ibclrf $SSW/smei/ucsd/sat/idl/toolbox/ibclrf.pro
[Previous] [Next]
 NAME:
	ibclrf
 PURPOSE:  
	Takes a longword (32-bit) integer, and clears (sets to zero) a bit
 CATEGORY:
	Bits and bytes
 CALLING SEQUENCE:
	Result = ibclrf(bitset, bitpos)
 INPUT:
	bitset	longword	A longword integer, one of it
				bits will be clear or zero 
	bitpos	longword	The position of the bit that
				will be cleared; 0 <= bitpos <= 31
 OUTPUT:
	Result 	longword	Same as bitset, (bitwise) but
				at bit position, bitpos, it will
				definitely be a zero
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLED BY:
	ice_pack
 SEE ALSO:
	ibsetf, ibtestf
 MODIFICATION HISTORY:
	8/23/00			Kevin Nguyen


ibsetf $SSW/smei/ucsd/sat/idl/toolbox/ibsetf.pro
[Previous] [Next]
 NAME:
	ibsetf
 PURPOSE:
	Sets a bit in a longword (32-bit) integer
 CATEGORY:
	Bits and bytes
 CALLING SEQUENCE:
	Result = ibsetf(bitset, bitpos)
 INPUT:
	bitset longword integer 32 bits longword integer.
				Its bit at bit position bitpos
				will be set at 1
	bitpos longword integer The bit position of bit to be
				set as 1 (0 <= bitpos <= 31)
 OUTPUT:  
	Result longword integer Same at bitset bitwise except 
				at bit position bitpos
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLED BY:
	ice_pack, ice_unpack, smei_frm_flag
 SEE ALSO:
	ibclrf, ibtestf
 MODIFICATION HISTORY:
	8/23/00		Kevin Nguyen


ibtestf $SSW/smei/ucsd/sat/idl/toolbox/ibtestf.pro
[Previous] [Next]
 NAME:
	ibtestf
 PURPOSE:
	Tests if the bit at bitpos of a longword (32-bit) integer is set
 CATEGORY:
	Bits and bytes
 CALLING SEQUENCE:
	Result = ibtestf(bitset, bitpos)
 INPUT:
	bitset	longword integer  will be used to test if
				  bit position, bitpos is zero or one
	bitpos	longword integer  the bit postion, bit pos, being tested
 OUTPUT:
	ibtestf		scalar; type:  byte
			1B if bit is set;  0B bit is clear
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLED BY:
	ice_pack, ice_unpack, smei_frm_flag
 SEE ALSO:
	ibclrf, ibsetf
 MODIFICATION HISTORY:
	8/23/00		Kevin Nguyen


