date100 $SSW/smei/bham/idl/utils/date100.pro
[Previous] [Next]
 DATE100
	Return a "mod 100" year in the range 50 to 150

 Usage:
	y100 = date100(year[, /print])

 Return:
	y100	<input>	The fixed year value

 Argument:
	year	any	input	The year to be normalized

 Keywords:
	print	???	input	If set, then return a true mod 100
				value suitable for printing.
	Full	???	input	If set, then convert to a full year
				with century

 CALLED BY:
	delta_hours
 History:
	Original: 1/12/95; SJT


defsysv_smei $SSW/smei/ucsd/gen/idl/environment/defsysv_smei.pro
[Previous] [Next]
 NAME:
	defsysv_smei
 PURPOSE:
	Defines a number of useful constants as system variables
 CATEGORY:
	Environment
 CALLING SEQUENCE:
	defsysv_smei
 INPUTS:
	(none)
 OUTPUTS:
	Defines system variables
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	DEFSYSV_
 PROCEDURE:
 >	For all system variables the IDL defsysv procedure is called only if the variable
		doesn't exist yet. A 2nd call to this procedure does nothing useful.

 >	!TheForegroundColor and !TheBackgroundColor
		The idea is to set !TheForegroundColor to black and !TheBackgroundColor to white.
		IDL sets the foreground to white (color index !d.n_colors-1) and the background to
		black (index 0) everytime the plot device is switched with 'set_plot'. This can be
		reversed by calling 'reset_colors' (which uses the two new color-related system
		variables).

 >	!TheTerminal, !ThePrinter
		Typically the terminal device (e.g. X or WIN) and the printer device (e.g. HP, EPS)
		remain the same during an IDL session. To assist in switching back to either device
		after a 'set_plot' call the device names are stored in two system variables.
		!TheTerminal can be set here since IDL sets the proper !d.name on startup.
		!ThePrinter is set here to the generic windows 'PRINTER' device, just to make sure it
		exists. For other platforms dependent it should be updated in the IDL_postop_* procedures.

 >	!ThePlotFile
 		!ThePlotFile is used by 'set_page' and 'spitplot' do keep track of the current plotfile.

	The constants are stored in several structures: !sun, !earth, !physics
 MODIFICATION HISTORY:
	SEP-1999, Paul Hick (UCSD/CASS)
	OCT-2002, Paul Hick (UCSD/CASS)
		Added JulianYr to !earth
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Added !TheTime


