AngleRange $SSW_SMEI_UCSD/gen/idl/toolbox/anglerange.pro
[Next]
 NAME:
	AngleRange
 PURPOSE:
	Map angles into the range [0,360) or (-180,+180]
 CATEGORY:
	sat/idl/toolbox/math
 CALLING SEQUENCE:
	R = AngleRange(A, [/pi, /degrees])
 INPUTS:
	Angles		scalar or array; type: any
			    angles
 OPTIONAL INPUT PARAMETERS:
	/pi		by default the angles are mapped to [0,360)
			if /pi is set then the angles are mapped to (-180,+180]
	/degrees	if set then in- and output angles are in degrees (default: radians)
 OUTPUTS:
	R		same size and type as input array
			    angles mapped to specified range
 INCLUDE:
	@compile_opt.pro		    ; On error, return to caller
 CALLS: ***
	InitVar, IsType, ToRadians
 CALLED BY:
	AngleUnits, Carrington, CarringtonT, CarringtonT0, CarringtonVar, ColorSkybox
	CvRotation, CvSky_Heliographic, EarthSky3DLoc, FishEye, GeographicInfo
	HammerAitoff, MercatorProj, PlotCoronagraph, PlotEarthSkymap, PlotEloTimeMap
	PlotPolarSkymap, RemoteView_CurrentSheet, RemoteView_FOV_Cube
	RemoteView_Init_Matrix, RemoteView_Init_View, big_eph, cv, cvsmei
	flat_centerofmass, jpl_eph, jpl_test, mpc_eph, mpc_orbit_eph, qvu_draw
	ra_fictitious_sun, sgp4_orbit_axis, smei_ccd2sky, smei_findpnt, smei_frm_cvhdr
	smei_frm_summary, smei_frm_where, smei_hdr_plot, smei_orient_test
	smei_sgp4_orbits, smei_sky, smei_sky_getmask, smei_star_fit, smei_star_stdmaps
	smei_zld_dumbbell, smei_zld_model, smei_zld_weekly, smei_zldsky, sphere_smooth
	usno_eph, vu_extract, vu_linecut, vu_planarcut, vu_remoteview, vu_solardisk
	vu_spherecut, vu_stereoview, vu_vox_write, wso_write
 PROCEDURE:
	The output interval is open on the right side for mapping to [0,360)
	(i.e. 360 is not included).
	The output interval is open on the left side for mapping to (-180,+180]
	(i.e. -180 is not included)
 MODIFICATION HISTORY:
	MAR-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