ice_pack $SSW/smei/ucsd/sat/idl/util/ice_pack.pro
[Previous] [Next]
 NAME:
	ice_pack
 PURPOSE:
	Compresses an integer array using a modified Rice algorithm
 CATEGORY:
	Bits and bytes
 CALLING SEQUENCE:
	ibit = ice_pack(Orig, Pack [, kmax=kmax, kshift=kshift, lenbit=lenbit, sign=sign, perm=perm])
 INPUTS:
	Orig	array; type: long integer
			array to be compressed
 OPTIONAL INPUTS:
	kmax	scalar; type: integer; default: 8
			cutoff for applying compression (see PROCEDURE) (kmax > 0)
	kshift	scalar; type: integer; default: 0
			minimum bits copied for each difference
	lenbit	scalar; type: integer; default: 16
			# bits encoded when full value instead of a difference
			is used (see PROCEDURE)
	sign 	scalar; type: integer; default: 1
			-1: all values in Orig < zero
			+1: all values in Orig >= zero
			 0: both positive and negative values are present
	perm	array[0:kmax-kshift]; type: integer
			permutation table (see PROCEDURE)
 OUTPUTS:
	ibit	scalar; type: long integer
			# bits in Pack used to hold the compressed data;
			on failure ibit = 0 is returned; this happens only if
			the compressed array Pack is bigger than the input
			array Orig.
	Pack	array; type: long integer
			compressed data;
			The # elements in Pack is 1+(ibit-1)/nbit.
			Bits 0..ibit-1 are filled with compressed data.
			For the last element only bits 0 .. ib-1 are
			used [ib = 1+ ((ibit-1) mod nbit)].
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	InitVar, ibclrf, ibsetf, ibtestf
 SEE ALSO:
	ice_unpack
 PROCEDURE:
	The technique is based on the algorithm described by Michael W. Richmond and Nancy E. 
	Ellman, in March 1996 paper which we have in preprint form.
	COMPRESSION ALGORITHM
	---------------------
	The Rice algorithm stores an integer in the following bit pattern:
		0.......0 1 x.......x
		|_______|   |_______|
		  ipad      itop + 1
	a string of ipad 0-bits, followed by a terminating 1 bit, followed by a string of itop + 1
	bits encoding the integer value.

	The actual number encoded is either the full value from the input array, or the difference
	with the previous element in the array (!!! for the first element in the array, the 'previous
	element' is assumed to be zero).

	The two cases are distinguished  using the kmax value: if the absolute difference is less than
	2^(kmax - 1) then the difference is encoded; if not then the full value is encoded

	CASE A: Non-zero absolute difference less than 2^(kmax - 1)
	-----------------------------------------------------------
	2^(kmax -1) has only bit kmax - 1 set. I.e. for absolute differences less than 2^(kmax - 1) this
	bit, and all higher bits, are NOT set, i.e. only the first kmax - 1 bits 0..kmax - 2 might be set.

	Let itop be the highest 1-bit of the absolute difference. For a non-zero difference
	0 <= itop <= kmax-2. Since bit itop is by definition set, the absolute difference
	is fully described by the first itop bits 0...itop-1. An additional bit is needed
	to encode the sign of the difference. So itop+1 bits are needed to store the difference:
	first ipad=itop+1 0-bits, followed by a terminator 1-bit, indicate how many bits are
	used. The terminator bit is then followed by the first itop bits of the absolute difference
	followed by a sign bit. The total number of bits used is 2*itop+3.

		0..........0 1 x..........x
		|__________|   |__________|
		ipad=itop+1       itop+1

	CASE B: Zero difference
	-----------------------
	No bit at all is needed to store a zero, except for a terminator bit. Not that this 
	is CASE A with ipad = 0, itop = -1.

	CASE C:  Absolute difference greater/equal 2^(kmax-1)
	-----------------------------------------------------
	In this case the full value instead of the difference is encoded.
	For case A the maximum number of leading 0-bits is kmax-1. A string of kmax 0-bits
	is used to indicate that a full value is encoded. After the terminator bit follow
	the first lenbit bits. The total number of bits used is kmax+1+lenbit

		0..........0 1 x..........x
		|__________|   |__________|
		ipad=kmax         lenbit

	MINIMUM NUMBER OF BITS
	----------------------

	The above describes the the compression algorithm for the case kshift=0.
	Setting kshift to non-zero value modifies the way differences are stored: for each
	difference the kshift lowest bits are always stored. The differences are now encoded
	as follows:

	Zero difference (ipad = 0)
		1 0
	The 1-bit is the terminating bit (i.e. no leading 0-bits), followed by a 0-bit to
	indicate the presence of a zero difference.

	Difference needing 1..kshift bits (1 <= ipad <= kshift)
		1 1 s x.....x
		      |_____|
		       kshift
	The leading 1-bit is the terminating bit (i.e. no leading 0-bits). It is followed by
	a 1-bit to be able to distinguish it from a zero difference. Then a bit follows
	storing the sign of the difference (s-bit). Then follow the lowest kshift bits.

	Differences needing kshift+1...kmax-1 bits (kmax-1 <= ipad <= kmax-1 above)
		0.......0 1 x........x
	        |_______|   |________|
	       ipad-kshift     ipad

	Full value (ipad=kmax)
		0.......0 1 x........x
	        |_______|   |________|
	       kmax-kshift    lenbit


	PERMUTATION TABLE
	-----------------

	The number of leading 0-bits varies from izero=0 to izero=kmax-kshift. These differences
	serve merely as identifiers for the type of information stored after the terminating
	1-bit. Rather than using them directly as described above, it is more efficient to
	use a permutation table based on the histogram of the number of bits needed for to store
	the differences. E.g. if for some sky image 3-bit difference occur most, followed by 2-bit,
	then 1-bit, then 0-bit, then 4-bit, 5-bit, etc. then the permutation table would be
		perm = 3,2,1,0,4,5...kmax-kshift
 MODIFICATION HISTORY:
	AUG-2000, Paul Hick (UCSD; pphick@ucsd.edu)
		Rewrite of Andy Buffington's ricearc.for.
		Main modifications:
		- large intermediate byte array for storing individual bits is removed
		- # leading zeroes used to store full values was reduced from kmax+1 to kmax
		- use of kshift allows for slightly better compression
	8/24/2000, Kevin Nguyen
		- Rewrite the code from fortran to idl


ice_read $SSW/smei/ucsd/sat/idl/util/ice_read.pro
[Previous] [Next]
 NAME:
	ice_read
 PURPOSE:
	Reads a compressed file written by ice_write into an integer array
 CATEGORY:
	Bits and bytes
 CALLING SEQUENCE:
	status = ice_read(cFile, Orig, info=info)
 INPUTS:
	cFile		scalar; type: string
				file name of compressed file
 OUTPUTS:
	status		scalar; type: integer
				0: failure (an error message is displayed)
				1: success
	Orig		array; type: long integer
 OPTIONAL OUTPUT PARAMETERS:
	info=info	scalar; type: string
				trailer string extracted from end of file
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	IsType, ice_unpack
 SEE ALSO:
	ice_pack, ice_write
 MODIFICATION HISTORY:
	AUG-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	AUG-2000, Kevin Nguyen translated from Fortran to IDL


ice_unpack $SSW/smei/ucsd/sat/idl/util/ice_unpack.pro
[Previous] [Next]
 NAME:
	ice_unpack
 PURPOSE:
	Deompresses an integer array compressed using ice_pack
 CATEGORY:
	Bits and bytes
 CALLING SEQUENCE:
	jbit = ice_unpack(ibit, Pack, Orig, kmax=kmax, kshift=kshift, lenbit=lenbit, sign=sign, perm=perm)
 INPUTS:
	ibit		scalar; type: integer
				# bits in Pack containing compressed data.

 OPTIONAL INPUTS:
	kmax		scalar; type: integer; default: 8
				cutoff for applying compression
	kshift		scalar; type: integer; default: 0
				minimum # bits copied for each difference
	lenbit		scalar: type: integer; default: 16
				# bits encoded  when the full value instead
				of a difference is used
	sign		scalar; type: integer
				-1: all values in Orig are <  zero
				+1: all values in Orig are >= zero
				 0: both positive and negative values are present
	perm		array[0:kmax-kshift]; type: integer; default: lindgen(kmax-kshift+1)
				permutation table
	Pack		array; type:long integer
				compressed data
 OUTPUTS:
	jbit		scalar; type: long integer
				# bits in Pack used to hold the compressed data
				as determined during the decompression. This
				should match the input value ibit.
	Orig		array; long integer
				decompressed array
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	InitVar, ORIG, ibsetf, ibtestf
 CALLED BY:
	ice_read
 SEE ALSO:
	ice_pack
 PROCEDURE:
 >	The input values for ibit, kmax, lenbit, sign, perm must be the same as for
	the ice_pack call that created the compressed array Pack.
 >	Inverts the compression of ice_pack.
 MODIFICATION HISTORY:
	AUG-2000, Paul Hick (UCSD; pphick@ucsd.edu)


img_read $SSW/smei/ucsd/gen/idl/util/img_read.pro
[Previous] [Next]
 NAME:
	img_read
 PURPOSE:
	Read image from file
 CATEGORY:
	I/O
 CALLING SEQUENCE:
	FUNCTION img_read, img_file, img_data, Red, Green, Blue,	$
		pseudocolor 	= PseudoColor	,	$
		truecolorimage	= TrueColorImage,	$
		rgbplane		= RGBPlane		,	$
		truedimension	= truedimension ,	$
		exten_no		= exten_no	 	,	$
		silent			= silent		,	$
		_extra			= _extra		,	$
		img_info		= img_info		,	$
		errormessage	= errormessage
 INPUTS:
	img_file	scalar; type: string
					image file to be read
					If no file is specified then the pickfile_dialog is used to
					select a file name
 OPTIONAL INPUT PARAMETERS:
	/truedimension
				scalar; type: integer: default: 1
					dimension used for color interleave (1,2 or 3)
					(works only for JPEG?)
	/pseudocolor	(used only for .BMP and .TIFF files)
					If this keyword is set and the file stores a truecolor image then it
					is converted to pseudocolor using the IDL color_quan function.
					The color table is returned in the Red, Green and Blue arrays
 OUTPUTS:
	status		0: some error occurred
				1: file properly read
	img			array[n,m] or array[3,n,m]; type: depends
					if a truecolor image [3,n,m] is returned then the keyword TrueColor
					returns 1 and RGBPlane returns the indices for the color planes
					!!! if no file name is specified, and no file is selected with
					from the file dialog then the scalar (img=-1) is returned.
 OPTIONAL OUTPUT PARAMETERS:
	red=Red, green=Green, blue=Blue
				array[*]; type: byte (?)
					red, green and blue color arrays, defining the color table for the image
					Should be loaded with tvlct, Red, Green, Blue
					The arrays are always returned for GIF files (256 colors) and pseudocolor
					(8-bit) .TIFF and .BMP files. For truecolor .TIFF or .BMP files they are
					only returned if the /pseudocolor keyword is set.
	truecolor=TrueColor
				scalar; type: integer
					1 if true color image is returned; otherwise 0
	rgbplane=RGBPlane
				array[3]; type: integer; always [0,1,2] (see below)
					if a true color image is returned then RGBPlane stores the indices for
					the red, green and blue color plane, respectively.
					(!!! currently the planes are rearranged if necessary, so that
					RGBPlane =[0,1,2])
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	GetFileSpec, InitVar, IsType, MagnifyArray, READFITS [1], READFITS [2], READFITS [3]
	READ_BMP, READ_GIF, SubArray, SuperArray, TimeString, TimeUnit, bin_read, do_file
	flt_read, grd_read, gunzip_file, hide_env, smei_TimePosn, smei_frm_cvhdr
	smei_frm_property, smei_frm_read
 CALLED BY:
	RemoteView_Display3D, View, even_light, put_logo, qImage_Pick, qView_FileFilter
	qView_GetData, qView_PickFiles
 PROCEDURE:
	The file name type is used to determine how to read the file:
	.gif: gif files are read using IDL procedure read_gif
	.tif: tiff files are read using IDL procedure read_tiff

	All remaining file types deal with grey-scale images.

	.fits and .fts: read using readfits function (from SOLARSOFT library ???)
	.txt: read using the flt_read function

	There are several types of simple binary files created using bin_read, which
	can also be read again by bin_read (the dimensions are stored in a header):
	'.pph': status = bin_read ( img_file, img )
			return short integer, long integer and floating point arrays.

	Two file types refer to CCD images:
	.img: these should be images from Andy's old Photometrics CCD camera. They are read using

		status = bin_read(img_file,img,/aint,off=160,nx=384)
		img = rotate(img,3)

		i.e. a 160 byte header is skipped; then rows of 384 short integers are read
		untill the end of file is reached, followed by clockwise rotation over 90 degree.

	'.nic': these are the images from the SMEI CCD camera. They are read using

		status = bin_read (img_file, img)

		bin_read returns a long integer array of 1280x600 for these files.
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS)
		Added documentation
	OCT-2002, Paul Hick (UCSD/CASS)
		Added keyword truedimension
	MAR-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Added detection of .gz files. These are now decompressed. The decompressed
		file is then processed in the usual, and is then deleted.


