GeographicInfo $SSW_SMEI_UCSD/sat/idl/util/geographicinfo.pro
[Previous] [Next]
 NAME:
	GeographicInfo
 PURPOSE:
	Return geographic longitude of specified location
 CATEGORY:
	Trivial
 CALLING SEQUENCE:
	PRO GeographicInfo, UT, previous=previous, next=next, degrees=degrees,	$
	    nagoya	= nagoya    , $
	    cambridge	= cambridge , $
	    mexart	= mexart    , $
	    ooty	= ooty	    , $
	    tmo 	= tmo	    , $
	    location	= location  , $

	    geolng	= geolng    , $
	    geolat	= geolat    , $

	    UTnoon	= UTnoon    , $
	    RAnoon	= RAnoon    , $
	    RAlocal	= RAlocal
 INPUTS:
	UT		array; type: time structure
			    UT times
	/nagoya 	if set, return location of Nagoya (Japan)
	/cambridge	if set, return location of Cambridge (UK)
	/ooty		if set, return location of Ooty (India)
	/tmo		if set, return location of Table Mntn Obs (US)
	location	geographic longitude of requested location
			(in radian, or if /degrees is set, in degrees)
 OPTIONAL INPUT PARAMETERS:
	/degrees	if set, all input and output angles are in degrees
			(default: radians)
	/previous	check for previous noon
	/next		check for next noon
			if neither /previous or /next is set then the nearest
			noon is checked
 OPTIONAL OUTPUT PARAMETERS:
	geolng		scalar; type: float
			    geographic longitude
	geolat		scalar; type: float
			    geographic latitude
	UTnoon		array; type: time structure
			    UT for nearest/previous/next time when Sun crossed local meridian
			    (i.e. local noon)
	RAnoon		array; type; float
			    right ascension of local meridian at times UTnoon
	RAlocal 	array; type; float
			    right ascension of local meridian at times UT
 INCLUDE:
	@compile_opt.pro		; On error, return to caller
 CALLS: ***
	AngleRange, BadValue, InitVar, IsTime, IsType, SubArray, SyncArgs, TimeGST, TimeGet
	TimeOp, TimeSet, TimeUnit, ToRadians, big_eph, jpl_body
 CALLED BY:
	PlotEarthSkymap, PlotPolarSkymap, vu_localskymap, vu_nagoyasourcemap
 PROCEDURE:
	Geographic coordinates are hardwired
 MODIFICATION HISTORY:
	SEP-1999, Paul Hick (UCSD/CASS)
	FEB-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added tmo and geolat keywords