AngleUnits $SSW_SMEI_UCSD/gen/idl/toolbox/angleunits.pro
[Previous] [Next]
 NAME:
	AngleUnits
 PURPOSE:
	Convert units of angle between radians, degrees, hours, sexagesimal units
	(degrees,arcmin, arcsec, milli-arcsec), and time units (hours,
	min, sec, milli-sec).
 CATEGORY:
	smei/gen/idl/toolbox
 CALLING SEQUENCE:
	FUNCTION AngleUnits,	$
	    from_angle	    = from_angle    ,	$
	    from_radians    = from_radians  ,	$
	    from_degrees    = from_degrees  ,	$
	    from_hours	    = from_hours    ,	$
	    from_time	    = from_time     ,	$
	    from_sexagesimal= from_sexagesimal, $
	    from_almanac    = from_almanac  ,	$
	    to_angle	    = to_angle	    ,	$
	    to_radians	    = to_radians    ,	$
	    to_degrees	    = to_degrees    ,	$
	    to_hours	    = to_hours	    ,	$
	    to_time	    = to_time	    ,	$
	    to_sexagesimal  = to_sexagesimal ,	$
	    to_almanac	    = to_almanac    ,	$
	    degrees	    = degrees	    ,	$
	    singlesign	    = singlesign    ,	$
	    strings	    = strings	    ,	$
	    html	    = html	    ,	$
	    xyout	    = xyout	    ,	$
	    plain	    = plain	    ,	$
	    upto	    = upto	    ,	$
	    scalar	    = scalar
 OPTIONAL INPUT PARAMETERS:
	from_angle=from_angle
	    scalar or array; type: numeric
		units of angles are determined by setting of /degrees
	from_radians=from_radians
	    scalar or array; type: numeric
		angles in radians
	from_degrees=from_degrees
	    scalar or array; type: numeric
		angles in degrees
	from_hours=from_hours
	    scalar or array; type: numeric
		angles in hours
	from_sexagesimal=from_sexagesimal
	    scalar or array; type: string
		string specifying an angle in sexagesimal form
		e.g. "-03d05'06.123"" or "+03 05 06.123"
	    scalar or array[i,*], i=1,2,3,4; type: numeric
		a scalar is interpreted as an angle in degrees
		an array needs to have a first dimension with 1,2,3 or 4 elements,
		which are interpreted as angles in degrees, arcminutes, arcseconds
		and milli-arcseconds
	from_time=from_time
	    scalar or array; type: string
		string specifying an angle in time measure
		e.g. "03h05m06.123s" or "03 05 06.123"
	    scalar or array[i,*], i=1,2,3,4; type: numeric
		a scalar is interpreted as an angle in hours
		an array needs to have a first dimension with 1,2,3 or 4 elements
		which are interpreted as angles in hours, minutes, seconds
		and  milliseconds
	from_almanac=from_almanac
	    array[2,*]; type: string
		array[0,*] is angle in time measure (as for from_time)
		array[1,*] is angle in sexagesimal units (as for from_sexagesimal)
	    array[i,2,*],i=1,2,3,4; type: numeric
		array[*,0,*] is angle in time measure (as in from_time)
		array[*,1,*] is angle in sexagesimal units (as in
		    from_sexagesimal) in single sign convention (see /singlesign)
	/to_angle
	/to_radians
	/to_degrees
	/to_hours
	/to_sexagesimal
	/to_time
	/to_almanac	convert input angles to specified units (see from* keywords)
			(for /to_angle the units are determined from the setting
			of /degrees)

	/singlesign	when angles are input as sexagesimal (usually latitudes)
			or time units (usually right ascensions) then negative
			angles are usually specified with all components negative,
			i.e.
			     AngleUnits(from_sexa=[-10,-30], /to_deg) = -10.5
			Setting /singlesign is used to convert positions from an
			almanac, e.g.
			    AngleUnits(from_sexa=[-10,30],/to_deg,/singlesign) = -10.5
			i.e. the sign of the first non-zero entry is applied to
			all subsequent components.

			!!  Note that almanacs may specify a small negative
			!!  latitude as '-0 30 30'. When this string is naively
			!!  read with an I format specifier, then the minus sign
			!!  gets lost and a small positive latitude would be
			!!  obtained. To obtain correct results using this function
			!!  the minus sign must be transferred to the first
			!!  non-zero component, i.e. '-0 30 30' should be entered
			!!  as [0,-30,30]

	If one of the keywords /to_time and /to_sexagesimal is used then
	the output is returned in string form if /strings is set. The exact
	string format is controlled with keywords /html and upto=upto:

	/strings	(used only if /to_time or /to_sexagesimal is set)
			returns time as string as in e.g.
			    12d35m54.000s (with /to_time)
			    12h35m54.000s (with /to_sexagesimal)
	/html		(used only if /strings is set)
			returns time as string as in e.g
			    12°35'54.000"	(with /to_time)
			    12<sup>h</sup>35<sup>m</sup>54.000<sup>s</sup>
						(with /to_sexagesimal)
	upto=upto	(used if /strings is set)
			    truncates strings at specified unit
			    (use TimeUnit to specify the unit)
 OUTPUTS:
	A		array[*] or array[4,*] or array[4,2,*]; type: same as
			    input angles converted to requested units
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
 CALLS: ***
	AngleRange, InitVar, IsType, SubArray, SuperArray, SyncDims, TimeUnit, ToDegrees
	flt_string
 CALLED BY:
	getootyasources, jpl_test, mpc_eph, qEphem_State, qImage_cw_DrawEphem
	qImage_cw_Where, smei_findpnt, smei_frm_where, smei_sky_track, smei_star_fit
	smei_star_info, smei_star_make, smei_zld_model, vu_timeseries
 PROCEDURE:
 MODIFICATION HISTORY:
	DEC-2002, Paul Hick (UCSD/CASS)
	MAR-2003, Paul Hick (UCSD/CASS)
	    Fixed bug in processing of /singlesign keyword
	JUN-2003, Paul Hick (UCSD/CASS)
	    Added /fromalmanac and /toalmanac keywords
	OCT-2004, Paul Hick (UCSD/CASS)
	    Added /strings keyword. Fixed bug in /totime conversion.
	SEP-2006, Paul Hick (UCSD/CASS)
	    Added underscores to from* and to* keywords
	DEC-2006, Paul Hick (UCSD/CASS)
	    For conversions to_time, to_sexa, and to_almanac the input is tested
	    for NaNs. These are explicitly set to zero to avoid producing
	    garbage integers when the long function is applied.
	    Fixed bug in production of strings with /strings or /html keyword.
	JUN-2008, Paul Hick (UCSD/CASS)
	    Added "upto" keyword. Added documentation.
	MAR-2011, Paul Hick (UCSD/CASS)
	    Added "scalar" keyword
	FEB-2014, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Modified to accept string input for from_almanac, from_sexagesimal
	    and from_time