InitVar $SSW/smei/ucsd/gen/idl/toolbox/initvar.pro
[Previous] [Next]
 NAME:
	InitVar
 PURPOSE:
	Initialize a variable
 CATEGORY:
	gen/toolbox
 CALLING SEQUENCE:
	InitVar, X, Xinit [, /keyword_var], set=set
 INPUTS:
	X				any variable
	Xinit			any variable; used to initialize X
 OPTIONAL INPUT PARAMETERS:
	/keyword_var	if set, X is assumed to be a keyword the initialization
					then is done with the command: X = keyword_set(X)
	set=set 		instead of initializing X, the variable 'set' is initialized.
					The content of X is transferred to 'set' if X exists.
					(this keyword is ignored if /keyword_var is set).
	count=count	scalar; type: integer; default: 0
					# elements in X that will trigger the initialization
					(ignored if /keyword_var is set).
 OUTPUTS:
	X				any variable; the initialized variable
 INCLUDE:
	@compile_opt.pro			; On error, return to caller
 CALLED BY:
	AlignHeliosphere, AngleRange, AngleUnits, ArrayLocation, CarringtonT0, CheckDir
	ColorPolarBox, ColorSkybox, CombineRotations, CvMag, CvPrecess, CvRotation, CvSky
	Distance2Sun, EarthSky3DLoc, EarthTransit3DLoc, Find2DGlitch, FindAllFiles
	FindAllSubDirs, FindPeaks, GeographicInfo, GetColors, GetFileSpec
	GetNagoyaSources, Get_Page, GroupPixels, GuessRecs, InSitu, InsituTimeSeries
	IntegrateLOS, InterpolateHeliosphere, IsBadTime, IsDisplay, IsPrinter, IsType
	KeplerOrbit, LocalExtrema, MagnifyArray, NewcombSun, PA_Pole, PlotCurve
	PlotEarthSkymap, PlotPlanarCut, PlotPolarSkymap, PlotSolarDisk, PlotSynopticMap
	PutFileSpec, RGBO_Project, ReadSynopticMap, RemoteView, RemoteView_BodyLoc
	RemoteView_Display2D, RemoteView_Display3D, RemoteView_FOV, RemoteView_FOV_loc
	RemoteView_FOV_xyz, RemoteView_Init, RemoteView_Init_Display
	RemoteView_Init_Matrix, RemoteView_Init_View, RemoteView_rgbo, Reset_Colors
	ScEarth, SetFileSpec, SetRange, Set_Page, SubArray, TMO_skymotion, TagArray
	ThomsonElectron, ThomsonElectronFar, ThomsonLOSDensity, ThomsonLOSFar
	ThomsonLOSRomb, ThomsonLOSStep, ThomsonMidpoint, ThomsonSolarFlux, TimeArray
	TimeGet, TimeInterpol, TimeLInterpol, TimeLimits, TimeMonth, TimeOp, TimeOrigin
	TimePieces, TimePosn, TimePosn_test, TimeSet, TimeShift, TimeSplit, TimeString
	TimeSystem, TimeUnit, TimeXAxis, TimeYDate, TimeYDoy, ToSolarRadii, View, anicenum
	arg_time, bargraph, big_eph, big_orbit, bin_read, bin_write, boost, coord3to2, do_file
	eclipsed_area, even_light, even_light_corrections, even_light_figures
	even_light_info, even_light_pedestal, even_light_photometry, even_light_plot
	even_light_registration, findfile_fix, flat_centerofmass, flt_clean, flt_read
	flt_string, grd_read, gridfill, gridgen, gridgen1d, gunzip_file, gzip_file, hide_env
	htmd_cat, ice_pack, ice_unpack, img_read, is_running, jpl_body, jpl_close, jpl_eph
	jpl_init, jpl_mag, jpl_phase, jpl_state, jpl_test, lsqLinearFit, lsqNormalFit
	mk_flick, mpc_eph, nagoya_glevel, nrZbrac, nso_fe_plot, nso_fe_read, nso_fe_start
	os_separator, plot3darc, plot3dcube, plot3dline, plot3dtext, qBar, qEphem
	qEphem_State, qImage_Send, qImage_cw, qImage_cw_Box, qImage_cw_BoxCosine
	qImage_cw_BoxImage, qImage_cw_BoxZoom, qImage_cw_Ellipse, qImage_cw_Ephem
	qImage_cw_MinMax, qImage_cw_Show, qImage_cw_Tool, qImage_cw_Transform
	qImage_cw_Update, qImage_cw_Wedge, qImage_cw_WedgeSection, qImage_cw_ZWedge
	qImage_cw_smei_frm, qLine, qLine_YAction, qLoadCT, qSave2File, qSave2File_Pick
	qSet_Page, qShow, qTool, qTool_State [1], qTool_State [2], qTool_Zoom [1]
	qTool_Zoom [2], qTool_rebin [1], qTool_rebin [2], qView, qView_ApplyGain
	qView_GetImage, qView_Image, qView_ImageInfo, qView_PlotTrack, qView_Sensitive
	qView_SubtractBase, qView_TMO_tracksky, qView_UpdateActive, qView_XYZ_Update
	qslider_cw, qsmei_hdr, qsmei_sky, qvu, scalarproduct, sgp4_eph, sgp4_tlm
	smei_base_testcase, smei_buf, smei_buf_get, smei_buf_getframe, smei_buf_mget
	smei_buf_prep, smei_buf_read, smei_cam2angle, smei_camera, smei_camera_gain
	smei_ccd2sky, smei_coriolis, smei_cv, smei_findcrazy, smei_frm_base, smei_frm_cp
	smei_frm_cvhdr, smei_frm_drive, smei_frm_eclipse, smei_frm_findpoint
	smei_frm_flatfield, smei_frm_get, smei_frm_hbar, smei_frm_hbar_inside
	smei_frm_info, smei_frm_name, smei_frm_path, smei_frm_property, smei_frm_read
	smei_frm_rebin, smei_frm_summary, smei_frm_track, smei_frm_update
	smei_frm_where, smei_fts_read, smei_getfile, smei_hdr_get, smei_hdr_make
	smei_hdr_plot, smei_hdr_update, smei_htm_testcase, smei_orbit_get
	smei_orbits_stat, smei_radial2theta, smei_setup_roi, smei_sky, smei_sky2cam
	smei_sky2ccd, smei_sky_file, smei_sky_get, smei_sky_read, smei_star_fit
	smei_star_fitone, smei_star_formatpnt, smei_star_info, smei_star_list
	smei_star_lsqfit, smei_star_remove, smei_star_standard, smei_star_writepnt
	smei_time, smei_zodiac_fit, smei_zodiac_model, smei_zodiac_remove
	smeidb_mounted, statpos, stopwatch, strposn, twin, txt_read, unexpected_event
	unhide_env, unitvectors, usno_eph, usno_init, usno_test, vectorproduct, vox_read
	vox_write, vu_NagoyaSourcemap, vu_RemoteView, vu_check, vu_correlate, vu_cvgrid
	vu_earthskymap, vu_filename, vu_fnc, vu_get_page, vu_getdata, vu_gettime, vu_header
	vu_image, vu_insitu, vu_insitu_raw, vu_insitucurve, vu_is_sequence, vu_mean
	vu_movie, vu_nagoyaskymap, vu_new_time, vu_planarcut, vu_point_source, vu_prefix
	vu_read, vu_select, vu_set, vu_solardisk, vu_synopticmap, vu_timeseries
	vu_type_insitu, vu_type_skymap, vu_update_hours, vu_update_marker
	vu_vox_drawsphere, vu_vox_read, vu_vox_write, vu_whatis, vu_write
	wedge_bounding_box, wedge_content, who_am_i, wso_read, wso_write, www_help
	www_help_called_by, www_help_change_tabs, www_help_files, www_help_get_header
	www_help_make, www_help_rsi, www_help_style, www_help_tree, xyoff
 PROCEDURE:
	If neither X nor Xinit exist, program is terminated
 MODIFICATION HISTORY:
	JUL-2002, Paul Hick (UCSD/CASS)
	JAN-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Added keyword set=set.


Inside_Wedge $SSW/smei/ucsd/sat/idl/toolbox/math/inside_wedge.pro
[Previous] [Next]
 NAME:
	Inside_Wedge
 PURPOSE:
	Tests whether image locations are inside a wedge
 CATEGORY:
 CALLING SEQUENCE:
	result = Inside_Wedge(p_box,p)
 INPUTS:
	p_box		array[2,2]; type: float
					two opposite corners of the wedge in polar coordinates
					in the form [ [angle1,radius1],[angle2,radius2] ]
	p			array[2,n,m,...]; type: float
					image locations in polar coordinates
					(same form as p_box)
 OPTIONAL INPUT PARAMETERS:
	exclude_p_box=exclude_p_box
				array[2,2]; type: float
					two opposite corners of another wedge in polar coordinates
					in the form [ [angle1,radius1],[angle2,radius2] ]
					This second wedge must lie entirely inside the first one.
					If specified the coordinate array p is tested for inside
					p_box and outside exclude_p_box.
 OUTPUTS:
	result		array[n,m,...]; type: byte
					0 for locations p outside the wedge
					1 for locations inside the wedge
 CALLS: ***
	IsType, SubArray
 CALLED BY:
	TMO_tracksky, even_light, qGlitch_Run, qImage_cw_BoxCosine, qImage_cw_SmeiMask
	qImage_cw_ZEllipse, qView_PlotSeries, smei_ccd2sky, smei_cv, smei_sky2ccd
	wedge_content
 RESTRICTIONS:
	If p contains !values.f_nan the value 1 is returned
 PROCEDURE:
 >	Formerly called qImage_cw_WTest
 >	The array p can have more than two dimensions, e.g. [2,n,m].
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


InSitu $SSW/smei/ucsd/sat/idl/util/insitu.pro
[Previous] [Next]
 NAME:
	InSitu
 PURPOSE:
	Plots in-situ data from various spacecraft
 CATEGORY:
 CALLING SEQUENCE:
	PRO InSitu,	T,	$
		delt	= delt,		$
		weight	= weight,	$

		source	= source,	$
		step	= step, 	$

		xtime	= xtime,	$
		xlng	= xlng,		$
		xlat	= xlat,		$

		ylng	= ylng,		$
		ylat	= ylat,		$
		ydis	= ydis,		$
		yden	= yden,		$
		yvel	= yvel,		$
		ybr		= ybr ,		$
		ybt		= ybt ,		$
		ybn		= ybn ,		$
		ybb		= ybb ,		$
		ykp 	= ykp , 	$
		ydst	= ydst, 	$
		ypdyn	= ypdyn,	$
		yvlng	= yvlng,	$
		yvlat	= yvlat,	$

		traceback=traceback,$
		xrange	= xrange,	$
		charsize=charsize,	$
	
		_extra	= _extra
 INPUTS:
	T			array[2], type: standard time structure
						time range for time series
 OPTIONAL INPUT PARAMETERS:
	/xtime,	/xlng,	/xlat
					select one to set the quantity plotted on the x-axis: time, heliographic longitude
					or heliographic latitude. Only one can be specified; if none is specified
					then /xtime is assumed
	source=source
			scalar; type: integer
					identifies in situ instrument (see function Instrument)
	/ylng,	/ylat,	/ydis,	/yden,	/yvel, /ybr, /ybt, /ybn, /ybb, /ykp, /ydst, /ypdyn, /yvlng, yvlat
					detemines quantity plotted on y-axis. Multiple keywords can be specified.
					If none is specified then velocity and density is plotted.
	traceback=traceback
					scalar; type: any; default:0 (no traceback)
					heliocentric traceback distance in AU; adjusts time and heliographic longitude to
					give a 'time and location of origin' at the traceback distance
 OUTPUTS:
	Output to screen
 OPTIONAL OUTPUT PARAMETERS:
	(none)
 INCLUDE:
	@compile_opt.pro				; On error, return to caller
 CALLS: ***
	InitVar, InsituTimeSeries, IsType, PlotCurve, TimeUnit, TimeXAxis, arg_time
 PROCEDURE:
 MODIFICATION HISTORY:
	SEP-1999, Paul Hick (UCSD/CASS)
	DEC-2001, Paul Hick (UCSD/CASS)
		added call to arg_time to allow input of time as Carrington variable
	SEP-2006, Paul Hick (UCSD/CASS)
		Added /ypdyn keyword to process Mars Global Surveyor dynamic pressure data
	SEP-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Added /yvlng and /yvlat keywords to plot velocity angles from the
		SOMNI and EOMNI databases.


