CarringtonLng $SSW/smei/ucsd/sat/idl/toolbox/sun/carringtonlng.pro
[Previous] [Next]
 NAME:
	CarringtonLng
 PURPOSE:
	Get Carrington (heliographic) longitude for given time T
 CALLING SEQUENCE:
	R = CarringtonLng(T)
 INPUTS:
	Yr				array; type: standard time structure
 OPTIONAL INPUT PARAMETERS:
	/degrees			if set then then the output is in degrees
						(default: radians)
 OUTPUTS:
	R				array; type: float
						Carrington (heliographic) longitude
 INCLUDE:
	@compile_opt.pro							; On error, return to caller
 CALLS: ***
	CarringtonVar, ToRadians
 SEE ALSO:
	CarringtonNr
 PROCEDURE:
	See CarringtonT0 for more details.
 MODIFICATION HISTORY:
	DEC-2000, Paul Hick (UCSD/CASS)
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Rewrite using new version of CarringtonVar


CarringtonNear $SSW/smei/ucsd/sat/idl/toolbox/sun/carringtonnear.pro
[Previous] [Next]
 NAME:
	CarringtonNear
 PURPOSE:
	Translate a heliographic longitude into a Carrington variable within half
	a rotation from a specified Carrington variable
 CATEGORY:
 CALLING SEQUENCE:
	XCnear = CarringtonNear(XC,LNG [/degrees])
 INPUTS:
	XC			array; type: float
					reference Carrington variable
	LNG			array; type: float
					heliographic longitude in [0,360]
 OPTIONAL INPUT PARAMETERS:
	/degrees	indicates LNG is in degrees (default is radians)
 OUTPUTS:
	XCnear		array; type: float
					Carrington variable near XC ( abs(XCnear-XC) le 0.5 )
 OPTIONAL OUTPUT PARAMETERS:
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	ToRadians
 CALLED BY:
	EarthSky3DLoc, EarthTransit3DLoc, InterpolateHeliosphere
 SEE ALSO:
	CarringtonVar
 RESTRICTIONS:
	The input longitudes MUST be inside [0,360]
 PROCEDURE:
	The difference in longitude between LNG and XC is calculated. If
	the difference is less than -180 deg then 360 deg is added; if greater than
	180 deg then 360 deg is subtracted.
 MODIFICATION HISTORY:
	OCT-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


CarringtonNr $SSW/smei/ucsd/sat/idl/toolbox/sun/carringtonnr.pro
[Previous] [Next]
 NAME:
	CarringtonNr
 PURPOSE:
	Get Carrington rotation number for given time (Yr,Doy)
 CALLING SEQUENCE:
	NC = CarringtonNr(T)
 INPUTS:
	T		array; type: standard time structure
				time
 OPTIONAL INPUTS:
	/degrees	if set then the heliographic longitude returned
				in keyword 'lng' is in degrees (default: radians)
 OUTPUTS:
	CarringtonNr	array; type: integer
				Carrington rotation number
 OPTIONAL OUTPUTS:
	lng=lng		array; type: float
				Carrington (heliographic) longitude in
				radians or degrees (depending on setting of
				keyword 'degrees')
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 SEE ALSO:
	CarringtonLng, CarringtonVar
 CALLS: ***
	CarringtonVar, ToRadians
 PROCEDURE:
	See CarringtonT0 for more details.
 MODIFICATION HISTORY:
	NOV-1994, Paul Hick (UCSD)
	SEP-1999, Paul Hick (UCSD/CASS)
		simplified procedure; argument is now a time structure
	DEC-2000, Paul Hick (UCSD/CASS)
		added output keyword 'lng'
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Rewrite using new version of CarringtonVar


CarringtonT $SSW/smei/ucsd/sat/idl/toolbox/sun/carringtont.pro
[Previous] [Next]
 NAME:
	CarringtonT
 PURPOSE:
	Get times when Earth was at Carrington variable XC
 CALLING SEQUENCE:
	T = CarringtonT(XC)
 INPUTS:
	XC			array; type: float
 OUTPUTS:
	T			array; type: standard time structure
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	AngleRange, ScEarth, TimeArray, TimeOp, TimeOrigin, TimeSet
 CALLED BY:
	PlotSynopticMap, arg_time, vu_gettime, vu_insitu, vu_select, vu_set_time_entry
	vu_timeseries
 PROCEDURE:
	An estimate for the Carrington start time is set up first.
	This is refined by a call to CarringtonT0.
 MODIFICATION HISTORY:
	SEP-1999, Paul Hick (UCSD/CASS)
	JAN-2004, Paul Hick (UCSD/CASS)
		Substantial rewrite to improve precision from several minutes
		to about a milli-second
	APR-2004, Paul Hick (UCSD/CASS)
		Added code to prevent iteration loop to get stuck in infinite loop
	JUN=2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Bug fix (du was subscripted with n instead of nn)


CarringtonT0 $SSW/smei/ucsd/sat/idl/toolbox/sun/carringtont0.pro
[Previous] [Next]
 NAME:
	CarringtonT0
 PURPOSE:
	Calculate list of start times for subsequent 'Carrington rotations'
 CATEGORY:
	Celestial mechanics
 CALLING SEQUENCE:
	Ts = CarringtonT0(T,ScName,dDoy=dDoy,ncar=nCar,n_c=N_C,f_c=F_C)
 INPUTS:
	T		array; type: time structure
				times
	ScName	scalar; type: string; default: 'ScEarth'
				function name; identifies spacecraft
	dDoy	scalar; type: float
				required accuracy (in days) for the Carrington start times JDs
	nCar	scalar; type: integer
				# start times to be calculated (default=1)
 OUTPUTS:
	Ts		array; type: standard time structure
					Carrington start times
 OPTIONAL OUTPUTS:
	n_c=N_C	scalar; type: integer
				Rotation for which Ts[0] is the start time
				(this is the rotation containing T)
	f_c=F_C	fraction of rotation between input T and Ts[0]
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	AngleRange, ArrayLocation, InitVar, ScEarth, TimeArray, TimeGet, TimeOp, TimeSet
	TimeUnit
 PROCEDURE:
 >	ScName is a user-written function which calculates the heliographic
		longitude of a spacecraft for a given time T
	The call to ScName has the form:
		LNG = ScName(T, degrees=degrees)
	where T, a standard time structure is input and LNG (float) is output.
	The function should not modify T in any way.
 >	The spacecraft is supposed to move in the ecliptic, circling the Sun in
	the same direction as Earth (direct motion)
 >	The start time of a new Carrington rotation is defined as the time for
	which the heliographic longitude of the spacecraft is zero.
 >	the input T is the time where the search for start times begins.
	the first nCar Carrington start times after T, including
	the one containing T, are calculated)
 MODIFICATION HISTORY:
	JAN-1992, Paul Hick (UCSD)
	NOV-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu); all times are now
		time structures (used to be yr, doy or Julian days).


CarringtonVar $SSW/smei/ucsd/sat/idl/toolbox/sun/carringtonvar.pro
[Previous] [Next]
 NAME:
	CarringtonVar
 PURPOSE:
	Get Carrington variable for given time T
 CALLING SEQUENCE:
	XC = CarringtonVar(T)
 INPUTS:
	T				array; type: standard time structure
 OUTPUTS:
	CarringtonVar	array; type: float
						Carrington variable
 OPTIONAL OUTPUTS:
	fraction		array; positive fraction of a rotation
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	AngleRange, ScEarth, TimeOp, TimeSet, TimeUnit
 CALLED BY:
	CarringtonLng, CarringtonNr, EarthSky3DLoc, EarthTransit3DLoc, arg_time
	nso_fe_plot, qvu_pick, vu_insitu_raw, vu_new_time, vu_synopticmap, vu_timeseries
	vu_update_marker, vu_vox_write, vu_whatis
 SEE ALSO:
	CarringtonLng, CarringtonNr
 PROCEDURE:
	See CarringtonT0 for more details.
 MODIFICATION HISTORY:
	SEP-1999, Paul Hick (UCSD/CASS)
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Rewrite, circumventing ugly CarringtonT0 calls