ArrayLocation $SSW_SMEI_UCSD/gen/idl/toolbox/arraylocation.pro
[Previous] [Next]
 NAME:
	ArrayLocation
 PURPOSE:
	Convert array indices from one-dimensional form (as returned by e.g.
	the IDL 'where' function) to a multi-dimensional index
 CATEGORY:
	Toolbox: generic
 CALLING SEQUENCE:
	Loc = ArrayLocation(Pos [, size=size, dim=dim, onedim=OneDim])
 INPUTS:
	Pos	    array[*], array[n,*], type integer
			if /OneDim not set: 1D array of one-dimensional array indices
			if /OneDim set: 2D array of multi-dimensional indices
			    each row array[*,i] specifies the values in each of the n
			    dimensions for a specific array element
	sizearr=SizeArr
		    array; type: long integer
			a size vector, i.e. the output of the IDL 'size' function
			using the target array as input.
	dimension=dimension
		    array; type: long integer
			the dimensions of the target array
			This can be specified instead of the full size vector
 OPTIONAL INPUT PARAMETERS:
	/onedim     if set then Pos is interpreted as a multi-dimensional index
			to be converted to a one-dimensional index.
		    if not set Pos is a one-dimensional index to be converted
			to a multi-dimensional index
	/zero2one   (only if /onedim NOT set)
			the output is scaled to the range [0,1] in each dimension
 OUTPUTS:
	Loc	    array, type long integer
			the converted array indices
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	InitVar
 CALLED BY:
	CarringtonT0, CleanGlitchBox, Find2DGlitch, FrameMoments, GroupPixels
	RGBO_Project, RemoteView_CMEDensity, TimeLInterpol, even_light, gridfill, max_pos
	nso_fe_start, qGlitch_Show, qImage_cw_Where, sgp4_eph, sgp4_tle, smei_findpnt
	smei_frm_base, smei_frm_hbar, smei_frm_track, smei_property, smei_setup_roi
	smei_sky_read, smei_star_remove, smei_zld_remove [1], smei_zld_remove [2]
	sphere_smooth, vu_vox_drawhcs
 EXAMPLE:
	A = indgen(5,5,5)
	L = ArrayLocation([5,6,7],size=size(A))

	results in L = [ [0,1,0],[1,1,0],[2,1,0] ].

	L = ArrayLocation([ [0,1,0],[1,1,0],[2,1,0] ], size=size(A), /onedim)

	results in L = [5,6,7]
 PROCEDURE:
	For a given array of dimension (N1,N2,..,Nn) each element can be addressed
	by specifying a 'multi-dimensional' index [i1,i2,..,in] or by specifying
	a one-dimensional index (as returned by several IDL functions such as where,
	min, max, etc.).
	The information about the target array is specified by providing the output
	of size(Array) as keyword SizeArr (SizeArr[1:n] = [N1,N2,..,Nn])
 MODIFICATION HISTORY:
	NOV-1998, Paul Hick (UCSD/CASS; pphick@ucsd.edu)