get_page $SSW_SMEI_UCSD/sat/idl/util/get_page.pro
[Previous] [Next]
 NAME:
	get_page
 PURPOSE:
	Complete output procedure set up with set_page.
	Submit PostScript or HP file to print queue
 CATEGORY:
	Plotting
 CALLING SEQUENCE:
	get_page [,File, /color]	    Close device & print & delete
	get_page [,File, /killfile]	    Close device & delete
	get_page [,File, /keepfile ,/color] Close device & keep
	get_page [,File, /keepfile, /printfile ,/color]
					    Close device & print & keep
 OPTIONAL INPUTS:
	File		scalar; type: string; default: !ThePlotFile
			    file name to be used for plot filefile name. In general the common block
			    default should be use. Primarily useful for /gif and /bmp ouput.
	/keepfile
	keepfile=KeepFile
			scalar; type: string or byte
			(HP only) the plot file will be saved
			If KeepFile is a valid file name it is used for the saved plot file.
			(this option is only set up for the HP printer on CASS01 and depends
			on the LIBPRN command procedure).
	/printfile	(HP and PS)
			if set the plot file is submitted for printing
			This is the default for HP and PS
	/killfile	(HP, PS and EPS)
			closes the plot device, and deletes the plot file
	/freezedev	by default the plot device is set back to !TheTerminal.
			If /freezedev is set the device will remain at the setting found when
			get_page was called (usually the printer device !ThePrinter)
	/color		plot in color (only for PS files)

	/gif
	/png
	/jpg
	/bmp		can be used in combination with the File argument to save the
			content of the current window into a GIF or BMP file.
			If File has the extension .gif or .bmp then the keyword does not need
			to be specified.
	/silent 	suppresses a bunch of informational messages
 INCLUDE:
	@compile_opt.pro		; On error return to caller
 CALLS: ***
	FILEPATH, GetFileSpec, InitVar, IsDisplay, IsPrinter, IsType, LOADCT, SetFileSpec
	SuperArray, WRITE_BMP, WRITE_GIF, do_file, flip_colors, hide_env, put_logo, twin
 CALLED BY:
	even_light_corrections, even_light_photometry, even_light_registration
	qBar_Print, qLine_Print, qSave2File_Save, qset_page, smei_frm_summary
	smei_hdr_plot, smei_sky, smei_star_show, smei_zldsky, vu_get_page, vu_image
 SEE ALSO:
	set_page
 PROCEDURE:
	set_page and get_page are supposed to be used together: set_page starts the
	output procedure, get_page completes it. get_page uses the file name save in
	common block 'devices' to determine what kind of output to produce (EPS, GIF, BMP,
	HP, PS, etc.).

	For the PRINTER device no plot file is created but instead output is send directly
	to the printer. Hence none of the keywords are useful. get_page will always close
	the PRINTER device (effectively forcing the printer to start printing).

	For EPS a file name is selected using 'set_page'. The file name is saved in common
	block 'devices'. Here the EPS file is just closed.

	For GIF and BMP a tvrd() is executed, and the return value is written into a file
	with the name in !ThePlotFile. Alternatively the File argument is used to specify a
	file name. If the name does not have extension .gif or .bmp then the keyword /gif
	or /bmp must be set explicitly.
 MODIFICATION HISTORY:
	Based on PSPLOT, written DMZ (ARC, Aug'90)
	July 1991, Paul Hick (ARC)
	1992, Paul Hick (UCSD/CASS); added option for plotting to HP printer
	2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added logo keyword


GetColors $SSW_SMEI_UCSD/sat/idl/toolbox/graphics/getcolors.pro
[Previous] [Next]
 NAME:
	GetColors
 PURPOSE:
	Convert array of function values to equivalent color indexes.
	Optionally plot a legend.
 CALLING SEQUENCE:
	FUNCTION GetColors, Value, BreakVal, BreakName, BreakPos,   $
	    open	= open	    , $
	    legend	= legend    , $
	    rimlegend	= rimlegend , $
	    format	= format    , $
	    ctable	= ctable    , $
	    cpart	= cpart     , $
	    usedcolors	= usedcolors, $
	    badforeground=badforeground, $
	    badbackground=badbackground, $
	    charsize	= charsize  , $
	    flip	= flip	    , $
	    noedge	= noedge    , $
	    ncolors	= ncolors   , $
	    strictlabels= strictlabels, $
	    steplabels	= steplabels, $
	    labelrange	= labelrange, $
	    logscale	= logscale  , $
	    _extra	= _extra
 INPUTS:
	Value		    array; type: any
				function values
	BreakVal	    array[n]; type: any
				function values between adjacent colors

	Only used if /legend is set:

	BreakName	    array[m]; type: any
				labels along legend; usually a subset
				of BreakVal. See PROCEDURE.
	BreakPos	    array[m];
				position for BreakName labels along legend
				See PROCEDURE:
 OPTIONAL INPUT PARAMETERS:
	/legend 	    if set, a legend is plotted at the left
				edge of the screen
	steplabels=steplabels
			    scalar; type: integer; default: 1+ncolors/8
				SEE PROCEDURE
	rimlegend=rimlegend scalar; type: any; default: 0
				sets the thickness of the bounding box around
				the legend

	/strictlabels
	format=format	    scalar; type: string
				format used to label the legend (only used if
				BreakVal is a float array)
	ctable=ctable	    scalar; type: integer
				used to load a color table with LOADCT
				(only if !d.n_colors=16)
	cpart=cpart	    array[2]; type: float
				fractions of one; limits the range of color indices
				used to cpart*(!d.n_colors-1)
	/noedge 	    avoids using color indices 0 and !d.n_colors-1
				this overrides the cpart setting.
				(these sometimes are set to black and white and
				do not fit in with the rest of the color table).

	_extra=_extra
	/badforeground	    if set then bad values (detected with the
				finite function) are set to the foreground
				color (!p.color)
	/badbackground	    if set then bad values are set to the foreground
				color (!p.background)
	/flip		    uses color table in reverse order, i.e. with increasing
				fnc value corresponding to decreasing color index
	labelrange=labelrange
			    array[2]; type: float; default: [0.0,1.0]
				determines range in normal coordinates used to
				plot the labels along the legend.
 OUTPUTS:
	Result		    array; type: byte
				array with color indices (same dimensions as Value)
 INCLUDE:
	@compile_opt.pro			; On error, return to caller
 CALLS: ***
	InitVar, IsType, LOADCT, REVERSE, UNIQ, anicenum, gridgen
 CALLED BY:
	PlotCoronagraph, PlotEarthSkymap, PlotEloTimeMap, PlotPlanarCut, PlotPolarSkymap
	PlotSolarDisk, PlotSphereCut, PlotSynopticMap, RemoteView_Display2D
	nagoya_glevel, vu_synopticmap
 SIDE EFFECTS:
	The BreakVal array is sorted
 RESTRICTIONS:
	#break values = n_elements(BreakVal) must be less than
	#colors = !d.n_colors
 PROCEDURE:
	The BreakVal array with N = n_elements(BreakVal) elements
	divides the data range into N+1 interval (the 1st interval
	covers data values below BreakVal[0], the last interval
	covers data value above BreakVal[N-1]. A data value is
	matched to a color index depending on the interval it
	belongs to.

	The # colors needed is 1+N (N=n_elements(BreakVal).
	The 1+N color indices are calculated as
	    Col = round( (!d.n_colors-1.)/nBreak*indgen(nCols) )
	i.e. as nearly evenly spaced over the full range 0,!d.n_colors-1
	[Col[0]=0, Col[nBreak]=!d.n_colors-1]

	The legend is a vertical color bar (color 0 to nBreak
	from bottom to top) at the left side of the screen.
	The BreakVal values are plotted at the borders between
	adjacent colors. A maximum of 8 evenly spaced numbers
	is plotted.

	By default the labeling of the legend is determined
	internally from the BreakVal array. This works well if
	the BreakVal array contains a large number of values
	(usually !d.n_colors).
	For short arrays of BreakVal the labelling is better
	controlled using a couple of arguments

	BreakName explicitly specifies how the legend needs to
	be labelled. Usually these are numbers. The numbers then
	also define the position of the label. If BreakName
	contains custom labels (e.g. string labels instead of
	numbers), then the position of the label can be
	specified as BreakPos.

	If /strictlabels is set then BreakName = BreakPos = BreakVal
	is assumed, and labels are plotted every
	'steplabels' value of BreakVal
	If BreakName is set then /strictlabels is ignored;
	This is how GetColors worked originally;
	the drawback is that the values plotted along
	the legend are usually not nicely rounded values.
 MODIFICATION HISTORY:
	SEP-1992, Paul Hick (UCSD/CASS)
	APR-1993, Paul Hick (UCSD/CASS)
	    removed restrictions to !d.n_colors=8 and 16
	AUG-1999, Paul Hick (UCSD/CASS)
	    added a check for bad values using the 'finite' function.
	    Corresponding entries in the Color output array are now set
	    to -1 (these will be ignored by ColorSkybox).
	SEP-1999, Paul Hick (UCSD/CASS)
	    added badforeground and badbackground options
	    added /open keyword
	SEP-2003, Paul Hick (UCSD/CASS)
	    added cpart keyword
	OCT-2003, Paul Hick (UCSD/CASS)
	    added /flip and /noedge
	MAY-2006, Paul Hick (UCSD/CASS)
	    Added /rimlegend
	JUN-2008, Paul Hick (UCSD/CASS)
	    Added /strictlabel, BreakPos. Added code to improve
	    labeling of legend.
	JAN-2009, Paul Hick (UCSD/CASS)
	    Added keyword labelrange. Improved positioning of labels
	    along legend.
	DEC-2009, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added keyword /logscale.
	    Removed restriction on equally spaced BreakVal array.


getnagoyasources $SSW_SMEI_UCSD/sat/idl/toolbox/ips/getnagoyasources.pro
[Previous] [Next]
 NAME:
	getnagoyasources
 PURPOSE:
	Extract Nagoya IPS observations from yearly data files
 CATEGORY:
	I/O
 CALLING SEQUENCE:
	FUNCTION getnagoyasources, trange, $
	    subdir  = subdir	, $
	    degrees = degrees	, $
	    silent  = silent	, $
	    point_sources=point_sources
 INPUTS:
	trange		scalar or array[2]; type: time structure
			    time range (begin and end time)
			    a scalar is interpreted as [trange, trange+1 day]
			    (i.e. a one day time range starting at trange
 OPTIONAL INPUT PARAMETERS:
	subdir=subdir	scalar; type: string; default='daily'
			    subdirectory in $dat/nagoya where to look for data files
	/degrees	if set pp will be in degrees (default: radians)
 OUTPUTS:
	Result		scalar; type: long;
			    # ips sources in time range
 OPTIONAL OUTPUT PARAMETERS:
	point_sources=point_sources
		array[n]; type: structure
		    structure with IPS sources inside time range
	    point_sources.name = string with source name
	    point_sources.pp   = 2-element array with RA and decl of source
	    point_sources.tt   = time structure with time of observation
	    point_sources.vv   = IPS velocity
	    point_sources.gg   = IPS g-level
	    point_sources.xy   = used by PlotEarthSkymap to set pixel locations of sources
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	BadValue, CheckDir, CvPrecess, FILEPATH, InitVar, IsType, TimeFixYear, TimeGet, TimeOp
	TimeSet, TimeUnit, ToDegrees, destroyvar, say, txt_read, vu_point_source
 CALLED BY:
	qnagoya_pointsources, vu_localskymap, vu_nagoyasourcemap
 PROCEDURE:
 >	All relevant yearly IPS data files are read to find observations inside
	specified time range. These files are stored in $NAGOYA/'subdir'
	where subdir is supplied as keyword.
 >	Files containing a list of IPS sources with celestial coordinates
	(presumably in B1950) are stored in directory $NAGOYA/sources
	A slightly different list is used each year. Currently this list
	contains the source name, B1950 right ascension and declination,
	and an expected source intensity.
 >	RA and dec for the sources are precessed to the current epoch.
 MODIFICATION HISTORY:
	SEP-1999, Paul Hick (UCSD/CASS)
	JUL-2000, Paul Hick (UCSD/CASS)
	    record length for nagoya.* files changed from 66 to 76 to
	    account for extra column with scintillation index data.
	MAY-2003, Paul Hick (UCSD/CASS)
	    Added precession of source coordinates from B1950 to current epoch.
	DEC-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added check for IPS sources in yearly data files which are not
	    specified in the STELab IPS source list (and for which therefore
	    no sky locations are available).


getootyasources $SSW_SMEI_UCSD/sat/idl/toolbox/ips/getootysources.pro
[Previous] [Next]
 NAME:
	getootyasources
 PURPOSE:
	Extract Ooty IPS observations from yearly data files
 CATEGORY:
	I/O
 CALLING SEQUENCE:
	FUNCTION getootysources, trange, $
	    subdir  = subdir	, $
	    degrees = degrees	, $
	    silent  = silent	, $
	    point_sources = point_sources
 INPUTS:
	trange		scalar or array[2]; type: time structure
			    time range (begin and end time)
			    a scalar is interpreted as [trange, trange+1 day]
			    (i.e. a one day time range starting at trange
 OPTIONAL INPUT PARAMETERS:
	subdir=subdir	scalar; type: string; default='daily'
			    subdirectory in $DAT/ooty where to look for data files
	/degrees	if set pp will be in degrees (default: radians)
 OUTPUTS:
	Result		scalar; type: long;
			    # ips sources in time range
 OPTIONAL OUTPUT PARAMETERS:
	point_sources=point_sources
		array[n]; type: structure
		    structure with IPS sources inside time range
	    point_sources.name = string with source name
	    point_sources.pp   = 2-element array with RA and decl of source
	    point_sources.tt   = time structure with time of observation
	    point_sources.vv   = IPS velocity
	    point_sources.gg   = IPS g-level
	    point_sources.xy   = used by PlotEarthSkymap to set pixel locations of sources
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	AngleUnits, BadValue, CheckDir, CvPrecess, FILEPATH, GETOOTYSOURCES, InitVar, IsType
	TimeFixYear, TimeGet, TimeOp, TimeSet, TimeUnit, ToDegrees, destroyvar, flt_string, say
	txt_read, vu_point_source
 PROCEDURE:
 MODIFICATION HISTORY:
	AUG-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Derived from getnagoyasources


getsmeisources $SSW_SMEI_UCSD/sat/idl/toolbox/ips/getsmeisources.pro
[Previous] [Next]
 NAME:
	getsmeisources
 PURPOSE:
	Extract SMEI lines of sight from orbital data files
 CATEGORY:
	I/O
 CALLING SEQUENCE:
	FUNCTION getsmeisources, trange, $
	    subdir  = subdir	, $
	    degrees = degrees	, $
	    silent  = silent	, $
	    point_sources = point_sources
 INPUTS:
	trange		scalar or array[2]; type: time structure
			    time range (begin and end time)
			    a scalar is interpreted as [trange, trange+1 day]
			    (i.e. a one day time range starting at trange
 OPTIONAL INPUT PARAMETERS:
	subdir=subdir	scalar; type: string; default='daily'
			    subdirectory in $DAT/smei where to look for data files
	/degrees	if set pp will be in degrees (default: radians)
 OUTPUTS:
	Result		scalar; type: long;
			    # ips sources in time range
 OPTIONAL OUTPUT PARAMETERS:
	point_sources=point_sources
		array[n]; type: structure
		    structure with lines of sight inside time range
		    (see vu_point_source)
	    point_sources.name = string with source name
	    point_sources.pp   = 2-element array with RA and decl of source
	    point_sources.tt   = time structure with time of observation
	    point_sources.vv   = IPS velocity
	    point_sources.gg   = IPS g-level
	    point_sources
	    point_sources.xy   = used by PlotEarthSkymap to set pixel locations of sources
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	BadValue, CheckDir, CvPrecess, FILEPATH, InitVar, IsType, TimeGet, TimeOp, TimeSet
	TimeUnit, ToDegrees, destroyvar, flt_read, smei_orbit_get, vu_point_source
 PROCEDURE:
 MODIFICATION HISTORY:
	AUG-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Derived from getnagoyasources


gridfill $SSW_SMEI_UCSD/sat/idl/toolbox/math/gridfill.pro
[Previous] [Next]
 NAME:
	gridfill
 PURPOSE:
	Removes empty bins. An empty bin is given the average over all
	neighbours with valid function values.
 CATEGORY:
	Plotting: contours
 CALLING SEQUENCE:
	FUNCTION gridfill, ZIn, nfill=nfill, weightfnc=WeightFnc,status=s
 INPUTS:
	Z   2D array; any type
	    If of type float, then invalid grid values are marked by !values.f_nan
 OPTIONAL INPUTS:
	nfill=nFill scalar; type integer; default: 0
		<= 0: fill all empty bins with extrapolated values
		>  0: fill empty bins with more than nFill neighbours
	weightfnc=WeightFnc
		scalar; type string; default: not present
		name of function to calculate weights (see PROCEDURE)
 OUTPUTS:
	Z   2D array; type float
		same as input array with invalid grid values replaced by averages
		(if nfill>0 not all invalid values may have been filled in)
 OPTIONAL OUTPUTS:
	status=S
	    2D array; type byte
		array identifying the extrapolated values:
		    = 1  contents of bin is same as valid input value
		    = 2  contents of bin is extrapolated value
		    nFill>0 only:
		    = 0  empty bin with less than nFill neighbours
			  Z[.,.] = !values.f_nan (same as input).
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	ArrayLocation, InitVar
 CALLED BY:
	InterpolateHeliosphere, PlotSphereCut, PlotSynopticMap, wso_read, wso_write
 PROCEDURE:
 >	If nFill <= 0 then:
	Step 1: for each empty bin, count the number of non-empty neighbours
	Step 2: find the subset of empty bins with the maximum number of
	    non-empty neighbours
	Step 3: for the subset of step 2, calculate the average over the non-
	    empty neighbours and assign this average to the empty bin
	Step 4: Go to step 1
	Repeat until there are no empty bins left.

 >	nFill > 0:
	Step 1: for each empty bin, count the number of non-empty neighbours
	Step 2: find the subset of empty bins with nFill or more non-empty
	    neighbours
	Step 3: for the subset of step 2, calculate the average over the non-
	    empty neighbours and assign this average to the empty bin
	Step 4: Return.

 >	By default neigbouring function values are averaged with weight=1.
	If WeightFnc is specified, it is used to calculate the weights instead.
	The function has the form
	    function WeightFnc(I,J,inX,jnY,Z[inX,jnY])
	I,J are the indices of the bad pixel; inX,jnY are arrays with the
	    indices of good neighbour pixels, and Z[inX,jnY] are the
	    function values in the good neighbours.
 MODIFICATION HISTORY:
	1990, Paul Hick (UCSD)
	24-MAR-1999, Paul Hick (UCSD), converted from Fortran


GroupPixels $SSW_SMEI_UCSD/sat/idl/toolbox/grouppixels.pro
[Previous] [Next]
 NAME:
	GroupPixels
 PURPOSE:
	Divide a group of pixels in separate groups based on nearness of the pixels in a group
 CATEGORY:
	Tools
 CALLING SEQUENCE:
	Loc = GroupPixels(Locations, Positions, range=range, ngroup=nGroup, pgroup=pGroup, lgroup=lGroup)
 INPUTS:
	Locations	1D array, type integer
			    array of linear indices of pixel locations
	Positions	3D array, type: float
			    x,y,z positions of pixels in 'Locations' array
			    (keywords sizeframe or dimension provide alternative
			    ways to specify x,y,z positions)
 OPTIONAL INPUT ARRAY:
	sizeframe=sizeframe size vector of image cube
	dimension=dimension dimensions of image cube
			    if either of these is specified, then 'Positions' is ignored
			    Instead the dimensions of the image cube are used to
			    to get x,y,z pixel coordinates from 'Locations' using
			    ArrayLocation.
 OPTIONAL INPUT PARAMETERS:
	range=Range	scalar, or vector with as many elements as Frame has dimensions
			    default: Range = 1
			    defines the distance in each dimension of Frame defining
			    how close the members of a group are.
	/ellipsoid	if set, Range is used to define an ellipsoidal region
			if not set, Range defines a square region.
 OUTPUTS:
	Loc		1D array, type integer
			    same as input array Locations but with elements reordered
			if Frame is supplied as an array (i.e. if /sizeframe is not set),
			then groups will be ordered with the values of the highest
			pixel in each group in decreasing order
 OPTIONAL OUTPUT PARAMETERS:
	ngroup=nGroup	scalar, type long integer
			    number of groups of pixels in Loc
	pgroup=pGroup	1D array[nGroup], type long integer
			    indicates the position in Loc where each group begins
	lgroup=lGroup	1D array[nGroup], type long integer
			    indicates number of pixels in each group
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	ArrayLocation, InitVar, IsType
 CALLED BY:
	Find2DGlitch
 PROCEDURE:
	This procedure was written to group pixels in a 3D image cube, but I think it works
	with cubes of any number of dimensions.
 MODIFICATION HISTORY:
	NOV-1998, Paul Hick (UCSD/CASS)
	FEB-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added possibility to specify x,y,z coordinates for pixels explicitly
	    (in addition to specification of size vector of image cube only)