CenterOfMass $SSW/smei/ucsd/gen/idl/toolbox/centerofmass.pro
[Previous] [Next]
 NAME:
	CenterOfMass
 PURPOSE:
	Calculate center of mass of a distribution of masses in n dimensions
 CATEGORY:
	gen/idl/toolbox
 CALLING SEQUENCE:
	P = CenterOfMass(mass_array [, loc_array])
 INPUTS:
	mass_array		array of any structure; type: integer or float
 OPTIONAL INPUT PARAMETERS:
	loc_array		array[n, size(mass_array,/dim)]
						i.e. same structure as mass_array with one extra
						leading dimension
 OUTPUTS:
	P				scalar, or array[n]; double precision
						coordinates of center of mass. In the one-dimensional
						case (n=1) a scalar is returned.
 CALLS: ***
	SubArray, SyncDims
 CALLED BY:
	even_light, qImage_cw_ZEllipse, qImage_cw_ZUpdate, wedge_content
 SIDE EFFECTS:
	The center of mass calculation is done in double precision.
 PROCEDURE:
	Two separate cases are calculated:
 >	1. Only the mass_array is specified as an n-dimensional array.
		The center of mass is returned as an n-element array (scalar if n=1).
		The array index in each dimension is used as the distance scale:
			mass_array = [[1,2],[3,4]]
			P = centerofmass(mass_array)
		results in
			P = [0.6,0.7]
 > 2. If both mass_array and loc_array are specified then loc_array, with
			leading dimension of n elements, specifies the n-dimensional locations
			of the masses in mass_array, e.g. in the 3-dimensional case, if mass_array
			is a 10x10 array then loc_array would be a 3x10x10 array, with
			loc_array[0,*,*] the x-coordinate, loc_array[1,*,*] the y-coordinate and
			loc_array[2,*,*] the z-ccordinate.
		The above example again:
			mass_array = [1,2,3,4]
			loc_array  = [[0,0],[1,0],[0,1],[1,1]]
			P = centerofmass(mass_array)
		results in
			P = [0.6,0.7]
 MODIFICATION HISTORY:
	NOV-1999, Paul Hick (UCSD/CASS)
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		internally the procedure converts the mass array to a normalized mass by
		dividing by the total mass. This results in a divide by zero if the sum is
		zero (presumably because all masses are zero). To avoid this one unit is
		added to each mass.


CheckDir $SSW/smei/ucsd/gen/idl/toolbox/files/checkdir.pro
[Previous] [Next]
 NAME:
       CheckDir
 PURPOSE:
       Check whether a directory exists
 CATEGORY:
	Environment
 CALLING SEQUENCE:
	Status = CheckDir(Name [, LongName])
 INPUTS:
	Name		scalar string, the directory name
					Name='' always returns status=1B with
					LongName set to the current directory.
 OPTIONAL INPUT PARAMETERS:
	/stay		if set then a 'cd' to the directory is made (if it exists)
 OUTPUTS:
	Status		0 : directory doesn't exist
				1 : directory exists
 OPTIONAL OUTPUT PARAMETERS:
	LongName	scalar string
			Status=0 : null string
			Status=1 : fully qualified directory name
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLED BY:
	FindAllFiles, FindAllSubDirs, RemoteView_Display2D, RemoteView_Display3D
	SetFileSpec, hide_env, htmd_cat, mk_flick, qImage_cw_SmeiMask, qView_FileFilter
	smei_base_testcase, smei_buf, smei_buf_get, smei_buf_getframe, smei_buf_mget
	smei_buf_prep, smei_frm_cp, smei_frm_findpoint, smei_frm_path, smei_frm_summary
	smei_frm_write, smei_hdr_get, smei_hdr_make, smei_hdr_plot, smei_orbits_stat
	smei_star_remove, smei_zodiac_remove, smeidb_mounted, unhide_env, vu_get_page
	vu_image, vu_movie, vu_quick_movie, www_help, www_help_rsi
 RESTRICTIONS:
 >	No attempt is made to pre-process the input directory name
	(such as translation of logicals/env. variables, etc.)
 CALLS: ***
	FILEPATH, InitVar, hide_env
 PROCEDURE:
 >	CD is used to decide whether a directory exists, and is
	used to retrieve the full directory name.
 >	filepath is called to make sure a trailing (back)slash is appended on
	Unix and Windows systems.
 MODIFICATION HISTORY:
	DEC-1997, Paul Hick
	SEP-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Return zero if input spec contains wildcard.


CHOOSE_PS_ACTIONS $SSW/smei/bham/idl/utils/choose_ps_actions.pro
[Previous] [Next]
 NAME:
	CHOOSE_PS_ACTIONS


 PURPOSE:
	Choose whether to print or preview a postscript file


 CATEGORY:
	Utilities (Plot)


 CALLING SEQUENCE:
	choose_ps_actions, file, print, preview


 INPUTS:
	file	string	The file to be printed/previewed
	print	string	The command to print a file.
	preview	string	The command to preview a file.


 KEYWORD PARAMETERS:
	printable	If explicitly set to zero then the file cannot
			be printed directly.

 CALLS: ***
	CH_PS_EVENT
 MODIFICATION HISTORY:
	Original: 6/6/05; SJT