InsituTimeSeries $SSW/smei/ucsd/sat/idl/util/insitutimeseries.pro
[Previous] [Next]
 NAME:
	InsituTimeSeries
 PURPOSE:
	Extract in-situ data in specified interval, and average if necessary
 CALLING SEQUENCE:
	FUNCTION InsituTimeseries, data_request, t_request, t_given, data_given,	$
		delt	= delt,		$
		weight	= weight,	$
		traceback=traceback,$
		from	= from,		$
		silent	= silent
 INPUTS:
	data_request	array, type: string
						determines which data are extracted.
						Identifiers are:
						'lng','lat','dis','den','vel','br','bt','bn','bb','pdyn'
						'lng'	= heliographic longitude (deg)
						'lat'	= heliographic latitude (deg)
						'dis'	= heliocentric distance (AU)
						'den'	= density (cm^-3)
						'vel'	= velocity (km/s)
						'br'	= radial magnetic field (nT)
						'bt'	= tangential magnetic field (nT)
						'bn'	= normal magnetic field (nT)
						'bb'	= field strength (nT)
						'pdyn'	= dynamic pressure (nPa)
	t_request		array[2],array[N] type: standard time structure
						If array[2]: data are extracted between t_request[0] and t_request[1]
							at times extracted from s/c insitu files
						If array[N]: data are extracted at times t_request
						Should be in chronological order
 OPTIONAL INPUT PARAMETERS:
	from=from		scalar; type: integer
						identifies insitu instrument (see function Instrument)
	delt=delt		scalar; type: time difference structure, or float; default: 0
						if present, and non-zero, time window used for averaging.
						in-situ data inside [t-delt/2,t+delt/2] are averaged.
						If a scalar (float or integer) is specified, then it is
						assumed to be the time window in days.
	/weight			if set, standard deviations are used to weight the averages (if available
						for selected instrument and data)
						if not set, an unweighted average is calculated
	traceback=traceback
					scalar; type: any; default:0
						trace back distance (AU)
					if set and nonzero then the in situ data are traced back to a distance of
					'traceback' AU, i.e. the time and heliographic longitude reflect the time of
					origin at the traceback distance.
					This option explicitly assumes that the distances in the in situ files are
					in AU, the velocities in km/s, and the heliographic longitudes in degrees.
					If this option is used date_request MUST contain 'lng','dis','vel'
 OUTPUTS:
	Result			scalar; type: integer
					0: if something went wrong
					1: time series succesfully set up
					(first check this status indicator before using the output arrays!!!)
	t_given			array[*]; type: time structure
						times for output time series
						If delt is set to a positive value and t_request contains more than two
						elements then t_given=t_request and the time series contains data
						averaged over delt days.
						If delt is zero, or t_request contains only 2 elements then
						t_given contains all times for which spacecraft data were found
						(averaged over delt days if delt > zero).
						(if /traceback is used then the time range is shifted relative to
						the input range)
	data_given		array[*,n_elements(data_request)], type: float
						data_given[*,i] are the data for the quantity indicated by data_request[i]
						missing data are marked by the value !values.f_nan
 OPTIONAL OUTPUT PARAMETERS:
	from=from		scalar; type: integer
						if not set on input, the return value is set to whatever default
						is set by the function Instrument (currently /somni).
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	BadValue, CvSky, FILEPATH, InitVar, Instrument, IsTime, TimeFixYear, TimeGet, TimeLimits
	TimeOp, TimeSet, TimeString, TimeUnit, UNIQ [1], UNIQ [2], UNIQ [3], big_body, big_eph
	flt_read, jpl_body
 CALLED BY:
	InSitu, vu_insitu
 RESTRICTIONS:
	Needs system variables: !sun.spiral and !sun.au
	The input time array should be in chronological order
 PROCEDURE:
 >	Input files for density and velocity are hourly-averages. The filename is:
		fil = filepath(root=getenv('SSW_SMEI_DAT'),sub='insitu','sw'+spacecraft+'_'+strcompress(year,/rem)+'.hravg')
		e.g. file = 'imp8_2000.hravg'
 >	The files are assumed to be chronologically ordered.
 >	The file structure is described internally as column numbers for all quantities.
 > Heliographic longitudes are returned in monotonic decreasing order by adding a multiple of 360
	degrees when the timeseries crosses from one Carrington rotation to the next.
 MODIFICATION HISTORY:
	AUG-1998, Paul Hick (UCSD/CASS)
	JUL-1999, Paul Hick (UCSD/CASS); documentation added
	SEP-2001, Paul Hick (UCSD/CASS)
		Added GSE & GSM to RTN conversion; currently this is only used for the real-time ACE data.
	JUL-2002, Paul Hick (UCSD/CASS)
		Fixed a bug with the delt keyword. When delt was input as a difference
		time structure it was converted to hours, instead of days.
	DEC-2003, Paul Hick (UCSD/CASS)
		Changed /omni to /somni (accesses the files with B in RTN)
		Added /eomni (accesses the files with B in GSM)
		The insitu data files can now also be located in a subdirectory of $SSW_SMEI_DATA/insitu,
		and the filenames can be more general than the default template described in PROCEDURE.
	SEP-2006, Paul Hick (UCSD/CASS)
		Added Dana Crider Mars Orbiter data
	OCT-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		All ephemeris calculations now done by big_eph.