DEL_SQ $SSW/smei/bham/idl/utils/del_sq.pro
[Previous] [Next]
 NAME:
	DEL_SQ


 PURPOSE:
	Return an approximation to Del^2 of the supplied array.


 CATEGORY:
	Utilities (Maths)


 CALLING SEQUENCE:
	d2 = del_sq(x)


 INPUTS:
	x	(float)	The array of 1, 2 or 3 dimensions to be
			differentiated. 


 KEYWORD PARAMETERS:
	stride	(float)	The spacing of the points in the array (must
			be the same in all dimensions (if not given
			unit spacing is assumed).


 OUTPUTS:
	d2	Float	The values of del^2 of the data. A border of
			zeroes will be left around the array.


 MODIFICATION HISTORY:
	Original: 2/6/05; SJT


delta_hours $SSW/smei/bham/idl/utils/delta_hours.pro
[Previous] [Next]
 DELTA_HOURS
	returns the difference in hours between two times.

 Usage;
	dt = delta_hours(t1, t0)

 Return Value:
	dt	float	The difference in hours between the two times.

 Arguments:
	t1	int/float	input	The "later" time in array [y,d,h,m,s]
	t0	int/float	input	The "earlier" time

 Method:
	Returns t1 - t0 with due allowance for leap years.

 CALLS: ***
	date100
 CALLED BY:
	doy2jd
 History:
	Original: 7/6/93; SJT
	Fix negative difference crossing year boundary: 28/10/93; SJT
	Fix for century boundary: 1/12/95; SJT
	Make double to allow sub-second accuracy over whole mission:
	16/11/99; SJT


destroyvar $SSW/smei/ucsd/gen/idl/toolbox/destroyvar.pro
[Previous] [Next]
 NAME:
	destroyvar
 PURPOSE:
	Destroy an IDL variable
 CATEGORY:
	Toolbox: generic
 CALLING SEQUENCE:
	destroyvar, a [, b, c, d, e, f, g, h]
 INPUTS:
	a,b,c,d,e,f,g,h		any IDL variable
 OUTPUTS:
	(none; that's the point)
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLED BY:
	AlignHeliosphere, KeplerOrbit, RemoteView, RemoteView_Display2D
	RemoteView_Display3D, RemoteView_FOV, Set_Page, ThomsonSetupLOS, big_eph
	big_eph_clean, even_light, even_light_info, even_light_photometry, flt_read
	grd_read, hide_env, htmd_cat, jpl_close, nso_fe_start, qGlitch_Run
	qImage_cw_DrawEphem, qImage_cw_Ephem, qImage_cw_EphemKill [1]
	qImage_cw_EphemKill [2], qImage_cw_SMEI, qLine_Curve, qView_ApplyGain
	qView_Gain, qView_PlotTrack, qvu_pick, smei_buf_getframe, smei_buf_prep
	smei_buf_read, smei_findcrazy, smei_frm_base, smei_frm_drive, smei_frm_findpoint
	smei_frm_get, smei_frm_hbar, smei_frm_hbar_inside, smei_frm_path
	smei_frm_summary, smei_frm_track, smei_frm_where, smei_getfile, smei_hdr_get
	smei_orbits_stat, smei_setup_roi, smei_sky, smei_sky_get, smei_sky_read
	smei_star_fit, smei_star_readpnt, smei_star_standard, smeidb_mounted, txt_read
	vu_NagoyaSourcemap, vu_RemoteView, vu_getdata, vu_header, vu_insitu, vu_movie
	vu_planarcut, vu_read, vu_solardisk, vu_synopticmap, vu_type_insitu, vu_vox_write
	wso_write, www_help_crosslinks, www_help_is_code
 RESTRICTIONS:
	Up to 7 variables can be destroyed in one call
 PROCEDURE:
	Use 'temporary' to move the variable to be deleted to local variable,
	which in turn is destroyed when the subroutine exits.
 MODIFICATION HISTORY:
	MAR-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Distance2Line $SSW/smei/ucsd/sat/idl/toolbox/tricks/distance2line.pro
[Previous] [Next]
 NAME:
	Distance2Line
 PURPOSE:
	Calculates the distance of a point to a line for points and lines in the x-y plane
 CATEGORY:
	Tricks
 CALLING SEQUENCE:
	d = Distance2Line(line, point, [,/close])
 INPUTS:
	line			array[2,n]; type: any
						array of points (x,y coordinates) defining line(s)
						There should be at least 2 points (n>=2)
	pointx			if only pointx is specified:
						array[2,m1,m2,...]; type: any
						points to be tested
					if both pointx and pointy are specified:
	pointx				array[m1]
						x-coordinates of points to be tested
	pointy				array[m2]
						y-coordinates of points to be tested
						if /grid is not set then m1 MUST be equal to m2
						if /grid is set then each x-coordinate is combined with
						each y-coordinate to cover an m1 x m2 grid of points
 OPTIONAL INPUT PARAMETERS:
	/close_area		adds first point of 'line' array to the end of the array
						(this effectively 'closes' the curve described by the 'line' array).
	/grid			(only used if both pointx and pointy are used)
 OUTPUTS:
	d				array[n',m1,m2,...]
						n'=n-1 if /close_area not set
						n'=n   if /close_area set
 OPTIONAL OUTPUT PARAMETERS:
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	SubArray, SuperArray, SyncDims
 RESTRICTIONS:
	If the 'line' array represents a boundary of an area in the x-y plane with a simple
	enough shape then this procedure can be used to find points inside the closed area.
	If 'line' runs in the clockwise/counter-clockwise direction around the area then all
	distances will be positive/negative for points inside the closed area.
	'Simple enough shape' means that the curvature should be in the same sense everywhere.
 PROCEDURE:
 >	Each pair of points line[*,i] and line[*,i+1] (i=0,n-1) defines a line in the
	x-y plane. If /close_area is set then an additional pair line[*,n], line[*,0]
	is defined.
 >	For each point in the 'point' array the distance to each of the lines is
	calculated. The distance is positive it the point is toward the right of the line when
	looking from line[*,i] to line[*,i+1], and negative on the other side.
 >	If vectors r1 and r2 correspond to points line[*,i] and line[*,i+1], respectively, and
	vector p corresponds to a point then the distance calculated as
	(r2-p)x(r1-p).z/|r2-r1| (z is a unit vector in the z-direction)
 MODIFICATION HISTORY:
	JAN-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Distance2Sun $SSW/smei/ucsd/sat/idl/toolbox/thomson/distance2sun.pro
[Previous] [Next]
 NAME:
	Distance2Sun
 PURPOSE:
	Calulates Electron-Sun distance and angle Sun-Electron-Observer
 CALLING SEQUENCE:
	RSun = Distance2Sun(Elo, S, SinChi, /degrees, /grid)
 INPUTS:
	Elo			array; type: float
					elongations of lines of sight
	S			array; type: float
					Distance along line of sight (i.e. Observer-Electron
					distance) in units of the Observer-Sun distance.
					If /grid NOT set then S should have the same structure
					as 'Elo'. If /grid is set then any array is allowed.
 OPTIONAL INPUT PARAMETERS:
	/degree		if set all angles are in degrees (default: radians)
	/grid		if set then every element in S is combined with
					every element in Elo
 OUTPUTS:
	RSun		array; type: float
					Sun-Electron distance (same units as S)
	SinChi		array; type: float
					Sine of angle Sun-Electron-Observer
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	InitVar, SuperArray, ToRadians
 CALLED BY:
	ThomsonLOSStep, ThomsonTang, ThomsonTangMRad
 PROCEDURE:
>	The elongation is the angle between observer-Sun and observer-electron
	direction (Elo = 0 is the direction observer-Sun)
>	Cosine and sine rule in triangle with Sun, Observer and Electron on the corners.
 MODIFICATION HISTORY:
	SEP-1996, Paul Hick (UCSD)
	JUN-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Replacement for old ElSunDistance function
		Added /grid keyword


do_file $SSW/smei/ucsd/gen/idl/toolbox/files/do_file.pro
[Previous] [Next]
 NAME:
	do_file
 PURPOSE:
	File manipulations: moving, copying and deleting files
 CALLING SEQUENCE:
	status = do_file ( file, [dest, /copy, /delete, /move ])
 INPUTS:
	file			scalar: type: string
						file spec (may contain wildcards)
	dest			scalar: type: string
						destination for copy or move
 OPTIONAL INPUT PARAMETERS:
	/copy			copies file
	/delete			deletes file
	/move			moves (renames) file
	silent=silent	controls messages to screen
 OUTPUTS:
	status			1 = success ; 0 = failure
						on Windows and Unix no status code is available
						and the value 1 is returned.
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	FILEPATH, GetFileSpec, InitVar, IsType, SetFileSpec, hide_env
 CALLED BY:
	Get_Page, Set_Page, bin_read, flt_read, grd_read, img_read, mk_flick, run_ssw_smei
	smei_buf, smei_findcrazy, smei_frm_cp, smei_frm_findpoint, smei_frm_read
	smei_fts_read, smei_hdr_make, smei_hdr_plot, smei_mkglare, smei_orbits_stat
	txt_read, vox_read, vu_get_page, vu_image, vu_movie, vu_quick_movie, vu_write
	www_help_rsi
 RESTRICTIONS:
	One and only one keyword can be set
 PROCEDURE:
 >	FIND_FILE is used to locate a file matching the input `file' value.
	(if file='' or absent no action is taken).
 >	`dest' is checked by DO_PARSE to make sure it is a valid file name

	On VMS all file operations use call_external to execute system functions or
	other F77 functions:
		/move calls the system function LIB$RENAME_FILE first (if not succesful
			the F77 function COPY_FILE is called followed by a LIB$DELETE_FILE
			call (this should work across drives)
		/copy   calls the F77 function COPY_FILE
		/delete calls the system function LIB$DELETE_FILE

 >	On Windows and Unix the proper shell command is spawned, with 'file' and
	'destin' as arguments.
 RESTRICTIONS:
	If large groups of files are processes the concatenated list of file names
	can create a cp,rm or mv command that is too long. The threshold for the length
	of a shell command apparently is 128kB (the actual limit is somewhat lower in
	practice, and apparently is not the same for all Linux boxes on the subnet,
	even those running the same Linux distribution).
	Currently files are processed in groups that keep the length below 124 kB. So far
	this appears to be a safe value. Use the keyword buffer to override the default.
 MODIFICATION HISTORY:
	JAN-1995, Paul Hick (UCSD/CASS)
	APR-2000, Paul Hick (UCSD/CASS)
		IDL 5.4 has some added feature: /hide keyword for Windows; exit status
		for Windows and unix. The unix modifications haven't been tested since
		we don't have 5.4 on any of the Linux boxes yet.
	JAN-2002, Paul Hick (UCSD/CASS)
		Fixed a pretty lethal bug in the file delete procedure on Windows.
		(it might try to delete all files in the current directory!!). 
	SEP-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Added code to copy multiple files at once.


doy2jd $SSW/smei/bham/idl/utils/doy2jd.pro
[Previous] [Next]
 DOY2JD
	Return the Julian day of a yy,dd,hh,mm,ss type time.

 Usage:
	jd = doy2jd(time)

 Argument:
	time	any	input	Array with year, day, hour, minute,
				second. (Less significant parts may be
				omitted). 

 CALLS: ***
	delta_hours
 CALLED BY:
	EPOCH2JD, FF_SUMMARY, JD2EPOCH, SMEI_SEQUENCE
 History:
	Original: 16/11/99; SJT
	Rename hours as delta_hours: 27/11/03; SJT