CleanGlitchBox $SSW/smei/ucsd/sat/idl/toolbox/cleanglitchbox.pro
[Previous] [Next]
 NAME:
	CleanGlitchBox
 PURPOSE:
	Given that a glitch has been detected (specified as a single pixel,
	check a neighbourhood of the pixel to decide whether the glitch
	covers more than one pixel.
 CATEGORY:
	Avoidable ?
 CALLING SEQUENCE:
	nLoc = CleanGlitchBox(Frames, Loc, spotwidth=SpotWidth, frac=frac)
 INPUTS:
	Frames		3D-array, any type (float or double needed to use NaN option)
					stack of 2D frames combined in 3D array; the last dimension counts
					the number of frames
					Frame elements set to the value !VALUES.F_NAN or D_NAN are ignored
	Loc			1-dim array, type long integer
					location of pixels already identified as part of glitches
					specified as 1-dim indices into the Frames array.
 OPTIONAL INPUT PARAMETERS:
	spotwidth=SpotWidth
				scalar, integer, default=1
					should be an odd integer.
					defines a neighbourhood of SpotWidth x Spotwidth pixels
					!! If SpotWidth is not defined the procedure simply
					returns the input Loc array unmodified.
	frac=frac	scalar, any type, default=1
					Used in the criterion for deciding whether a pixel is part of
					a glitch or not. See PROCEDURE.
 OUTPUTS:
	nLoc		scalar, long integer
					# elements in Loc (=n_elements(Loc))
	Loc			1-dim array, type long integer
					location of the glitches as 1-dim indices into the Frames array
					The array will contain all the input values. Added are all pixels
					that are identified as part of the glitch
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	ArrayLocation, BadValue, UNIQ [1], UNIQ [2], UNIQ [3]
 CALLED BY:
	Find2DGlitch
 PROCEDURE:
	For each element in the Loc array a box of SpotWidth x SpotWidth in the
	appropriate frame is processed. Minimum and median in the box are calculated
	excluding the center of the box.
	The difference between median and minimum is used to identify other pixels
	in the box which are considered part of the central glitch. Any pixel more
	than frac*(median-minimum) above the median is considered part of the glitch.
 MODIFICATION HISTORY:
	OCT-1998, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


clock $SSW/smei/ucsd/gen/idl/toolbox/time/clock.pro
[Previous] [Next]
 NAME:
	clock
 PURPOSE:
	Display time of day (including day of year (DOY) and Julian day number (JD)
 CATEGORY:
	Totally unnecessary
 CALLING SEQUENCE:
	clock
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	TimeGet, TimeSplit
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


ColorPolarBox $SSW/smei/ucsd/sat/idl/toolbox/graphics/colorpolarbox.pro
[Previous] [Next]
 NAME:
	ColorPolarBox
 PURPOSE:
	Draws a color display for a set of 'skyboxes' as defined by a grid
	of spherical coordinates. Draws either a rectangular map
	(x=phase,y=polar), a fish-eye map or a Hammer-Aitoff map
 CALLING SEQUENCE:
	PRO ColorPolarBox, cosP, sinP, Color,	$
		skyedge		= skyedge	, $
		zero_phase	= zero_phase, $
		dabg		= dabg		, $
		degrees		= degrees	, $
		black		= black		, $
		void		= void		, $
		fill2edge	= fill2edge
 INPUTS:
	Phase		array[n [+1] ] or array[n [+1],m [+1] ]; type: float
					Phase angle; 'longitude'
					Dimension n and/or m is used to specify the center of
					sky box n,m (the box edges will be calculated internally
					Dimension n+1 and/or m+1 is used to specify the edges of
					sky box n,m
	Polar		array[m [+1] ] or array[n [+1],m [+1] ]; type: float
					Polar angle; 'colatitude'
					Box center of box edge can be specified, as for 'Phase'
	Color		array[n,m]; type: integer
					2D array with color indices
					boxes with negative color indices are never colored in
					boxes with index zero are colored only if keyword /black is set
	skyedge		scalar; type: float
					if set and positive, data are plotted as a 'fish-eye' map.
					The value is used as cut-off for the range of polar angles
					plotted (polar angles above 'skyedge' not plotted); if set and
					negative, a Hammer-Aitoff projection is used; if not set or
					zero, a rectangular map is drawn
 OPTIONAL INPUTS:
	zero_phase=zero_phase
				scalar, or array with same structure as 'Phase'; type: float
					Only used if Xp is a 1-dim array of box centers.
					The input arrays Xp, Yp, Color are rearranged to put
					zero_phase in the center of the map.	
	dabg=dabg	array[3]; type: float; default: [0,0,0]
					Passed to FishEye and HammerAitoff
					Determines the direction of the center of the plot
	/degrees	if set, all angles are in degrees (default: radians)
	/black		if set, then color index 0 (black) is drawn with a call to polyfill
					By default color index 0 is not drawn (i.e. remains in the
					background color).
	/void		if set, then negative color index is drawn using the foreground
					color !p.color. By default these are not drawn (i.e. remain
					in the background color).
	/fill2edge	if set, then the phase angle boundaries of the outermost bins are set to
					+/- 180 degrees. Only used if bin centers are specified for
					the phase angles.
 OUTPUTS:
	skyedge		scalar
					updated only if positive and bigger than 170 deg
					(returned value is 170 deg)
 INCLUDE:
	@compile_opt.pro					; On error, return to caller
 CALLS: ***
	InitVar, SuperArray, ToDegrees, ToRadians
 RESTRICTIONS:
 >	Color must be a 2D array with dimension [N,M]. The first dimension (N) is the
	phase angle dimension; the second (M) is the polar angle dimension
 >	The Phase and Polar arrays can be 1-dim or 2-dim.
	A 1-dim Phase array (n) is interpreted as a 2-dim array (n,m) with all m rows the same.
	A 1-dim Polar array (m) is interpreted as a 2-dim array (n,m) with all n columns the same.
 >	The second dimension of Phase should be the same (n=N) or one larger (n=N+1) than for Color.
	If n=N+1 then Phase contains the phase angles of the edges of sky boxes; if n=N it contains
	the center phase angles, and the edges are calculated internally.
 >	The second dimension of Polar should be the same (m=M) or one larger (m=M+1) than for Color.
	If m=M+1 then Polar contains the polar angles of the edges of sky boxes; if m=M it contains
	the center polar angles, and the edges are calculated internally.
 >	The value of 'skyedge' is changed to skyedge = (skyedge < 170).
	The method of plotting the skyboxes (by connecting the corners by straight lines in
	the x-y plane of the plot) does not work for large elongations. Problems are avoiding
	by not permitting 'skyedge' to be larger than 170.
 PROCEDURE:
 >	The color array indices contains color indices for NxM 'skyboxes'.
	The corners of the boxes are stored in the Phase and Polar arrays
 >	Phase and Polar are spherical coordinates in a coordinate system where
	the reference direction (e.g. the direction to the Sun) is the Z-axis.
 >	Synonyms:
		phase angle = longitude, position angle
		polar angle = colatitude, elongation
 >	The arrays Phase and Polar will usually be obtained by a call to EulerRotate
 >	The array color can be obtained by a call to GetColors
 >	If the 'skyedge' keyword is set, then the angles Phase and Polar are plotted
	on the screen as a 'fish-eye' view, interpreting the Polar angle
	as 'radius' and the Phase angle as an phase angle in the x-y plane of
	the plot, i.e. x = Polar*cos(Phase) and y = Polar*sin(Phase).
 >	The boxes in the x-y plane of the plot are defined by connecting the
	corners by straight lines (and using the appropriate color).
 >	Boxes with color index 0 (black) are skipped by default. If the keyword
	'black' is set color index 0 is explicitly colored with polyfill
 MODIFICATION HISTORY:
	AUG-1999, Paul Hick (UCSD/CASS)
		added check for negative color indices, these are now ignored
		(GetColors now checks for bad values using the 'finite' function and
		sets corresponding boxes to a negative color index).
	JAN-2002, Paul Hick (UCSD/CASS)
		Improved tests to decide which sky boxes to plot in a fish-eye plot
		at large polar angles.
	APR-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Added /fill2edge keyword.


ColorSkybox $SSW/smei/ucsd/sat/idl/toolbox/graphics/colorskybox.pro
[Previous] [Next]
 NAME:
	ColorSkybox
 PURPOSE:
	Draws a color display for a set of 'skyboxes' as defined by a grid
	of spherical coordinates. Draws either a rectangular map
	(x=phase,y=latitude), a fish-eye map or a Hammer-Aitoff map
 CALLING SEQUENCE:
	PRO ColorSkybox, Phase, Latitude, Color,	$
		skyedge 	= skyedge	, $
		zero_phase	= zero_phase, $
		dabg		= dabg		, $
		degrees		= degrees	, $
		black		= black		, $
		void		= void		, $
		fill2edge	= fill2edge
 INPUTS:
	Phase		array[n [+1] ] or array[n [+1],m [+1] ]; type: float
					Phase angle; 'longitude'
					Dimension n and/or m is used to specify the center of
					sky box n,m (the box edges will be calculated internally
					Dimension n+1 and/or m+1 is used to specify the edges of
					sky box n,m
	Latitude	array[m [+1] ] or array[n [+1],m [+1] ]; type: float
					Latitude angle
					Box center or box edge can be specified, as for 'Phase'
	Color		array[n,m]; type: integer
					2D array with color indices
					boxes with negative color indices are never colored in
					boxes with index zero are colored only if keyword /black is set
	skyedge		scalar; type: float
					if set and positive, data are plotted as a 'fish-eye' map.
					The value is used as cut-off for the range of colatitude (polar)
					angles plotted (polar angles above 'skyedge' not plotted);
					if set and negative, a Hammer-Aitoff projection is used;
					if not set or zero, a rectangular map is drawn
 OPTIONAL INPUTS:
	zero_phase=zero_phase
				scalar, or array with same structure as 'Phase'; type: float
					Only used if Xp is a 1-dim array of box centers.
					The input arrays Xp, Yp, Color are rearranged to put
					zero_phase in the center of the map.	
	dabg=dabg	array[3]; type: float; default: [0,0,0]
					Passed to FishEye and HammerAitoff
					Determines the direction of the center of the plot
	/degrees	if set, all angles are in degrees (default: radians)
	/black		if set, then color index 0 (black) is drawn with a call to polyfill
					By default color index 0 is not drawn (i.e. remains in the
					background color).
	/void		if set, then negative color index is drawn using the foreground
					color !p.color. By default these are not drawn (i.e. remain
					in the background color).
	/fill2edge	if set, then the phase angle boundaries of the outermost bins are set to
					+/- 180 degrees. Only used if bin centers are specified for
					the phase angles.
 OUTPUTS:
	skyedge		scalar
					updated only if positive and bigger than 170 deg
					(returned value is 170 deg)
 INCLUDE:
	@compile_opt.pro					; On error, return to caller
 CALLS: ***
	AngleRange, FishEye, HammerAitoff, InitVar, IsType, SuperArray, ToDegrees, ToRadians
 CALLED BY:
	PlotEarthSkymap, PlotPolarSkymap
 RESTRICTIONS:
 >	Color must be a 2D array with dimension [N,M]. The first dimension (N) is the
	phase angle dimension; the second (M) is the latitude angle dimension
 >	The Phase and Latitude arrays can be 1-dim or 2-dim.
	A 1-dim Phase array (n) is interpreted as a 2-dim array (n,m) with all m rows the same.
	A 1-dim Latitude array (m) is interpreted as a 2-dim array (n,m) with all n columns the same.
 >	The second dimension of Phase should be the same (n=N) or one larger (n=N+1) than for Color.
	If n=N+1 then Phase contains the phase angles of the edges of sky boxes; if n=N it contains
	the center phase angles, and the edges are calculated internally.
 >	The second dimension of Latitude should be the same (m=M) or one larger (m=M+1) than for Color.
	If m=M+1 then Latitude contains the latitude angles of the edges of sky boxes; if m=M it contains
	the center latitude angles, and the edges are calculated internally.
 >	The value of 'skyedge' is changed to skyedge = (skyedge < 170).
	The method of plotting the skyboxes (by connecting the corners by straight lines in
	the x-y plane of the plot) does not work for large elongations in the fish-eye maps.
	Problems are avoiding by not permitting 'skyedge' to be larger than 170.
 PROCEDURE:
 >	The color array indices contains color indices for NxM 'skyboxes'.
	The corners of the boxes are stored in the Phase and Latitude arrays
 >	Phase and Latitude are usually equatorial (RA, dec) or ecliptic coordinates
 > The center of fish-eye and Hammer-Aitoff has phase angle zero_lng and latitude 0.
 >	The arrays Phase and Latitude will usually be obtained by a call to EulerRotate
 >	The array color can be obtained by a call to GetColors
 >	If the 'skyedge' keyword is set, then the angles Phase and Latitude are plotted
	on the screen as a 'fish-eye' view.
 >	The boxes in the x-y plane of the plot are defined by connecting the
	corners by straight lines (and using the appropriate color).
 >	Boxes with color index 0 (black) are skipped by default. If the keyword
	'black' is set color index 0 is explicitly colored with polyfill
 MODIFICATION HISTORY:
	AUG-1999, Paul Hick (UCSD/CASS)
		added check for negative color indices, these are now ignored
		(GetColors now checks for bad values using the 'finite' function and
		sets corresponding boxes to a negative color index).
	JAN-2002, Paul Hick (UCSD/CASS)
		Improved tests to decide which sky boxes to plot in a fish-eye plot
		at large polar angles.
	APR-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Added /fill2edge keyword.


CombineRotations $SSW/smei/ucsd/gen/idl/toolbox/math/combinerotations.pro
[Previous] [Next]
 NAME:
	CombineRotations
 PURPOSE:
	Combine two rotations, i.e. find the rotation resulting from
	first applying one (R1), then another (R2) rotation.
 CATEGORY:
	gen/idl/toolbox/math
 CALLING SEQUENCE:
	R = CombineRotations(R1, R2 [,R3,R4,R5], /euler_angles, degrees=degrees)
 INPUTS:
	R1				array[3,n], array[4,n], array[3,3,n]; type: float
						first rotation
	R2				array[3,m], array[4,m], array[3,3,m]; type: float
						second rotation

					R1 and/or R2 can be a single rotation with the other
					multiple rotations, i.e. n = 1 and m != 1; or n != 1
					and m = 1. The single rotation will be combined with
					each of the multiple rotations.

	R3,R4,R5		Additional rotations. Up to 5 rotations can be combined
					in a single call.
 OPTIONAL INPUT PARAMETERS:
	/quaternion 	input and output rotations are in quaternions;
	/euler_angles	in- and output rotations are in Euler angles triplets
	/dcm			in- and output rotations are in direction cosine matrices
	/geometric		in- and putput rotations are in geometic form
						(unit vector, plua rotation around unit vector).

	/degrees		if set then all angles are in degrees (default: radians)
 OUTPUTS:
	R				array[3,n > m]; type: same as input
						combined rotation in same form as input
 CALLS: ***
	CvRotation, InitVar, IsType, SyncArgs
 CALLED BY:
	CvSky, CvSky_Galactic, smei_cam_quaternion, smei_camera, smei_frm_where
	smei_orient_test, vu_planarcut
 SEE ALSO:
	EulerRotate
 PROCEDURE:
	See definition of quaternions in: Foley, van Dam, Feiner and Hughes
	'Computer graphics, principles and practice', 2nd edition.
	Addison-Wesley, 1992, page 1063
 MODIFICATION HISTORY:
	MAR-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


compile_opt $SSW/smei/ucsd/gen/idl/compile_opt.pro
[Previous] [Next]
 NAME:
	compile_opt
 PURPOSE:
	Controls default IDL error handler and special compiler options
 CALLING SEQUENCE:
	@compile_opt.pro
 PROCEDURE:
	Included in virtually all IDL procedures in the SSW_SMEI tree
 MODIFICATION HISTORY:
	JAN-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


coord3to2 $SSW/smei/ucsd/sat/idl/toolbox/tricks/coord3to2.pro
[Previous] [Next]
 NAME:
	coord3to2
 PURPOSE:
	Convert a 3D position vector to a 2D 'screen location'
 CATEGORY:
 CALLING SEQUENCE:
	result = coord3to2(p, [,/device, /normal])
 INPUTS:
	p			array[3,*]; type: int or float
					coordinates of 3d vectors
 OPTIONAL INPUT PARAMETERS:
	/data, /normal, /device
					only one of these should be set
					if set the input coordinates are assumed to be in data, normal
					or device coordinates. If all are absent, then data coordinates are assumed
 OUTPUTS:
	p			array[3,*]; same type as input
					the converted 'screen location'
 OPTIONAL OUTPUT PARAMETERS:
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	InitVar, SyncDims
 CALLED BY:
	arrow3d, plot3dtext
 PROCEDURE:
	If a 3D transformation (!p.t) is in effect than all 3D vector arguments supplied to IDL
	plot functions while using the /t3d keyword are converted to a 'screen location' for actual plotting.
	This function is my best guess as to how this works. The x,y coordinates of the returned
	vector indicate where on the screen (inside the plotwindow) the point would be plotted, while
	the z-coordinate provides the 'depth' dimension perpendicular to the screen.
 MODIFICATION HISTORY:
	AUG-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Cv2Grid $SSW/smei/ucsd/sat/idl/toolbox/math/cv2grid.pro
[Previous] [Next]
 NAME:
	Cv2Grid
 PURPOSE:
	Generate function values in a regular grid of NX by NY points.
	The input function values are specified on a set random points XP,YP
	with function values ZP, or as a 2-D array ZP
 CALLING SEQUENCE:
	Z = Cv2Grid (ZP, nX,nY, dist=Dist, xp=XP, yp=YP, pos=pos, zflag=Zflag, noflag=NoFlag)
	Z = Cv2Grid (ZP, nX,nY, dist=Dist, zflag=Zflag, noflag=NoFlag)
 INPUTS:
	ZP		array[*] or array[*,*]; type:float
				if array[*]	 : function values for a 'random' set of data points
				if array[*,*]: any 2-dim array to be rebinned
	nX		scalar; type: integer
	nY		scalar: type: integer
				size of regular output array
 OPTIONAL INPUTS:
	dist=Dist
			scalar; type: float
				data points closer than abs(Dist) grid
					spacings from an output grid point are included
					in the averaging
	xp=XP	array[*]; type: float
	yp=YP	array[*]; type: float
				X/Y-coordinates of points in the random set in user-specified units
	position=[XB,YB,XE,YE]
			array[4]; type: float
				XB,YB)		X/Y-coordinates of grid point (0,0) in user units
				XE,YE		X/Y-coordinates of grid point (nX-1,nY-1) in user units
	zflag=ZFlag
			scalar; type: float; default: !values.f_nan
				value used to identify invalid fnc-values in in- and output Z
	/noflag		if set, no fnc-values are flagged as 'bad'
 OUTPUTS:
	Z		array[nX,nY]; type: float
				grid function values.
				If no function value was calculated for a particular grid point
				the value Zflag is returned
 RESTRICTIONS:
	The user units for XB,XE,YB,YE should be the same as for XP and YP
 PROCEDURE:
 >	If both keywords xp and yp are present, then zp is assumed to be 1-dim
	array of 'random' points. Otherwise zp is assumed to be a 2-dim array.
 >	The output grid defines a regular grid of nX by nY squares.
 >	The function values Z are calculated by averaging over points ZP
	inside a grid square.
 MODIFICATION HISTORY:
	JAN-1995, Paul Hick (UCSD); based on Fortran routine CONSTRUCT_GRID


CvMag $SSW/smei/ucsd/gen/idl/ephem/cvmag.pro
[Previous] [Next]
 NAME:
	CvMag
 PURPOSE:
	Converts between various magnetic coordinate systems
 CATEGORY:
	smei/gen/idl/ephem
 CALLING SEQUENCE:
	R = CvMag(UT,from_GSE=In, /to_RTN [,/degrees, /rectangular])
 INPUTS:
	UT				array; type: standard time structure
						times (UT)
 OPTIONAL INPUTS:
	from_rtn	= In
	from_gse	= In
	from_gsm	= In

	/to_rtn			conversion to magnetic RTN coordinates
	/to_gse			conversion to magnetic GSE coordinates
	/to_gsm			conversion to magnetic GSM coordinates

	/degrees		input and output angles are in degrees
	/rectangular	input and output is in rectangular coordinates
 INPUTS/OUTPUTS:
	R				array[2,*] or array[3,*]; type: double
						output array according to selected /to... keyword
						if /rectangular is set then the output array will be
						in rectangular (x,y,z) coordinates; otherwise spherical
						coordinates (longitude, latitude, and (optional) radial
						distance is returned
 INCLUDE:
	@compile_opt.pro			; On error, return to caller
 CALLS: ***
	CvSky, EulerRotate, InitVar, IsType, NewcombSun, SubArray, SuperArray, TimeGet, TimeUnit
	ToDegrees, ToRadians
 PROCEDURE:
	GSE	used for magnetic measurements near Earth
		x-axis towards Sun, z-axis towards ecliptic North pole
	GSM	variation on GSE
		x-axis towards Sun, z-axis along projection of Earth's magnetic
		dipole in plane perpendicular  to x-axis. The y-z plane is the
		same for GSE and GSM.
	RTN	used for magnetic field measurements in a heliographic reference
		frame. x-axis (R-axis) points radially away from the Sun
		The y-axis (T-axis) is the cross product of solar north (solar
		rotations axis) and R-axis. The z-axis (N-axis) is the cross product
		of R and T-axis.

		For an observer in the solar equator the N-axis points toward solar North.
		For an observer at Earth x(RTN) = - x(GSE) = -x(GSM), and
		three magnetic coordinate frames share the same y-z plane)
 MODIFICATION HISTORY:
	SEP-2001, Tamsen Dunn, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


CvPointOnLos $SSW/smei/ucsd/sat/idl/toolbox/thomson/cvpointonlos.pro
[Previous] [Next]
 NAME:
	CvPointOnLos
 PURPOSE:
	Converts from topocentric to heliocentric coordinates and v.v
 CALLING SEQUENCE:
	FUNCTION CvPointOnLos, RP,$
		oldelo	= ELOLD 	, $
		oldphase= PHOLD 	, $
		newelo	= ELNEW 	, $
		eorw	= EorW		, $
		degrees = degrees
 INPUTS: (either topocentric or heliocentric)
	RP					array[3,*]; type: float
							RP[0,*]	= longitude (0<=LNG<=360) and ...
							RP[1,*] = latitude (-90<=LAT<=90) of line of sight
							RP[2,*] = radial distance to point on los
								(in units of the observer-Sun distance)
 OPTIONAL INPUT PARAMETERS:
	/degrees			if set all in- and output angles are in degrees
						(default is radians)
 OUTPUTS: (either heliocentric or topocentric)
	Result				array[3,*]; type: float
							RP[0,*]	= longitude (0<=XLNG<=360) and ...
							RP[1,*] = latitude (-90<=XLAT<=90) of line of sight
							RP[2,*] = radial distance to point on los
								(in units of the observer-Sun distance)
	oldelo=OldElo		array[*]; type: float
							elongation in the old coordinate system; 0<=ELOLD<=180
	oldphase=OldPhase	array[*]; type: float
							phase angle measured counterclockwise from the north
	newelo=NewElo		array[*]; type: float
							elongation in the new coordinate system 0<=ELNEW<=180
	EorW				array[*]; type: integer
							+1 or -1; indicates on which side (East or West) of
							the Sun-Earth line the point is located
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	SyncDims, ToRadians
 CALLED BY:
	EarthSky3DLoc, EarthTransit3DLoc, ThomsonLOSDensity, nagoya_glevel
 RESTRICTIONS:
 >	There is no check for -90 <= XLAT <= 90
 PROCEDURE:
 >	The topocentric coordinate system (with Earth in the origin)
	has its X-axis pointing towards the Sun. Y and Z-axis are arbitrary
	(usually the X-Y plane will be the ecliptic).
	The topocentric longitude is measured in a positive sense, i.e.
	counterclockwise as viewed from the positive Z-axis.
 >	The heliocentric coordinate system (with the Sun in the origin
	has its X-axis pointing towards Earth.
	The heliocentric longitude is measured in a positive sense.
 >	Spherical coordinates for both systems: longitude (deg), latitude
	(deg) and radial distance (units of Sun-Earth distance).
 >	Input can be in topocentric or heliocentric coordinates. The output
	will be in the other coordinate system (the calculation is symmetric).
 >	EorW is determined from the input elongation XLNG:
	if 0<=XLNG<=180 then EorW = 1; if 180<XLNG<360 the EorW = -1
 >	If input is in topocentric coordinates then
	- OldElo is the angle Sun-Earth-P
	- NewElo is the angle Earth-Sun-P
	- EorW = +1 if P is towards the east of the Sun (viewed from Earth)
	- EorW = -1 if P is towards the west of the Sun (viewed from Earth)
 >	If input is in heliocentric coordinates then
	- OldElo is the angle Earth-Sun-P
	- NewElo is the angle Sun-Earth-P
	- EorW = -1 if P is towards the east of the Sun (viewed from Earth)
	- EorW = +1 if P is towards the west of the Sun (viewed from Earth)
 >	If RP is negative then the opposite direction (180+XLNG,-XLAT,-RP)
	is used.
 >	The Sun is located at topocentric longitude 0 deg and latitude 0 deg
	and radial distance 1.0
 >	The Earth is located at heliocentric longitude 0 deg and latitude
	0 deg and radial distance 1.0
 >	Internal calculations are done in double precision
 >	The easiest way to check the equations is to work out the relations
	between the x,y,z components of the vector to P in both coordinates
	systems.
 MODIFICATION HISTORY:
	FEB-1990, Paul Hick (UCSD); adapted from the subroutine SC_ECLIP.FOR
	JUN-1994, Paul Hick (UCSD); made the calculation symmetric so that
	    it is valid also going from heliocentric to topocentric.


CvPrecess $SSW/smei/ucsd/gen/idl/ephem/cvprecess.pro
[Previous] [Next]
 NAME:
	CvPrecess
 PURPOSE:
	Converts ecliptic coordinates for epoch UT1 to epoch UT2,
	i.e. corrects for precession between the two epochs.
 CATEGORY:
	smei/gen/idl/ephem
 CALLING SEQUENCE:
	R = CvPrecess(UT1,UT2,pos)
	R = CvPrecess(UT1,UT2,pos, /from_ecliptic, /to_ecliptic)
 CALLS: ***
	CvSky, CvSky_Precess, EulerRotate, InitVar, REVERSE
 INPUTS:
	UT		 	array[n]; type: time structure
					initial epoch
	UT	 		array[n]; type: time structure
					final epoch
	pos[2,n] or pos[3,n]
				spherical coordinates at start epoch UT1
				RA or longitude, declination or latitude, and, optional
				the distance (the distance is not modified)
 OPTIONAL INPUT PARAMETERS:
	/degrees	if set, all angles are in degrees
	/from_ecliptic
	/to_ecliptic
				by default the input and output are assumed to be in
				equatorial coordinates (RA and declination).
				If /from_ecliptic is set then the input is assumed to be
				in ecliptic coordinates (longitude and latitude)
				If /to_ecliptic is set then the output is in ecliptic
				coordinates
 OUTPUTS:
	pos[2,n] or pos[3,n]
				spherical coordinates at final epoch UT2
				RA or longitude, declination or latitude, and, optional
				the distance (the distance is not modified)
 INCLUDE:
	@compile_opt.pro
 CALLS: ***
	CvSky, CvSky_Precess, EulerRotate, InitVar, REVERSE
 CALLED BY:
	GetNagoyaSources, big_eph, jpl_eph, jpl_test, mpc_eph, smei_sky, usno_eph
 PROCEDURE:
	See R. Green, Spherical Astronomy, Cambridge UP, 1985, Sect. 9.5, p. 217
	(1) First transform ecliptic longitude and latitude to equatorial right
	    ascension and declination (for initial epoch);
	(2) Transform equatorial coordinates for initial epoch to epoch J2000.0;
	(3) Calculate equatorial coordinates for epoch J2000.0 to final epoch;
	(4) Transform back to ecliptic coordinates (for final epoch).
 MODIFICATION HISTORY:
	DEC-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Adapted from Fortran subroutine PRECESSION_ROT


CvRotation $SSW/smei/ucsd/gen/idl/toolbox/math/cvrotation.pro
[Previous] [Next]
 NAME:
	CvRotation
 PURPOSE:
	Convert between several ways of specifying rotations
 CATEGORY:
	gen/idl/toolbox/math
 CALLING SEQUENCE:
	R = CvRotation( from_euler=from_euler, /to_quaternion, /degrees)
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
	Only one of the from_* keywords is specified:

	from_euler=from_euler
				array[3,n]; type: real
					triplets of Euler angles
	from_quaternion=from_quaternion
				array[4,n]; type: real
					unit quaternion quatruplets with the scalar in array[3,n]
					(MUST be unit quanternion)
	from_dcm	array[3,3,n]; type: float
					direction cosine matrices
	from_geometric
				array[3,n] or array[4,n]
					unit vector, plus angle of rotation around unit vector.
					array[3,n]: phase angle, latitude and angle of rotation
					array[4,n]: rectangular coordinates and angle of rotation

	Only one of the /to_* keywords is specified:

	/to_euler	if set then the output is an array[3,n] of Euler angles
	/to_quaternion
				if set then the output is an array[4,n] on unit quaternions
	/to_dcm 	if set then direction cosine matrices array[3,3,n] are returned
	/to_geometric
				if set then a unit vector in rectangular coordinates and an
					angle of rotation around the unit vector, array[4,n]
					are returned.

	/degrees	if set, all angles are in degrees (default: radians)
 OUTPUTS:
	out 		array[3,n], array[4,n]; type: same as input
					Euler angles, unit quaternion, direction cosine matrix
					or unit vector with angle of rotation.
 CALLS: ***
	AngleRange, CV_COORD, InitVar, IsType, ToRadians, boost
 CALLED BY:
	CombineRotations, CvSky_Galactic, smei_ccd2sky, smei_cv, smei_frm_where
	smei_orient_test, smei_sgp4_quat, smei_sky2cam
 SEE ALSO:
	EulerRotate
 RESTRICTIONS:
	The quaternion to Euler angle conversion may still have problems near qx = qy = 0
	(rotations around the z-axis) and q0 = qz = 0 (rotations around axis in x-y plane.
	The singularities themselves (strictly qx=qy=0 and strictly q0=qz=0) are dealt
	with properly.
 PROCEDURE:
	The Euler angle triplets define rotation around z-axis, y-axis and
	z-axis respectively.

	A specific rotation can be specified by more then one set of Euler
	angles or quaternions. For Euler angles [pi+alfa, -beta, pi+gamma] is the same
	rotation as [alfa, beta, gamma]. For quaternions [-qx,-qy,-qz,-q0] is the same
	rotation as [qx,qy,qz,q0]. If q = cos(phi/2)+sin(phi/2)*u and
	-q = cos(chi/2)+sin(chi/2)*v (for unit vectors u and v), then v=-u and
	chi/2=180-phi/2, i.e. chi=360-phi. So -q is a rotation over -phi after changing
	the sign of the rotation vector.

	The conversion /to_euler always returns a positive beta in [0,180].
 MODIFICATION HISTORY:
	FEB-2003, Paul Hick (UCSD/CASS)
	MAR-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Rewrite. Moved scalar quaternion component from first to last position
		Improved calculation of quaternions from DCM or Euler angles
		(avoiding singularities for q0 close to zero).


CvSky $SSW/smei/ucsd/gen/idl/ephem/cvsky.pro
[Previous] [Next]
 NAME:
	CvSky
 PURPOSE:
	Converts between ecliptic, heliographic, equatorial and geographic
	coordinates
 CATEGORY:
	smei/gen/idl/ephem
 CALLING SEQUENCE:
	FUNCTION CvSky, UT,	fromvectors 		, $
		from_ecliptic	= from_ecliptic		, $
		from_centered_ecliptic = from_centered_ecliptic,	$
		from_equatorial	= from_equatorial	, $
		from_galactic	= from_galactic		, $
		from_heliographic= from_heliographic, $
		from_geographic = from_geographic	, $
		from_gse		= from_GSE			, $
		from_gsm		= from_GSM			, $
		from_rtn		= from_RTN			, $

		to_ecliptic		= to_ecliptic		, $
		to_centered_ecliptic = to_centered_ecliptic,	$
		to_equatorial	= to_equatorial		, $
		to_galactic		= to_galactic		, $
		to_heliographic	= to_heliographic	, $
		to_geographic   = to_geographic		, $
		to_rtn			= to_RTN 			, $
		to_gse			= to_GSE 			, $
		to_gsm			= to_GSM 			, $

		heliocentric	= heliocentric		, $

		degrees         = degrees			, $
		rectangular		= rectangular		, $

		euler_angles 	= euler_angles		, $
		euler_info		= euler_info		, $
		silent			= silent
 INPUTS:
	UT				array; type: standard time structure
						times (UT); Note that if /rectangular is set then UT
						can only be an array[1] (i.e. a single time must be specified)
	fromvectors 	array;
 OPTIONAL INPUTS:
	from_ecliptic	= from_ecliptic
	from_centered_ecliptic = from_centered_ecliptic
	from_heliographic= from_heliographic
	from_geographic	= from_geographic
	from_equatorial	= from_equatorial
	from_rtn		= from_rtn
	from_gse		= from_gse
	from_gsm		= from_gsm
					array [2,n] or array[3,n]
						/rectangular NOT set: In[0,*] is longitude, In[1,*] is latitude;
											In[2,*] (optional?) is radial distance
						/rectangular set: rectangular (x,y,z) coordinates

					Alternatively, fromvectors contains the input vectors and the
					appropriate keyword /from* is SET.

	/to_ecliptic		conversion to ecliptic coordinates
	/to_centered_ecliptic
						conversion to sun-centered ecliptic coordinates
						(/heliocentric NOT set) or earth-centered ecliptic
						coordinates (/heliocentric SET)
	/to_heliographic	conversion to heliographic coordinates
	/to_geographic		conversion to geographic coordinates
	/to_equatorial		conversion to equatorial ccordinates
	/to_rtn				conversion to magnetic RTN coordinates
	/to_gse				conversion to magnetic GSE coordinates
	/to_gsm				conversion to magnetic GSM coordinates

	/heliocentric		used in conjunction with from_centered_ecliptic and
						to_centered_ecliptic keywords: sun-centered if /heliocentric
						is NOT set; earth-centered if /heliocentric SET

	/degrees			input and output angles are in degrees
	/rectangular		input and output is in rectangular coordinates

	silent=silent		suppresses information messages
 INPUTS/OUTPUTS:
	Result			array[2,*] or array[3,*]; type: double
						output array according to selected /to... keyword
						if /rectangular is set then the output array will be
						in rectangular (x,y,z) coordinates; otherwise spherical
						coordinates (longitude, latitude, and (optional) radial
						distance is returned
 OPTIONAL OUTPUTS:
	euler_angles=euler_angles
					array[3,*]; type: double
						Euler angles applied to input coordinates.
	euler_info=euler_info
					scalar; type: string
						descriptive string describing the transformation
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	CombineRotations, CvSky_Equatorial, CvSky_GSE, CvSky_GSM, CvSky_Galactic
	CvSky_Geographic, CvSky_Heliographic, CvSky_RTN, EulerRotate, InitVar, IsType
	REVERSE, SuperArray, big_eph, jpl_body, who_am_i
 CALLED BY:
	CvMag, CvPrecess, CvSky_GSM, EarthSky3DLoc, EarthTransit3DLoc, InsituTimeSeries
	PlotEarthSkymap, PlotPolarSkymap, RemoteView, RemoteView_BodyLoc
	RemoteView_FovTilt, RemoteView_Init_View, RemoteView_ZEclipticPlane
	RotationMeasure, ScEarth, big_eph, big_orbit, jpl_eph, jpl_test, mpc_eph
	smei_frm_where, smei_sky, smei_zodiac_fit, smei_zodiac_model, usno_eph
	vu_planarcut, vu_point_source, vu_vox_drawelatitude, vu_vox_drawelongitude
	vu_vox_draworbit, vu_vox_write
 PROCEDURE:
	For the regular celestial coordinate frames see e.g.
	R. Green, Spherical Astronomy, Cambridge UP, 1985, Section 17.7, p. 430.

	For magnetic RTN,GSE and GSM coordinate frames, see
		???

	GSE	used for magnetic measurements near Earth
		x-axis towards Sun, z-axis towards ecliptic North pole
	GSM	variation on GSE
		x-axis towards Sun, z-axis along projection of Earth's magnetic
		dipole in plane perpendicular  to x-axis. The y-z plane is the
		same for GSE and GSM.
	RTN	used for magnetic field measurements in a heliographic reference
		frame. x-axis (R-axis) points radially away from the Sun
		The y-axis (T-axis) is the cross product of solar north (solar
		rotations axis) and R-axis. The z-axis (N-axis) is the cross product
		of R and T-axis.

		For an observer in the solar equator the N-axis points toward solar North.
		For an observer at Earth x(RTN) = - x(GSE) = -x(GSM), and
		three magnetic coordinate frames share the same y-z plane)
 MODIFICATION HISTORY:
	MAR-1997, Paul Hick (UCSD/CASS)
		adapted from FORTRAN version
	MAR-1998, Paul Hick (UCSD/CASS)
		now accepts multi-dim arrays
	JAN-2001, Paul Hick (UCSD/CASS)
		added /rectangular keyword
	SEP-2001, Tamsen Dunn, Paul Hick (UCSD/CASS)
		added transformations from/to magnetic frames RTN, GSE and GSM
	SEP-2006, Paul Hick (UCSD/CASS)
		Added fromvectors argument
		Added from_centered_ecliptic and to_centered_ecliptic keywords
		Added euler_angles and euler_info keywords
		Added silent keyword
		Added underscores to to* and from* keywords
	OCT-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Now accumulates all Euler angles and calls EulerRotate only once
		to perform the coordinate transformation.


CvSky_Equatorial $SSW/smei/ucsd/gen/idl/ephem/cvsky_equatorial.pro
[Previous] [Next]
 NAME:
	CvSky_Equatorial
 PURPOSE:
	Euler angles for Ecliptic --> Equatorial conversion
 CATEGORY:
	smei/gen/idl/ephem
 CALLING SEQUENCE:
	abc = CvSky_Equatorial(UT [, /degrees)
 INPUTS:
	UT			array[n]; type: time structure
 OPTIONAL INPUT PARAMETERS:
	/degrees	if set, all angles are in degrees (default: radians)
 OUTPUTS:
	abc			array[3,n]; type: double
					Euler angles for converting from
					ecliptic to equatorial coordinates
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	SubArray, SuperArray, TimeGet, ToDegrees
 CALLED BY:
	CvSky, CvSky_Galactic
 PROCEDURE:
	Angle ecliptic-equator as in:
	Spherical Astronomy, R.M. Green, Cambridge UP, p. 220, eq 9.25
 MODIFICATION HISTORY:
	AUG-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


CvSky_Galactic $SSW/smei/ucsd/gen/idl/ephem/cvsky_galactic.pro
[Previous] [Next]
 NAME:
	CvSky_Galactic
 PURPOSE:
	Euler angles for Ecliptic --> Galactic conversion
 CATEGORY:
	smei/gen/idl/ephem
 CALLING SEQUENCE:
	FUNCTION CvSky_Galactic, UT, degrees=Degrees
 INPUTS:
	UT			array[n]; type: time structure
 OPTIONAL INPUT PARAMETERS:
	/degrees		if set, all angles are in degrees (default: radians)
 OUTPUTS:
	abc			array[3,n]; Euler angles for converting from
					ecliptic to heliographic coordinates
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	CombineRotations, CvRotation, CvSky_Equatorial, CvSky_Precess, REVERSE, TimeSet
 CALLED BY:
	CvSky
 PROCEDURE:
	Angle ecliptic-equator as in:
	Spherical Astronomy, R.M. Green, Cambridge UP, p. 41, eq 2.31
 MODIFICATION HISTORY:
	SEP-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


CvSky_Geographic $SSW/smei/ucsd/gen/idl/ephem/cvsky_geographic.pro
[Previous] [Next]
 NAME:
	CvSky_Geographic
 PURPOSE:
	Euler angles for Ecliptic to Geographic conversion
 CATEGORY:
	smei/gen/idl/ephem
 CALLING SEQUENCE:
	FUNCTION CvSky_Geographic, UT, degrees=Degrees
 INPUTS:
	UT	array[n]; type: time structure
 OPTIONAL INPUT PARAMETERS:
	/degrees    if set all angles are in degrees (default: radians)
 OUTPUTS:
	abc	array[3,n]; type: float
		Euler angles
 INCLUDE:
	@compile_opt.pro				; On error, return to caller
 CALLS: ***
	SubArray, SuperArray, TimeGet, ToDegrees
 CALLED BY:
	CvSky
 PROCEDURE:
 MODIFICATION HISTORY:
	AUG-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


CvSky_GSE $SSW/smei/ucsd/gen/idl/ephem/cvsky_gse.pro
[Previous] [Next]
 NAME:
	CvSky_GSE
 PURPOSE:
	Euler angles for Ecliptic to GSE conversion
 CATEGORY:
	smei/gen/idl/ephem
 CALLING SEQUENCE:
	FUNCTION CvSky_GSE, UT, degrees=degrees
 INPUTS:
	UT	array[n]; type: time structure
 OPTIONAL INPUT PARAMETERS:
	/degrees    if set all angles are in degrees (default: radians)
 OUTPUTS:
	Result		array[3,n]; type: float
					Euler angles
 INCLUDE:
	@compile_opt.pro				; On error, return to caller
 CALLS: ***
	SubArray, big_eph, jpl_body
 CALLED BY:
	CvSky
 PROCEDURE:
	Geocentric Solar Ecliptic (GSE) coordinates:
	x-axis points from Earth to Sun
	y-axis is in the ecliptic plane opposing orbital motion
	z-axis  points to ecliptic north
 MODIFICATION HISTORY:
	AUG-2002, Paul Hick (UCSD/CASS)
	OCT-2006, Pual Hick (UCSD/CASS; pphick@ucsd.edu)
		Replaced NewcombSun by big_eph


CvSky_GSEQ $SSW/smei/ucsd/gen/idl/ephem/cvsky_gseq.pro
[Previous] [Next]
 NAME:
	CvSky_GSEQ
 PURPOSE:
	Euler angles for Ecliptic to GSEQ conversion
 CATEGORY:
	smei/gen/idl/ephem
 CALLING SEQUENCE:
	FUNCTION CvSky_GSEQ, UT, degrees=degrees
 INPUTS:
	UT	array[n]; type: time structure
 OPTIONAL INPUT PARAMETERS:
	/degrees    if set all angles are in degrees (default: radians)
 OUTPUTS:
	Result		array[3,n]; type: float
					Euler angles
 INCLUDE:
	@compile_opt.pro				; On error, return to caller
 CALLS: ***
	SubArray, SuperArray, big_eph, jpl_body
 PROCEDURE:
	Geocentric Solar Equatorial (GSEQ) coordinates:
	x-axis points from Earth to Sun
	y-axis is parallel to Sun's equatorial plane pointing
		east of the Sun
	z-axis is pointing north and completes righthanded
		coordinate frame

	The Sun's rotation axis lies in the x-z plane.
 MODIFICATION HISTORY:
	OCT-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


CvSky_GSM $SSW/smei/ucsd/gen/idl/ephem/cvsky_gsm.pro
[Previous] [Next]
 NAME:
	CvSky_GSM
 PURPOSE:
	Euler angles for Ecliptic to GSM conversion
 CATEGORY:
	smei/gen/idl/ephem
 CALLING SEQUENCE:
	FUNCTION CvSky_GSM, UT, degrees=degrees
 INPUTS:
	UT	array[n]; type: time structure
 OPTIONAL INPUT PARAMETERS:
	/degrees    if set all angles are in degrees (default: radians)
 OUTPUTS:
	Result	array[3,n]; type: float
		Euler angles
 INCLUDE:
	@compile_opt.pro							; On error, return to caller
 CALLS: ***
	CvSky, SubArray, SuperArray, TimeGet, ToDegrees, ToRadians, big_eph, jpl_body
 CALLED BY:
	CvSky
 PROCEDURE:
	Geocentric Solar Magnetospheric (GSM) coordinates
	x-axis points from Earth to Sun
	z-axis is the northern magnetic pole.
	The difference between the GSM system and the GSE
	and GSEQ is a rotation about the X-axis.
 MODIFICATION HISTORY:
	AUG-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


CvSky_Heliographic $SSW/smei/ucsd/gen/idl/ephem/cvsky_heliographic.pro
[Previous] [Next]
 NAME:
	CvSky_Heliographic
 PURPOSE:
	Euler angles for Ecliptic to Heliographic conversion
 CATEGORY:
	smei/gen/idl/ephem
 CALLING SEQUENCE:
	abc = CvSky_Heliographic(UT [, /degrees])
 INPUTS:
	UT		array[n]; type: time structure
 OPTIONAL INPUT PARAMETERS:
	/degrees	if set all angles are in degrees (default: radians)
 OUTPUTS:
	abc		array[3,n]; type: float
			Euler angles
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	SubArray, SuperArray, TimeGet, TimeUnit, ToDegrees
 CALLED BY:
	CvSky, vu_solardisk
 PROCEDURE:
 MODIFICATION HISTORY:
	AUG-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


CvSky_Precess $SSW/smei/ucsd/gen/idl/ephem/cvsky_precess.pro
[Previous] [Next]
 NAME:
	CvSky_Precess
 PURPOSE:
	Euler angles for precesion of equatorial coordinates from epoch UT to J2000
 CATEGORY:
	smei/gen/idl/ephem
 CALLING SEQUENCE:
	abc = CvSky_Precess(UT [, /degrees)
 INPUTS:
	UT			array[n]; type: time structure
 OPTIONAL INPUT PARAMETERS:
	/degrees		if set, all angles are in degrees (default: radians)
 OUTPUTS:
	abc 		array[3,n]; Euler angles for precession from epoch UT to J2000
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	SubArray, SuperArray, TimeGet, ToDegrees
 CALLED BY:
	CvPrecess, CvSky_Galactic
 PROCEDURE:
	Precession angles from:
	Spherical Astronomy, R.M. Green, Cambridge UP, p. 219, eq 9.23
 MODIFICATION HISTORY:
	DEC-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


CvSky_RTN $SSW/smei/ucsd/gen/idl/ephem/cvsky_rtn.pro
[Previous] [Next]
 NAME:
	CvSky_RTN
 PURPOSE:
	Euler angles for Heliographic to RTN conversion at Earth
 CATEGORY:
	smei/gen/idl/ephem
 CALLING SEQUENCE:
	FUNCTION CvSky_RTN, UT_or_LOC, degrees=degrees
 INPUTS:
	UT_or_LOC		array[3,n]; type: float
						heliocentric locations in heliographic
						coordinates (heliographic longitude, latitude and
						distance)
					array[n]; type: time structure
						UT times; in this case the heliocentric locations
						is assumed to be at Earth at the specified times
 OPTIONAL INPUT PARAMETERS:
	/degrees    if set all angles are in degrees (default: radians)
 OUTPUTS:
	Result		array[3,n]; type: float
					Euler angles to rotate from heliographic
					coordinates to RTN coordinates
 INCLUDE:
	@compile_opt.pro			; On error, return to caller
 CALLS: ***
	IsTime, SubArray, big_eph, jpl_body
 CALLED BY:
	CvSky, RotationMeasure
 PROCEDURE:
	RTN (Radial, Tangential, Normal) coordinates at point P:
	x-axis = radial direction
	y-axis = in tangent plane, parallel to solar equator
	z-axis = in tangent plane, pointing toward the solar north pole
 MODIFICATION HISTORY:
	AUG-2002, Paul Hick (UCSD/CASS)
	OCT-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Added option to directly enter heliocentric locations
		in addition to always using Earth's location.


CvT3d $SSW/smei/ucsd/sat/idl/toolbox/cvt3d.pro
[Previous] [Next]
 NAME:
	CvT3d
 PURPOSE:
	Implement three-dimensional transformation of coordinate systems.
	!!! t3d provides a transformation matrix for transforming vectors in a
		fixed coordinate frame. This routine provides a matrix for
		transforming the coordinate frame, while keeping the vectors constant.
	Accumulates one or more sequences of translation,
	scaling, rotation, (perspective, and oblique) transformations
	and returns the resulting 4x4 transformation matrix.
 CATEGORY:
	Number strangling
 CALLING SEQUENCE:
	pt = CvT3D(translate=T, scale=S, rotate=R, /degrees)
 OPTIONAL INPUTS:
	/degrees	if set, all angles are assumed to be in degrees (default: radians)
	matrix=Matrix		float array[4,4]
				Used as starting transformation matrix
				if absent the identity matrix is used as starting point.
	vector=Vector		float array[3,*]
				x,y,z coordinates in original coordinate frame.
				If present, the transformation matrix is applied and the
				result is returned, instead of the matrix itself.

	All inputs to T3D are in the form of keywords.  Any, all, or none of
	the following keywords can be present in a call to T3D.

	The transformation specified by each keyword is performed in the
	order of their descriptions below (e.g., if both TRANSLATE and
	SCALE are specified, the translation is done first):

	Translate	3-element vector of the translations in the X, Y, and Z directions.
	Scale		3-element vector of scale factors for the X, Y, and Z axes.
	Rotate		n-element vector of the rotations, about the X, Y, and Z axes.
				The elements in Rotate are interpreted in sets of 3 for rotations
				around X, Y, and Z axes.
	XYexch		exchange the X and Y axes.
	XZexch		exchange the X and Z axes.
	YZexch		exchange the Y and Z axes.

 Not implemented
	PERSPECTIVE	Perspective transformation.  This parameter is a scalar (p)
		that indicates the Z distance of the center of the projection.
		Objects are projected into the XY plane at Z=0, and the "eye"
		is at point [0,0,p].
	OBLIQUE:	A two-element vector of oblique projection parameters.
		Points are projected onto the XY plane at Z=0 as follows:
			x' = x + z(d COS(a)), and y' = y + z(d SIN(a)).
		where OBLIQUE[0] = d, and OBLIQUE[1] = a.
 OUTPUTS:
	If keyword vector is not specified, then the 4x4 transformation matrix is returned.
	If keyword vertor is specified, then the transformation matrix is applied and
		the result is returned as a float array[3,*]
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	ToRadians
 CALLED BY:
	EulerRotate, PlotSolarDisk, RemoteView_FOV_Cube, RemoteView_FOV_loc, qvu_draw
	vu_solardisk
 RESTRICTIONS:
	This routine implements general rotations about the three axes.
 PROCEDURE:
 >	See also IDL procedure t3d.pro
 >	If a set of vectors is given in the form x[3,*] (containing
	x,y,z-coordinates in the original coordinate frame), then
	T3DMatrix(..)#x is an array[3,*] with coordinates in the new
	coordinate frame.
 >	Using the /xyexch, /yzexch or /zxexch keywords turns a
	right-handed coordinate frame into a left-handed frame. This impacts
	the interpretation of the rotation angles (positive rotations are
	counter-clockwise in a right-handed coordinate frame), and is better
	avoided. These exchange keywords are only useful as final
	transformations to swap the corresponding vector coordinates.
 MODIFICATION HISTORY:
	DMS, Nov, 1987.
	DMS, June 1990.	Fixed bug that didn't scale or translate
			matrices with perspective properly.
	DMS, July, 1996.  Added MATRIX keyword.
	FEB-1998, Paul Hick (UCSD/CASS, pphick@ucsd.edu); based on T3D.pro


cw_ffield $SSW/smei/bham/idl/utils/cw_ffield.pro
[Previous] [Next]
 CW_FFIELD
	A labeled text entry field

 Usage:
	id = cw_ffield(parent, ...)

 Return:
	id	long	The ID of the compound widget

 Argument:
	parent	long	input	The ID of the base in which the widget
				will sit.

 Keywords:
	label	string	input	The label to be attached to the entry box
	value	...	input	The initial value of the widget
	uvalue	...	input	A user-value for the compound.
	floating	input	If set then the values are floating point
	double		input	If set, then the values are double
				precision fp
	integer		input	If set then the values are short
				integers
	long_int	input	If set then the values are long
				integers
	text		input	If set, then the values are text
				strings (default action)
	format	string	input	The format for displaying the value.
	xsize	int	input	The size of the text input box (chars)
	ysize	int	input	The number of rows in the box
	column		input	If set then put the label above the
				text box (default is to the left)
	frame		input	If set, then put a box around the
				whole compound
	box		input	If set, then put a box around the text
				field.
	all_events	input	If set, then return all events except
				selection events
	no_event	input	If set, then don't return events at
				all.
	select_events	input	If set and all_events is set, then
				even return selection events
	tracking_events	input	If set, then enable cursor tracking
				events in the text window.
	capture_focus	input	If set, then putting the cursor into
				the text-box gives the focus to the widget.
	array_valued	input	If set, then the widget can accept &
				return an array of values (normally
				only scalar values are accepted)
	scroll		input	If set then make the text widget a
				scrolling widget.
	graphics	input	If set and this is a text input box,
				don't return strings ending in a
				single pling "!" (To avoid hershey
				character errors).
	font	string	input	The font to use for the label.
	fieldfont string input	The font to use for the entry box.

 CALLS: ***
	FFLD_CVT_FLOAT, FFLD_CVT_INT, FFLD_ENTER_EV, FFLD_FOCUS_ENTER, FFLD_GET_ENTER
	FFLD_SET_ENTER, REVERSE
 CALLED BY:
	SAVE_PROFILE, SMEI_CALC_MENU, vmain
 Restrictions:
	If the text window does not contain a valid value for the
	given type, then the null string is returned by a get_value
	call.

 History:
	Original: 25/8/95; SJT
	use decoders rather than internal reads: 29/8/95; SJT
	Add tracking_events key: 4/12/95; SJT
	Add array_valued and scroll keys: 9/12/96; SJT
	Modify handler so tracking events can be returned by
	"non-editable" or "non-event" widgets: 14/1/97; SJT
	Add CAPTURE_FOCUS key: 6/2/97; SJT
	Add GRAPHICS key: 12/2/97; SJT
	Put in "event backlog" trapping to prevent the multiple
	updating of the plot when a title is typed rapidly: 3/7/97; SJT
	Renamed as cw_ffield, added font keys and included keyboard
	focus events (to get right feel for IDL_HS): 7/12/99; SJT


CW_PROGRESS $SSW/smei/bham/idl/utils/cw_progress.pro
[Previous] [Next]
 NAME:
	CW_PROGRESS


 PURPOSE:
	Generate a progress bar.


 CATEGORY:
	UTILS


 CALLING SEQUENCE:
	wid = cw_progress(parent[, <options>])


 INPUTS:
	parent	long	Widget ID of the base widget in which it is located.


 KEYWORD PARAMETERS:
	title	string	A title for the progress bar
	/column		If set, then any title is placed above the bar
			and the text progress below it.
	xsize	int	The x-size of the bar in pixels
	ysize	int	The y-size of the bar in pixels
	index	int	a 2-element array with the colour indices to
			use index[0] is the unprocessed part [255] and
			index[1] is the processed part [0]
	font	string	Font to use for the title and text progress.
	/frame		If set, then put a frame round the whole compound
	/box		If set, then put a frame round the
			draw_widget. (default is set (use box=0 to remove it)
	uvalue	any	A user value for the widget.
	uname	string	A user name for the widget
	value	float	An initial setting of the progress state.
	text	int	The format of the textual display of the
			progress, 0 -- no text display, 1 -- display
                       as a fraction, 2 (default)  -- display as
                       percentage, 3 -- display as N of Nmax (for
                       this the maximum keyword must be given)
	map	bool	Whether the widget is initially mapped or not
			(since the widget you see is a BASE, it can be
			mapped and unmapped directly).
	maximum	int	The maximum value for the progress (implies
			TEXT=3)


 OUTPUTS:
	wid	long	The widget ID of the resulting widget.


 CALLS: ***
	CW_PROGRESS_GET_V, CW_PROGRESS_SET_V, CW_PROGRESS__INIT, CW_PROGRESS__KILL_B
 CALLED BY:
	FF_SUMMARY
 SIDE EFFECTS:
	A pixmap 2*xsize x ysize is created.

 RESTRICTIONS:
	The size may not be greater than 32k. widget_control's
	get_value key is supported but not very useful.
	If it is created before any graphics windows, then unless you
	explicitly create a window, your graphics will go to the
	progress bar.

 EXAMPLE:
	The widget is used by using widget_control to set its value to
	the completed fraction. e.g.
		progid = cw_progress(base, title='Progress')
		.
		.
		.
		for j =0, n-1 do begin
		    .
		    .
		    widget_control, progid,set_value=float(j)/float(n-1)
		endfor


 MODIFICATION HISTORY:
	Original: 9/1/03; SJT
	Redesigned internals: 10/1/03; SJT
	Fixed so it doesn't crash with NaN inputs: 13/5/03; SJT
	Allow it to run as a standalone: 18/7/03; SJT
	Add "3-D look" and make /box the default: 4/11/03; SJT
	Add TEXT=3 (N of M) mode: 5/11/03; SJT
	Fixes to prevent it changing input keys: 20/11/03; SJT