Instrument $SSW/smei/ucsd/sat/idl/util/instrument.pro
[Previous] [Next]
 NAME:
	Instrument
 PURPOSE:
	Provides a means for consistently dealing with all the different instrument for which
	in situ observations are available
 CATEGORY:
	Auxilliary
 CALLING SEQUENCE:
	Result = Instrument( which [, /name, /label, /nearearth )
	Result = Instrument( /imp8 [, /name, /label, /nearearth )
 INPUTS:
	which		scalar; string or integer
					integer ID of primary name of instrument
 OPTIONAL INPUT PARAMETERS:
	The following instrument keywords are available
	(instead of these keywords the argument 'which' can be set to 'imp8','celias', etc.)
	/imp8
	/celias
	/wind
	/acesw
	/aceb
	/somni
	/helios1
	/helios2
	/swoops
	/mgs			Mars global surveyor

	/name			retrieves primary name
	/label			retrieves alternative name (usually same as primary name)
	/nearearth		identifies instrument as near-earth or deep-space
	/L1				identifies instrument as at L1.
 OUTPUTS:
	Result			scalar; integer, byte or string
					/name set: string containing the primary name
					/label set: string containing the alternative name
					/nearearth set: 1B if instrument is a nearearth instrument;
						0B if it is a deep-space instrument
					no keyword set: integer identifier for the instrument
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLED BY:
	InsituTimeSeries, vu_insitu, vu_movie
 PROCEDURE:
	Each of the in situ instruments is associated with an integer identifier.
	Currently listed by name are
		['imp8','celias','wind','somni','helios1','helios2','swoops','acesw','aceb']
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS)
	FEB-2000, Paul Hick (UCSD/CASS)
		Changed /omni to /somni; added /eomni
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Added Mars Global Surveyor


IntegrateLOS $SSW/smei/ucsd/sat/idl/util/integratelos.pro
[Previous] [Next]
 NAME:
	IntegrateLOS
 PURPOSE:
	Calculate a sky map by integrating through a 3D heliospheric matrix.
	Two forms of integrated expressions are implemented:
	(1) A weighted integration (used for g-level and IPS velocity):
		F = Integral(F*W ds)/Integral(W ds)
	(2) Straight integration (used for Thomson scattering):
		F = Integral(F ds)
	See PROCEDURE for more details.
 CATEGORY:
	sat/idl/util
 CALLING SEQUENCE:
	FUNCTION IntegrateLOS,	R, FF, WW,		$
		R3D 	= R3D		, $
		dR3D	= dR3D		, $
		xcrange = xcrange	, $
		xlrange = xlrange	, $
		longitudes=longitudes,$
		opengrid= opengrid	, $	; InterpolateHeliosphere
		xcgrid	= xcgrid	, $
		xlgrid	= xlgrid	, $
		rrgrid	= rrgrid	, $	; InterpolateHeliosphere
		fillbad = fillbad	, $
		degrees = degrees	, $	; InterpolateHeliosphere
		minRR	= minRR 	, $
		f3dfnc	= f3dfnc	, $
		f3darg	= f3darg	, $
		w3dfnc	= w3dfnc	, $
		w3darg	= w3darg	, $
		REarth	= REarth	, $
		ut_earth= ut_earth	, $
		pa_earth= pa_earth	, $
		elo_earth=elo_earth , $
		elo_sun = elo_sun	, $
		silent	= silent
 INPUTS:
	R		array[3,*,n]; type: float
				Locations in heliographic coordinates for all points along all
				lines of sight. '*' can be absent or represent more than one dimension.
				E.g. for a typical skymap there will be two dimensions l,m
				representing longitude and latitude. 'n' represents the
				'depth' dimension along the lines of sight. 

				R[0,*,n] contains Carrington variables in the range 'xcrange' or
					(if /longitudes is set) heliographic longitudes in [0,360]
				R[1,*,n] contains heliographic latitudes in [-90,90]
				R[2,*,n] contains heliocentric distances in AU

	The last dimension is the 'depth' dimension along the line of sight over
	which the integration is performed.

	'Densities' and 'Weights' can be specified in two ways.

	If R3D and dR3D are NOT specified then FF and WW directly specify densities
	and weights along all lines of sight:

	FF			array[*,n]; type: float
					volume data at locations 'R'.
	WW			array[*,n]; type: float
					weights at locations 'R'.

	If R3D is specified then FF and WW should be density and weight
	matrices on a heliographic grid. Densities and weights are calculated
	using InterpolateHeliosphere.

	FF		array[L,M,N]; type: float
				3D matrix of volume data (radial velocity, density, etc.)
				The array specifies values on a heliographic coordinate grid
				1st dim: Carrington variable: xc = xcrange[1]+(xcrange[0]-xcrange[1])*i/(L-1), i=0,L-1
				2nd dim: heliographic latitude : lat = -90+i/(M-1)*180, i=0,M-1
				3rd dim: heliocentric distance : dis = R3D+i*dR3D, i=0,N-1
	W3D		array[L,M,N]; type; float
				quantity to be used in the calculation of the weights (see PROCEDURE)

 OPTIONAL INPUT PARAMETERS:
	/degrees	if set then all angles are in degrees (default: radians)

	Setting R3D triggers a call to the interpolation function InterpolateHeliosphere.
	The radial grid is defined by R3D and dR3D.

	R3D		scalar; type: float
				heliocentric distance of inner boundary of F3D array (AU)
	dR3D	scalar; type: float
				radial grid spacing of F3D array (AU)

	Other keywords controlling the interpolation:

	xcrange=xcrange
			scalar, array[2]; type: float
				range of Carrington variable covered by F3D.
				(this argument is passed to InterpolateHeliosphere)
	/fillbad
			by default, bad values in the F3D array are set to zero.
			If /fillbad is set then they are filled with FillGrid

	/longitudes
			if set then R[0,*,*] contains heliographic longitudes instead of
			Carrington variables

	The integrands are set up using a number of additional keywords:

	ut_earth=ut_earth
	pa_earth=pa_earth
			array[*,n]; type: float
				line of sight position angle measured counterclockwise
				from ecliptic north 
	elo_earth=elo_earth
			array[*,n]; type: float
				angle Sun-observer-segment on line of sight (i.e. the elongation)
				for all line of sight segments (note that array[*,0] = array[*,1] etc.
	elo_sun=elo_sun
			array[*,n]; type: float
				angle observer-Sun-segment on line of sight
 OUTPUTS:
	Result	array[*]; type: float
				sky map with line-of-sight integrated quantities
 INCLUDE:
	@compile_opt.pro				; On error, return to caller
 CALLS: ***
	BadValue, InitVar, InterpolateHeliosphere, IsType
 CALLED BY:
	RemoteView_Display2D, vu_earthskymap
 PROCEDURE:
 > Two types of expressions are evaluated

	(1) <F> = Integral[ w3dfnc(s,W(s))*f3dfnc(s,F(s)) ds]/ Integral[ w3dfnc(s,W(s)) ds]
	and
	(2) <F> = Integral[ w3dfnc(s,W(s))*f3dfnc(s,F(s)) ds]

	The line of sight integrations is done for all lines of sight specified.
	The integration dimension always is the last dimension in the input arrays.
	The integration is performed simply by summing over the integration dimension,
	implicitly assuming a constant stepsize ds:

	(1) <F> = Sum[ w3dfnc(s,W(s))*f3dfnc(s,F(s)) ]/ Sum[ w3dfnc(s,W(s)) ]
	and
	(2) <F> = Sum[ w3dfnc(s,W(s))*f3dfnc(s,F(s)) ]

	Note that for expression (1) the stepsize ds will cancel. For expression (2)
	it is the users responsibility to absorb the stepsize ds into one of the
	input arrays F or W.

 >	W(s) and F(s) represent two physical quantities known on a heliographic grid
	(for example solar wind velocity and density, and the s-dependence reflects some
	geometrical aspect of the integration.

	In all applications I can think of the dependence of f3dfnc on F(s) will be linear:
	f3dfnc(s,t) = f3dfnc(s)*t. In that case the integration looks like:
		<F> = Integral[ w3dfnc(s,W(s))*f3dfnc(s)*F(s) ds ]/ Int[ w3dfnc(s,W(s)) ds ]
	This form applies to the calculation of IPS velocities, where the weight factor
	depends on the density: w3dfnc is 'IPS_velocity_w', W(s) = n(s), and
	the perpendicular velocity is integrated: f3dfnc(s) = sin(angle(s)) (is
	'IPS_velocity') and F(s) = V(s).

	In its simplest form w3dfnc(s,t) = w3dfnc(s) and f3dfnc(s,t) = t. In that case:
		<F> = Integral[ w3dfnc(s)*F(s) ds ]/ Int[ w3dfnc(s) ds ]
	i.e. <F> is a weighted average of F(s) along the line of sight. This form applies
	to the calculation of IPS g-level with a weight factor that depends only on the
	line of sight geometry: w3dfnc is 'IPS_hlevel_w', and the quantity F(s) is
	the 'gamma function' (introduced in the tomography manifesto).

	A special case occurs when there is no denominator:
		<F> = Integral[ w3dfnc(s)*F(s) ds ]
	This applies to the Thomson scattering brightness where w3dfnc is the scattered
	intensity from a single electron ('ThomsonBrightness'), and F(s) is the
	solar wind density n(s). The stepsize ds is absorbed into ThomsonBrightness.

 >	Bad values in the input array F3D are detected with the IDL 'finite' function.
	This is done InterpolateHeliosphere. The treatment of these bad values depends on
	the setting of 'fillbad'.

 MODIFICATION HISTORY:
	AUG-1999, Paul Hick (UCSD/CASS)
	AUG-2004, Paul Hick (UCSD/CASS)
		Bug fix: w3dfnc was not be used if WW did not exist. This is wrong
		when w3dfnc only uses R and not WW (as for the g-level determination).
		Bug fix: if neither w3dfnc nor WW is defined (as for Thomson
		scattering the average rather than the total along the line of
		sight was calculated.
		Also rearranged some of the arrangement. Now the presence of R3D
		triggers a call to InterpolateHeliosphere.
	JUN-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Fixed bug in the summation expressions. It was explicitly set to
		the third dimension. Now it is set to the last dimension present.
		in F and W. Added grid keywords xcgrid, xlgrid and rrgrid to call to
		InterpolateHeliosphere.


InterpolateHeliosphere $SSW/smei/ucsd/sat/idl/util/interpolateheliosphere.pro
[Previous] [Next]
 NAME:
	InterpolateHeliosphere
 PURPOSE:
	Get interpolated function values on scalar heliospheric matrix at specified
	locations in the heliosphere.
 CATEGORY:
	sat/idl/util
 CALLING SEQUENCE:
	FUNCTION InterpolateHeliosphere, R, F3D, R3D, dR3D,		$
		xcrange 	= xcrange	, $
		xlrange 	= xlrange	, $
		longitudes	= longitudes, $
		opengrid	= opengrid	, $
		periodic	= periodic	, $
		xcgrid		= xcgrid	, $
		xlgrid		= xlgrid	, $
		rrgrid		= rrgrid	, $
		fillbad 	= fillbad	, $
		degrees 	= degrees

	(1) Matrix specified on implicit regular grid in heliographic coordinates:

	F = InterpolateHeliosphere(R, F3D, R3D, dR3D,	$
		[xcrange=xcrange, xlrange=xlrange, /longitudes, /opengrid, /periodic, /fillbad, /degrees])

	(2) Matrix on explicitly specified grid in heliographic coordinates:

	F = InterpolateHeliosphere(R, F3D, xcgrid=xcgrid, xlgrid=xlgrid, rrgrid=rrgrid, 	$
		[/fillbad, /degrees])
 INPUTS:
	(1) Matrix specified on regular grid in heliographic coordinates:

	R			array[3,*]; type: float
					heliospheric locations where interpolated values are needed
					R[0,*] Carrington variables or heliographic longitude (radians or degrees)
					R[1,*] heliographic latitudes (radians or degrees)
					R[2,*] heliocentric distance
	F3D			array[L,M,N]; type: float
					3D matrix of function values of scalar heliospheric quantity
					1 dim: Carrington variable l=0,L-1 covers [xcrange[1],xcrange[0]]
					       or heliographic longitude: l=0,L-1 covers [0,360] degrees
					2 dim: heliographic latitude: m=0,M-1 covers [-90,90] degrees
							For both angles the grid is closed (with the outer grid points on
							the edges of the ranges. If /opengrid is set the angular
							grids are open (with the outer grid points half a grid spacing
							away from the edges of the ranges).
					3 dim: heliocentric distance: n=0,N-1 covers R3D+i*dR3D
	R3D			scalar; type: float
					heliocentric distance of inner boundary of F3D
	dR3D		scalar; type: float
					heliocentric distance resolution of F3D

	All distances (R[2,*], R3D, dR3D) must have the same units (usually AU).

	(2) Matrix on explicitly specified grid in heliographic coordinates:

	R			array[3,*]; type: float
					heliospheric locations where interpolated values are needed
					R[0,*] Carrington variables or heliographic longitude (radians or degrees)
					R[1,*] heliographic latitudes (radians or degrees)
					R[2,*] heliocentric distance
	F3D			array[L,M,N]; type: float
					3D matrix of function values of scalar heliospheric quantity

	xcgrid=xcgrid
				array[L]; type: any
					grid of Carrington variables or heliographic longitudes, matching
					R[0,*] (covering 1st dimension of F3D)
	xlgrid=xlgrid
				array[M]; type: any
					grid of heliographic latitudes
					(covering 2nd dimension of F3D)
	rrgrid=rrgrid
				array[N]; type: any
					grid of heliocentric distances
					(covering 3rd dimension of F3D)

	All distances (R[2,*], rrgrid) must have the same units (usually AU).

 OPTIONAL INPUT PARAMETERS:
	/degrees	if set then the longitude and latitude are assumed to be in
					degrees (default: radians)
	/fillbad	if set then GridFill is called first to fill in all 'bad' values

	(1) Matrix specified on implicit regular grid in heliographic coordinates:

	/longitudes	if set then R[0,*] is assumed to be heliographic longitude.
					The longitudes are converted to Carrington variables using
						CarringtonNear( mean(xcrange), R[0,*] )
					These values will be within 0.5 of mean(xcrange) if the longitudes
					are in the range [0,360]
	xcrange=xcrange
				scalar, array[2]; type: float; default: [0,1]
					If xcrange is a scalar then xcrange+[0,1] is assumed.
					Range of Carrington variables covered by array F3D.
					!!! the default [0,1] is useful only if the /longitudes keyword
						is set and F3D corresponds to an integer rotation (longitude
						range [0,360])
	xlrange=xlrange
				scalar; array[2]; type: float; default: [-90,90]
					If xlrange is a scalar then xlrange*[-1,1] is assumed.
					Range of heliographic latitudes covered by array F3D
	/opengrid	if set then the angular grids (longitude and latitude) are assumed
					to be open. By default the grids are assumed closed.
 OUTPUTS:
	F			array[*]; type: float
					interpolated function values
 INCLUDE:
	@compile_opt.pro			; On error, return to caller
 CALLS: ***
	BadValue, CarringtonNear, InitVar, IsType, MEAN, ToRadians, boost, gridfill
 CALLED BY:
	IntegrateLOS, qvu_draw, vu_atlocation, vu_timeseries
 PROCEDURE:
 >	Bad values are identified with the IDL 'finite' function
 >	The location R are translated into index values. The IDL function
	interpolate is used to obtain an interpolated value. 'Missing' values
	are set to BadValue(F3D).

	(1) Matrix specified on implicit regular grid in heliographic coordinates:

 >	If /longitudes is set then R[0,*] MUST contain heliographic longitudes in the
	range [0,360].
 >	If /longitudes NOT set, then R[0,*] MUST contain Carrington variables.

 MODIFICATION HISTORY:
	OCT-1999, Paul Hick (UCSD/CASS)
	SEP-2002, Paul Hick (UCSD/CASS)
		Added check for bad entries in positions R. If any one of the three
		coordinates is bad the matching entry in F is set to BadValue(F3D)
	NOV-2003, Paul Hick (UCSD/CASS)
		Fixed problem with replicate statement (didn't work in IDL 5.3)
	JUN-2006, Paul Hick (UCSD/CASS)
		Changed order of arguments (F3D is now 2nd instead of 4th argument)
		Added keywords xcgrid, xlgrid and rrgrid to handle matrices defined
		on irregular grids.
	OCT-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Modified to allow interpolation on vector fields.


IPS_hlevel_w $SSW/smei/ucsd/sat/idl/toolbox/ips/ips_hlevel_w.pro
[Previous] [Next]
 NAME:
	IPS_hlevel_w
 PURPOSE:
	Calculates weights for integrating IPS g-level
 CATEGORY:
	Physics: IPS
 CALLING SEQUENCE:
	FUNCTION IPS_hlevel_w, REarth, R, F, w3darg,	$
		ut_earth	= ut_earth	, $
		pa_earth	= pa_earth	, $
		elo_earth	= elo_earth , $
		elo_sun 	= elo_sun	, $
		degrees 	= degrees
 INPUTS:
	REarth		array[3]			for 'plain' sky map
				array[3,N]			for 'transit' sky map
									heliographic coordinates of Earth for lines of sight
	R			array[3,N,L,M]		heliographic coordinates of points in a 2D grid
									of NxL lines of sight with M segments along each.
									of dimension N, L, M
									R[0,*,*,*] : heliographic longitude
									R[1,*,*,*] : heliographic latitude
									R[2,*,*,*] : heliocentric distance
	F								not used
	w3darg		array[4]			w3darg[0] = observing freq (MHz)
									w3darg[1] = source size (arcsec)
									w3darg[2] = extra source size scale factor
									w3darg[3] = betar
 OPTIONAL INPUT PARAMETERS:
	/degrees						if set all input angles should be in degrees (default: radians)
	ut_earth						not used
	pa_earth						not used
	elo_earth						not used
	elo_sun							not used
 OUTPUTS:
	R			array[N,L,M]		weight factors
 INCLUDE:
	@compile_opt.pro			; On error, return to caller
 EXTERNAL BY:
	vu_earthskymap
 CALLS: ***
	CV_COORD, IPS_WeightFnc, SuperArray
 CALLED BY:
	IPS_velocity_w
 RESTRICTIONS:
	For each line of sight segment the weight is the product of a factor which is a function
	heliocentric distance and a factor which is a function of the geocentric distance.
	The second factor is calculated for one line of sight only on the assumption that
	it's the same for all lines of sight.
 PROCEDURE:
 MODIFICATION HISTORY:
	SEP-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


IPS_params $SSW/smei/ucsd/sat/idl/toolbox/ips/ips_params.pro
[Previous] [Next]
 NAME:
	IPS_params
 PURPOSE:
	Sets parameters for calculating IPS velocities and g-levels
 CATEGORY:
	Physics
 CALLING SEQUENCE:
	R = IPS_params( /nagoya )
	R = IPS_params( freqmhz=FreqMHz, arcsec=ArcSec, sourcescale=SourceScale)
 OPTIONAL INPUT PARAMETERS:
	/nagoya			if set, returns [327 , 0.1, 1.0]
	/cambridge		if set, returns [81.5, 0.3, 1.0]
	/sandiego		if set, returns [73.8, 0.3, 1.0]
 OUTPUTS:
	R			array[3]; type: float; default: [327, 0.1, 1.0] (Nagoya values)
					R[0]: observing frequency in MHz
					R[1]: source size (arcsec)
					R[2]: source scale (multiplicative factor to be applied to source size)
 CALLED BY:
	IPS_WeightFnc, vu_earthskymap
 MODIFICATION HISTORY:
	JUN-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


IPS_velocity $SSW/smei/ucsd/sat/idl/toolbox/ips/ips_velocity.pro
[Previous] [Next]
 NAME:
	IPS_velocity
 PURPOSE:
	Calculates component of solar wind velocity perpendicular to line of sight
 CATEGORY:
	Physics: IPS
 CALLING SEQUENCE:
	FUNCTION IPS_velocity, REarth, R, F, w3darg,	$
		ut_earth	= ut_earth	, $
		pa_earth	= pa_earth	, $
		elo_earth	= elo_earth , $
		elo_sun 	= elo_sun	, $
		degrees 	= degrees
 INPUTS:
	REarth							not used
	R								not used
	F			array[N,L,M]		solar wind velocity matrix
	w3darg							not used
 OPTIONAL INPUT PARAMETERS:
	/degrees						if set all input angles are in degrees
	ut_earth						not used
	pa_earth						not used
	elo_earth						angle Sun-Earth-LOS segment
	elo_sun							angle Sun-LOS segment-Earth
 OUTPUTS:
	R			array[N,L,M]		weight factors
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 EXTERNAL BY:
	vu_earthskymap
 CALLS: ***
	ToRadians
 MODIFICATION HISTORY:
	SEP-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


IPS_velocity_w $SSW/smei/ucsd/sat/idl/toolbox/ips/ips_velocity_w.pro
[Previous] [Next]
 NAME:
	IPS_velocity_w
 PURPOSE:
	Calculates weights for integrating IPS g-level
 CATEGORY:
	Physics: IPS
 CALLING SEQUENCE:
	FUNCTION IPS_velocity_w, REarth, R, F, w3darg,	$
		ut_earth	= ut_earth	, $
		pa_earth	= pa_earth	, $
		elo_earth	= elo_earth , $
		elo_sun 	= elo_sun	, $
		degrees 	= degrees
 INPUTS:
	REarth		array[3]			for 'plain' sky map
				array[3,N]			for 'transit' sky map
									heliographic coordinates of Earth for lines of sight
	R			array[3,N,L,M]		heliographic coordinates of points in a 2D grid
									of NxL lines of sight with M segments along each.
									of dimension N, L, M
									R[0,*,*,*] : heliographic longitude
									R[1,*,*,*] : heliographic latitude
									R[2,*,*,*] : heliocentric distance
	F			array[N,L,M]		g-values at all los segments
	w3darg		array[4]			w3darg[0] = observing freq (MHz)
									w3darg[1] = source size (arcsec)
									w3darg[2] = extra source size scale factor
									w3darg[3] = betar
 OPTIONAL INPUT PARAMETERS:
	/degrees						if set all input angles should be in degrees (default: radians)
	ut_earth						not used
	pa_earth						not used
	elo_earth						not used
	elo_sun							not used
 OUTPUTS:
	R			array[N,L,M]		weight factors
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 EXTERNAL BY:
	vu_earthskymap
 CALLS: ***
	IPS_hlevel_w
 RESTRICTIONS:
	For each line of sight segment the weight is the product of a factor which is a function
	heliocentric distance and a factor which is a function of the geocentric distance.
	The second factor is calculated for one line of sight only on the assumption that
	it's the same for all lines of sight.
	These weights are calculated by ips_hlevel_w, and are here multiplied by the F array.
 MODIFICATION HISTORY:
	SEP-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


IPS_WeightFnc $SSW/smei/ucsd/sat/idl/toolbox/ips/ips_weightfnc.pro
[Previous] [Next]
 NAME:
	IPS_WeightFnc
 PURPOSE:
	Calculates weight function along the line of sight for IPS
 CATEGORY:
	Physics
 CALLING SEQUENCE:
	W = IPS_WeightFnc(ZAu, params)
 INPUTS:
	ZAu			array[N]; type float
					distance from Earth along line of sight (AU)
	params		array[3]; type: float
					params[0]: observing freq in MHz
					params[1]: source size (arcsec)
					params[2]: extra scale factor for source size
 OUTPUTS:
	W			array[N]; type: float
					weight factors
 CALLS: ***
	IPS_params, SPECTRALFNC, nrSimpson
 CALLED BY:
	IPS_hlevel_w
 PROCEDURE:
	CALCULATE INTEGRAL FOR WEIGHTING FUNCTION OF Z.
	SIMPSON METHOD DOUBLE INTEGRAL
	SpectralFnc = q*fresnel(q)*size(q)*spectr(q)
	fresnel= fresnel filter term
	size   = source size term
	spectr = spectrum fluctuation term
 MODIFICATION HISTORY:
	MAR-1999, Paul Hick (pphick@ucsd.edu)
		Adapted from STELab Fortran code


is_running $SSW/smei/ucsd/gen/idl/environment/is_running.pro
[Previous] [Next]
 NAME:
	is_running
 PURPOSE:
	Check whether specified process is running
 CATEGORY:
	gen/idl/environment
 CALLING SEQUENCE:
	FUNCTION is_running, cmd, silent=silent
 INPUTS:
	cmd
 OPTIONAL INPUT PARAMETERS:
	/silent 	suprresses informational messages
 OUTPUTS:
	Result		0: 'cmd' NOT running
				1: 'cmd' IS running
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	InitVar
 CALLED BY:
	smei_hdr_update
 PROCEDURE:
	Preliminary version. Works only on Unix/Linux
	Check 'cmd' against output of
		ps -eo args
 MODIFICATION HISTORY:
	OCT-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


IsBadTime $SSW/smei/ucsd/gen/idl/toolbox/time/isbadtime.pro
[Previous] [Next]
 NAME:
	IsBadTime
 PURPOSE:
	Defines and checks for bad times
 CATEGORY:
	Tell time
 CALLING SEQUENCE:
	IsBad = IsBadTime(T)
 INPUTS:
	T		array[*]; type: time structure
				time origin
 OUTPUTS:
	IsBad	array[*]
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	InitVar, TimeArray, TimeOp, TimeUnit
 CALLED BY:
	vu_new_time, vu_select, vu_update_hours
 PROCEDURE:

 MODIFICATION HISTORY:
	OCT-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


IsDisplay $SSW/smei/ucsd/gen/idl/environment/isdisplay.pro
[Previous] [Next]
 NAME:
	IsDisplay
 PURPOSE:
	Check whether !d.name is the terminal display or the printer
 CATEGORY:
	Environment
 CALLING SEQUENCE:
	Result = IsDisplay()
 INPUTS:
	(none)
 OUTPUTS:
	Result		scalar; type: byte
					0: it's a printer device
					1: it's the display
 CALLS: ***
	InitVar
 CALLED BY:
	Get_Page, View, even_light_corrections, even_light_photometry
	even_light_registration, qBar, qLine_Curve, qNagoya_Skymap, twin, vu_image
 PROCEDURE:
	Returns true if !d.name is !TheTerminal. !TheTerminal is set during IDL startup
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


IsPrinter $SSW/smei/ucsd/gen/idl/environment/isprinter.pro
[Previous] [Next]
 NAME:
	IsPrinter
 PURPOSE:
	Check whether !d.name is the printer
 CATEGORY:
	Environment
 CALLING SEQUENCE:
	Result = IsPrinter()
 INPUTS:
	(none)
 OUTPUTS:
	Result		scalar; type: byte
					1: it's a printer device
					1: it's not the printer
 CALLS: ***
	InitVar
 CALLED BY:
	Get_Page
 PROCEDURE:
	Returns true if !d.name is !ThePrinter or !d.name = 'PS'.
	!TheTerminal is set during IDL startup
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


IsSymLink $SSW/smei/ucsd/gen/idl/toolbox/files/issymlink.pro
[Previous] [Next]
 NAME:
	IsSymLink
 PURPOSE:
	Checks whether a file or directory is a symbolic link
 CATEGORY:
	Environment
 CALLING SEQUENCE:
	B = IsSymLink(file)
 INPUTS:
	file		scalar; type: string
					name of file or directory to be tested
 OUTPUTS:
	B			scalar; type: integer
					0: not a symbolic link
					1: it's symbolic link
				On non-Unix systems, always 0 is returned
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLED BY:
	FindAllSubDirs
 RESTRICTIONS:
 >	Has only been tested on Linux (bash shell) under IDL 5.3 and 5.5
 >	The islink script is needed for IDL version <= 5.4 and must be in the Linux path
 >	Does not work on a path that contains a symbolic link, e.g.
	if /usr/local/rsi is a symbolic link then /usr/local/rsi/lib will
	return zero.
 PROCEDURE:
 >	Only useful on Unix/Linux systems.
	If !version.os_family is not 'unix' then always 0 is returned.

 >	If !version.os_family is 'unix' then:
	- for IDL 5.3 and earlier the script islink is spawned. The
		output from this script (0 or 1) is captured in the 'result'
		argument of spawn.
	- for IDL 5.4 and later, a 'test -L' is spawned, and the
		exit_status keyword is used directly (this makes the test
		independent of the islink script).
 MODIFICATION HISTORY:
	JULY-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


IsTime $SSW/smei/ucsd/gen/idl/toolbox/time/istime.pro
[Previous] [Next]
 NAME:
	IsTime
 PURPOSE:
	Check whether argument is a time structure
 CATEGORY:
	smei/gen/idl/toolbox/time
 CALLING SEQUENCE:
	B = IsTime(T)
 INPUTS:
	T		array; type: anything
 OUTPUTS:
	IsTime	scalar; type: byte
			0 if argument is not a time structure
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	IsType
 CALLED BY:
	CvSky_RTN, GeographicInfo, InsituTimeSeries, PlotCurve, TimeDay, TimeXAxis
	TimeYDate, TimeYDoy, arg_time, eclipsed_area, jpl_eph, lsqLinearFit, mpc_eph
	nagoya_glevel, qLine, qLine_Curve, qLine_FitPlot, qLine_XBase, qView_ApplyGain
	qView_PlotSeries, qView_PlotTrack, qView_UpdateTime, qsmei_hdr, qsmei_sky_Pick
	smei_buf_get, smei_buf_getframe, smei_buf_read, smei_coriolis, smei_frm_cp
	smei_frm_get, smei_frm_hbar, smei_frm_hbar_inside, smei_frm_name, smei_frm_path
	smei_frm_summary, smei_frm_where, smei_getfile, smei_hdr_make, smei_sky_file
	smei_sky_get, smei_sky_read, smei_star_fit, smei_star_remove, smei_zodiac_remove
	smeidb_mounted, usno_eph, vu_gettime, vu_insitu, vu_insitu_raw, vu_insitucurve
	vu_movie, vu_select, vu_set_time_entry, vu_timeseries
 PROCEDURE:
	Keys on structure name
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


IsType $SSW/smei/ucsd/gen/idl/toolbox/istype.pro
[Previous] [Next]
 NAME:
	IsType
 PURPOSE:
	Check for type of variable, or get type code
 CATEGORY:
	Toolbox: generic
 CALLING SEQUENCE:
	R = IsType(X, /floating_x)			tests whether X is of type 'floating'
	R = IsType(/floating_x)				returns type code for type 'floating'
	R = IsType(X)						returns type code for X
 INPUTS:
	X		any variable
 OPTIONAL INPUT PARAMETERS:
	Only one of these should be set:
	/Byte_X
	/Integer_X
	/Short_Integer_X		(same as Integer_X)
	/Longword_X
	/Floating_X
	/Double_X
	/Complex_floating_X
	/String_X
	/Structure_X
	/Complex_double_X
	/Pointer_X
	/Object_reference_X
	/Unsigned_Integer_X
	/Unsigned_Short_Integer_X	(same as Unsigned_Integer_X
	/Unsigned_Longword_X
	/Integer_64_bit_X
	/Unsigned_Integer_64_bit_X
 OUTPUTS:
	IsTime			scalar; type: long integer
					if argument X is set, in combination with one of the type keywords:
						0 if argument is not of specified type; 1 if it is
					otherwise
						type code of X, or type code for specified type keyword
 OPTIONAL OUTPUT PARAMETERS:
	type =type		scalar; type: integer
						code of specified type
	bytes=bytes		scalar; type: integer
						# bytes in scalar of specified type
	name =name		scalar; type: string
						name of specified type
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	InitVar
 CALLED BY:
	AngleRange, AngleUnits, BadValue, ColorSkybox, CombineRotations, CvMag, CvRotation
	CvSky, EarthTransit3DLoc, FindAllFiles, FindPeaks, FishEye, GeographicInfo
	GetColors, GetFileSpec, GetNagoyaSources, Get_Page, GroupPixels, HammerAitoff
	InSitu, Inside_Wedge, IntegrateLOS, InterpolateHeliosphere, IsTime, MagnifyArray
	MercatorProj, PlotCurve, PlotEarthSkymap, PlotPlanarCut, PlotPolarSkymap
	PlotSolarDisk, PlotSynopticMap, RGBO_DepthCue, RGBO_Project, RemoteView
	RemoteView_CubeFrame, RemoteView_CurrentSheet, RemoteView_Display2D
	RemoteView_Display3D, RemoteView_FOV, RemoteView_FOV_xyz, RemoteView_Init
	RemoteView_Init_Matrix, RemoteView_Init_View, RemoteView_Matte
	RemoteView_rgbo, SetFileSpec, Set_Page, SubArray, SuperArray, TagArray
	ThomsonElectron, ThomsonLOSDensity, ThomsonLOSFar, ThomsonLOSStep
	ThomsonRadialFilter, ThomsonSetupLOS, TimeArray, TimeGet, TimeInterpol
	TimeLInterpol, TimeLimits, TimeMonth, TimeOp, TimeOrigin, TimePieces, TimePosn
	TimePosn_test, TimeSet, TimeShift, TimeSplit, TimeString, TimeSystem, TimeUnit
	TimeXAxis, TimeYDate, TimeYDoy, View, WhatIs, WhatIs0, anicenum, arg_time, arrow3d
	bargraph, big_body, big_eph, big_eph_clean, big_eph_short, bin_read, bin_write, boost
	do_file, eclipsed_area, even_light_info, even_light_photometry
	flat_centerofmass, flt_read, grd_read, gridgen, gridgen1d, hide_env, ice_read
	img_read, jpl_body, jpl_eph, jpl_mag, lsqLinearFit, mk_flick, mpc_body, mpc_eph
	nagoya_glevel, nso_fe_read, plot3darc, plot3dcube, plot3dline, put_logo, qBar, qEphem
	qEphem_State, qImage, qImage_FileInfo, qImage_Pick, qImage_Send
	qImage_SendDestination, qImage_TriggerSend, qImage_cw, qImage_cw_BoxCosine
	qImage_cw_BoxImage, qImage_cw_DrawCross, qImage_cw_DrawEphem
	qImage_cw_Ellipse, qImage_cw_Ephem, qImage_cw_EphemKill [1]
	qImage_cw_ImageType, qImage_cw_MinMax, qImage_cw_Property, qImage_cw_Set_Value
	qImage_cw_Transform, qImage_cw_Update, qImage_cw_Wedge, qImage_cw_Where
	qImage_cw_ZEllipse, qImage_cw_ZWedge, qImage_cw_ctable, qImage_cw_smei_frm
	qLine, qLine_XBase, qLoadCT, qSave2File, qSave2File_Save, qSet_Page, qShow, qTool
	qTool_State [1], qTool_State [2], qView, qView_ApplyGain, qView_ImageInfo
	qView_UpdateActive, qslider_cw, qsmei_hdr, qsmei_sky, qsmei_sky_FileInfo
	qsmei_sky_Pick, rank_array, sgp_body, smei_base_testcase, smei_buf_get
	smei_buf_getframe, smei_buf_gzip, smei_buf_mget, smei_buf_prep, smei_buf_read
	smei_cam_quaternion, smei_camera, smei_ccd2sky, smei_coriolis, smei_cv
	smei_frm_base, smei_frm_cvhdr, smei_frm_drive, smei_frm_eclipse
	smei_frm_findpoint, smei_frm_flag, smei_frm_flatfield, smei_frm_get
	smei_frm_hbar, smei_frm_hbar_inside, smei_frm_name, smei_frm_path, smei_frm_ped
	smei_frm_property, smei_frm_read, smei_frm_summary, smei_frm_track
	smei_frm_update, smei_frm_where, smei_frm_write, smei_fts_read, smei_getfile
	smei_hdr_get, smei_hdr_make, smei_hdr_plot, smei_hdr_update, smei_mkglare
	smei_mksidereal, smei_mkstdstar, smei_orbit_set, smei_orbits_stat
	smei_pick_stars, smei_setup_roi, smei_sky, smei_sky2cam, smei_sky2ccd
	smei_sky_get, smei_sky_read, smei_star_fit, smei_star_info, smei_star_list
	smei_star_lsqbins, smei_star_lsqfit, smei_star_remove, smei_star_standard
	smei_star_writepnt, smei_theta2radial, smei_zodiac_fit, smei_zodiac_remove
	smeidb_mounted, statpos, stopwatch, twin, txt_read, usno_body, usno_eph, usno_init
	vox_read, vox_write, vu_NagoyaSourcemap, vu_RemoteView, vu_atlocation, vu_cvgrid
	vu_earthskymap, vu_filename, vu_get_page, vu_getdata, vu_gettime, vu_image
	vu_insitu, vu_insitu_raw, vu_insitucurve, vu_mean, vu_movie, vu_nagoyaskymap
	vu_new_time, vu_planarcut, vu_point_source, vu_quick_movie, vu_read, vu_select
	vu_set, vu_solardisk, vu_synopticmap, vu_timeseries, vu_type_insitu
	vu_type_skymap, vu_vox_read, vu_vox_write, vu_weight, vu_write, wedge_bounding_box
	wedge_content, wso_read, wso_write, www_help, www_help_crosslinks, www_help_make
	www_help_master, www_help_rsi, www_help_tree
 PROCEDURE:
	Trivial
 MODIFICATION HISTORY:
	APR-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


IsWindowSystem $SSW/smei/ucsd/gen/idl/environment/iswindowsystem.pro
[Previous] [Next]
 NAME:
	IsWindowSystem
 PURPOSE:
	Check whether !d.name is a window system
 CATEGORY:
	Environment
 CALLING SEQUENCE:
	Result = IsWindowSystem()
 INPUTS:
	(none)
 OUTPUTS:
	Result		scalar; type: byte
					0: not a window system
					1: it's a window system
 CALLED BY:
	pcursor [1], twin
 PROCEDURE:
	Compares !d.name against a list of devices (currently X and WIN)
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)