Carrington $SSW_SMEI_UCSD/sat/idl/toolbox/sun/carrington.pro
[Previous] [Next]
 NAME:
	Carrington
 PURPOSE:
	Get times when Earth was at Carrington variable XC, and v.v
 CALLING SEQUENCE:
	FUNCTION Carrington, xc_or_t	    , $
	    fraction	    = fraction	    , $
	    longitude	    = longitude     , $
	    rotation	    = rotation	    , $
	    get_fraction    = get_fraction  , $
	    get_longitude   = get_longitude , $
	    get_rotation    = get_rotation  , $
	    get_time	    = get_time	    , $
	    get_variable    = get_variable  , $
	    near_longitude  = near_longitude, $
	    degrees	    = degrees
 INPUTS:
	xc_or_t 	array; type: any numerical type
			    if input is a Carrington variable, the
			    return value is the corresponding UT time
			array; type: standard time structure
			    if input is a UT time, the return value
			    is a Carrington variable.
 OPTIONAL INPUTS:
	/get_fraction	return fraction of rotation
	/get_longitude	return heliographic longitude
	/get_rotation	return integer rotation number
	/get_time	always return UT time (even if input already
			    is a UT time)
	/get_variable	always return Carrington variable (even if
			    input already is a Carrington variable)

	near_longitude=near_longitude
			heliographic longitude in [0,360]

			If specified this heliographic longitude is
			translated into a Carrington variable within half
			a rotation from input Carrington variable/time
			xc_or_t. Note that the rules for the return value
			are the same as without the near_longitude, i.e.
			if xc_or_t is a Carrington variable then the
			return value is a time structure, unless one of the
			get_* keywords is set.

 OUTPUTS:
	Result		If no /get_* keywords are set:
			    array; type: standard time structure
			    array; type: double
			/get_fraction : fraction of rotation
			/get_longitude: heliographic longitude
			/get_rotation : integer Carrington rotation nr.
			/get_time     : UT time
			/get_variable : Carrington variable
 OPTIONAL OUTPUTS:
	fraction=fraction
			array; type: double
			positive fraction of a rotation
	longitude=longitude
			array; type: double
			heliographic longitude
	rotation=rotation
			array; type: integer
			integer Carrington rotation number
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	AngleRange, CvSky, IsTime, IsType, SubArray, TimeArray, TimeOp, TimeOrigin, TimeSet
	TimeUnit, ToRadians, jpl_eph
 CALLED BY:
	CarringtonLng, CarringtonNr, EarthSky3DLoc, EarthTransit3DLoc, InSitu
	InterpolateHeliosphere, PlotSynopticMap, RemoteView_Init_View, TimeGet, TimeSet
	arg_time, nso_fe_plot, qvu_draw, qvu_pick, vu_atlocation, vu_coronagraph
	vu_earthskymap, vu_elotime, vu_extract, vu_filename, vu_get_page, vu_getdata
	vu_gettime, vu_image, vu_insitu, vu_insitu_raw, vu_insitucurve, vu_linecut
	vu_localskymap, vu_losmap, vu_mean, vu_movie, vu_nagoyasourcemap, vu_new_time
	vu_planarcut, vu_quick_movie, vu_radialcut, vu_remoteview, vu_select, vu_set
	vu_set_time_entry, vu_solardisk, vu_spherecut, vu_synopticmap, vu_timeseries
	vu_update_marker, vu_vox_write, vu_whatis
 PROCEDURE:
	An estimate for the Carrington start time is set up first.
	This is iteratively refined.

	If keyword near_longitude is defined then
	the difference in longitude between near_longitude and
	xc_or_t 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:
	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, and avoid calls to
	    CarringtonT0
	APR-2004, Paul Hick (UCSD/CASS)
	    Added code to prevent iteration loop to get stuck in
	    infinite loop
	JUN=2006, Paul Hick (UCSD/CASS)
	    Bug fix (du was subscripted with n instead of nn)
	JUL-2007, Paul Hick (UCSD/CASS)
	    Merged carringtonvar, carringtont, carringtonlng,
	    carringtonnr and arg_time into this procedure.
	    Merged CarringtonNear by adding keyword near_longitude.
	AUG-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Removed calls to scearth.


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:
	FUNCTION 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
 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)


ColorEloTimeBox $SSW_SMEI_UCSD/sat/idl/toolbox/graphics/colorelotimebox.pro
[Previous] [Next]
 NAME:
	ColorEloTimeBox
 PURPOSE:
	Draws a color display for a set of 'skyboxes' as defined by a grid
	of time and elongation coordinates.
 CALLING SEQUENCE:
	PRO ColorEloTimeBox, time_grid, elo_grid, Color,    $
	    dabg	= dabg	    , $
	    degrees	= degrees   , $
	    black	= black     , $
	    void	= void
 INPUTS:
	time_grid   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
	elo_grid    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
 OPTIONAL INPUTS:
	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).
 OUTPUTS:
 INCLUDE:
	@compile_opt.pro		    ; On error, return to caller
 CALLS: ***
	InitVar, SuperArray, ToDegrees, ToRadians, WhatIs
 CALLED BY:
	PlotEloTimeMap
 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.
 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
 >	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:
	JAN-2009, Paul Hick (UCSD/CASS)


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 , $
	    use_mask	= use_mask  , $
	    mask	= mask	    , $
	    _extra	= _extra
 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
	mask	    array[n,m]; type: float
			array with same dimensions as Color.
			Usually this is a "mask" identifying "good" and "bad" areas
			in the Color map.
	use_mask    scalar or array; type: float
			specifies contour levels in the "mask" array
			These contour leves are overplotted on the color map
			using the IDL contour function.
	_extra=_extra	can be used to pass keywords to IDL contour function
			processing the mask and use_mask keywords
 OPTIONAL INPUTS:
	zero_phase=zero_phase
		    scalar, or array with same structure as 'Phase'; type: float
			The input arrays Phase, Latitude, 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:
	PlotCoronagraph, 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)
	    Added /fill2edge keyword.
	MAR-2011, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Dropped restriction on zero_phase being applied only if
	    Phase is 1-dim array.


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


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: ***
	IsType, SubArray, SyncDims, ToRadians, boost
 CALLED BY:
	EarthSky3DLoc, EarthTransit3DLoc, ThomsonLOSDensity, nagoya_plotg2d
 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.


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
	RemoteView_FovTilt, 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