Say $SSW_SMEI_UCSD/gen/for/lib/str/say.f
[Previous] [Next]
 NAME:
	Say
 PURPOSE:
	Print informational or error messages in a format modeled after the VMS/DCL messages.
 CALLING SEQUENCE:
	subroutine Say(cP2,cP3,cP4,cP5)
	call Say(cName,cSeverity,cMessageID,cMessage)
 INPUTS:
	(all are read-only)
	cName		character*(*)	program name
	cSeverity	character*(*)	W,S,E,I,D,w,s,e,i,d
	cMessageID	character*(*)	descriptor of error message
					if cMessageID(1:4)='Stop' program will terminate
					if cMessageID='<time>' then the message ID will be
					    current system time
					if cMessageID='<fmt>' with 'fmt' a valid time format
					    (see Time2Str) then the message ID is the
					    system time displayed in the specified format,
					    e.g. '<hh:mm:ss>' displays the time of day.
	cMessage	character*(*)	full message string; the separator # can be
					used to output lines over multiple lines.
					Only cMessage sections of non-zero length are printed
	LIB__SIGNAL_QUIET	global symbol	(not case-sensitive)
		string containing one or more of the severity status chars
		WSEIF. The error message is suppressed if the current severity
		is present in the LIB_SIGNAL_QUIET list.
	LIB__SIGNAL_STOP	global symbol	(not case-sensitive)
		string containing one or more of the severity status chars
		WSEIF. Error messages of this type will result in program termination.
		Severity E and F ALWAYS result in program termination.
		For individual messages program termination can be forced by setting
		the first 4 characters of cMessageID(1:4)='Stop' (case sensitive!!)
	LIB__SIGNAL_FILE	global symbol
		if set to 1 then messages are written to a file instead of
		standard output. The file name is 'say.txt' and is located in
		the directory cTemp (see include file dirspec.h)
 OUTPUTS:
	Single message to SYS$OUTPUT or to file.
	Program termination is done by OSExitCmd. The error code passed to
	OSExitCmd is 0=W,1=S,2=E,3=I,4=F. (On VMS the 'Inhibit display' bit is also set).
 CALLED BY:
	ArrayLoc3, AskLimit, FileSelection, ForeignArg, ForeignArgFind, GridFill
	GridRan2Reg, GridSphere3D, GridSphereRange, GridSphereWeight, HOSInquire
	MAP_TZERO, MessengerOrbit, NicHdr, Peep, RebinSphere, SetLog2Dir, SetRotations
	SplineGridX, SplineGridY, SplineX, SplineY, StereoAOrbit, StereoBOrbit, Str2Dbl
	Str2Flt, Str2Flt_Exp, Str2Flt_FforI, Str2Flt_Int, Str2Flt_Mask, Str2Flt_XforA
	Str2Int, Time2Carrington, Time2CarringtonT0, Time2Split, Time2smei_eph
	UlyssesOrbit, WR2DARR, XMAP_SC_POS, bOpenFile, bReadNic, bTempFile, iFltArr
	iGetLogical [3], iOSSetDirectory [4], iOpenFile [1], iOpenFile [2]
	iOpenFile [3], iOpenFile [4], iSearch [1], iSearch [2], iSearch [3], iSearch [4]
	iSearchTree, iSetDefaultDir, ice_read, ice_write, jpl_close, jpl_init, jpl_message
	jpl_state, mkenv, nrPolInt, nrPolInt2, nrQRomb, nrQRomo, nrQSimp, nrQTrap, nrRatInt
	nrSplInt, nrSpline, nrSpline2, nrTrapZD, nrZBrent, nrZBrentd, rice, rotate, rotated
	say_fts, smei_base, smei_cal, smei_cal_add, smei_cal_bin, smei_cal_build
	smei_cal_c3mask, smei_cal_get, smei_cal_group, smei_cal_init, smei_cal_read
	smei_cal_write, smei_eclipse, smei_foreign, smei_frm_base, smei_frm_c3fudge
	smei_frm_fts_eph, smei_frm_ok, smei_frm_path, smei_frm_ped, smei_frm_ped_guess
	smei_frm_ratio, smei_frm_read, smei_frm_read_get_sdark, smei_frm_write
	smei_get_glare, smei_get_starmask, smei_orb, smei_orb_cal_name, smei_orb_camera
	smei_orb_get, smei_orb_min_name, smei_orb_min_number, smei_orb_name
	smei_orb_number, smei_orb_read, smei_orb_time, smei_orb_version, smei_orb_write
	smei_orbit2, smei_orbit_info2, smei_orbit_period2, smei_orbit_time2
	smei_sky_iread, smei_sky_read, smei_skyd, smei_skyd_combine, smei_skyd_fill
	smei_skyd_flush, smei_skyd_fts, smei_skyd_go, smei_skyd_init, smei_skyd_make
	smei_skyd_pixel, smei_skyd_scan, smei_skyd_size, smei_skyd_sky, smei_skyd_sort
	sprint
 INCLUDE:
	include		'dirspec [1].h'
	include		'dirspec [2].h'
	include		'dirspec [3].h'
	include		'dirspec [4].h'
	include		'filparts.h'
 CALLS: ***
	LocFirstLen, OSExitCmd [1], OSExitCmd [2], OSExitCmd [3], OSExitCmd [4]
	cTime2System, iFilePath, iFreeAllLun, iFreeLun, iGetLun, iGetSymbol [1]
	iGetSymbol [2], iGetSymbol [3], iHideLogical, itrim, uppercase
 RESTRICTIONS:
 	The severity string should be only one character long
 PROCEDURE:
 >	Use Say0 in graphics program (VMS)
 >	If the severity is E (error) or F (fatal) program execution stops. The
	symbol $STATUS is set to a FALSE (i.e. even) value by the EXIT routine.
 >	If the severity is S (succes) or I (informational) and W (warning)
	the procedure returns to caller, unless LIB__SIGNAL_STOP is used to terminate.
 MODIFICATION HISTORY:
	SEP-1992, Paul Hick (UCSD/CASS), based on DCL procedure Say
	NOV-1994, Paul Hick (UCSD/CASS)
	- Check the symbol LIB__SIGNAL_QUIET to determine whether the error message
	  should be displayed.
	MAY-1999, Paul Hick (UCSD/CASS)
	- Originally, if the symbol LIB__SIGNAL_FILE was set, the file 'say.txt' would
	  be opened and closed in each Say call. NT has problems with this. I am not sure
	  why, but I suspect there is some limit on the number of files that can be opened.
	  Now the file stays open as long as the symbol LIB__SIGNAL_FILE is set.
	AUG-1999, Paul Hick (UCSD/CASS)
	- The error code passed to iOSExitCmd includes the 'Inhibit display' bit now
	  only on VMS.
	FEB-2005, Paul Hick (UCSD/CASS)
	    Added iHideLogical call to process cP4.
	JAN-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added <time> option for cP4


say_fts $SSW_SMEI_UCSD/gen/for/lib/io/say_fts.f
[Previous] [Next]
 NAME:
	say_fts
 PURPOSE:
	Processes error stack of cfitsio package
 CATEGORY:
	ucsd/for/gen/lib
 CALLING SEQUENCE:
	subroutine say_fts(cSay,cSeverity,istat)
 INPUTS:
	cSay		character*(*)	passed to Say
	cSeverity	character*(*)	passed to Say
	istat		integer		error code from FITS routine
 CALLS: ***
	FTGMSG, Say, cInt2Str, itrim
 CALLED BY:
	smei_cal_read, smei_cal_write, smei_frm_fts, smei_frm_fts_axis
	smei_frm_fts_base, smei_frm_fts_eph, smei_frm_read, smei_frm_read_get_sdark
	smei_frm_write, smei_get_glare, smei_get_lsff, smei_get_starmask, smei_orb
	smei_orb_cal_name, smei_orb_camera, smei_orb_min_name, smei_orb_min_number
	smei_orb_name, smei_orb_number, smei_orb_read, smei_orb_time, smei_orb_version
	smei_orb_write, smei_sky_iread, smei_sky_read, smei_skyd_fts, smei_skyd_go
	smei_skyd_init, smei_skyd_make, smei_skyd_sky
 PROCEDURE:
	Processes the Fits error stack; then calls Say with
	cSeverity to control program continuation.
 MODIFICATION HISTORY:
	DEC-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


SetLog2Dir $SSW_SMEI_UCSD/gen/for/lib/gen/setlog2dir.f
[Previous] [Next]
 NAME:
	SetLog2Dir
 PURPOSE:
	Set logical to directory containing files matching specified wildcard
 CALLING SEQUENCE:
	subroutine SetLog2Dir(iPrompt,cLog,cWild,cFound)
 INPUTS:
	iPrompt		integer		 1 = prompt for directory until
					     requested files are located
					 2 = do not prompt
					-2 = do not prompt, do not delete logical
	cLog*(*)	character	name of logical
	cWild*(*)	character	file name wildcard
					(NO directory specification permitted)
 OUTPUTS:
	cFound*(*)	character	first file name matching wildcard
					= ' ' if no file is found
	If necessary the logical is entered into the PROCESS table
 CALLS: ***
	AskChar, Say, iDeleteLogical [1], iDeleteLogical [2], iDeleteLogical [3]
	iGetDefaultDir, iGetFileSpec, iGetLogical [1], iGetLogical [2], iGetLogical [3]
	iSearch [1], iSearch [2], iSearch [3], iSearch [4], iSetFileSpec, iSetLogical [1]
	iSetLogical [2], iSetLogical [3], itrim, uppercase
 CALLED BY:
	SetRotations
 INCLUDE:
	include		'filparts.h'
	include		'dirspec [1].h'
	include		'dirspec [2].h'
	include		'dirspec [3].h'
	include		'dirspec [4].h'
 PROCEDURE:
 >	If iPrompt=1 then the logical is defined upon return and
	cFound contains the first file name matching the wildcard (if necessary
	after prompting for a directory).
 >	If iPrompt=2 then two things can happen on return
	- The logical is still defined and a matching file is located.
		cFound contains the first matching file name upon return
	- The logical is not defined, and cFound = ' ', because 
		1. the logical was not defined in the first place
		2. no matching file name was found
		3. matching files were also found in the current directory
 >	If iPrompt=-2 then three things can happen on return
	- The logical is not defined, and cFound = ' ', because 
		1. the logical was not defined in the first place
	- The logical is still defined and a matching file is located.
		cFound contains the first matching file name upon return
	- The logical is still defined, but cFound = ' ', because
		2. no matching file name was found
		3. matching files were also found in the current directory
 >	If a matching file name is returned in cFound, then also iSetFileSpec
	has been called to fill the parse structure.

	The following steps are taken to set the logical and test the wildcard:
 >1	Translate the logical cLog
 >2	If the logical is not defined, go to step 6
 >3	If the logical is defined then test the wildcard.
 >4	If a match is found, RETURN, UNLESS the current directory is different
	from the logical directory, and also contains matching files
 >5	Undefine the logical (happens if the logical directory does not
	contain matching files or the ambiguity with the current directory
	arises (see previous step).
 >6	RETURN if iPrompt=0 (cFound=' ', logical does not exist (anymore))
 >7	Test the wildcard in the default directory. If a match is found
	offer it as the default choice for the directory prompt
 >8	Prompt for directory until a match for the wildcard if found
 >9	Set the logical to the selected directory
 MODIFICATION HISTORY:
	SEP-1992, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


SetRotations $SSW_SMEI_UCSD/gen/for/lib/io/setrotations.f
[Previous] [Next]
 NAME:
	SetRotations
 PURPOSE:
	Use specified wildcard to locate directory with data files for the
	Carrington programs. If located, define a logical pointing to the
	data directory.
	Also return first and last Carrington rotations numbers for which files
	are available.
 CALLING SEQUENCE:
	subroutine SetRotations(iPrompt,cWild,IClo,IChi)
 INPUTS:
	iPrompt		integer		= 0/1
		0 : check directory assigned to logical only.
		1 : check directory assigned to logical. If unsuccessful, prompt
			for directories until data files are located
	cWild*(*)	character	wildcard used to search for data files
					(only file name and type are used)
 OUTPUTS:
	IClo		integer		First and ..
	IChi		integer		last Carrington rotation located
 CALLS: ***
	Int2Str, Int2StrSet, Say, SetLog2Dir, Str2Str, Str2StrSet, iFilePath, iGetFileSpec
	iSearch [1], iSearch [2], iSearch [3], iSearch [4], iSetFileSpec, itrim
 INCLUDE:
	include		'filparts.h'
	include		'str2str_inc.h'
	include		'dirspec [1].h'
	include		'dirspec [2].h'
	include		'dirspec [3].h'
	include		'dirspec [4].h'
 PROCEDURE:
 >	The wildcard is used to search for data files.
	The Carrington rotation should be encoded into file name as a 4 digit
	integer. Mark the location with the 4 char string %%%% or ####.
	(use #### if there is there is another %%%% present in the wildcard
	preceding the location of the Carrington number.
 >	The wildcard must have the same number of characters as the real
	file name+file extension, i.e. do NOT use the wildcard *, but only
	the single character wildcard %.
 >	The file type (extension) is used to construct the name of the logical
	assigned to the data directory.
 >	If the logical is already assigned to a directory, that directory is
	searched first. If data files are found, the value is retained. If not,
	the logical is deassigned.
 >	If no files are found in the previous step, then
	- if iPrompt = 0 then return IClo = IChi = 0
	- if iPrompt = 1 continue to prompt for a directory until one is specified
			which contains data files or until program is aborted.
 MODIFICATION HISTORY:
	JUL-1993, Paul Hick (UCSD/CASS; pphick@ucsd.edu), modification of SetGipsy


Simpson $SSW_SMEI_UCSD/gen/for/lib/math/simpson.f
[Previous] [Next]
 NAME:
	Simpson
 PURPOSE:
	Numerical integration of function of one variable using Simpson rule
 CALLING SEQUENCE:
	function Simpson(F,A,B,DEL,MAXN,N)
 INPUTS:
	F	real	function; declared external in caller
	A,B	real	integration range
	DEL	real	accuracy
	MAXN	integer	maximum number of iterations
 OUTPUTS:
	Simpson	real	result of integration
	N	integer	0: no convergence
			1: if A=B (then also R=0)
 CALLED BY:
	IPSBase
 PROCEDURE:
 >	If DEL <=0 then DEL=1x10^-4 is used
 >	If MAXN< 2 then MAXN=2 is used
 MODIFICATION HISTORY:


sind $SSW_SMEI_UCSD/gen/for/os/goniod.f
[Previous] [Next]
 NAME:
	sind
 CALLING SEQUENCE:
	entry sind(a)
 INPUTS:
	a	real		angle in degrees
 CALLED BY:
	ElSunDistance, EqKepler, KeplerOrbit, MapWarp, SindLookup, ThomsonMidpointFar
	Time2PrecesssionLtd
 SEE ALSO:
	cosd
 MODIFICATION HISTORY:
	JAN-2001, Paul Hick (UCSD; pphick@ucsd.edu)


SindLookup $SSW_SMEI_UCSD/gen/for/lib/math/sindlookup.f
[Previous] [Next]
 NAME:
	SindLookup
 PURPOSE:
	Calculates sin(x) using lookup table
 CATEGORY:
	Math
 CALLING SEQUENCE:
	function SindLookup(X)
 INPUTS:
	X		real		X-coordinate (degrees)
 OUTPUTS:
	F		real		sin(x) from table lookup
 CALLS: ***
	FLINT, sind
 SEE ALSO:
	CosdLookup, GaussLookup
 RESTRICTIONS:
	The table lookup runs up to 10. For larger X-values, the return value is zero
 MODIFICATION HISTORY:
	SEP-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_axis_cam $SSW_SMEI_UCSD/gen/for/lib/frm/smei_axis_cam.f
[Previous] [Next]
 NAME:
	smei_axis_cam
 PURPOSE:
	Convert polar CCD coordinates to sky coordinates
	in camera frame, and v.v
 CALLING SEQUENCE:
	subroutine smei_axis_cam(id,icam,mode,dr,phi,rx,ry,rz,tx,ty)
 INPUTS:
	id	integer			id=0: CCD pixel coord to camera sky coord
					id=1: camera sky coord to CCD pixel coord
	icam	integer			camera id (1,2,3)
	mode	integer			mode (0,1,2)

	id=0:
	dr	double precision	radial distance to optical axis in
					units of engineering mode pixels
	phi	double precision	angle from optical axis in degrees

	id=1:
	rx	double precision	x-component of unit vector
	ry	double precision	y-component of unit vector
	rz	double precision	z-component of unit vector (always positive)
 OUTPUTS:
	id=0:
	rx	double precision	x-component of unit vector
	ry	double precision	y-component of unit vector
	rz	double precision	z-component of unit vector (always positive)

	id=1:
	dr	double precision	radial distance to optical axis in
					units of engineering mode pixels
	phi	double precision	angle from optical axis in degrees

	tx	double precision	theta-x = arcsin(rx)
	ty	double precision	theta-y = arcsin(ry)
 CALLS: ***
	BadR8, datan2d, dsind
 CALLED BY:
	smei_skyd_fill, smei_skyd_flush, smei_skyd_fts, smei_skyd_init, smei_skyd_make
	smei_skyd_sky, smei_skyd_sort
 RESTRICTIONS:
	The input values for x,y need to be sensible, i.e. not too far
	outside the field of view.
 RESTRICTIONS:
	If a unit vector is specified (id=1) then the conversion
	is only done if the location is within a reasonable
	distance of the fov (currently abs(tx) < 45 and abs(ty) < 10
	degrees. For locations outside this range dr and phi are
	set to BadR8() on return.
 PROCEDURE:
	(rx,ry,rz) is a unit vector representing the location
	on the sky of (x,y) on the CCD, i.e. rx,ry,rz are the
	direction cosines.
	Quadratic coefficients from Andys July 2001 memo. In addition some
	ad-hoc stretching of tx and ty is done
 MODIFICATION HISTORY:
	FEB-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_axis_ccd $SSW_SMEI_UCSD/gen/for/lib/frm/smei_axis_ccd.f
[Previous] [Next]
 NAME:
	smei_axis_ccd
 PURPOSE:
	Convert rectangular CCD coordinates to polar coordinates
	relative to optical axis and v.v.
 CALLING SEQUENCE:
	subroutine smei_axis_ccd(id,icam,mode,x,y,dr,phi,r)
 INPUTS:
	id	integer			id=0: CCD pixel coord to camera sky coord
					id=1: camera sky coord to CCD pixel coord
	icam	integer			camera id (1,2,3)
	mode	integer			mode (0,1,2)

	id=0:
	x,y	double precision	pixel coordinates for specified input mode

	id=1:
	dr	double precision	radial distance to optical axis in
					units of engineering mode pixels
	phi	double precision	angle from optical axis in degrees
					(usually dr,phi are output from smei_axis_cam)
 OUTPUTS:
	id=1:
	dr	double precision	radial distance to optical axis in
					units of engineering mode pixels
	phi	double precision	angle from optical axis in degrees
					(usually dr,phi are output from smei_axis_cam)
	id=0:
	x,y	double precision	pixel coordinates for specified input mode

	r	double precision	radial distance to origin of polar
					transformation, i.e. r,phi are polar coordinates
					on the CCD, and r = r0+dr, where r0 is the
					distance of the optical axis from the origin.
 CALLS: ***
	datan2d, dcosd, dsind
 CALLED BY:
	smei_skyd_fts, smei_skyd_init, smei_skyd_make, smei_skyd_sky
 SEE ALSO:
	smei_axis_cam
 PROCEDURE:
	Binned (mode 1,2) and unbinned (mode 0, engineering mode) pixel
	indices are related by (nbin = 2^mode):
	   (unbinned index) = nbin*(binned index)-0.5*(nbin-1)
 MODIFICATION HISTORY:
	FEB-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_cal_get $SSW_SMEI_UCSD/gen/for/lib/cal/smei_cal_get.f
[Previous] [Next]
 NAME:
	smei_cal_get
 PURPOSE:
	Get closed shutter calibration pattern.
 CALLING SEQUENCE:
	subroutine smei_cal_get(cFile,ipick,icam,mode,mask,time,
     &		cpattern,pattern,pattern_dark,bNew,version)
 INPUTS:
	cFile*(*)	character	fully-qualified file name of pattern file
					(must be a .grd file, .fts or .fts.gz file).
					If left empty or set to SMEIDB? then a
					calibration pattern is selected from
					$SMEIDB/cal (a Fits file) based 
					on the fourth input argument (time).
	ipick		integer		0: pick earlier pattern for mode 1,2
					   and nearest pattern for mode 0
					1: always pick nearest pattern
					2: pick later pattern for mode 1,2 and
					   nearest pattern for mode 0
	camera		integer		camera number (1,2,3)
	mode		integer		camera mode (0,1,2)
	mask		integer		C3 mask applied or not (0=No,1=Yes)
	time(2)		integer		time used for pattern selection.
					For mode 0 the pattern closest to 'time' is returned
					For mode 1 and 2 the last pattern preceeding 'time'
					is returned.
 OUTPUTS:
	cpattern*(*)	character	file name of calibration pattern
	pattern(*)	real		calibration pattern
	pattern_dark	real		dark current in calibration pattern.
	bNew		logical		.TRUE. if smei_cal_read was called to read new
					pattern; .FALSE. if not.
	version		double precision (Only if bNew = .TRUE.)
					version number of smei_cal program that wrote the
					the calibration pattern. If bNew=.FALSE. then version=0.
					I.e. the version number is returned only if
					smei_cal_read is called.
 CALLED BY:
	smei_base, smei_orb, smei_skyd_fts, smei_skyd_init, smei_skyd_make, smei_skyd_sky
 INCLUDE:
	include		'filparts.h'
	include		'dirspec [1].h'
	include		'dirspec [2].h'
	include		'dirspec [3].h'
	include		'dirspec [4].h'
	include		'smei_frm_layout.h'
 RESTRICTIONS:
	smei_cal_init() needs to be called first.
 CALLS: ***
	Int2Str, Say, Str2Str, Time2Delta, Time2Differ, cInt2Str, cTime2Str, iFilePath, iFreeLun
	iGetFileSpec, iGetLun, iSearch [1], iSearch [2], iSearch [3], iSearch [4]
	iSetFileSpec, itrim, smei_Time2Split, smei_cal_read, smei_cal_version
 PROCEDURE:
	The first nX * nY elements of pattern will be filled where
	nX = 1272, 636 or 318 and nY = 256, 128, 64 for mode 0,1 and
	2, respectively.
 MODIFICATION HISTORY:
	DEC-2004, Paul Hick (UCSD/CASS)
	JUL-2005, Paul Hick (UCSD/CASS)
	    Fixed bug in pattern selection for mode 0 (would fail if
	    frame time was later than last pattern).
	SEP-2005, Paul Hick (UCSD/CASS)
	    Added bNew
	MAR-2007, Paul Hick (UCSD/CASS)
	    Added argument 'mask' to access patterns with c3 "bad pixel"
	    mask applied.
	JAN-2008, Paul Hick (UCSD/CASS)
	    Added argument 'version'
	JUL-2008, Paul Hick (UCSD/CASS)
	    Added argument ipick
	JUN-2011, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added ipick=2 option to pick later pattern.


smei_cal_init $SSW_SMEI_UCSD/gen/for/lib/cal/smei_cal_get.f
[Previous] [Next]
 NAME:
	smei_cal_init
 PURPOSE:
	Initializes data base of calibration patterns for use
	with smei_get_cal.
 CALLING SEQUENCE:
	entry smei_cal_init()
 CALLS: ***
	Int2Str, Say, Str2Str, Time2Delta, Time2Differ, cInt2Str, cTime2Str, iFilePath, iFreeLun
	iGetFileSpec, iGetLun, iSearch [1], iSearch [2], iSearch [3], iSearch [4]
	iSetFileSpec, itrim, smei_Time2Split, smei_cal_read, smei_cal_version
 CALLED BY:
	smei_base, smei_orb, smei_skyd
 MODIFICATION HISTORY:
	FEB-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_cal_read $SSW_SMEI_UCSD/gen/for/lib/cal/smei_cal_read.f
[Previous] [Next]
 NAME:
	smei_cal_read
 PURPOSE:
	Read closed shutter calibration pattern file
 CATEGORY:
	ucsd/camera/for/lib
 CALLING SEQUENCE:
	subroutine smei_cal_read(cFile, mode, mask, pattern_dark, nx, ny, pattern)
 INPUTS:
	cFile*(*)	character	fully qualified Fits pattern file name
	mode		integer		camera mode (0,1,2)
	mask		integer		C3 mask applied or not (0=No,1=Yes)
 OUTPUTS:
	pattern_dark	real		dark current in pattern
	pattern(*)	real		engineering mode (1272x256) pattern array
	nfrm		integer		# frames used to calculate the pattern
	cfrm(nfrm)	character	names of frames used to calculate the pattern
	TBeg(2)		integer		Begin time of closed shutter calibration data
	TEnd(2)		integer		End time of closed shutter calibration data
					All engineering mode frames between TBeg and TEnd
					are used for the performance test.
	ncr_count	integer		cosmic ray count (from smei_cal_add)
 CALLED BY:
	smei_cal_get, smei_cal_init
 INCLUDE:
	include		'filparts.h'
	include		'smei_frm_layout.h'
	include		'ftspar.h'
 CALLS: ***
	FTCLOS, FTGISZ, FTGKNS, FTGKYD, FTGKYE, FTGKYJ, FTGKYL, FTGKYS, FTGPVE, FTMAHD, FTNOPN
	Int2Str, Say, Str2Str, cInt2Str, iFreeLun, iGetFileSpec, iGetLun, iSetFileSpec, say_fts
	smei_Time2Split
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS)
	MAR-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added argument 'mask' to deal with patterns with c3 "bad pixel"
	    mask applied.


smei_cal_time $SSW_SMEI_UCSD/gen/for/lib/cal/smei_orb_read.f
[Previous] [Next]
 NAME:
	smei_cal_time
 PURPOSE:
	Time of calibration pattern.
 CATEGORY:
	ucsd/camera/for/lib
 CALLING SEQUENCE:
	entry smei_orb_cal_time(TTime)
 INPUTS:
	(none)
 OUTPUTS:
	TTime(2)	integer		time of calibration pattern
 CALLS:
	TimeSplit
 PROCEDURE:
	Entry point in smei_orb_read.
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_cam2ccd $SSW_SMEI_UCSD/gen/for/lib/frm/smei_ccd2cam.f
[Previous] [Next]
 NAME:
	smei_cam2ccd
 PURPOSE:
	Convert sky coordinates in camera fram to CCD coordinates
 CALLING SEQUENCE:
	entry smei_cam2ccd(icam,r0,x,y,rx,ry,rz,tx,ty)
 INPUTS:
	icam	integer			camera id (1,2,3)
	r0	double precision	distance center of fov curvature to optical axis (in pixels)
	rx	double precision	x-component of unit vector
	ry	double precision	y-component of unit vector
	rz	double precision	z-component of unit vector
 OUTPUTS:
	x	double precision	hor distance to center of fov curvature (in pixels)
	y	double precision	vert distance to center of fov curvature (in pixels)
	tx	double precision	theta-x = arcsin(rx)
	ty	double precision	theta-y = arcsin(ry)
 CALLS: ***
	BadR8, datan2d, dcosd, dsind
 RESTRICTIONS:
	The conversion is only performed for sensible (rx,ry,rz), i.e. for unit
	vectors that project close to the field of view.
 PROCEDURE:
	(rx,ry,rz) is a unit vector representing the location
	on the sky of (x,y) on the CCD, i.e. rx,ry,rz are the
	direction cosines.
	Quadratic coefficients from Andys July 2001 memo. In addition some
	ad-hoc stretching of tx and ty is done
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_ccd2cam $SSW_SMEI_UCSD/gen/for/lib/frm/smei_ccd2cam.f
[Previous] [Next]
 NAME:
	smei_ccd2cam
 PURPOSE:
	Convert CCD coordinates to sky coordinates
 CALLING SEQUENCE:
	subroutine smei_ccd2cam(icam,r0,x,y,rx,ry,rz,tx,ty)
 INPUTS:
	icam	integer			camera id (1,2,3)
	r0	double precision	distance center of fov curvature to optical axis (in pixels)
	x	double precision	hor distance to center of fov curvature (in pixels)
	y	double precision	vert distance to center of fov curvature (in pixels)
 OUTPUTS:
	rx	double precision	x-component of unit vector
	ry	double precision	y-component of unit vector
	rz	double precision	z-component of unit vector (always positive)
	tx	double precision	theta-x = arcsin(rx)
	ty	double precision	theta-y = arcsin(ry)
 CALLS: ***
	BadR8, datan2d, dcosd, dsind
 RESTRICTIONS:
	The input values for x,y need to be sensible, i.e. not too far
	outside the field of view.
 PROCEDURE:
	(rx,ry,rz) is a unit vector representing the location
	on the sky of (x,y) on the CCD, i.e. rx,ry,rz are the
	direction cosines.
	Quadratic coefficients from Andys July 2001 memo. In addition some
	ad-hoc stretching of tx and ty is done
 MODIFICATION HISTORY:
	NOV-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_eclipse $SSW_SMEI_UCSD/gen/for/lib/frm/smei_eclipse.f
[Previous] [Next]
 NAME:
	smei_eclipse
 PURPOSE:
	Check whether SMEI is seeing a solar eclipse
	(by Moon) or is in Earth shadow.
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	logical function smei_eclipse(tt,id,fraction)
 INPUTS:
	tt(2)		integer		UT time
	id		integer		10: solar eclipse by Moon
					 3: solar eclipse by Earth
					    (i.e. in Earth shadow)
 OUTPUTS:
	smei_eclipse
			logical		.TRUE.: eclipse in progress
	fraction	real		fraction of solar disk covered.
					For eclipses by Moon the fraction
					will be larger than one for a total.
					For Earth shadow the fraction is
					never larger than one.
 CALLS: ***
	Say, Time2jpl_eph, Time2smei_eph
 CALLED BY:
	smei_frm_fts_eph
 IMPLICIT:
	implicit double precision (A-H,O-Z)
 INCLUDE:
	include		'sun.h'
	include		'planet.h'
	include		'math.h'
 MODIFICATION HISTORY:
	FEB-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_FitPlane $SSW_SMEI_UCSD/gen/for/lib/frm/smei_fitplane.f
[Previous] [Next]
 NAME:
	smei_FitPlane
 PURPOSE:
	Solves for a least-squares planar fit through the 8 z-values
	surrounding [0,0], then reduces all 9 z values relative to
	the plane, and returns with the reduced values.
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine smei_FitPlane(z,dz,z0,a,b,sumzz)
 INPUTS:
	z(-1:1,-1:1)	real	3x3 array of fnc values
 OUTPUTS:
	dz(-1:1,-1:1)	real	3x3 array of residuals after subtracting
				planar fit
	z0		real	planar fit value at center pixel
	a,b		real	slopes in x and y direction
				(i.e. the planar fit is f=z0+a*i+b*j
				with i=-1,0,1, j=-1,0,1)
	sumzz		real	sum of square of residual of 8 pixels
				on outside (i.e. omitting center pixel).
 CALLED BY:
	smei_frm_measle, smei_skyd_fts, smei_skyd_init, smei_skyd_make, smei_skyd_sky
 MODIFICATION HISTORY:
	JUN-2004, Andy Buffington (UCSD/CASS; abuffington@ucsd.edu)


smei_foreign $SSW_SMEI_UCSD/gen/for/lib/frm/smei_foreign.f
[Previous] [Next]
 NAME:
	smei_foreign
 PURPOSE:
	Process command line arguments
 CALLING SEQUENCE:
	subroutine smei_foreign(id,cList,cBase,cDest,min_orbit,beg_orbit,end_orbit,forbit,icam,mode,cArg)
 INPUTS:
	(from command line)

	id		integer		1: cal_pattern (calibration 'closed shutter' patterns)
					2: orb_pattern (on-the-fly orbital patterns)
					3: smei_base (all data using patterns; CRX program)
					4: smei_htm
 OPTIONAL INPUTS:
	<pattern_text_template>
	destination=<destination>
	begin=<beg_time>
	orbits=<orbits>
	camera=<camera>
	mode=<mode>
 OUTPUTS:
	cList*(*)	character	extracted from <pattern_text_template>
					where <pattern_text_template> is the fully-qualified
					file name of the ASCII file containing
					the information defining each of the
					'closed shutter' data.
					Remember to escape any wildcard chars in
					<pattern_text_file> to avoid wildcard expansion
					at the command prompt.
	cBase*(*)	character	source directory
	cDest*(*)	character	extracted from
					    -destination=<destination>
					where <destination> is the name of an existing
					directory where to write the output file.
					If not specified than $TUB is used.
	min_orbit	integer		extracted from
					    -minimum_orbit=<min_orbit>
					    -minimum_orbit=<YYYY_DOY_hhmmss>
					orbit to be used for calculating the mimimum pattern
					in orb_pattern. If a time is specified then the orbit
					with the closest start time is used.
					If absent then the first orbit starting after
					the time from the closed shutter pattern is used.
	beg_orbit	integer		extracted from
					    -start_time=<beg_orbit>
					    -start_time=<YYYY_DOY_hhmmss>
					The first orbit for which a difference orbital pattern
					is calculated. If a time is specified then the orbit
					with the closest start time is used.
					If absent then the first orbit starting after
					the time from the closest shutter pattern is used.
	end_orbit	integer		extracted from
					    -stop_time=<end_orbit>
					    -stop_time=<YYYY_DOY_hhmmss>
					The first orbit for which a minimum orbital pattern
					is calculated. If a time is specified then the orbit
					with the closest start time is used.
					If omitted all orbits up to the time of the
					closed shutter pattern following the one
					specified in cList are processed.
	norbit		integer		extracted from
					    -orbits=<orbits>
					Alternative to stop_time: # orbits processed starting
					at beg_orbit.
	forbit(2)	double precision
					(only accessed if id=2, i.e. for smei_orb)
					extracted from
					    -lowfraction=<lowfraction>
					    -highfraction=<highfraction>
					two fractions of one defining the part of the orbit
					used for the orbital minimum and difference patterns.
	icam		integer		extracted from -camera=<camera>
					camera number (default: 0)
	mode		integer		extracted from -mode=<mode>
					mode number (default: -1)
 CALLED BY:
	smei_base, smei_cal, smei_orb, smei_skyd
 INCLUDE:
	include			'dirspec [1].h'
	include			'dirspec [2].h'
	include			'dirspec [3].h'
	include			'dirspec [4].h'
	include			'filparts.h'
 CALLS: ***
	BadI4, ForeignArg, ForeignArgSet, ForeignI4Arg, ForeignR8Arg, ForeignStrArg
	SMEI_FOREIGN_ORBIT_TIME, Say, Time2Differ, bOSFindClose, iCheckDirectory
	iFilePath, iGetFileSpec, iGetLogical [1], iGetLogical [2], iGetLogical [3]
	iSearch [1], iSearch [2], iSearch [3], iSearch [4], iSetFileSpec, itrim, lowercase
	smei_Time2Split, smei_orbit2, smei_orbit_time2
 MODIFICATION HISTORY:
	JUN-2011, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Bug fixes: checked for presence of -digsource and -digdestination
	    before adding them to cArg to avoid program abort because of
	    "keyword abbreviation not unique" condition.


smei_frm_base $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_base.f
[Previous] [Next]
 NAME:
	smei_frm_base
 PURPOSE:
	Calculates pedestal and dark current
 CATEGORY:
	ucsd/camera/for/lib
 CALLING SEQUENCE:
	logical function smei_frm_base(cframe,nx,ny,frame,pattern,
     &		nped,ped_val,ndark,dark_val,dark_pixs,
     &		ped_aux,dark_aux,base_aux)
 INPUTS:
	cframe  	character*(*)	fully-qualified file name of SMEI data frame
						(only used to format messages;
						contains time and camera number)
	nx		integer		horizontal frame size
	ny		integer		vertical frame size
	frame  (nx,ny)	real		frame data (usually after running it through
					    smei_frm_clean)
	pattern(nx,ny)	real		dark current pattern

	ped_aux(*)	real		passed to smei_frm_ped
					    Two values of ped_aux returned by smei_frm_ped
					    are used here:
						ped_aux(SMEI__PED_VERY_LOW) (to reject frame)
						ped_aux(SMEI__PED_NAIVE_MEAN) (message only)

	dark_aux(*)	real		passed to smei_frm_dark
					   If a valid pedestal is returned by smei_frm_ped
					   then two values in dark_aux are set here before
					   passing it to smei_frm_dark:
						dark_aux(SMEI__DRK_PEDESTAL)
						    pedestal value returned by smei_frm_ped
						dark_aux(SMEI__DRK_RATIO)
						    dark current ratio of frame and pattern

	base_aux(*)	real		base_aux(SMEI__BAS_DARK_GUESS)
					    guess at dark current (with pedestal subtracted)
					    for this frame (usually the dark current from a
					    previous frame).
					    If set to bad, then the naive mean dark current
					    of the frame is used (without using the pattern).
					base_aux(SMEI__BAS_PATTERN_DARK)
					    dark current of pattern.
					    Used with base_aux(SMEI__BAS_DARK_GUESS) to obtain
					    the dark current ratio needed by smei_frm_dark.
					base_aux(SMEI__BAS_DARK_MAX_RATIO  )
					base_aux(SMEI__BAS_DARK_SCALE_RATIO)
					    Used to constrain the dark current ratio fed to
					    smei_frm_dark, but only if the dark current guess
					    base_aux(SMEI__BAS_DARK_GUESS) is bad.
					base_aux(SMEI__BAS_NPED_MIN)
					base_aux(SMEI__BAS_NDARK_MIN)
					    threshold on number of pixels contributing to
					    pedestal and dark current respectively.
					    Frames are rejected if less pixels than this
					    contribute.
					base_aux(SMEI__BAS_NPED_BAD)
					    needs to be initialized to a negative number
					    by caller. Other parameters (including this one)
					    are initialized internally as a result.
 OUTPUTS:
	smei_frm_base	logical		.TRUE. if pedestal and dark current are OK
					.FALSE. if pedestal and/or dark current are rejected
					Note that, if smei_frm_base = .FALSE., the rejected
					values are still returned.
	nped		integer		# pixels contributing to pedestal
	ped_val		real		pedestal
	ndark		integer		# pixels contributing to dark current
	dark_val	real		dark current
	ped_aux(*)	real		as modified by smei_frm_ped

	base_aux(*)	real		base_aux(SMEI__BAS_NPED_BAD)
					    updated counter for # frames rejected because 
					    pedestal exceeded ped_threshold
					base_aux(SMEI__BAS_NBAD)
					    updated counter for # frames rejected because
					    not enough pixels contributed to the pedestal,
					    or because the dark current was bad.
	dark_pixs(*)	real		dark current pixels as returned from smei_frm_dark,
					    or all set to bad if the frame is rejected here.
 CALLS: ***
	ArrR4Bad, BadR4, Flt2Str, Int2Str, Say, Str2Str, cFlt2Str, iGetFileSpec, iHideLogical
	iSetFileSpec, smei_Time2Split, smei_frm_dark, smei_frm_mode, smei_frm_ped
	smei_frm_ped_guess, smei_frm_ratio
 CALLED BY:
	smei_base, smei_cal
 INCLUDE:
	include		'filparts.h'
	include		'smei_frm_layout.h'
	include		'smei_frm_basepar.h'
 PROCEDURE:
	1. Calculate pedestal with smei_frm_ped (using values in ped_aux)

	2. If pedestal is bad, then reject frame and return .FALSE.

	3. If pedestal is good, then store good pedestal in dark_aux.
	4. If no guess for dark current is available, calculate it internally
	   (by calling smei_frm_dark without using pattern) 

	5. Store ratio of dark currents of frame and pattern in dark_aux.
	6. Calculate dark current with smei_frm_dark (using values in dark_aux).
	   This time make smei_frm_dark use the pattern.

	7. Test pedestal and dark current.
	   The test mainly ensures that enough pixels contribute to pedestal
	   and dark current calculation.

	8. If the frame is rejected then return .FALSE.
	   (a recovery attempt is made if more than 12 consecutive frames
	   are rejected this way).
 MODIFICATION HISTORY:
	DEC-2004, Paul Hick (UCSD/CASS)
	NOV-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Modified to accomodate new arg in smei_frm_ped call.
	    Pedestal initialization values stored in
	    base_aux(SMEI__BAS_PED_INIT+[0,1,2]) are not used anymore.
	    Instead the value returned by smei_frm_ped_guess is used.


smei_frm_basepar $SSW_SMEI_UCSD/gen/for/h/smei_frm_basepar.h
[Previous] [Next]
 NAME:
	smei_frm_basepar
 PURPOSE:
	Include file for pedestal and dark current routines
 CATEGORY:
	gen/for/h
 CALLING SEQUENCE:
	include	'smei_frm_basepar.h'
 INCLUDED BY:
	smei_base, smei_cal, smei_cal_build, smei_frm_base, smei_frm_dark, smei_frm_ped
 PROCEDURE:
	Note that the prefixes SMEI__PED and SMEI__DRK
	are also used in smei__frm_layout.h. Make sure there
	is no conflict.
 MODIFICATION HISTORY:
	OCT-2002, Paul Hick (UCSD/CASS)
	FEB-2007, Paul Hick (UCSD/CASS)
	    Added SMEI__PED_LEFT_SIDE_ONLY
	JUL-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added SMEI__DRK_MEAN and SMEI__DRK_MEDIAN
	    (filled in smei_frm_dark)


smei_frm_c3fudge $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_c3fudge.f
[Previous] [Next]
 NAME:
	smei_frm_c3fudge
 PURPOSE:
	Set dark current fudge ratio for camera 3, mode 1
 CALLING SEQUENCE:
	function smei_frm_c3fudge(tt,c3mask)
 INPUTS:
	tt	integer(2)	SMEI frame time
	c3mask	integer		0/1: onboard flatfield off/on
 CALLED BY:
	smei_base
 INCLUDE:
	include		'smei_frm_layout.h'
 CALLS: ***
	Say, Time2DHMS, Time2Day, Time2Delta, Time2Str, Time2YMD, cFlt2Str, cTime2Str
	smei_frm_c3mask_active
 PROCEDURE:
	c3mask=0:
	The dark current fudge ratio is a function of time, and
	is determined from a fit to a function
	    f(t) = 1-exp(-(t-b)/a)
	where t is the number of days since 2003/04/15 0 UT
	The fit is done by the IDL procedure smei_frm_darkratio.pro

	c3mask=1:
	The fudge factor depends on which "bad-pixel" mask is active.
	The actual fudge factor is returned by smei_frm_c3mask_active
 RESTRICTIONS:
	The origin t0 (currently 2003/04/15 0 UT) MUST match the
	origin in the IDL procedure!!.
 MODIFICATION HISTORY:
	JUL-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Extracted from smei_frm_ratio


smei_frm_c3mask_active $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_c3mask_active.f
[Previous] [Next]
 NAME:
	smei_frm_c3mask_active
 PURPOSE:
	Check whether camera 3 mask is active at specified time
 CATEGORY:
	gen/for/lib/frm
 CALLING SEQUENCE:
	integer function smei_frm_c3mask_active(ipatt,tframe,flat_enabled,cmask,fudge)
 INPUTS:
	ipatt		integer		0: use exact range of "bad-pixel" mask periods
					1: use extended range of "bad-pixel" mask periods
					   for use by smei_cal
	tframe		character*(*)	SMEI frame time in format YYYY_DOY_hhmmss
	flat_enabled	integer		nint(hdr(SMEI__HDR_FLAT_ENABLED)) or -1
					if set to -1 this argument is ignored
					if set to the "flat_enabled" flag from a
					SMEI frame then this flag is tested in
					addition to the time.
 OUTPUTS:
	smei_frm_c3mask_active
			integer		1: bad pixel mask in use for specified time
					0: no bad pixel mask in use for specified time
	cmask		character*(*)	mask time in format YYYY_DOY_hhmmss
					This is used in the construction of the file
					name for the mask.
					cmask = ' ' if smei_frm_c3mask_active returns 0
	fudge		real		fudge factor for mask
 CALLED BY:
	smei_base, smei_cal_bin, smei_cal_c3mask, smei_frm_c3fudge, smei_frm_read
	smei_frm_read_get_sdark, smei_orb, smei_skyd_fts, smei_skyd_init, smei_skyd_make
	smei_skyd_sky
 INCLUDE:
	include		'smei_frm_layout.h'
 PROCEDURE:
	A camera 3 "bad pixel" mask is in effect onboard during specific
	periods, and since it is applied as a "flatfield" it is only
	used if the "flatfield-enabled" flag is set in a SMEI frame.
	The time periods are hardcoded in this routine.

	If flat_enabled = -1 then only the time 'tframe' is checked:
	if the time is inside one of the time periods then
	smei_frm_c3mask_active = 1 is returned. Otherwise 0 is returned.
	(this is used in smei_cal).

	If flat_enabled = 0 or 1 then the flatfield flag is tested also:

	If flat_enabled = 0 then always smei_frm_c3mask_active=0 is
	returned (the mask is present, but is not applied)

	If flat_enabled = 1 then smei_frm_c3mask_active is 1 only if the
	time 'tframe' is inside one of the "bad pixel mask" periods
	(the mask is present and is applied).

	If a new mask is added to this routine than all SMEI Fortran
	programs need to be recompiled. This includes smei_base,
	smei_cal, smei_orb and smei_skyd.

	Modification 2008/10/09: transitions between masks was changed
	considerably. A number of patterns were recreated:
		2006_038_085451         removed "mask-in" pattern
		2006_053_044615                 ,,
		2006_134_114227                 ,,
		2006_256_042123                 ,,
		2007_101_044631         different mask for "mask-in" pattern
		==================================
		2007_136_044747 - 2007_250_044827
		total of 17 patterns:   removed "mask-in" pattern
		==================================
		2008_044_044547         removed "mask-in" pattern
		2008_051_034355         removed "mask-in" pattern
		==================================
		2008_156_040215 - 2008_240_043351
		total of 13 patterns:   removed "mask-in" pattern
 MODIFICATION HISTORY:
	MAR-2007, Paul Hick (UCSD/CASS)
	APR-2007, Paul Hick (UCSD/CASS)
	    Added argument ipatt.
	NOV-2007, Paul Hick (UCSD/CASS)
	    Added mask 2007_237
	JUL-2008, Paul Hick (UCSD/CASS)
	    Added mask 2008_023
	OCT-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added mask 2008_226
	OCT-2009, John Clover (UCSD/CASS; jclover@ucsd.edu)
	    Added mask 2009_260
       APR-2010, John Clover (UCSD/CASS)
           Added mask 2010_098
       OCT-2010, John Clover (UCSD/CASS)
           Added mask 2010_259
       MAR-2011, John Clover (UCSD/CASS)
           Added mask 2011_038


smei_frm_clean $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_clean.f
[Previous] [Next]
 NAME:
	smei_frm_clean
 PURPOSE:
	Massages SMEI data frame for further processing
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	integer function smei_frm_clean(nX, nY, frm1, frm2)
 INPUTS:
	nX		integer		horizontal frame size
	nY		integer		vertical frame size
	frm1(nX,nY)	real		frame data (from smei_frm_read)
 OUTPUTS:
	frm2(nX,nY)	real		massaged data with some
					pixels flagged as bad
	smei_frm_clean	integer		# pixels flagged as bad
					This should be 8/nbin
					In full-frame eng mode (no ROI applied)
					this will be 4*256+8 (4 leading columns
					of zeros).
 CALLS: ***
	ArrR4Copy, BadR4, smei_frm_mode
 CALLED BY:
	smei_base, smei_cal, smei_cal_build, smei_orb
 INCLUDE:
	include		'smei_frm_layout.h'
	include		'smei_frm_hdr.h'
 PROCEDURE:
 >	Pixels with readout of zero ADU are set to bad
	This primarily flags the first 4 columns for full-frame eng mode
	frames (which contain 4 columns of zero at the start)
 >	8 pixels in top row at right side of frame. 4 dark current
	and 4 pedestal pixels are set to bad. These sometimes contain
	funny values like 0 of 512.
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_frm_dark $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_dark.f
[Previous] [Next]
 NAME:
	smei_frm_dark
 PURPOSE:
	Calculates dark current for SMEI data frame
 CATEGORY:
	ucsd/camera/for/lib
 CALLING SEQUENCE:
	integer function smei_frm_dark(bMedian, nx, ny, frame, pattern, dark_val, dark_pixs, dark_aux)
 INPUTS:
	bMedian		logical		.TRUE. : return median
					.FALSE.: return mean
	nx		integer		horizontal frame size
	ny		integer		vertical frame size
	frame(nx,ny)	real		frame data (after massaging by smei_frm_clean)
	pattern(nx,ny)	real		dark current pattern
					    (not accessed if dark_aux(SMEI__DRK_RATIO) is bad)
	dark_aux(*)	real		dark_aux(SMEI__DRK_PEDESTAL)
					    pedestal (return value of smei_frm_ped)
					dark_aux(SMEI__DRK_HEADROOM)
					    used in median calculation of dark current

					dark_aux(SMEI__DRK_RATIO)
					    ratio of dark current in frame and dark current
					    in pattern. If set bad, then the pattern array is
					    not used. The caller sets the ratio by using some
					     estimate for the dark current in the frame.
					dark_aux(SMEI__DRK_CUT)
					    threshold above pedestal used to reject dark
					    current pedestal.
					    (not accessed if dark_aux(SMEI__DRK_RATIO) is bad)
					dark_aux(SMEI__DRK_POWER)
					    not used (yet?)
 OUTPUTS:
	smei_frm_dark	real		# pixels contributing to dark current
	dark_val	real		dark current value (with pedestal subtracted)
					    if dark_val is bad then smei_frm_dark=0 and v.v.
	dark_pixs(*)	real		all dark current pixel values (with pedestal subtracted)
					    used to calculate dark_val. If the pattern was
					    used than 'cosmic ray' pixels were flagged as bad.
	dark_aux(*)	real		three entries
					dark_aux(SMEI__DRK_MEAN  ) mean-based dark current
					dark_aux(SMEI__DRK_MEDIAN) median-based dark current
					dark_aux(SMEI__DRK_STDEV ) standard deviation of dark_val
 CALLED BY:
	smei_cal_build, smei_frm_base
 INCLUDE:
	include		'smei_frm_layout.h'
	include		'smei_frm_basepar.h'
 CALLS: ***
	ArrR4AddConstant, ArrR4Mean, ArrR4Median, ArrR4Stdev, BadR4, smei_frm_pickup
 RESTRICTIONS:
	The values in the pattern (when used) should all be valid,
	i.e. no BadR4() values at least for those pixels in the
	input frame which are expected to contain valid data.
 SEE ALSO:
	smei_frm_clean, smei_frm_ped
 PROCEDURE:
	Only the dark current values in the frame are accessed (4 columns left and right
	in engineering mode).

	If dark_aux(SMEI__DRK_RATIO) is bad then the return value 'dark_val' is the median
	or the mean (depending on setting of bMedian) of the dark current pixels, with the
	pedestal value in dark_aux(SMEI__DRK_PEDESTAL) subtracted.

	If the pattern and dark ratio are available (dark_aux(SMEI__DRK_RATIO) is NOT bad)
	then the best estimate of the expected dark current is
	   dark_aux(SMEI__DRK_PEDESTAL)+dark_aux(SMEI__DRK_RATIO)*pattern
	
	The threshold dark_aux(SMEI__DRK_CUT) is used to detect spikes ('cosmic rays'):
	by rejected dark current pixels with values above
	   dark_aux(SMEI__DRK_PEDESTAL)+dark_aux(SMEI__DRK_RATIO)*pattern+dark_aux(SMEI__DRK_CUT).
	The median (or mean) is then calculated after the spikes have been flagged as bad.

	Note that the pattern is multiplied with the dark ratio, and NOT with some power of the
	dark ratio as in ???.
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS)
	JUL-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Both mean and median are now calculated and returned in
	    dark_aux(SMEI__DRK_MEAN) and dark_aux(SMEI__DRK_MEDIAN).
	    The return value dark_val is one of these two, depending
	    on setting of bMedian.


smei_frm_fts $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_fts.f
[Previous] [Next]
 NAME:
	smei_frm_fts
 PURPOSE:
	Write SMEI CCD frame to Fits file
 CALLING SEQUENCE:
	subroutine smei_frm_fts(cFile,nx,ny,nb,frame,hdr,bforce)
 INPUTS:
	cFile*(*)	character	fully-qualified Fits filename
	nx		integer		1st array dimension
	ny		integer		2nd array dimension
	nb		integer		2=int 2; 4=int 4; -4=float
	frame(*)	real		CCD frame array
	hdr(*)		double precision CCD header array
	bforce		logical		if .TRUE. then force overwrite
					if file exists already.
 CALLS: ***
	FTCLOS, FTINIT, FTPHPR, FTPKND, FTPKYD, FTPKYJ, FTPKYS, FTPPRE, FTPPRI, FTPPRJ, Time2Str
	iFreeLun, iGetFileSpec, iGetLun, iOSDeleteFile [1], iOSDeleteFile [2]
	iOSDeleteFile [3], iOSDeleteFile [4], iSetFileSpec, say_fts, smei_frm_fts_axis
	smei_frm_fts_base, smei_frm_fts_eph, smei_hdr_str, smei_hdr_time
 CALLED BY:
	smei_base, smei_cal_build, smei_frm_write
 INCLUDE:
	include		'filparts.h'
	include		'smei_frm_hdr.h'
	include		'smei_frm_layout.h'
 MODIFICATION HISTORY:
	JUN-2008, Paul Hick)
	    Added documentation.
	APR-2009, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added bforce argument.


smei_frm_fts_axis $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_fts_axis.f
[Previous] [Next]
 NAME:
	smei_frm_fts_axis
 PURPOSE:
	Process header entries for optical axis
 CALLING SEQUENCE:
	subroutine smei_frm_fts_axis(iU, hdr)
 INPUTS:
	iU		integer			logical unit number of open Fits file
	hdr(*)		double precision	SMEI header array
 OUTPUTS:
 CALLED BY:
	smei_frm_fts, smei_frm_write
 INCLUDE:
	include		'smei_frm_hdr.h'
 CALLS: ***
	FTUKYD, dasind, datan2d, quaternion_rotate_xyz, say_fts, smei_hdr_quaternion
 PROCEDURE:
	Header entries for RA, dec and PA of optical axis are written
	into the open Fits file.
 MODIFICATION HISTORY:
	MAR-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_frm_fts_base $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_fts_base.f
[Previous] [Next]
 NAME:
	smei_frm_fts_base
 PURPOSE:
	Process header entries for optical axis
 CALLING SEQUENCE:
	subroutine smei_frm_fts_base(iU, hdr)
 INPUTS:
	iU		integer			logical unit number of open Fits file
	hdr(*)		double precision	SMEI header array
 OUTPUTS:
 CALLED BY:
	smei_frm_fts, smei_frm_write
 INCLUDE:
	include		'filparts.h'
	include		'smei_frm_hdr.h'
 CALLS: ***
	FTUKYD, FTUKYG, FTUKYJ, FTUKYS, iGetFileSpec, iSetFileSpec, say_fts, smei_hdr_flag
	smei_hdr_str
 PROCEDURE:
	Header entries related to the base calculation are written into
	the open Fits file. In addition all binary flags are combined into
	the header entry SMEI__HDR_FLAGS and is written into the file.
	The Fits update functions FTUK* are used because this routine is
	used both to create the original Fits file and to update them.
 MODIFICATION HISTORY:
	MAR-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_frm_fts_eph $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_fts_eph.f
[Previous] [Next]
 NAME:
	smei_frm_fts_eph
 PURPOSE:
	Process ephemeris related entries in SMEI header
 CALLING SEQUENCE:
	subroutine smei_frm_fts_eph(iU,hdr)
 INPUTS:
	iU		integer			logical unit number of open Fits file
	hdr(*)		double precision	SMEI header array
 OUTPUTS:
	
	hdr(SMEI__HDR_ECLIPSE)
	hdr(SMEI__HDR_SHADOW)
			filled by calls to smei_eclipse
			(but still need to be written to Fits file by
			a subsequent call to smei_frm_fts_base
			(where they are incorporated into the
			SMEI__HDR_FLAGS entry).
 CALLED BY:
	smei_frm_fts, smei_frm_write
 INCLUDE:
	include		'smei_frm_hdr.h'
 CALLS: ***
	FTUKYD, Say, say_fts, smei_eclipse, smei_hdr_eph, smei_hdr_time
 PROCEDURE:
	Unit vectors for Sun, Moon, and Venus in the UCSD camera frame
	are calculated and written into the open Fits file.
	The Fits update functions FTUK* are used because this routine is
	used both to create the original Fits file and to update them.
	(there do not seem to be update routines for arrays of
	parameter values, so we use the update function TPUK* for
	each individual element).
 MODIFICATION HISTORY:
	MAR-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_frm_get $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_get.f
[Previous] [Next]
 NAME:
	smei_frm_get
 PURPOSE:
	Finds SMEI frame in specified time period
 CALLING SEQUENCE:
	logical function smei_frm_get(iFirst,TBeg,TEnd,icam,mode,bdig,cBase,cFrmSpec)
 INPUTS:
	iFirst		integer		1 for new search
					0 to continue search
	TBeg(2)		integer		start time
	TEnd(2)		integer		end time
	icam		integer		camera number (1,2,3)
					passed to smei_frm_path
	mode		integer		mode number (0,1,2)
	bdig		integer
	cBase*(*)	character	root directory of SMEI DB
					passed to smei_frm_path
 OUTPUTS:
	cFrmSpec*(*)	character	fully qualified name of SMEI frame.
 CALLED BY:
	smei_cal, smei_frm_getlist, smei_orb
 INCLUDE:
	include		'filparts.h'
 CALLS: ***
	Time2Differ, smei_Time2Split, smei_frm_getfirst, smei_frm_getnext, smei_frm_path
 PROCEDURE:
	Typically this function is used in a construct like this:

	include		'openfile.h'
	include		'smei_frm_layout.h'

	cBase  = ' '
	call smei_Time2 Split(1, cFrameBeg, TBeg)
	call smei_Time2 Split(1, cFrameEnd, TEnd)
	icam   = 1
	iFirst = 1
	do while (smei_frm_get(iFirst, TBeg, TEnd, icam, cBase, cFrmSpec))
	    if (bReadNic(OPN__REOPEN+OPN__STOP, cFrmSpec, SMEI__FRM_NPIX, nx, ny, nb, frame, ctrailer)) then
		(process frame data in array frame)
	    end if
	end do

	As long as smei_frm_get returns .TRUE. cFrmSpec should return
	frame names from TBeg to TEnd in chronological order.
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS)
	FEB-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added check to make sure that the first record found
	    wit t > TBeg also has t <= TEnd.


smei_frm_getfirst $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_getfirst.f
[Previous] [Next]
 NAME:
	smei_frm_getfirst
 PURPOSE:
	(internal use by smei_frm_get)
 CALLING SEQUENCE:
	logical function smei_frm_getfirst(iFind,cPath,TTime,mode,cFrmSpec)
 INPUTS:
	iFind		integer		1 for new search
					0 to continue search
					(passed to iSearch)
	cPath*(*)	character	directory is SMEI data base where
					data for current doy are located.
	TTime(2)	integer		test time
	mode		integer		mode number (0,1,2)
 OUTPUTS:
	smei_frm_getfirst
			logical		.TRUE. if a frame is found with the mode
						less than requested or if the mode is OK
						but T < TTime
					.FALSE. if no frame is found, or if a frame
						is found with a mode larger than requested
						(cFrmSpec is set to blank string).
					.FALSE. if a frame is found with the right mode
						and T >= TTime. cFrmSpec contains the
						fully-qualified file name
	cFrmSpec*(*)	character	Fully qualified file name of SMEI frame
					or blank string
 CALLED BY:
	smei_frm_get
 INCLUDE:
	include		'filparts.h'
 CALLS: ***
	Time2Differ, bOSFindClose, iFilePath, iGetFileSpec, iSearch [1], iSearch [2]
	iSearch [3], iSearch [4], iSetFileSpec, smei_Time2Split
 PROCEDURE:
	smei_frm_get calls this routine in a while loop that terminates if
	.FALSE. is returned. On a .FALSE. return, cFrmSpec contains a filename
	only if it has the right mode, and T >= TTime.
 MODIFICATION HISTORY:
	MAR-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_frm_getlist $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_getlist.f
[Previous] [Next]
 NAME:
	smei_frm_getlist
 CALLING SEQUENCE:
	integer function smei_frm_getlist(TBeg,TEnd,icam,mode,bdig,cBase,cList)
 CALLED BY:
	smei_base, smei_skyd
 INCLUDE:
	include		'openfile.h'
	include		'dirspec [1].h'
	include		'dirspec [2].h'
	include		'dirspec [3].h'
	include		'dirspec [4].h'
	include		'filparts.h'
	include		'smei_frm_layout.h'
 CALLS: ***
	GETPID, Int2Str, Str2Str, Time2Str, bOpenFile, iFilePath, iFreeLun, iGetFileSpec
	iSetFileSpec, itrim, smei_frm_get
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS)
	MAR-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	   Mode argument was there already, but was not doing anything.
	   Now it does.


smei_frm_getnext $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_getnext.f
[Previous] [Next]
 NAME:
	smei_frm_getnext
 PURPOSE:
	(internal use by smei_frm_get)
 CALLING SEQUENCE:
	logical function smei_frm_getnext(iFind,cPath,TTime,mode,cFrmSpec)
 INPUTS:
	iFind		integer		1 for new search
					0 to continue search
					(passed to iSearch)
	cPath*(*)	character	directory is SMEI data base where
					data for current doy are located.
	TTime(2)	integer		test time
	mode		integer		mode number (0,1,2)
 OUTPUTS:
	smei_frm_getnext
			logical		.TRUE. if a frame is found with mode less than 
						requested.
					.FALSE. if no frame is found, cFrmSpec is blank
					.FALSE. if frame is found with mode larger than
						requested. cFrmSpec is blank
					.FALSE. if frame is found right mode but with
						T > TTime; cFrmSpec is blank
					.FALSE. if frame is found with right mode and
						T <= TTime; cFrmSpec contains
						fully-qualified filename
	cFrmSpec*(*)	character	Fully qualified file name of SMEI frame
					or blank string
 CALLED BY:
	smei_frm_get
 INCLUDE:
	include		'filparts.h'
 CALLS: ***
	Time2Differ, bOSFindClose, iFilePath, iGetFileSpec, iSearch [1], iSearch [2]
	iSearch [3], iSearch [4], iSetFileSpec, smei_Time2Split
 PROCEDURE:
	smei_frm_get calls this routine in a while loop, that terminates
	when .FALSE. is returned. On a .FALSE. return cFrmSpec contains a
	filename only if it has the right mode and T <= TTime.
 MODIFICATION HISTORY:
	MAR-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_frm_hdr $SSW_SMEI_UCSD/gen/for/h/smei_frm_hdr.h
[Previous] [Next]
 NAME:
	smei_frm_hdr
 PURPOSE:
	Parameter definition for handling Fits frame headers
 CALLING SEQUENCE:
	include		'smei_frm_hdr.h'
 INCLUDED BY:
	NicHdr, Peep, smei_base, smei_cal, smei_cal_bin, smei_cal_build, smei_frm_clean
	smei_frm_fts, smei_frm_fts_axis, smei_frm_fts_base, smei_frm_fts_eph
	smei_frm_ok, smei_frm_read, smei_frm_saturated, smei_frm_write, smei_hdr_flag
	smei_hdr_quaternion, smei_hdr_str, smei_hdr_time, smei_orb, smei_skyd
	smei_skyd_sky
 PROCEDURE:
	Used as array indices into the real*8 array used to
	store the Fits header.
 MODIFICATION HISTORY:
	FEB-2005, Paul Hick (UCSD/CASS)
	JUL-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added SMEI__DARK_MEAN


smei_frm_hdrok $SSW_SMEI_UCSD/gen/for/h/smei_frm_hdrok.h
[Previous] [Next]
 NAME:
	smei_frm_hdrok
 PURPOSE:
	Parameters for Fits header entries set in smei_frm_ok
 CATEGORY:
	gen/for/h
 CALLING SEQUENCE:
	include 'smei_frm_hdrok'
 INCLUDED BY:
	smei_frm_ok, smei_orb, smei_skyd, smei_skyd_sky
 MODIFICATION HISTORY:
	JUN-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_frm_layout $SSW_SMEI_UCSD/gen/for/h/smei_frm_layout.h
[Previous] [Next]
 NAME:
	smei_frm_layout
 PURPOSE:
	Include file with parameter definitions for SMEI data frames
 CATEGORY:
	ucsd/camera/for/h
 CALLING SEQUENCE:
	include		'smei_frm_layout.h'
 INCLUDED BY:
	NicHdr, Peep, smei_base, smei_cal, smei_cal_add, smei_cal_bin, smei_cal_build
	smei_cal_c3mask, smei_cal_get, smei_cal_read, smei_cal_write, smei_frm_base
	smei_frm_c3fudge, smei_frm_c3mask_active, smei_frm_clean, smei_frm_dark
	smei_frm_fts, smei_frm_getlist, smei_frm_measle, smei_frm_mode, smei_frm_path
	smei_frm_ped, smei_frm_pickup, smei_frm_read, smei_frm_saturated, smei_frm_stats
	smei_frm_write, smei_get_glare, smei_get_lsff, smei_orb, smei_orb_get
	smei_orb_min, smei_orb_mkname, smei_orb_read, smei_orb_write, smei_sky_iread
	smei_sky_read, smei_skyd, smei_skyd_sky
 PROCEDURE:
	Frame layout for mode 0 (engineering mode)
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_frm_measle $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_measle.f
[Previous] [Next]
 NAME:
	smei_frm_measle
 PURPOSE:
	Measle detector
 CATEGORY:
 CALLING SEQUENCE:
	subroutine smei_frm_measle(kill,icam,nx,ny,frame,count,count_big,mask,indx)
 INPUTS:
	kill		logical		.TRUE. : set measles to bad value
					.FALSE.: set measles to neighbours average
	icam		integer		camera number (1,2,3)
					not used yet
	nx		integer		horizontal frame size (1272 for mode 0)
	ny		integer		vertical frame size (256 for mode 0)
	frame(nx,ny)	real		SMEI frame after pedestal and dark current have been subtracted
	indx(nx,ny)	integer		scratch array
 OUTPUTS:
	frame(nx,ny)	real		SMEI frame with value of measles replace by a
					an neighbours average.
					Only the uncovered pixels are tested. Pedestal and dark current
					areas are not modified.
	mask(nx,ny)	integer		1 if pixel is OK
					0 if pixel is flagged as measle
					mask will be 1 for all pedestal and dark current pixels.
	count		integer		# measles found
	count_big	integer		# big measles (with at most 3 of the neighbour pixels
					modified too
 CALLED BY:
	smei_base, smei_cal
 INCLUDE:
	include		'smei_frm_layout.h'
 CALLS: ***
	ArrI4Constant, ArrR4GetMinMax, BadR4, IndexR4, iArrR4ValuePresent, smei_FitPlane
	smei_frm_mode
 PROCEDURE:
	Uses the ADUs departure of
	a pixel from its neighbors-average z0 to trigger its replacement/elimination.
	The response must be above a fixed value "val_cut" and be at least double the
	8-pixel average response z0. Also, the departure from the neighbors average
	is compared to the difference of neighboring pixels on opposing sides of the
	center pixel.
 MODIFICATION HISTORY:
	JUN-2004, Andy Buffington (UCSD/CASS; abuffington@ucsd.edu), Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_frm_mode $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_mode.f
[Previous] [Next]
 NAME:
	smei_frm_mode
 PURPOSE:
	Get mode and binning factor for SMEI data
 CATEGORY:
	ucsd/camera/for/lib
 CALLING SEQUENCE:
	integer function smei_frm_mode(N, ibin)
 INPUTS:
	N		integer		identifies size of SMEI frame
					Can be horizontal size, vertical size
					or total number of pixels in frame
 OUTPUTS:
	smei_frm_mode	integer		mode ID (0, 1 or 2)
	ibin		integer		binning factor (=2^mode, i.e. 1,2 or 4)
 CALLED BY:
	smei_cal, smei_cal_build, smei_frm_base, smei_frm_clean, smei_frm_measle
	smei_frm_pickup, smei_frm_stats, smei_orb, smei_orb_min
 INCLUDE:
	include		'smei_frm_layout.h'
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_frm_ok $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_ok.f
[Previous] [Next]
 NAME:
	smei_frm_ok
 PURPOSE:
	Process command line arguments related to frame selection
 CALLING SEQUENCE:
	logical function smei_frm_ok(cArg,cName,hdr,hdrok,iSilent)
 INPUTS:
	cName*(*)	character		file name of frame
	cArg*(*)	character		command line keywords
	hdr(*)		double precision	frame header array
	iSilent		integer			higher value suppresses more 
						informational messages
 CALLED BY:
	smei_orb, smei_skyd
 INCLUDE:
	include		'smei_frm_hdr.h'
	include		'smei_frm_hdrok.h'
 CALLS: ***
	ArrR8Copy, ArrR8Zero, Dbl2Str, ForeignArgSet, ForeignI4Arg, ForeignR8ArgN, Int2Str
	Say, Str2Str, datan2d, itrim
 PROCEDURE:
	bodyexcl(4,3)   double precision
					defines exclusion area around optical axis for Sun, Moon
					and Venus: if Sun, Moon or Venus are inside the exclusion
					area the frame will not be used for indexing.
					The exclusion area is defined in terms of
					theta-x = atan(rx,rz) and theta-y=atan(ry/rz), where
					(rx,ry,rz) is the unit vector to Sun, Moon, Venus in the
					camera coordinate frame
					If
						bodyexcl(1,i) <= theta_x <= bodyexcl(2,i)
						bodyexcl(3,i) <= theta_y <= bodyexcl(4,i)
					then the corresponding frame is excluded, where
					i=0 is the Sun, i=1 is the Moon, i=2 is Venus.
					The values for the Sun are extracted from cmd line arg
					-sunbox=tx1,tx2,ty1,ty2. The moon is extracted
					from -moonbox=tx1,tx2,ty1,ty2, and Venus from
					-venusbox=tx1,tx2,ty1,ty2 (all angles in degrees).
					Setting keyword -avoid_moon is equivalent to
					-moonbox=-42,42,-6.5,6.5 degrees.
 MODIFICATION HISTORY:
	MAY-2005, Paul Hick (UCSD/CASS)
	JUL-2006, Paul Hick (UCSD/CASS)
	    Added check for bad quaternions.
	NOV-2008, Paul Hick (UCSD/CASS)
	    Added default box for avoiding Sun.
	    Fixed bug in processing of avoid* keywords.


smei_frm_path $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_path.f
[Previous] [Next]
 NAME:
	smei_frm_path
 PURPOSE:
	Determines directory where frame for given time and camera
	is located
 CATEGORY:
 CALLING SEQUENCE:
	integer function smei_frm_path(bdig, cFile, TT, camera, cBase, cPath)
 INPUTS:
	bdig		logical		=.FALSE.: return base drive (e.g. /smeidb/db3/
					=.TRUE. : return base directory (e.g. /smeidb/db3/2004_001/)
	cFile		character*(*)	file name of SMEI frame (without directory)
					if itrim(cFile) .ne. 0 then TT and camera are
						extracted from the frame name
	TT(2)		integer		standard 2-element time
	camera		integer		camera number
	cBase*(*)	character	root directory of SMEI DB
					if left blank than the environment variables
					SMEIDB1, SMEIDB2, etc. are used
 OUTPUTS:
	TT(2)		integer		if cFile .ne. ' ', frame time
	camera		integer		if cFile .ne. ' ', camera number
	cPath*(*)	character	directory where frame is located
 CALLS: ***
	Say, Str2Flt, Str2Flt_Format, Time2Differ, Time2Str, Time2YDoy, bOpenFile, cInt2Str
	iFilePath, iFreeLun, iGetLogical [1], iGetLogical [2], iGetLogical [3], itrim
	smei_Time2Split
 CALLED BY:
	smei_cal, smei_frm_get, smei_frm_read, smei_frm_read_get_sdark, smei_frm_write
 INCLUDE:
	include		'dirspec [1].h'
	include		'dirspec [2].h'
	include		'dirspec [3].h'
	include		'dirspec [4].h'
	include		'openfile.h'
	include		'filparts.h'
	include		'smei_frm_layout.h'
 RESTRICTIONS:
	Env variables $SMEIDB1, $SMEIDB2, etc. need to be stored in the
	log file $HOME/LOGFIL.TXT (this should be done automatically by the login
	script $com/login.
 PROCEDURE:
	If cFile is not a blank string, it should be the filename (without directory)
	of a SMEI frame, e.g. c1frm_2003_123456. The file type is ignored.
	If cFile is the blank string then arguments TT and camera are used to construct
	a frame name.
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS)
	NOV-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Maximum number of drives is now 16 (was 8)


smei_frm_ped $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_ped.f
[Previous] [Next]
 NAME:
	smei_frm_ped
 PURPOSE:
	Calculate pedestal for SMEI data frame
 CATEGORY:
 CALLING SEQUENCE:
	integer function smei_frm_ped(cframe,nx,ny,frame,pattern,ped_val,ped_aux)
 INPUTS:
	cframe		character*(*)	frame name (contains time and camera)
	nx		integer		horizontal frame size
	ny		integer		vertical frame size
	frame(nx,ny)	real		frame data (after massaging by smei_frm_clean)
	pattern(nx,ny)	real		"shutter-closed" calibration pattern
					The pattern is only used if ped_aux(SMEI__PED_RIGHT_OFFSET)
					is NOT bad, in which case it is subtracted from the
					pedestal columns prior to updating the left-right offset
					stored in this element of ped_aux.
					This is only used for camera 3 when both sides of the frame
					are used for the pedestal determination.
	ped_aux(*)	real		six entries:

					ped_aux(SMEI__PED_RIGHT_OFFSET)
					    Offset between mean left and right pedestal. If not
					    set to bad than naive means are calculated after taking
					    out the pattern and this left-to-right offset.
					    If set to bad, then the pattern array is not accessed.

					ped_aux(SMEI__PED_MEAN_REF    )  mean 'reference' pedestal
					ped_aux(SMEI__PED_MEAN_EXCESS )  mean excess
					    frames with naive mean above the threshold
						ped_aux(SMEI__PED_MEAN_REF)+ped_aux(SMEI__PED_MEAN_EXCESS)
					    are rejected.
					    If the right-to-left offset ped_aux(SMEI__PED_RIGHT_OFFSET)
					    is not bad then the means are calculated after taking out
					    the pattern and the right-to-left offset.

					ped_aux(SMEI__PED_MEDIAN_DEFICIT)
					ped_aux(SMEI__PED_MEDIAN_EXCESS )
					    only pedestal pixels with values between
					    the naive median pedestal+median_deficit and
					    naive median pedestal+median_excess.
					    are used to get the final pedestal.
					    If set to BadR4() the corresponding
					    restriction is not applied
 OUTPUTS:
	smei_frm_ped	integer		# pixels used in final pedestal calculation
					If only the left side of the frame is
					used for the pedestal calculation, i.e. if 
					ped_aux(SMEI__PED_LEFT_SIDE_ONLY) .ne. bad,
					then the result is multiplied by 2 before
					returning.
	ped_val		real		pedestal
					value will be bad if
					- no valid pedestal pixels (smei_frm_ped=0)
					- mean pedestal higher than ped_mean_ref+ped_mean_excess
	ped_aux(*)	real		six entries:
					ped_aux(SMEI__PED_RIGHT_OFFSET	)  updated right-to-left offset
					    Updated only if input was not bad. Update depends on input
					    value of ped_aux(SMEI__PED_MEAN_EXCESS).
					ped_aux(SMEI__PED_LEFT_SIDE_ONLY)  use left ped cols only
					    used only if ped_aux(SMEI__PED_RIGHT_OFFSET) is set to bad
					    (no pattern used).
					ped_aux(SMEI__PED_NAIVE_MEAN	)  naive mean pedestal
					ped_aux(SMEI__PED_NAIVE_MEDIAN	)  naive pedestal median
					ped_aux(SMEI__PED_MEDIAN_LOW	)  naive median+median_deficit
					ped_aux(SMEI__PED_MEDIAN_HIGH	)  naive median+median_excess
					ped_aux(SMEI__PED_VERY_LOW	)  ??
					ped_aux(SMEI__PED_STDEV		)  standard dev. of ped_val
 CALLS: ***
	ArrR4AddConstant, ArrR4Mean, ArrR4Median, ArrR4MinusArrR4, ArrR4Stdev, BadR4, Say
	cFlt2Str, smei_frm_ped_guess, smei_frm_pickup
 CALLED BY:
	smei_cal_build, smei_frm_base
 SEE ALSO:
	smei_frm_clean
 RESTRICTIONS:
	The median deficit must be negative, the median excess must
	be positive. If not, all bets are off.
 INCLUDE:
	include		'smei_frm_layout.h'
	include		'smei_frm_basepar.h'
 PROCEDURE:
	SMEI__* parameters are defined in the two include files.

	Better check the code to find out what 'naive' means
	these days.

	Only the pedestal values in the frame are accessed (4
	columns left and right in engineering mode)

	First the 'naive' mean pedestal (average over all pedestal
	pixels with valid values) is calculated and compared with
	ped_mean_ref+ped_mean_excess. If the 'naive' mean is higher
	than ped_mean_ref+ped_mean_excess the pedestal is rejected.

	If this first test is passed then the median pedestal is
	calculated. All pedestal pixels more than ped_median_excess
	above the median are rejected. (the median+ped_median_excess
	is returned in ped_median_high).

	The mean of the remaining pixels is returned as the
	pedestal ped_val
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS)
	FEB-2007, Paul Hick (UCSD/CASS)
	    Added option to use only left side of frame to calculate
	    the pedestal when the pattern is not used.
	NOV-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added argument cframe.
	    Mean pedestal is now calculated with smei_frm_ped_guess.
	    A constant value (hardcoded in smei_base and smei_cal)
	    was passed in as ped_aux(SMEI__PED_MEAN_REF).
	    This is not accessed anymore.


smei_frm_ped_guess $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_ped_guess.f
[Previous] [Next]
 NAME:
	smei_frm_ped_guess
 PURPOSE:
	Used to get a "best guess" for the pedestal of a CCD frame.
	Set mean reference pedestal
 CALLING SEQUENCE:
	function smei_frm_ped_guess(cframe)
 INPUTS:
	cframe	character*(*)	frame name
				(contains time and camer number)
 CALLED BY:
	smei_frm_base, smei_frm_ped
 INCLUDE:
	include		'filparts.h'
 CALLS: ***
	Say, Time2DHMS, Time2Day, Time2Delta, Time2YMD, cFlt2Str, iGetFileSpec, iSetFileSpec
	smei_Time2Split
 RESTRICTIONS:
 PROCEDURE:
	Currently the mean pedestal is calculated from a linear
	trend with time based on 5 years of data.
 MODIFICATION HISTORY:
	NOV-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	AUG-2010, John Clover (UCSD/CASS)
	    Changed camera 2 pedestal change per day to 0.01252


smei_frm_pickup $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_pickup.f
[Previous] [Next]
 NAME:
	smei_frm_pickup
 PURPOSE:
	Pick up pedestal or dark current pixels
 CATEGORY:
	ucsd/camera/for/lib
 CALLING SEQUENCE:
	integer function smei_frm_pickup( id, nx, ny, frame, pixs )
 INPUTS:
	id		integer		mod(id,4)=0: pick up pedestal pixels
					mod(id,4)=1: pick up dark current pixels
					mod(id,4)=2: pick up squares outside FOV arc
					mod(id,4)=3: pick up center inside FOV arc

					bit 2 NOT set: do not pick up left side of CCD
					bit 2 SET    : pick up left side of CCD

					bit 3 NOT set: do not pick up right side of CCD
					bit 3 SET    : pick up right side of CCD

					If neither bit 2 nor bit 3 are set then both
					left and right side are extracted (i.e. both
					bits are assumed SET).
	nx		integer		horizontal frame size
	ny		integer		vertical frame size
	frame  (nx,ny)	real		frame data
 OUTPUT:
	smei_frm_pickup	integer		# pedestal or dark current pixels
	pixs(n)		real		frame values in pedestal or dark current pixels
 CALLED BY:
	smei_base, smei_cal, smei_frm_dark, smei_frm_ped
 INCLUDE:
	include		'smei_frm_layout.h'
 CALLS: ***
	smei_frm_mode
 MODIFICATION HISTORY:
	DEC-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_frm_ratio $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_ratio.f
[Previous] [Next]
 NAME:
	smei_frm_ratio
 PURPOSE:
	Set dark current ratio for camera 3, mode 1
 CALLING SEQUENCE:
	function smei_frm_ratio(tt)
 INPUTS:
	tt	integer(2)	SMEI frame time
 CALLS: ***
	Say, Time2DHMS, Time2Day, Time2Delta, Time2YMD, cFlt2Str, cTime2Str
 CALLED BY:
	smei_frm_base
 PROCEDURE:
	The dark ratio is from a fit to a function
	f(t) = 1-exp(-(t-b)/a)
	where t is the number of days since 2003/04/15 0 UT
	The fit is done by the IDL procedure smei_frm_darkratio.pro
 RESTRICTIONS:
	The origin t0 (currently 2003/04/15 0 UT) MUST match the
	origin in the IDL procedure!!.
 MODIFICATION HISTORY:
	NOV-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_frm_read $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_read.f
[Previous] [Next]
 NAME:
	smei_frm_read
 PURPOSE:
	Read SMEI frame
 CATEGORY:
	I/O
 CALLING SEQUENCE:
	logical function smei_frm_read(iAct0,cFile,N,nX,nY,nB,Img,hdr,headroom)
 INPUTS:
	iAct0		integer		open code passed to bOpenFile
					Usually set to zero. If cFile is known
					to exist (e.g. a return value from
					iSearch [1]) then file access can be
					made more efficient by using the value 
					OPN__REOPEN (defined in openfile.h).
	cFile		character*(*)	file name. If no explicit directory
					is specified then the SMEI databases
					are tried, first SMEIDC, then SMEIDB.
	N		integer		size of Img
 OUTPUTS:
	smei_frm_read	logical		.TRUE. : success
					.FALSE.: failure
	nX		integer		horizontal size of image
	nY		integer		vertical size of image
	nB		integer		# bytes per number on input file
					2 for integer*2
					4 for integer*4
					-4 for real*4
	Img(nX*nY)	real		image data
					(the image read from file divided by the
					the headroom)
	hdr(*)		double precision
					array with frame header entries
	headroom	real		headroom (1.0 or 0.75)
 CALLS: ***
	ArrR4TimesConstant, ArrR8Zero, FTCLOS, FTGISZ, FTGKND, FTGKYD, FTGKYJ, FTGKYS, FTGPVE
	FTNOPN, NicHdr, Say, Time2Str, bReadNic, iFreeLun, iGetFileSpec, iGetLun, iSetFileSpec
	say_fts, smei_Time2Split, smei_frm_c3mask_active, smei_frm_path, smei_hdr_flag
	smei_hdr_str, smei_hdr_time
 CALLED BY:
	Peep, smei_base, smei_cal, smei_cal_build, smei_orb, smei_skyd
 SEE ALSO:
	bWriteFrm, bWriteNic
 RESTRICTIONS:
	Reading of *.gz files depends on availability of gzip
	(windows) or gunzip (Linux).
 INCLUDE:
	include		'filparts.h'
	include		'smei_frm_layout.h'
	include		'smei_frm_hdr.h'
	include		'ftspar.h'
 PROCEDURE:
	See bReadNic
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS)
	JUN-2005, Paul Hick (UCSD/CASS)
	    Added check for presence of VERSION keyword in header. In
	    early Fits files produced by IDL this keyword was not present.
	AUG-2005, Paul Hick (UCSD/CASS)
	    Fixed bug that affected the factor two compensation applied to
	    correct for the onboard gain change in Feb 2005 for cam 2, mode 1.
	    The frame time was not picked up correctly from the header.
	APR-2006, Paul Hick (UCSD/CASS)
	    If no directory is specifed in cFile, first SMEIDC, then SMEIDB
	    is tried (only SMEIDB was checked before).
	JUN-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Bug fixes. For time periods with a "bad pixel" mask onboard
	    (smei_frm_c3mask_active(0,ctime,-1,cmask)=1)
	    two errors were made:
	    - For camera 3, mode 1, the gain change of a factor two was
	      not applied to frames with the flat_enabled flag off (zero)
	      In smei_base this would have failed all frames.
	      In smei_cal  this would have had no effect (the mask setting
	      is not used when mode=0 and flat_enabled=0 as is the case
	      for the weekly calibration data).
	      In smei_orb the orbital pattern would have been wrong when
	      flat_enabled=0. This occurs the first time after 2007_133,
	      but this has not yet been run through smei_orb at this time.
	      In smei_skyd the skyamp would have been wrong also if
	      flat_enabled=0, i.e after 2007_133, but these data have not
	      been run yet.
	    - For cameras 1 and 2 the headroom 0.75 was not corrected for
	      if flat_enabled=1.
	      In smei_base this would have resulted in a pedestal and
	      and dark current of 0.75 the correct value.
	      In smei_base this would have had no effect (since always
	      flat_enabled=0 for the weekly calibration data)
	      smei_orb is never run for cameras 1 and 2.
	      In smei_skyd the resulting skymap would be too low by
	      about 0.75 if the same error was made in smei_base. However,
	      if the pedestal and dark current were calculate with
	      a smei_base version < 4.00, then the error would not be
	      a simple scaling.


smei_frm_read_get_sdark $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_read.f
[Previous] [Next]
 NAME:
	smei_frm_read_get_sdark
 CALLING SEQUENCE:
	entry smei_frm_read_get_sdark(idark)
 CALLS: ***
	ArrR4TimesConstant, ArrR8Zero, FTCLOS, FTGISZ, FTGKND, FTGKYD, FTGKYJ, FTGKYS, FTGPVE
	FTNOPN, NicHdr, Say, Time2Str, bReadNic, iFreeLun, iGetFileSpec, iGetLun, iSetFileSpec
	say_fts, smei_Time2Split, smei_frm_c3mask_active, smei_frm_path, smei_hdr_flag
	smei_hdr_str, smei_hdr_time
 CALLED BY:
	smei_orb_get


smei_frm_read_set_dark $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_read.f
[Previous] [Next]
 NAME:
	smei_frm_read_set_dark
 CALLING SEQUENCE:
	entry smei_frm_read_set_sdark(idark)


smei_frm_saturated $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_saturated.f
[Previous] [Next]
 NAME:
	smei_frm_saturated
 PURPOSE:
	Count saturated pixels
 CATEGORY:
	ucsd/camera/for/lib
 CALLING SEQUENCE:
	integer function smei_frm_saturated(hdr, frame)
 INPUTS:
	hdr(*)		double precision	SMEI frm header
	frame(*)	real			frame data (from smei_frm_read)
 OUTPUTS:
	smei_frm_saturated
			integer		# saturated pixels
 CALLS:
	iArrR4ValuePresent
 CALLED BY:
	smei_base, smei_cal
 INCLUDE:
	include		'smei_frm_layout.h'
	include		'smei_frm_hdr.h'
 PROCEDURE:
	If the onboard flatfield is NOT enable then every pixel
	with readout >= 65533 is counted as saturated.
	(strictly speaking the saturation value is 65535, but for
	camera 3 in mode 1 the highest value appears to be
	65533 at least some of the time).
	If the onboard flatfield is enabled (and the headroom of
	0.75 is applied) then 49147 is used).
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS)
	AUG-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Changed saturation value from 65535 to 65533.


smei_frm_stats $SSW_SMEI_UCSD/gen/for/lib/frm/smei_frm_stats.f
[Previous] [Next]
 NAME:
	smei_frm_stats
 PURPOSE:
	Determines some stats on frame after measle removal
 CALLING SEQUENCE:
	subroutine smei_frm_stats(nx,ny,frame,pixsum,ipixsum,pixdif,ipixdif)
 INPUTS:
	nx		integer
	ny		integer
	frame(nx,ny)	real
 OUTPUTS:
	pixsum		real
	ipixsum		integer
	pixdif		real
	ipixdif		integer
 CALLED BY:
	smei_base, smei_cal
 INCLUDE:
	include		'smei_frm_layout.h'
 CALLS: ***
	BadR4, smei_frm_mode
 MODIFICATION HISTORY:


smei_get_lsff $SSW_SMEI_UCSD/gen/for/lib/frm/smei_get_lsff.f
[Previous] [Next]
 NAME:
	smei_get_lsff
 PURPOSE:
	Get flat field correction.
 CALLING SEQUENCE:
	subroutine smei_get_lsff(mode,icam,flatfield)
 INPUTS:
	icam		integer		camera number (1,2,3)
	mode		integer		camera mode (0,1,2)
 OUTPUTS:
	flatfield(*)	real		flatfield correction
 CALLED BY:
	smei_skyd_fts, smei_skyd_init, smei_skyd_make, smei_skyd_sky
 INCLUDE:
	include		'filparts.h'
	include		'dirspec [1].h'
	include		'dirspec [2].h'
	include		'dirspec [3].h'
	include		'dirspec [4].h'
	include		'smei_frm_layout.h'
	include		'ftspar.h'
 CALLS: ***
	BADR4SET, FTCLOS, FTGISZ, FTGPVE, FTNOPN, GridFill, iFilePath, iFreeLun, iGetLun, say_fts
 PROCEDURE:
	The first nX * nY elements of flatfield will be filled where
	nX = 1272, 636 or 318 and nY = 256, 128, 64 for mode 0,1 and
	2, respectively.
 MODIFICATION HISTORY:
	DEC-2004, Paul Hick (UCSD/CASS)
	JAN-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Replaced all zeroes by one in output array.


smei_hdr_eph $SSW_SMEI_UCSD/gen/for/lib/frm/smei_hdr_eph.f
[Previous] [Next]
 NAME:
	smei_hdr_eph
 PURPOSE:
	Get direction to specified body in camera coordinate frame
 CALLING SEQUENCE:
	logical function smei_hdr_eph(hdr,id,nbody,rx,ry,rz)
 INPUTS:
	hdr(*)		double precision
					SMEI frame header
	id		integer		0: geocentric direction, using JPL ephemeris
					1: geocentric direction, use USNO ephemeris (not implemented yet)
					2: topocentric direction, using JPL ephemeris
					3: topocentric direction, use USNO ephemeris (not implemented yet)
					The topocentric direction takes the spacecraft location
					into account.
	nbody		integer		0,..,10
					Any of the bodies used by the JPL ephemeris
 OUTPUTS:
	rx,ry,rz	double precision
					x,y,z components of a unit vector
					in the UCSD camera coordinate frame.
 CALLS: ***
	Time2jpl_eph, Time2smei_eph, quaternion_rotate_xyz, smei_hdr_quaternion
	smei_hdr_time
 CALLED BY:
	smei_frm_fts_eph
 RESTRICTIONS:
	It may be necessary to close the JPL ephemeris
	with a call to jpl_close()
 PROCEDURE:
	(rx,ry,rz) is a vector on the unit sphere defining the
	direction to the selected body. The components are defined
	in the UCSD camera coordinate frame.

	Several angles can be derived from this.
	The direction cosine angles follow by taking the arcsin:
		tx = asind(rx)
		ty = asind(ry)
	The rotation angles (needed for the glare removal):
		tx = asind( sind(tx)/cosd(ty) ) = asind( rx/cosd( asind(ry) )
		ty = asind( sind(ty)/cosd(tx) ) = asind( ry/cosd( asind(rx) )
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_hdr_flag $SSW_SMEI_UCSD/gen/for/lib/frm/smei_hdr_flag.f
[Previous] [Next]
 NAME:
	smei_hdr_flag
 PURPOSE:
	Manipulate binary flags in SMEI header
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine smei_hdr_flag(id,iflag,hdr)
 INPUTS:
	id	integer			0: read all flags from iflag into hdr
					1: write all flags from hdr into iflag
					2: only read UCSD flags
					3: only write UCSD flags
	iflag	integer
	hdr(*)	double precision	SMEI frm header
 OUTPUTS:
	hdr(*)	double precision	updated heaer
 CALLED BY:
	smei_frm_fts_base, smei_frm_read, smei_frm_read_get_sdark
 INCLUDE:
	include		'smei_frm_hdr.h'
 PROCEDURE:
 MODIFICATION HISTORY:
	MAR-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_hdr_quaternion $SSW_SMEI_UCSD/gen/for/lib/frm/smei_hdr_quaternion.f
[Previous] [Next]
 NAME:
	smei_hdr_quaternion
 PURPOSE:
	Extract quaternion from SMEI frame header
 CALLING SEQUENCE:
	subroutine smei_hdr_quaternion(hdr,id,qq)
 INPUTS:
	hdr(*)		double precision
					SMEI frame header
	id		integer		=0: return Coriolis quaternion
					=1: return sky-to-cam quaternion
					=2: return cam-to-sky quaternion
 OUTPUTS:
	qq(4)		double precision
					Coriolis s/c or camera quaternion
 CALLED BY:
	smei_frm_fts_axis, smei_hdr_eph, smei_skyd_fts, smei_skyd_init, smei_skyd_make
	smei_skyd_sky
 INCLUDE:
	include		'smei_frm_hdr.h'
 CALLS: ***
	quaternion_inverse, quaternion_multiply
 SEE ALSO:
	quaternion_rotate_xyz
 PROCEDURE:
 >	For id=0 the quaternion qcoriolis stored in the frame header is returned.
	This rotates vectors from equatorial sky coordinates to HAFB
	spacecraft coordinates.
 >	Hardcoded in this procedure are quaternions qcam that rotate vectors
	from HAFB spacecraft coordinates to HAFB camera coordinates.
 >	An additional hardcoded quaternion qucsd rotates vectors from HAFB
	camera coordinates to UCSD camera coordinates.
 >	For id=1 these three quaternions are multiplied together to get
	the quaternion qq1=qcoriolis*qcam*qucsd that rotates from equatorial sky
	coordinates to UCSD camera coordinates,
	i.e, if (rx,ry,rz) is a unit vector in equatorial sky coordinates then
		call quaternion_rotate_xyz(qq1,rx,ry,rz)
	will return (rx,ry,rz) in the UCSD camera frame.
 >	For id=2 the inverse quaternion qq2 of the id=1 quaternion is returned,
	which rotates vectors from UCSD camera coordinate to equatorial sky
	coordinates.
	i.e, if (rx,ry,rz) is a unit vector in the UCSD camera frame then
		call quaternion_rotate_xyz(qq2,rx,ry,rz)
	will return (rx,ry,rz) in the equatorial frame.
 MODIFICATION HISTORY:
	DEC-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_hdr_str $SSW_SMEI_UCSD/gen/for/lib/frm/smei_hdr_str.f
[Previous] [Next]
 NAME:
	smei_hdr_str
 PURPOSE:
	Extract character quantities from SMEI frame header
 CALLING SEQUENCE:
	subroutine smei_hdr_str(id, hdr, chdr)
 INPUTS:
	id		integer			abs(id): entry for char entry in SMEI header
						(see smei_frm_hdr.h)
						if id > 0 a string is extracted from hdr
						if id < 0 a string is entered into hdr
	hdr(*)		double precision	SMEI frame header
	chdr		character*(*)		id < 0: string to be put in header
 OUTPUTS:
	chdr		character*(*)		id > 0: sting extracted from header
 CALLED BY:
	smei_base, smei_cal_bin, smei_frm_fts, smei_frm_fts_base, smei_frm_read
	smei_frm_read_get_sdark, smei_orb, smei_skyd
 INCLUDE:
	include		'smei_frm_hdr.h'
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_hdr_time $SSW_SMEI_UCSD/gen/for/lib/frm/smei_hdr_time.f
[Previous] [Next]
 NAME:
	smei_hdr_time
 PURPOSE:
	Extract time from SMEI frame header
 CALLING SEQUENCE:
	subroutine smei_hdr_time(hdr,time)
 INPUTS:
	hdr(*)		double precision	SMEI frame header
 OUTPUTS:
	time(2)		integer			frame time
 CALLED BY:
	smei_cal_bin, smei_frm_fts, smei_frm_fts_eph, smei_frm_read
	smei_frm_read_get_sdark, smei_hdr_eph, smei_skyd_fts, smei_skyd_init
	smei_skyd_make, smei_skyd_sky
 INCLUDE:
	include		'smei_frm_hdr.h'
 CALLS:
	Time2HMS, Time2YDoy
 PROCEDURE:
 MODIFICATION HISTORY:
	DEC-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_inside_fov $SSW_SMEI_UCSD/gen/for/lib/frm/smei_inside_fov.f
[Previous] [Next]
 NAME:
	smei_inside_fov
 PURPOSE:
	Check whether CCD location is inside FOV
 CALLING SEQUENCE:
	logical function smei_inside_fov(icam,mode,dfov,dr,phi)
 INPUTS:
	id	integer			id=0: CCD pixel coord to camera sky coord
					id=1: camera sky coord to CCD pixel coord
	icam	integer			camera id (1,2,3)
	mode	integer			mode (0,1,2)
	dfov(4)	double precision	modification to fov
					dfov(1)	< 0	added to inner radius (pixels)
					dfov(2) > 0	added to outer radius (pixels
					dfov(3) < 0	added to left side of fov (deg)
					dfov(4) > 0	added to right side of fov deg)
	dr	double precision	radial distance to optical axis in
					units of engineering mode pixels
	phi	double precision	angle from optical axis in degrees
					(usually dr,phi are output from smei_axis_cam
					output from smei_ccd_cam)
 OUTPUTS:
	smei_inside_fov	logical		.TRUE. : location inside fov
					.FALSE.: location outside fov
 CALLED BY:
	smei_skyd_fts, smei_skyd_init, smei_skyd_make, smei_skyd_sky
 PROCEDURE:
 MODIFICATION HISTORY:
	FEB-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_min_time $SSW_SMEI_UCSD/gen/for/lib/cal/smei_orb_read.f
[Previous] [Next]
 NAME:
	smei_min_time
 PURPOSE:
	Time of minimum pattern.
 CATEGORY:
	ucsd/camera/for/lib
 CALLING SEQUENCE:
	entry smei_orb_min_time(TTime)
 INPUTS:
	(none)
 OUTPUTS:
	TTime(2)	integer		time of minimum pattern
 CALLS:
	TimeSplit
 PROCEDURE:
	Entry point in smei_orb_read.
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_orb_cal_name $SSW_SMEI_UCSD/gen/for/lib/cal/smei_orb_read.f
[Previous] [Next]
 NAME:
	smei_orb_cal_name
 PURPOSE:
	Name of closed shutter calibration pattern on which the
	orbital pattern is based.
 CATEGORY:
	ucsd/camera/for/lib
 CALLING SEQUENCE:
	entry smei_orb_cal_name(cPat)
 INPUTS:
	(none)
 OUTPUTS:
	cPat*(*)	character	name of calibration pattern
 CALLS: ***
	FTCLOS, FTGISZ, FTGKYD, FTGKYJ, FTGKYL, FTGKYS, FTGPVE, FTNOPN, Say, iFreeLun, iGetLun
	say_fts, smei_Time2Split
 CALLED BY:
	smei_orb_get
 PROCEDURE:
	Entry point in smei_orb_read.
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_orb_camera $SSW_SMEI_UCSD/gen/for/lib/cal/smei_orb_read.f
[Previous] [Next]
 NAME:
	smei_orb_camera
 PURPOSE:
	Camera ID of orbital pattern.
 CATEGORY:
	ucsd/camera/for/lib
 CALLING SEQUENCE:
	entry smei_orb_camera(icam)
 INPUTS:
	(none)
 OUTPUTS:
	icam		integer		camera ID of orbital pattern
 CALLS: ***
	FTCLOS, FTGISZ, FTGKYD, FTGKYJ, FTGKYL, FTGKYS, FTGPVE, FTNOPN, Say, iFreeLun, iGetLun
	say_fts, smei_Time2Split
 PROCEDURE:
	Entry point in smei_orb_read.
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_orb_min_name $SSW_SMEI_UCSD/gen/for/lib/cal/smei_orb_read.f
[Previous] [Next]
 NAME:
	smei_orb_min_name
 PURPOSE:
	Name of minimum pattern from on which the orbital pattern
	is based.
 CATEGORY:
	ucsd/camera/for/lib
 CALLING SEQUENCE:
	entry smei_orb_min_name(cPat)
 INPUTS:
	(none)
 OUTPUTS:
	cPat*(*)	character	name of minimum pattern
 CALLS: ***
	FTCLOS, FTGISZ, FTGKYD, FTGKYJ, FTGKYL, FTGKYS, FTGPVE, FTNOPN, Say, iFreeLun, iGetLun
	say_fts, smei_Time2Split
 PROCEDURE:
	Entry point in smei_orb_read.
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_orb_min_number $SSW_SMEI_UCSD/gen/for/lib/cal/smei_orb_read.f
[Previous] [Next]
 NAME:
	smei_orb_min_number
 PURPOSE:
	Orbit number of minimum pattern.
 CATEGORY:
	ucsd/camera/for/lib
 CALLING SEQUENCE:
	entry smei_orb_min_number(n)
 INPUTS:
	(none)
 OUTPUTS:
	n		integer		orbit number of orbital pattern
 CALLS: ***
	FTCLOS, FTGISZ, FTGKYD, FTGKYJ, FTGKYL, FTGKYS, FTGPVE, FTNOPN, Say, iFreeLun, iGetLun
	say_fts, smei_Time2Split
 PROCEDURE:
	Entry point in smei_orb_read.
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_orb_mkname $SSW_SMEI_UCSD/gen/for/lib/cal/smei_orb_mkname.f
[Previous] [Next]
 NAME:
	smei_orb_mkname
 PURPOSE:
	Constructs file name of for orbital "on-the-fly" pattern
 CATEGORY:
	gen/for/lib/cal
 CALLING SEQUENCE:
	subroutine smei_orb_mkname(tt,cname)
 INPUTS:
	tt(2)		integer		time on which to base the filename
					Should be the first frame
					in an orbit
 OUTPUTS:
	cname*(*)	character	name of orbital pattern
					in format c3orb_YYYY_hhmmss
					(i.e. NO extension)
 CALLS: ***
	Str2Str, Time2Str, smei_orbit2, smei_orbit_time2
 CALLED BY:
	smei_base, smei_orb_write
 INCLUDE:
	include		'smei_frm_layout.h'
 RESTRICTIONS:
	Both smei_base and smei_orb call this routine.
	smei_base uses it to set the expected name of the orbital pattern
	for a camera 3 frame and adds it to the header of the frame.
	smei_orb uses it when it creates the orbital pattern.

	The names in smei_base and smei_orb MUST match. If they do not
	then smei_skyd will not be able to produce skymaps (it will
	abort).

	Both programs pass the time for the first frame into an orbit
	to this subroutine.

	Note that smei_orb has a keyword that will force an update of
	the frame headers with the name of orbital patterns it creates.
	This is a more foolproof way of setting the orbital pattern
	name, but also makes smei_orb a lot slower since all frames
	need to be rewritten (unzip,read,update header,write,zip for
	every frame).
 PROCEDURE:
	The time in the file name is the start time
	(rounded to the nearest second) of the orbit of which
	tt is part.
 MODIFICATION HISTORY:
	APR-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_orb_name $SSW_SMEI_UCSD/gen/for/lib/cal/smei_orb_read.f
[Previous] [Next]
 NAME:
	smei_orb_name
 PURPOSE:
	Pattern name of last pattern read with smei_orb_read
 CATEGORY:
	ucsd/camera/for/lib
 CALLING SEQUENCE:
	entry smei_orb_name(cPat)
 INPUTS:
	(none)
 OUTPUTS:
	cPat*(*)	character	name of orbital pattern
 CALLS: ***
	FTCLOS, FTGISZ, FTGKYD, FTGKYJ, FTGKYL, FTGKYS, FTGPVE, FTNOPN, Say, iFreeLun, iGetLun
	say_fts, smei_Time2Split
 PROCEDURE:
	Entry point in smei_orb_read.
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_orb_number $SSW_SMEI_UCSD/gen/for/lib/cal/smei_orb_read.f
[Previous] [Next]
 NAME:
	smei_orb_number
 PURPOSE:
	Orbit number of orbital pattern.
 CATEGORY:
	ucsd/camera/for/lib
 CALLING SEQUENCE:
	entry smei_orb_number(n)
 INPUTS:
	(none)
 OUTPUTS:
	n		integer		orbit number of orbital pattern
 CALLS: ***
	FTCLOS, FTGISZ, FTGKYD, FTGKYJ, FTGKYL, FTGKYS, FTGPVE, FTNOPN, Say, iFreeLun, iGetLun
	say_fts, smei_Time2Split
 PROCEDURE:
	Entry point in smei_orb_read.
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_orb_read $SSW_SMEI_UCSD/gen/for/lib/cal/smei_orb_read.f
[Previous] [Next]
 NAME:
	smei_orb_read
 PURPOSE:
	Read orbital difference pattern
 CATEGORY:
	ucsd/camera/for/lib
 CALLING SEQUENCE:
	subroutine smei_orb_read(cFile, nx, ny, orb_pattern)
 INPUTS:
	cFile*(*)		character	fully qualified Fits file name
 OUTPUTS:
	nx			integer		horizontal frame size
	ny			integer		vertical frame size
	orb_pattern(nx,ny)	real		pattern
 CALLED BY:
	smei_orb_get
 INCLUDE:
	include		'filparts.h'
	include		'ftspar.h'
	include		'smei_frm_layout.h'
 CALLS: ***
	FTCLOS, FTGISZ, FTGKYD, FTGKYJ, FTGKYL, FTGKYS, FTGPVE, FTNOPN, Say, iFreeLun, iGetLun
	say_fts, smei_Time2Split
 PROCEDURE:
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_orb_time $SSW_SMEI_UCSD/gen/for/lib/cal/smei_orb_read.f
[Previous] [Next]
 NAME:
	smei_orb_time
 PURPOSE:
	Time of orbital pattern.
 CATEGORY:
	ucsd/camera/for/lib
 CALLING SEQUENCE:
	entry smei_orb_time(TTime)
 INPUTS:
	(none)
 OUTPUTS:
	TTime(2)	integer		time of calibration pattern
 CALLS: ***
	FTCLOS, FTGISZ, FTGKYD, FTGKYJ, FTGKYL, FTGKYS, FTGPVE, FTNOPN, Say, iFreeLun, iGetLun
	say_fts, smei_Time2Split
 PROCEDURE:
	Entry point in smei_orb_read.
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_orb_version $SSW_SMEI_UCSD/gen/for/lib/cal/smei_orb_read.f
[Previous] [Next]
 NAME:
	smei_orb_version
 PURPOSE:
	Software version number of smei_orb
 CATEGORY:
	ucsd/camera/for/lib
 CALLING SEQUENCE:
	entry smei_orb_version(Version)
 INPUTS:
	(none)
 OUTPUTS:
	Version		double precision	version number
 CALLS: ***
	FTCLOS, FTGISZ, FTGKYD, FTGKYJ, FTGKYL, FTGKYS, FTGPVE, FTNOPN, Say, iFreeLun, iGetLun
	say_fts, smei_Time2Split
 CALLED BY:
	smei_orb_get
 PROCEDURE:
	Entry point in smei_orb_read.
 MODIFICATION HISTORY:
	JAN-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_orbit2 $SSW_SMEI_UCSD/gen/for/lib/orbit/smei_orbit_time2.f
[Previous] [Next]
 NAME:
	smei_orbit2
 PURPOSE:
	Coriolis orbit number at specified time
 CALLING SEQUENCE:
	entry smei_orbit2(tt,iorbit,dorbit)
 INPUTS:
	tt(2)		integer		time
 OUTPUTS:
	iorbit		integer		Coriolis orbit number
	dorbit		double precision
					Coriolis orbit fraction
 CALLS: ***
	ArrI4Copy, Say, Time2Add, Time2Day8, Time2Delta, smei_orbit_info2
 CALLED BY:
	smei_foreign, smei_orb, smei_orb_mkname, smei_skyd, smei_skyd_fts, smei_skyd_init
	smei_skyd_make, smei_skyd_sky
 PROCEDURE:
	See smei_orbit_time2
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS)
	JAN-2010, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added warning if iorbit goes beyond last orbit in smei_sgp4_orbits.txt


smei_orbit_info2 $SSW_SMEI_UCSD/gen/for/lib/orbit/smei_orbit_info2.f
[Previous] [Next]
 NAME:
	smei_orbit_info2
 PURPOSE:
	Return start times of SMEI orbits
 CALLING SEQUENCE:
	subroutine smei_orbit_info2(norbit_max,orbit0,norbit,torbit)
 OUTPUTS:
	orbit0		integer			Coriolis orbit number
						this number added to the array index of torbit
						gives the corresponding orbit number
	norbit		integer			number of orbits for which start times are
						available
	torbit(2,*)	integer			start times
 CALLED BY:
	smei_orbit2, smei_orbit_period2, smei_orbit_time2
 INCLUDE:
	include		'dirspec [1].h'
	include		'dirspec [2].h'
	include		'dirspec [3].h'
	include		'dirspec [4].h'
	include		'filparts.h'
	include		'openfile.h'
 CALLS: ***
	Say, Time2Split, bOpenFile, iFilePath, iFreeLun
 PROCEDURE:
	Reads data base file $EPHEM/smei/smei_sgp4_orbits.txt
 MODIFICATION HISTORY:
	JAN-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_orbit_period2 $SSW_SMEI_UCSD/gen/for/lib/orbit/smei_orbit_time2.f
[Previous] [Next]
 NAME:
	smei_orbit_period2
 PURPOSE:
	Coriolis orbital period
 CALLING SEQUENCE:
	entry smei_orbit_period2(iorbit,dorbit,porbit)
 INPUTS:
	orbit		double precision
					Coriolis orbit number
 OUTPUTS:
	smei_orbit_period2
			double precision
					orbital period in days
 CALLS: ***
	ArrI4Copy, Say, Time2Add, Time2Day8, Time2Delta, smei_orbit_info2
 CALLED BY:
	smei_skyd_fts, smei_skyd_init, smei_skyd_make, smei_skyd_sky
 PROCEDURE:
	See smei_orbit_time2
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS)
	JAN-2010, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Bug fix. Array index to torbit was not limited to valid range.
	    Added warning if iorbit goes beyond last orbit in smei_sgp4_orbits.txt


smei_orbit_time2 $SSW_SMEI_UCSD/gen/for/lib/orbit/smei_orbit_time2.f
[Previous] [Next]
 NAME:
	smei_orbit_time2
 PURPOSE:
	Returns time at which Coriolis was in specified orbit
 CALLING SEQUENCE:
	subroutine smei_orbit_time2(iorbit,dorbit,tt)
 INPUTS:
	iorbit		integer			Coriolis orbit number
	dorbit		double precision	Coriolis orbit fraction
 OUTPUTS:
	tt(2)		integer			time at which Coriolis was at specified orbit
 CALLS: ***
	ArrI4Copy, Say, Time2Add, Time2Day8, Time2Delta, smei_orbit_info2
 CALLED BY:
	smei_foreign, smei_orb, smei_orb_mkname, smei_skyd, smei_skyd_fts, smei_skyd_init
	smei_skyd_make, smei_skyd_sky
 PROCEDURE:
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS)
	MAR-2007, Paul Hick (UCSD/CASS)
	    Increased NORBIT_MAX from 20000 to 40000
	JAN-2010, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added warning if iorbit goes beyond last orbit in smei_sgp4_orbits.txt
	    Increased NORBIT_MAX from 40000 to 50000


smei_sky_iread $SSW_SMEI_UCSD/gen/for/lib/frm/smei_sky_iread.f
[Previous] [Next]
 NAME:
	smei_sky_iread
 PURPOSE:
	Read one of the real*4 arrays in an orbital sky map
 CATEGORY:
	ucsd/camera/for/lib
 CALLING SEQUENCE:
	subroutine smei_sky_iread(cFile, mode, nx, ny, skymap, cx, cy, dd, ctype)
 INPUTS:
	cFile*(*)	character	fully qualified Fits file name
	mode		integer		selects Fits extension
					= 0: (used by smei_sky_read)
					= 1: (used by smei_sky_read)
					= 2: (used by smei_sky_read)
					= 3:
					= 4:
					= 5:
					= 6: (used by smei_sky_read)
					= 7: (used by smei_sky_read)
					= 8: (used by smei_sky_read)
					= 9: (used by smei_sky_read)
					=10: (used by smei_sky_read)
					=11: (used by smei_sky_read)
					=12: Bad pixel map

					The equatorial map is 3600x1200; the polar maps 1600x1600.
					all others are 720x360 arrays.
 OUTPUTS:
	nx,ny		integer		dimensions of sky map
					If there is an open error (usually because the file does not
					exist) then nx=0 and ny=0 is returned.
	skymap(nx,ny)	integer		sky map
	cx,cy,dd	double precision
					constants relating array index to RA and dec.
					For north polar map:
					   i=cx+dd*RA*cos(90-decl); j=cy+dd*RA*sin(90-decl)
					For south polar map:
					   i=cx+dd*RA*cos(90+decl); j=cy+dd*RA*sin(90+decl)
					For all other (equatorial) maps:
					   i=cx+dd*RA; j=cy+dd*decl
	ctype		character*(*)	string describing data
 INCLUDE:
	include		'smei_frm_layout.h'
	include		'filparts.h'
	include		'ftspar.h'
 CALLS: ***
	FTCLOS, FTGISZ, FTGKYS, FTGPVJ, FTMAHD, FTNOPN, Say, iFreeLun, iGetLun, say_fts
 SEE ALSO:
	smei_htm_fts
 PROCEDURE:
 MODIFICATION HISTORY:
	FEB-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_sky_read $SSW_SMEI_UCSD/gen/for/lib/frm/smei_sky_read.f
[Previous] [Next]
 NAME:
	smei_sky_read
 PURPOSE:
	Read one of the real*4 arrays in an orbital sky map
 CATEGORY:
	ucsd/camera/for/lib
 CALLING SEQUENCE:
	subroutine smei_sky_read(cFile, mode, nx, ny, skymap, cx, cy, dd, ctype)
 INPUTS:
	cFile*(*)	character	fully qualified Fits file name

	Sky maps:
	mode		integer		selects Fits extension
					= 0: Equatorial map, RA=[0,360],DEC=[-60,+60]
					= 1: Polar projection of north pole, DEC=[+50,+90]
					= 2: Polar projection of south pole, DEC=[-50,-90]
					= 3: (smei_sky_iread) Counts for equatorial map, RA=[0,360],DEC=[-60,+60]
					= 4: (smei_sky_iread) Counts for map of north pole, DEC=[+50,+90]
					= 5: (smei_sky_iread) Counts for map of south pole, DEC=[-50,-90]
					= 6: Dirty sky brightness RA=[0,360],DEC=[-90,+90]
					= 7: Time (fraction of orbit) RA=[0,360],DEC=[-90,+90]
					= 8: PSF position angle from north RA=[0,360],DEC=[-90,+90]
					= 9: PSF position angle from equinox RA=[0,360],DEC=[-90,+90]
					=10: Discarded response map RA=[0,360],DEC=[-90,+90]
					=11: Discarded triangles RA=[0,360],DEC=[-90,+90]
					=12: Theta-x for glare removal
					=13: Theta-y for glare removal
					=14: Time (secs since TORIGIN)
					=15: Direction cosine angle-x
					=16: Contributing pixel count

	Equ maps:
	mode		integer		selects Fits extension
					= 0: Equatorial map, RA=[0,360],DEC=[-60,+60]
					= 1: Polar projection of north pole, DEC=[+50,+90]
					= 2: Polar projection of south pole, DEC=[-50,-90]
					= 3: Equatorial map, RA=[0,360],DEC=[-60,+60] (flat)
					= 4: Polar projection of north pole, DEC=[+50,+90] (flat)
					= 5: Polar projection of south pole, DEC=[-50,-90] (flat)
					= 6: Stars removed from equator, RA=[0,360],DEC=[-60,+60]
					= 7: Stars removed from north pole, DEC=[+50,+90]
					= 8: Stars removed from south pole, DEC=[+50,+90]
					= 9: Time (fraction of orbit) RA=[0,360],DEC=[-90,+90]
					=10: Time (sec since TORIGIN) RA=[0,360],DEC=[-90,+90]
					=11: Direction cosine angle-x RA=[0,360],DEC=[-90,+90]
					=12: Contributing pixel count RA=[0,360],DEC=[-90,+90]

					The equatorial map is 3600x1200; the polar maps 800x800.
					all others are 720x360 arrays.
 OUTPUTS:
	nx,ny		integer		dimensions of sky map
					If there is an open error (usually because the file does not
					exist) then nx=0 and ny=0 is returned.
	skymap(nx,ny)	real		sky map
	cx,cy,dd	double precision
					constants relating array index to RA and dec.
					For north polar map:
					   i=cx+dd*RA*cos(90-decl); j=cy+dd*RA*sin(90-decl)
					For south polar map:
					   i=cx+dd*RA*cos(90+decl); j=cy+dd*RA*sin(90+decl)
					For all other (equatorial) maps:
					   i=cx+dd*RA; j=cy+dd*decl
	ctype		character*(*)	string describing data
 INCLUDE:
	include		'smei_frm_layout.h'
	include		'filparts.h'
	include		'ftspar.h'
 CALLS: ***
	FTCLOS, FTGISZ, FTGKYD, FTGKYS, FTGPVE, FTMAHD, FTNOPN, Say, iFreeLun, iGetLun, say_fts
 SEE ALSO:
	smei_htm_fts
 PROCEDURE:
 MODIFICATION HISTORY:
	JAN-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_Time2Split $SSW_SMEI_UCSD/gen/for/lib/orbit/smei_time2split.f
[Previous] [Next]
 NAME:
	smei_Time2Split
 PURPOSE:
	Extract time in SMEI format from string
 CALLING SEQUENCE:
	subroutine smei_Time2Split(id,cStr,tt)
 INPUTS:
	id		integer		indicates method of locating
					the time in SMEI format
					id=0: time starts after first underscore
					id=1: time starts after first underscore
						of file name part
					id=2: time starts at 1st char of string
	cStr		character*(*)	string containing SMEI time
 OUTPUTS:
	tt(2)		integer		time as 2-element standard time
 CALLED BY:
	smei_base, smei_cal, smei_cal_get, smei_cal_group, smei_cal_init, smei_cal_read
	smei_foreign, smei_frm_base, smei_frm_get, smei_frm_getfirst, smei_frm_getnext
	smei_frm_path, smei_frm_ped_guess, smei_frm_read, smei_frm_read_get_sdark
	smei_orb, smei_orb_cal_name, smei_orb_camera, smei_orb_min_name
	smei_orb_min_number, smei_orb_name, smei_orb_number, smei_orb_read
	smei_orb_time, smei_orb_version
 INCLUDE:
	include		'filparts.h'
 CALLS: ***
	Time2Split, iGetFileSpec, iSetFileSpec
 MODIFICATION HISTORY:
	FEB-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Sort2I2 $SSW_SMEI_UCSD/gen/for/lib/math/sort2i2.f
[Previous] [Next]
 NAME:
	Sort2I2
 PURPOSE:
	Rearrange two array so that the first one is put into ascending
	numerical order
 CATEGORY:
	Math: sorting
 CALLING SEQUENCE:
	subroutine Sort2I2(N1,N2,M1,M2,RA,RB)
 INPUTS:
	N1,N2		integer		logical dimensions of array RA
	M1,M2		integer		physical dimensions of array RA
					(only the logical part of the array is sorted
	RA(M1:M2)	integer*2	array to be sorted
	RB(M1:M2)	integer*2	array to be sorted
 OUTPUTS:
	RA,RB	sorted array
 SIDE EFFECTS:
	The part of the arrays RA,RB outside the logical range (i.e. indices
	[M1,N1-1] and [N2+1,M2] remains untouched
 RESTRICTIONS:
	The logical range [N1,N2] must be a subset of physical range [M1,M2]
 SEE ALSO:
	IndexI2, Rank, Sort2I4, Sort2R4, Sort2R8, SortI2
 PROCEDURE:
	Modification of the heapsort subroutine in Press et al., "Numerical 
	Recipes", Cambridge UP (1989), par. 8.2, p. 231
 MODIFICATION HISTORY:
	1990, Paul Hick (UCSD)


Sort2I4 $SSW_SMEI_UCSD/gen/for/lib/math/sort2i4.f
[Previous] [Next]
 NAME:
	Sort2I4
 PURPOSE:
	Rearrange two array so that the first one is put into ascending
	numerical order
 CATEGORY:
	Math: sorting
 CALLING SEQUENCE:
	subroutine Sort2I4(N1,N2,M1,M2,RA,RB)
 INPUTS:
	N1,N2		integer		logical dimensions of array RA
	M1,M2		integer		physical dimensions of array RA
			(only the logical part of the array is sorted
	RA(M1:M2)	integer		array to be sorted
	RB(M1:M2)	integer		array to be sorted
 OUTPUTS:
	RA,RB	sorted array
 SIDE EFFECTS:
	The part of the arrays RA,RB outside the logical range (i.e. indices
	[M1,N1-1] and [N2+1,M2] remains untouched
 RESTRICTIONS:
	The logical range [N1,N2] must be a subset of physical range [M1,M2]
 SEE ALSO:
	IndexI4, Rank, Sort2I2, Sort2R4, Sort2R8, SortI4
 PROCEDURE:
	Modification of the heapsort subroutine in Press et al., "Numerical 
	Recipes", Cambridge UP (1989), par. 8.2, p. 231
 MODIFICATION HISTORY:
	1990, Paul Hick (UCSD)


Sort2R4 $SSW_SMEI_UCSD/gen/for/lib/math/sort2r4.f
[Previous] [Next]
 NAME:
	Sort2R4
 PURPOSE:
	Rearrange two array so that the first one is put into ascending
	numerical order
 CATEGORY:
	Math: sorting
 CALLING SEQUENCE:
	subroutine Sort2R4(N1,N2,M1,M2,RA,RB)
 INPUTS:
	N1,N2		integer		logical dimensions of array RA
	M1,M2		integer		physical dimensions of array RA
					(only the logical part of the array is sorted
	RA(M1:M2)	real		array to be sorted
	RB(M1:M2)	real		array to be sorted
 OUTPUTS:
	RA,RB		sorted array
 CALLED BY:
	nrInterpol
 SIDE EFFECTS:
	The part of the arrays RA,RB outside the logical range (i.e. indices
	[M1,N1-1] and [N2+1,M2] remains untouched
 RESTRICTIONS:
	The logical range [N1,N2] must be a subset of physical range [M1,M2]
 SEE ALSO:
	IndexR4, Rank, Sort2I2, Sort2I4, Sort2R8, SortR4
 PROCEDURE:
	Modification of the heapsort subroutine in Press et al., "Numerical 
	Recipes", Cambridge UP (1989), par. 8.2, p. 231
 MODIFICATION HISTORY:
	1990, Paul Hick (UCSD)


Sort2R8 $SSW_SMEI_UCSD/gen/for/lib/math/sort2r8.f
[Previous] [Next]
 NAME:
	Sort2R8
 PURPOSE:
	Rearrange two array so that the first one is put into ascending
	numerical order
 CATEGORY:
	Math: sorting
 CALLING SEQUENCE:
	subroutine Sort2R8(N1,N2,M1,M2,RA,RB)
 INPUTS:
	N1,N2		integer			logical dimensions of array RA
	M1,M2		integer			physical dimensions of array RA
						(only the logical part of the array is sorted
	RA(M1:M2)	double precision	array to be sorted
	RB(M1:M2)	double precision	array to be sorted
 OUTPUTS:
	RA,RB		sorted arrays
 INCLUDE:
	include		'sort_inc.h'
 SIDE EFFECTS:
	The part of the arrays RA,RB outside the logical range (i.e. indices
	[M1,N1-1] and [N2+1,M2] remains untouched
 RESTRICTIONS:
	The logical range [N1,N2] must be a subset of physical range [M1,M2]
 SEE ALSO:
	IndexR8, Rank, Sort2I2, Sort2I4, Sort2R4, SortR8
 PROCEDURE:
	Modification of the heapsort subroutine in Press et al., "Numerical 
	Recipes", Cambridge UP (1989), par. 8.2, p. 231
 MODIFICATION HISTORY:
	1990, Paul Hick (UCSD)


SortI2 $SSW_SMEI_UCSD/gen/for/lib/math/sorti2.f
[Previous] [Next]
 NAME:
	SortI2
 PURPOSE:
	Rearrange array into ascending numerical order
 CATEGORY:
	Math: sorting
 CALLING SEQUENCE:
	subroutine SortI2(N1,N2,M1,M2,RA)
 INPUTS:
	N1,N2		integer		logical dimensions of array RA
	M1,M2		integer		physical dimensions of array RA
	RA(M1:M2)	integer*2	array to be sorted
 OUTPUTS:
	RA		integer*2	sorted array
 RESTRICTIONS:
	The logical range [N1,N2] must be a subset of physical range [M1,M2]
	I.e. N1 >= M1 and N2 <= M2.
 SEE ALSO:
	IndexI2, Rank, Sort2I2, SortI4, SortR4, SortR8
 MODIFICATION HISTORY:
	1990, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


SortI4 $SSW_SMEI_UCSD/gen/for/lib/math/sorti4.f
[Previous] [Next]
 NAME:
	SortI4
 PURPOSE:
	Rearrange array into ascending numerical order
 CATEGORY:
	Math: sorting
 CALLING SEQUENCE:
	subroutine SortI4(N1,N2,M1,M2,RA)
 INPUTS:
	N1,N2		integer		logical dimensions of array RA
	M1,M2		integer		physical dimensions of array RA
	RA(M1:M2)	integer*4	array to be sorted
 OUTPUTS:
	RA		integer*4	sorted array
 RESTRICTIONS:
	The logical range [N1,N2] must be a subset of physical range [M1,M2]
	I.e. N1 >= M1 and N2 <= M2.
 SEE ALSO:
	IndexI4, Rank, Sort2I4, SortI2, SortR4, SortR8
 MODIFICATION HISTORY:
	1990, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


SortR4 $SSW_SMEI_UCSD/gen/for/lib/math/sortr4.f
[Previous] [Next]
 NAME:
	SortR4
 PURPOSE:
	Rearrange array into ascending numerical order
 CATEGORY:
	Math: sorting
 CALLING SEQUENCE:
	subroutine SortR4(N1,N2,M1,M2,RA)
 INPUTS:
	N1,N2		integer		logical dimensions of array RA
	M1,M2		integer		physical dimensions of array RA
	RA(M1:M2)	real*4		array to be sorted
 OUTPUTS:
	RA		real*4		sorted array
 CALLED BY:
	ArrR4Median
 RESTRICTIONS:
	The logical range [N1,N2] must be a subset of physical range [M1,M2]
	I.e. N1 >= M1 and N2 <= M2.
 SEE ALSO:
	IndexR4, Rank, Sort2R4, SortI2, SortI4, SortR8
 MODIFICATION HISTORY:
	1990, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


SortR8 $SSW_SMEI_UCSD/gen/for/lib/math/sortr8.f
[Previous] [Next]
 NAME:
	SortR8
 PURPOSE:
	Rearrange array into ascending numerical order
 CATEGORY:
	Math: sorting
 CALLING SEQUENCE:
	subroutine SortR8(N1,N2,M1,M2,RA)
 INPUTS:
	N1,N2		integer			logical dimensions of array RA
	M1,M2		integer			physical dimensions of array RA
						(only the logical part of the array is sorted
	RA(M1:M2)	double precision	array to be sorted
 OUTPUTS:
	RA		double precision	sorted array
 SEE ALSO:
	IndexR8, Rank, Sort2R8, SortI2, SortI4, SortR4
 SIDE EFFECTS:
	The part of the array RA outside the logical range (i.e. indices
	[M1,N1-1] and [N2+1,M2] remains untouched
 RESTRICTIONS:
	The logical range [N1,N2] must be a subset of physical range [M1,M2]
	I.e. N1 >= M1 and N2 <= M2.
 PROCEDURE:
	Modification of the heapsort subroutine in Press et al., "Numerical 
	Recipes", Cambridge UP (1989), par. 8.2, p. 231
 MODIFICATION HISTORY:
	1990, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


SplineGridX $SSW_SMEI_UCSD/gen/for/lib/math/splinegridx.f
[Previous] [Next]
 NAME:
	SplineGridX
 PURPOSE:
	Interpolation of 2D arrays in horizontal direction.
 CATEGORY:
	Interpolation using natural spline
 CALLING SEQUENCE:
	subroutine SplineGridX(iFlag,XN1,XN2,XM1,XM2,NX,NY,ZN,MX,ZM)
 INPUTS:
	iFlag		integer		1st bit set: flag bad point in output ZM if
					    nearest grid point in input ZN is bad.

					2nd bit set: if the range [XM1,XM2] extends
					    outside [XN1,XN2] then x-coordinates outside
					    [XN1,XN2] are mapped back inside
					    by a mod (XN2-XN1) operation. 

	XN1		real		x-coordinate of 1st  column of input  ZN
	XN2		real		x-coordinate of last column of input  ZN
	XM1		real		x-coordinate of 1st  column of output ZM
	XM2		real		x-coordinate of last column of output ZM
	NX		integer		horizontal dimensions of ZN
	NY		integer		vertical dimensions of ZN
	ZN(NX,NY)	real		fnc-values
	MX		integer		new horizontal dimension
 OUTPUTS:
	ZM(MX,NY)	real		interpolated fnc-values
 CALLS: ***
	ArrR4Step, Say, SplineX
 CALLED BY:
	nrSqueezeX
 RESTRICTIONS:
	The in- and output user-coordinate ranges must be non-zero
 PROCEDURE:
 >	1st bit of iFlag is set: for each grid point of the output grid the
	nearest grid point of the output grid is determined. If this nearest
	point was flagged (contained value BadR4()) then the value of the
	output grid is also flagged.
	!! `Nearest' means the nearest grid point in the
	   horizontal direction only (along a single row);
 >	For each row in ZN a spline is calculated, using all valid fnc-values
	in that row. The ordinate for the spline is assumed to run from
	XN1 to XN2. The spline is then used to interpolate fnc-values in
	evenly spaced ordinate values between XM1 and XM2.
 >	If the row dimension is not changed, SplineGridX and has the effect of
	filling in the invalid function values (if 1st bit of iFlag is set)
 MODIFICATION HISTORY:
	JUL-1993, Paul Hick (UCSD/CASS)
	APR-1994, Paul Hick (UCSD/CASS)
	    added argument bFlag to control flagging of function values in the output array
	MAY-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    added arguments MX and ZM to allow changes in horizontal dimension
	    Note that the old functionality is retained by setting MX=NX, ZM=ZN
	    Changed logical argument bFlag to integer argument iFlag. The original bFlag
	    functionality is now controlled by the first bit in iFlag. The second bit
	    is now used to contol the mod( XN2-XN1) ) behavior.


SplineGridY $SSW_SMEI_UCSD/gen/for/lib/math/splinegridy.f
[Previous] [Next]
 NAME:
	SplineGridY
 PURPOSE:
	Interpolation of 2D arrays in vertical direction.
 CATEGORY:
	Interpolation using natural spline
 CALLING SEQUENCE:
	subroutine SplineGridY(iFlag,YN1,YN2,YM1,YM2,NX,NY,ZN,MY,ZM)
 INPUTS:
	iFlag		integer		1st bit set: flag bad point in output ZM if
					    nearest grid point in ZN is bad.

					2nd bit set: if the range [YM1,YM2] extends
					    outside [YN1,YN2] then y-coordinates outside
					    [YN1,YN2] are mapped back inside
					    by a mod (YN2-YN1) operation. 
	YN1		real		y-coordinate of 1st  row of  input ZN
	YN2		real		y-coordinate of last row of  input ZN
	YM1		real		y-coordinate of 1st  row of output ZM
	YM2		real		y-coordinate of last row of output ZM
	NX		integer		horizontal dimension of ZN
	NY		integer		vertical dimensions of ZN
	ZN(NX,NY)	real		fnc-values
	MY		integer		new vertical dimension
 OUTPUTS:
	ZM(NX,MY)	real		interpolated fnc-values
 CALLS: ***
	ArrR4Step, Say, SplineY
 CALLED BY:
	nrSqueezeY
 RESTRICTIONS:
	The in- and output user-coordinate ranges must be non-zero
 PROCEDURE:
 >	1st bit of iFlag is set: for each grid point of the output grid the
	nearest grid point of the output grid is determined. If this nearest
	point was flagged (contained value BadR4()) then the value of the
	output grid is also flagged.
	!! `Nearest' means the nearest grid point in the
	   in the vertical direction only (along a single column).

 >	For each column in ZN a spline is calculated, using all valid fnc-values
	in that column. The ordinate for the spline is assumed to run from
	YN1 to YN2. The spline is then used to interpolate fnc-values in
	evenly spaced ordinate values between YM1 and YM2.
 >	If the column dimension is not changed, SplineGridY has the effect of
	filling in the invalid function values (if 1st bit of iFlag is set)
 MODIFICATION HISTORY:
	JUL-1993, Paul Hick (UCSD/CASS)
	APR-1994, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    added argument bFlag to control flagging of function values in the output array
	MAY-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    added arguments MY and ZM to allow changes in horizontal dimension
	    Note that the old functionality is retained by setting MY=NY, ZM=ZN
	    Changed logical argument bFlag to integer argument iFlag. The original bFlag
	    functionality is now controlled by the first bit in iFlag. The second bit
	    is now used to contol the mod( YN2-YN1 ) behavior.


SplineX $SSW_SMEI_UCSD/gen/for/lib/math/splinex.f
[Previous] [Next]
 NAME:
	SplineX
 PURPOSE:
	Interpolation of 2D arrays in first (horizontal) dimension.
 CATEGORY:
	Interpolation using natural spline
 CALLING SEQUENCE:
	subroutine SplineX(iFlag,NX,XN,MX,XM,NY,ZN,ZM)
 INPUTS:
	iFlag		integer		1st bit set: flag bad point in output ZZ if
					    nearest grid point in Z is bad.

					2nd bit set: if the range of XM extends
					    outside the range of XN then x-coordinates outside
					    the range of XN are mapped back inside
					    by a mod ( max(XN)-min(XN)) operation. 

	NX		integer		first (horizontal) dimension of input ZN
	XN(NX)		real		horizontal coordinates for input ZN
	MX		integer		first (horizontal) dimension of output ZM
	XM(MX)		real		horizontal coordinates for output ZM
	ZN(NX,NY)	real		fnc-values
 OUTPUTS:
	ZM(MX,NY)	real		interpolated fnc-values
 CALLS: ***
	ArrR4GetMinMax, BadR4, IndexR4, Say, nrSplInt, nrSpline
 CALLED BY:
	SplineGridX
 SEE ALSO:
	SplineGridX, SplineGridY, SplineY
 RESTRICTIONS:
	The in- and output horizontal coordinate ranges must be non-zero
 PROCEDURE:
 >	1st bit of iFlag is set: for each grid point of the output grid the
	nearest grid point of the output grid is determined. If this nearest
	point was flagged (contained value BadR4()) then the value of the
	output grid is also flagged.
	!! `Nearest' means the nearest grid point in the
	   horizontal direction only (along a single row);
 >	For each row in Z a spline is calculated, using all valid fnc-values
	in that row. XN provides the ordinates for the spline
 >	If the row dimension is not changed (NX=MX), SplineX and has the effect of
	filling in the invalid function values (if 1st bit of iFlag is set).
	In this case the same array can be used for both ZN and ZM.
 MODIFICATION HISTORY:
	JUL-1993, Paul Hick (UCSD/CASS)
	APR-1994, Paul Hick (UCSD/CASS)
	    added argument bFlag to control flagging of function values in the output array
	MAY-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Generalized version of old SplineGridX. Instead of working with evenly spaced
	    ordinate values, now arbitrary ordinate values for in- and output arrays
	    are allowed.
	    Changed logical argument bFlag to integer argument iFlag. The original bFlag
	    functionality is now controlled by the first bit in iFlag. The second bit
	    is now used to contol the mod(Xmax-Xmin) behavior.


SplineY $SSW_SMEI_UCSD/gen/for/lib/math/spliney.f
[Previous] [Next]
 NAME:
	SplineY
 PURPOSE:
	Interpolation of 2D arrays in second (vertical) dimension.
 CATEGORY:
	Interpolation using natural spline
 CALLING SEQUENCE:
	subroutine SplineY(iFlag,NY,YN,MY,YM,NX,ZN,ZM)
 INPUTS:
	iFlag		integer		1st bit set: flag bad point in output ZN if
					    nearest grid point in ZM is bad.

					2nd bit set: if the range of YM extends
					    outside the range of YN then y-coordinates outside
					    the range of YN are mapped back inside
					    by a mod ( max(YN)-min(YN)) operation. 

	NY		integer		second (vertical) dimension of input ZN
	YN(NY)		real		vertical coordinates for input ZN
	MY		integer		second (vertical) dimension of output ZM
	YM(MY)		real		vertical coordinates for output ZM
	ZN(NX,NY)	real		fnc-values
 OUTPUTS:
	ZM(NX,MY)	real		interpolated fnc-values
 CALLS: ***
	ArrR4GetMinMax, BadR4, IndexR4, Say, nrSplInt, nrSpline
 CALLED BY:
	SplineGridY
 SEE ALSO:
	SplineGridX, SplineGridY, SplineX
 RESTRICTIONS:
	The in- and output vertical coordinate ranges must be non-zero
 PROCEDURE:
 >	1st bit of iFlag is set: for each grid point of the output grid the
	nearest grid point of the output grid is determined. If this nearest
	point was flagged (contained value BadR4()) then the value of the
	output grid is also flagged.
	!! `Nearest' means the nearest grid point in the
	   vertical direction only (along a single column);
 >	For each column in ZN a spline is calculated, using all valid fnc-values
	in that column. YN provides the ordinates for the spline
 >	If the column dimension is not changed (NY=MY), SplineY and has the effect of
	filling in the invalid function values (if 1st bit of iFlag is set)
	In this case the same array can be used for both ZN and ZM.
 MODIFICATION HISTORY:
	JUL-1993, Paul Hick (UCSD/CASS)
	APR-1994, Paul Hick (UCSD/CASS)
	    added argument bFlag to control flagging of function values in the output array
	MAY-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Generalized version of old SplineGridY. Instead of working with evenly spaced
	    ordinate values, now arbitrary ordinate values for in- and output arrays
	    are allowed.
	    Changed logical argument bFlag to integer argument iFlag. The original bFlag
	    functionality is now controlled by the first bit in iFlag. The second bit
	    is now used to contol the mod( max(YN)-min(YN) ) behavior.


sprint $SSW_SMEI_UCSD/gen/for/main/sprint.f
[Previous] [Next]
 NAME:
	sprint	
 PURPOSE:
	Copy a specified file to another file, with selected format,
	ready to be printed
 CATEGORY:
	I/O
 CALLING SEQUENCE:
	program SPRINT

	run $exe:sprint		(vms)
	$ $exe:sprint filename	(vms)
	$exe/sprint		(linux)
 INPUTS:
	filename	Name of text file to be processed (optional)
			If no file name is specified, user is prompted

	The program attempts to read the following global DCL symbols (only
	the page length indicator is mandatory):
	LIB__LS_PAGEL	# lines per page, minus 3 (for the header)
	LIB__LS_PRNT	the VMS-DCL or Linux-bash command which submits the file
			for printing
	LIB__LS_START	initialize sequence for printer (1st line of print file)
	LIB__LS_STOP	soft reset sequence for printer (last line)
	LIB__LS_FF	if set to "YES" an explicit formfeed is written at
			the end of each page (if the page length set in
			LIB__LS_PAGEL exactly matches the intrinsic page length
			of the printer this may not be necessary).
 OUTPUTS:
	?.las		Scratch file to be send to printed and deleted
 INCLUDE:
	include		'dirspec [1].h'
	include		'dirspec [2].h'
	include		'dirspec [3].h'
	include		'dirspec [4].h'
	include		'filparts.h'
	include		'openfile.h'
 CALLS: ***
	ForeignArg, LocFirst, OSExitCmd [1], OSExitCmd [2], OSExitCmd [3], OSExitCmd [4]
	Say, Str2Str, bOpenFile, cTime2System, iFreeLun, iGetFileSpec, iGetLogical [1]
	iGetLogical [2], iGetLogical [3], iGetSymbol [1], iGetSymbol [2], iGetSymbol [3]
	iHideLogical, iOSDeleteFile [1], iOSDeleteFile [2], iOSDeleteFile [3]
	iOSDeleteFile [4], iOSRenameFile [1], iOSRenameFile [2], iOSRenameFile [3]
	iOSRenameFile [4], iOSSpawnCmd [1], iOSSpawnCmd [2], iOSSpawnCmd [3]
	iOSSpawnCmd [4], iSearch [1], iSearch [2], iSearch [3], iSearch [4], iSetFileSpec
	iUniqueName, itrim, uppercase
 PROCEDURE:
 >	The input text file is processed record by record and are written to
	an output scratch file. The scratch file is printed and deleted.
 >	The output file '?.las' is created in SYS$SCRATCH
 >	Wild cards are permitted in the input file name
 >	If the second calling sequence is used ($SPRINT), then a comma separated
	list of arguments is permitted. Each argument can contain a wild card.
 >	By default the output file includes line numbers.

	Command line switches (preceded by "/"):
 >	/NOLINENUMBERS: the line numbers are suppressed.
 >	/MARGIN (only used in combination with /NOLINENUMBERS):
		add a margin of one tab (8 characters) on the left.
 >	/COUNTONLY: only a page count is given. Nothing is actually printed.
 >	/NOCRLFFF: an output file with a higher version number
	(same directory and name as input file) is created with trailing CR,LF
	and/or FF remove. I.e. no header is added, and no printer initialize
	and reset string.
 >	/FORTRAN: the scratch file send to the printer is
	identical to the input file except for an additional header (consisting
	of the ALL initialize string, the system time and the file name) and
	an additional trailer (the RSP reset string). This option is useful
	for printing files with FORTRAN carriagecontrol.
 >	/CRLF: CR and LF's are explicitly processed. By default they are
	stripped out and ignored.
 >	/LANDSCAPE: printing is in landscape mode
 >	/DELETE: the original input file is deleted after processing
	(NOTE: whether the scratch file is deleted depends on the print command)
 >	/HELP: display few lines of help
 
 >	The landscape option uses the global symbols LIB__LS_LAND and 
	LIB__LS_LANDL instead of LIB__LS_START and LIB__LS_PAGEL, respectively.
	These symbols are available for the HP Laserjet printer, but is 
	currently not of much use, since it only prints a maximum of 132
	characters per line (only a few characters more than in portrait mode)
 >	On Linux the script $com/sprint_setup adds the required symbols to
	the file ~/LOGFIL.TXT.
 MODIFICATION HISTORY:
	Original HC.FOR by George L. Huszar    May, 1991
	OCT-1991, Paul Hick (UCSD), modified to accept external input
	MAR-1992, Paul Hick (UCSD), added loop for wild-card specification
	FEB-1993, Paul Hick (UCSD),
		- option to suppress line numbers
		- option to get page count without actually printing
		- added removal of trailing CR,LF and FF
		- option to retain file with CR,LF and FF removed
		- option to print files with FORTRAN carriagecontrol
	MAR-1995, Paul Hick (UCSD), added option to delete the original input
		file after processing
	MAR-1995, Paul Hick (UCSD), introduced command line switches to
		differentiate between various options (used to be numericals
		appended to the list of file names)
	AUG-2000, Kevin Nguyen, Paul Hick (UCSD)
		Adapted for Linux. The main change was the addition of an
		explicit carriage return after all text output to the scratch
		file before sending it to the printer. The current print command
		is lpr -Php -r. All required LIB__* symbols are set up by
		the script $com/sprint_setup.


StereoAOrbit $SSW_SMEI_UCSD/gen/for/lib/ephem/stereoaorbit.f
[Previous] [Next]
 NAME:
	StereoAOrbit
 PURPOSE:
	Calculate Stereo orbit (position and velocity vectors)
 CATEGORY:
	/gen/for/lib/ephem
 CALLING SEQUENCE:
	subroutine StereoAOrbit(iYr,Doy,RR,VV)
 INPUTS:
	iYr		integer		year
	Doy		real		day of year
 OUTPUTS:
	RR(3)		real		position vector: ecliptic longitude and
					latitude (deg), radial distance (AU)
	VV(5)		real		velocity vector: ecliptic longitude and
					latitude (deg), magnitude, radial and
					tangential velocity (AU/day)
					(will be zero if the Ulysses orbital
					data base is used; see PROCEDURE).
 CALLS: ***
	Julian, KeplerOrbit, Say
 PROCEDURE:
	Times have to be later than 2007/01/01 00 UT
 MODIFICATION HISTORY:
	JUL-1998, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


StereoBOrbit $SSW_SMEI_UCSD/gen/for/lib/ephem/stereoborbit.f
[Previous] [Next]
 NAME:
	StereoBOrbit
 PURPOSE:
	Calculate Stereo B (position and velocity vectors)
 CATEGORY:
	/gen/for/lib/ephem
 CALLING SEQUENCE:
	subroutine StereoBOrbit(iYr,Doy,RR,VV)
 INPUTS:
	iYr		integer		year
	Doy		real		day of year
 OUTPUTS:
	RR(3)		real		position vector: ecliptic longitude and
					latitude (deg), radial distance (AU)
	VV(5)		real		velocity vector: ecliptic longitude and
					latitude (deg), magnitude, radial and
					tangential velocity (AU/day)
					(will be zero if the Ulysses orbital
					data base is used; see PROCEDURE).
 CALLS: ***
	Julian, KeplerOrbit, Say
 PROCEDURE:
	Times have to be later than 2007/01/01 00 UT
 MODIFICATION HISTORY:
	JUL-1998, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


StereoOrbit $SSW_SMEI_UCSD/gen/for/lib/ephem/stereoorbit.f
[Previous] [Next]
 NAME:
	StereoOrbit
 PURPOSE:
	Calculate the Stereo A and B orbit (position locations)
 CATEGORY:
	Celestial mechanics
 CALLING SEQUENCE:
	subroutine StereoOrbit(nS,iYr,Doy,RR)
 INPUTS:
	nS		1 - Stereo A
			2 - Stereo B
	iYr		integer		year
	Doy		real		day of year
 OUTPUTS:
	RR(3)		real		position vector: ecliptic longitude and
					latitude (deg), radial distance (AU).
 CALLS: ***
	Julian, KeplerOrbit
 INCLUDE:
 PROCEDURE:
 >	If the data base with Ulysses orbital coordinates exists (file
	$dat:UlyssesPos.txt) the position vector is obtained by
	linear interpolation on the data base.
 >	If the data base does not exist, approximate orbital parameters
	are used. These parameters were determined by least-square fitting
	Ulysses orbital data from the years 1993 to 1996 (first polar passage).
 MODIFICATION HISTORY:
	JUN-1997, Paul Hick (UCSD/CASS; pphick@ucsd.edu), JUL-2008 (UCSD/CASS; bjackson@ucsd.edu)


stop_here $SSW_SMEI_UCSD/gen/for/lib/gen/stop_here.f
[Previous] [Next]
 NAME:
	stop_here
 PURPOSE:
       Stop the program with a message.
       This is a workaround for 'stop' directly used inside an OpenMP loop.
 CALLING SEQUENCE:
       call stop_here(msg)


StopWatch $SSW_SMEI_UCSD/gen/for/lib/gen/stopwatch.f
[Previous] [Next]
 NAME:
	StopWatch
 PURPOSE:
	Display time difference between start and stop time
	(start time can be set internally; stop time can be system time)
 CALLING SEQUENCE:
	subroutine StopWatch(cStartIn,cStopIn)
 INPUTS: (read-only)
	cStart	character*(*)	start time string; absolute time
	cStop	character*(*)	(optional) stop time string
				special value cStop = ' ' or cStop = '_'
 OUTPUTS:
	Displayed on screen
 CALLS: ***
	StopWatchSub, cTime2System
 RESTRICTIONS:
	No check is made whether START is in the proper absolute time format.
	If not, all bets are off.
 PROCEDURE:
 >	If START .eq. ' ':
	- the first  call to StopWatch will set and save the system time
	- the second call to StopWatch will display the elapsed time between
	  the cStart time set in the previous call and the specified cStop time.
 >	If cStart .ne. ' ': 
	- the start time must be in absolute time format YYY/MN/DD hh:mm:ss.ss,
 >	If cStop = ' ' or cStop = '_' the current system time is used as stop
	time. Otherwise it must be an absolute time
 MODIFICATION HISTORY:
	JAN-1993, Paul Hick (UCSD/CASS)
		Original written in Lindau.
	NOV-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Rewritten using Time2* routines.


StopWatchSub $SSW_SMEI_UCSD/gen/for/lib/gen/stopwatchsub.f
[Previous] [Next]
 NAME:
	StopWatchSub
 PURPOSE:
	Clock the time elapsed since given start time
 CALLING SEQUENCE:
	subroutine StopWatchSub(cStart,cStop,cLapsed)
 INPUTS:
	cStart	character*(*)	read-only	start time string; absolute time
	cStop	character*(*)			(optional) stop time string
			special input: cStop = ' ' and cStop = '_'
 OUTPUTS:
	cStop	character*(*)			current time string
	LAPSED	character*(*)			time difference string
			format DDD HH:MM:SS.SS
 CALLS: ***
	Time2Delta, Time2Split, Time2Str, Time2System
 CALLED BY:
	StopWatch
 RESTRICTIONS:
	There is no check whether the input times are in the proper absolute
	time format. If not, all bets are off.
 PROCEDURE:
 >	The input and (optional) stop time must be specified as absolute times,
	in the format specified in argument cFmt.
 >	if the input string cStop = ' ' or cStop = '_' then the stop time is
	obtained using Time2System
 >	if cStop = ' ' the stop time is not returned, i.e. cStop is used read-only
 >	if cStop = '_' the stop time is returned
 >	the time difference is returned in the form DDD HH:MM:SS.SS.
	If the number of days DDD=0 the DDD part is filled with blanks.
 MODIFICATION HISTORY:
	JAN-1993, Paul Hick (UCSD/CASS)
		Original written in Lindau.
	NOV-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Rewritten using Time2* routines.


Str2Dbl $SSW_SMEI_UCSD/gen/for/lib/str/str2flt.f
[Previous] [Next]
 NAME:
	Str2Dbl
 PURPOSE:
	Extract numbers from string and put them in floating point array
 CALLING SEQUENCE:
	entry Str2Dbl(cStr,nVec,dVec)
 INPUTS:
	cStr	string (e.g. 89/1/12)
	nVec	integer		max # elements read into rVec
 OUTPUTS:
	nVec	integer		# elements of rVec filled
			If more than nVec numbers were located in the input
			string, then nVec is set to the NEGATIVE of the
			input value of nVec.
	rVec	real		floating point array with identified numbers
 CALLS: ***
	Int2Str, Int2StrSet, Say, Str2Flt_CheckNext, Str2Flt_FmtCrumbs, Str2Flt_FmtNumbers
	Str2Str, itrim, uppercase
 CALLED BY:
	AskLimit, ForeignR8ArgN, bStr2Dbl
 PROCEDURE:
	Double precision version of Flt2Str


Str2Flt $SSW_SMEI_UCSD/gen/for/lib/str/str2flt.f
[Previous] [Next]
 NAME:
	Str2Flt
 PURPOSE:
	Extract numbers from string and put them in floating point array
 CALLING SEQUENCE:
	subroutine Str2Flt(cStr,nVec,rVec)
 INPUTS:
	cStr	string (e.g. 89/1/12)
	nVec	integer		max # elements read into rVec
 OUTPUTS:
	nVec	integer		# elements of rVec filled
			If more than nVec numbers were located in the input
			string, then nVec is set to the NEGATIVE of the
			input value of nVec.
	rVec	real		floating point array with identified numbers
 CALLS: ***
	Int2Str, Int2StrSet, Say, Str2Flt_CheckNext, Str2Flt_FmtCrumbs, Str2Flt_FmtNumbers
	Str2Str, itrim, uppercase
 CALLED BY:
	AskWhatPrmpt, FileSelection, ForeignR4ArgN, WR2DARR, bStr2Flt, iFltArr
	smei_frm_path
 SEE ALSO:
	Str2Flt_Crumbs, Str2Flt_Exp, Str2Flt_FforI, Str2Flt_Format, Str2Flt_Int
	Str2Flt_Mask, Str2Flt_XforA, bStr2Flt
 INCLUDE:
	include		'str2str_inc.h'
 PROCEDURE:
 >	Str2Flt is the main program unit. It checks each character in cStr against
	a list of valid characters. Processing characters sequentially going
	from first to last, the largest possible substrings representing valid
	numbers are extracted.
 >	If the number of valid numbers in cStr exceeds the requested input
	value of nVec, then (output nVec) = -(input nVec). I.e. a negative
	return value of nVec indicates that not all numbers have been read
	from cStr into the output array rVec.
 >	By default Str2Flt does not search for exponents (i.e. E and D are
	not considered a valid part of a number). If Str2Flt_Exp is called prior
	to Str2Flt, then integer exponents will be recognized. The setting
	specified by Str2Flt_Exp is only valid for one call to Str2Flt
 >	Str2Flt builds a format string describing cStr. After the call to
	Str2Flt the format string can be extracted using Str2Flt_Format.
 >	All substrings in cStr that can not be interpreted as part of a
	valid number are stored in a string array. The array can be extracted
	using Str2Flt_Crumbs. The maximum number of substrings extracted is
	currently 20; the max length of each substring also is 20.
	Str2Flt_Crumbs also returns the total number of character in cStr
	that have not been interpreted as part of a number.
 >	bStr2Flt is a special case of a Str2Flt call. It will return .TRUE.
	if cStr contains exactly nVec numbers with no residual characters
	that are not part of any number. (It's used by the ASK routines to
	verify whether a valid number has been entered).
 MODIFICATION HISTORY:
	Written Jan 1989 by DMZ (ARC)
	Converted to V2 Dec 1990 by DMZ (ARC)
	OCT-1990, Paul Hick (ARC), rewritten and expanded to accept exponentials
	DEC-1992, Paul Hick (UCSD/CASS), converted from IDL
	SEP-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Fairly substantial rewrite to remove remaining statement labels.


Str2Flt_CheckNext $SSW_SMEI_UCSD/gen/for/lib/str/str2flt_checknext.f
[Previous] [Next]
 NAME:
	Str2Flt_CheckNext
 PURPOSE:
	(Internal use by Str2Flt only)
	Checks whether character following char I in string Str is present in Valid.
 CALLING SEQUENCE:
	logical function Str2Flt_CheckNext(nLen,cStr,nMask,cMask,I,CH,cValid,iFirst)
 INPUTS:
	nLen		integer		effective length of cStr
	cStr		character*(*)	string
	nMask
	cMask
	I		integer
	CH		character
	cValid		character*(*)
	iFirst		integer
 OUTPUTS:
	Str2Flt_CheckNext
			logical
	I		integer
	CH		character
	iFirst		integer
 CALLED BY:
	Str2Dbl, Str2Flt, Str2Flt_Exp, Str2Flt_FforI, Str2Flt_Int, Str2Flt_Mask
	Str2Flt_XforA, Str2Int
 PROCEDURE:
	Called when CH = cStr(I:I) is a '+', '-' or dot. To be part of a valid
	number the char following I must be a dot or digit (if CH = '+' or '-') or
	it must be a digit (if CH = '.').
 MODIFICATION HISTORY:
	SEP-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Str2Flt_Crumbs $SSW_SMEI_UCSD/gen/for/lib/str/str2flt_fmtnumbers.f
[Previous] [Next]
 NAME:
	Str2Flt_Crumbs
 PURPOSE:
	Extract parts of cStr that did not fit into any numbers
 CALLING SEQUENCE:
	entry Str2Flt_Crumbs(lCrumbsOut,nCrumbsOut,cCrumbsOut)
 INPUTS:
	nCrumbs		integer		max # crumbs to be retrieved
 OUTPUTS:
	nCrumbs		integer		# crumbs in cStr
	cCrumbs		character(20)*20values of all crumbs in cStr
	cCrumbs		integer		total length of all crumbs
 CALLS: ***
	Int2Str, Str2Str, itrim
 CALLED BY:
	bStr2Dbl, bStr2Flt
 PROCEDURE:
	Entry point in subroutine Str2Flt_FmtNumbers

	All substrings in cStr that can not be interpreted as part of a
	valid number are stored in a string array.
	This subroutine extracts this array. See Str2Flt
 MODIFICATION HISTORY:
	DEC-1992, Paul Hick (UCSD), converted from IDL


Str2Flt_Exp $SSW_SMEI_UCSD/gen/for/lib/str/str2flt.f
[Previous] [Next]
 NAME:
	Str2Flt_Exp
 PURPOSE:
	Set the value of logical bExp for next call to Str2Flt (def: .FALSE.)
 CALLING SEQUENCE:
	entry Str2Flt_Exp(bExpIn)
 INPUTS:
	bExpIn		logical	.FALSE. : ignore 'E' and 'D'
				.TRUE.  : exponentials of type 'D' and 'E' are interpreted
 CALLS: ***
	Int2Str, Int2StrSet, Say, Str2Flt_CheckNext, Str2Flt_FmtCrumbs, Str2Flt_FmtNumbers
	Str2Str, itrim, uppercase
 CALLED BY:
	bStr2Dbl, bStr2Flt, iFltArr
 RESTRICTIONS:
	The setting specified by Str2Flt_Exp is only valid for one call to Str2Flt
 PROCEDURE:
	Entry point in subroutne Str2Flt

	By default Str2Flt does not search for exponents (i.e. E and D are
	not considered a valid part of a number). If Str2Flt_Exp is called prior
	to Str2Flt, then integer exponents will be recognized.
 MODIFICATION HISTORY:
	DEC-1992, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Str2Flt_FforI $SSW_SMEI_UCSD/gen/for/lib/str/str2flt.f
[Previous] [Next]
 NAME:
	Str2Flt_FforI
 PURPOSE:
	Determines how integers in the next Str2Flt call are
	represented in the format cFmt string: as In or Fn.0
 CALLING SEQUENCE:
	entry Str2Flt_FforI(bFforIIn)
 INPUTS:
	bFforIIn	logical		default: .FALSE.
 CALLS: ***
	Int2Str, Int2StrSet, Say, Str2Flt_CheckNext, Str2Flt_FmtCrumbs, Str2Flt_FmtNumbers
	Str2Str, itrim, uppercase
 RESTRICTIONS:
	Valid for one call to Str2Flt only.
 PROCEDURE:
	Entry point in subroutine Str2Flt

	If bFforI=.TRUE. then integers are represented as Fn.0
	in the cFmt string. The default is In.
 MODIFICATION HISTORY:
	DEC-1992, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Str2Flt_FmtCrumbs $SSW_SMEI_UCSD/gen/for/lib/str/str2flt_fmtnumbers.f
[Previous] [Next]
 NAME:
	Str2Flt_FmtCrumbs
 PURPOSE:
	(Internal use by Str2Flt only)
	Adds component to crumbs array
 CALLING SEQUENCE:
	entry Str2Flt_FmtCrumbs(Init,cStr,iFirst,iLast,bXforA)
 INPUTS:
	Init		integer		1: initialize new crumb collection
					0: add to collection
	cStr		character	string
	iFirst		integer		first char of current number
	iLast		integer		last char of previous number
	bXforA		logical		add X to format instead of A
					array of crumbs
 OUTPUTS:
 CALLS: ***
	Int2Str, Str2Str, itrim
 CALLED BY:
	Str2Dbl, Str2Flt, Str2Flt_Exp, Str2Flt_FforI, Str2Flt_Int, Str2Flt_Mask
	Str2Flt_XforA, Str2Int
 SEE ALSO:
	Str2Flt
 PROCEDURE:
	Entry point in subroutine Str2Flt_FmtNumbers
 MODIFICATION HISTORY:
	SEP-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Str2Flt_FmtNumbers $SSW_SMEI_UCSD/gen/for/lib/str/str2flt_fmtnumbers.f
[Previous] [Next]
 NAME:
	Str2Flt_FmtNumbers
 PURPOSE:
	(Internal use by Str2Flt only)
	Adds component to format string
 CALLING SEQUENCE:
	subroutine Str2Flt_FmtNumbers(Init,iFmtCnt,cFmtSub,iFmtLen)
 INPUTS:
	iFmtCnt		integer		# numbers collected
	cFmtSub		character*(*)	format fitting numbers
	iFmtLen		integer		# characters in number
 OUTPUTS:
	iFmtCnt		integer		set to zero
 CALLS: ***
	Int2Str, Str2Str, itrim
 CALLED BY:
	Str2Dbl, Str2Flt, Str2Flt_Exp, Str2Flt_FforI, Str2Flt_Int, Str2Flt_Mask
	Str2Flt_XforA, Str2Int
 SEE ALSO:
	Str2Flt
 MODIFICATION HISTORY:
	SEP-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Str2Flt_Format $SSW_SMEI_UCSD/gen/for/lib/str/str2flt_fmtnumbers.f
[Previous] [Next]
 NAME:
	Str2Flt_Format
 PURPOSE:
	Extract format set up during last call to Str2Flt
 CALLING SEQUENCE:
	entry Str2Flt_Format(cFmtOut)
 INPUTS:
	(none)
 OUTPUTS:
	cFmtOut		character*(*)	format fitting input string to last Str2Flt call.
 CALLS: ***
	Int2Str, Str2Str, itrim
 CALLED BY:
	iFltArr, smei_frm_path
 PROCEDURE:
	Entry point in subroutine Str2Flt_FmtNumbers
 MODIFICATION HISTORY:
	DEC-1992, Paul Hick (UCSD), converted from IDL


Str2Flt_Int $SSW_SMEI_UCSD/gen/for/lib/str/str2flt.f
[Previous] [Next]
 NAME:
	Str2Flt_Int
 PURPOSE:
	Deterimines how integers in the next Str2Flt are interpreted.
 CALLING SEQUENCE:
	entry Str2Flt_Int(bIntIn)
 INPUTS:
	bIntIn		logical		default: .FALSE.
 CALLS: ***
	Int2Str, Int2StrSet, Say, Str2Flt_CheckNext, Str2Flt_FmtCrumbs, Str2Flt_FmtNumbers
	Str2Str, itrim, uppercase
 SEE ALSO:
	See Str2Flt
 RESTRICTIONS:
	Valid for one call to Str2Flt only.
 PROCEDURE:
	Entry point in subroutine Str2Flt

	If bInt=.TRUE. then integer values are equivalenced
	to a real*4. The real*4 value is then returned in the
	output array rVec of Str2Flt
 MODIFICATION HISTORY:
	DEC-1992, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Str2Flt_Mask $SSW_SMEI_UCSD/gen/for/lib/str/str2flt.f
[Previous] [Next]
 NAME:
	Str2Flt_Mask
 CALLING SEQUENCE:
	entry Str2Flt_Mask(cMaskIn)
 CALLS: ***
	Int2Str, Int2StrSet, Say, Str2Flt_CheckNext, Str2Flt_FmtCrumbs, Str2Flt_FmtNumbers
	Str2Str, itrim, uppercase
 PROCEDURE:
	Entry point in subroutine Str2Flt
 MODIFICATION HISTORY:
	DEC-1992, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Str2Flt_XforA $SSW_SMEI_UCSD/gen/for/lib/str/str2flt.f
[Previous] [Next]
 NAME:
	Str2Flt_XforA
 PURPOSE:
	Set the value of bXforA for one call to Str2Flt (def: .FALSE.)
 CALLING SEQUENCE:
	entry Str2Flt_XforA(bXforAIn)
 INPUTS:
	bXforAIn	logical		 uninterpreted chars are identified with:
					.TRUE.  : 'X' in cFmt
					.FALSE. : 'A' in cFmt
 OUTPUTS:
	(none)
 CALLS: ***
	Int2Str, Int2StrSet, Say, Str2Flt_CheckNext, Str2Flt_FmtCrumbs, Str2Flt_FmtNumbers
	Str2Str, itrim, uppercase
 RESTRICTIONS:
	Valid for one call to Str2Flt only; before returning values are set
	back to defaults)
 PROCEDURE:
	Entry point in subroutine Str2Flt
 MODIFICATION HISTORY:
	DEC-1992, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Str2Int $SSW_SMEI_UCSD/gen/for/lib/str/str2flt.f
[Previous] [Next]
 NAME:
	Str2Int
 PURPOSE:
	Extract numbers from string and put them in integer array
 CALLING SEQUENCE:
	entry Str2Int(cStr,nVec,iVec)
 INPUTS:
	cStr	string (e.g. 89/1/12)
	nVec	integer		max # elements read into rVec
 OUTPUTS:
	nVec	integer		# elements of rVec filled
			If more than nVec numbers were located in the input
			string, then nVec is set to the NEGATIVE of the
			input value of nVec.
	iVec	integer		integer array with identified numbers
 CALLS: ***
	Int2Str, Int2StrSet, Say, Str2Flt_CheckNext, Str2Flt_FmtCrumbs, Str2Flt_FmtNumbers
	Str2Str, itrim, uppercase
 CALLED BY:
	ForeignI2ArgN, ForeignI4ArgN
 PROCEDURE:
	Integer version of Flt2Str


Str2Str $SSW_SMEI_UCSD/gen/for/lib/str/str2str.f
[Previous] [Next]
 NAME:
	Str2Str
 PURPOSE:
	Copy string to another string
 CATEGORY:
       Strings: write string to string
 CALLING SEQUENCE:
	integer function Str2Str(cStr1,cStr2)
 INPUTS:
	cStrI		character*(*)	string to be processed
 OUTPUTS:
	Str2Str		integer		length non-trivial part of output string
 CALLS: ***
	itrim
 CALLED BY:
	AskLimit, GridFill, MAP_TZERO, NicHdr, ParseRepair, Peep, SetRotations, Str2Dbl, Str2Flt
	Str2Flt_Crumbs, Str2Flt_Exp, Str2Flt_FforI, Str2Flt_FmtCrumbs
	Str2Flt_FmtNumbers, Str2Flt_Format, Str2Flt_Int, Str2Flt_Mask, Str2Flt_XforA
	Str2Int, Time2CarringtonT0, WriteI4GRD, WriteR4GRD, bCompressNic, bOSFind [3]
	iDir2File, iFile2Dir, iFilePath, iFileStructure, iFltArr, iGetDirectoryFragment
	iGetFileSpec, iGetParentDirectory, iGetTopDirectory, iOSCopyFile [1]
	iOSCopyFile [2], iOSCopyFile [3], iOSgunzip, iSearchTree, iSetFileSpec, ice_read
	ice_write, mkenv, rice, smei_base, smei_cal, smei_cal_add, smei_cal_build
	smei_cal_c3mask, smei_cal_get, smei_cal_init, smei_cal_read, smei_frm_base
	smei_frm_getlist, smei_frm_ok, smei_frm_write, smei_get_glare, smei_orb
	smei_orb_mkname, smei_skyd, smei_skyd_combine, smei_skyd_fill, smei_skyd_flush
	smei_skyd_fts, smei_skyd_init, smei_skyd_make, smei_skyd_scan, smei_skyd_size
	smei_skyd_sky, smei_skyd_sort, sprint
 SEE ALSO:
	Flt2Str, Int2Str, Int2StrSet, Str2StrSet
 INCLUDE:
	include		'str2str_inc.h'
 PROCEDURE:
       The input string cStrI is put in the output string subject to the
       constraints set by Str2StrSet.
	A sequence of Str2Str, Int2Str and Flt2Str calls can be used to build
	a string without explicitly referring to locations in the destination
	string:
	I = 0
	I = I+Str2Str(cStr1, cStrO(I+1:))
	I = I+Int2Str(iNum , cStrO(I+1:))
	I = I+Str2Str(cStr2, cStrO(I+1:))
 MODIFICATION HISTORY:
	JAN-1995, Paul Hick (UCSD)


str2str_inc $SSW_SMEI_UCSD/gen/for/h/str2str_inc.h
[Previous] [Next]
 NAME:
	str2str_inc
 PURPOSE:
	Define parameter constants
 SEE ALSO:
	Int2Str, Str2Flt, Str2Str
 CALLING SEQUENCE:
	include 'str2str_inc.h'
 INCLUDED BY:
	AskLimit, Dbl2Str, Flt2Str, Int2Str, ParseRepair, SetRotations, Str2Flt, Str2Str
	bOSFind [1], bOSFind [2], bOSFind [3], iDir2File, iFile2Dir, iFilePath, iFltArr
	iSetFileSpec
 PROCEDURE:


Str2StrSet $SSW_SMEI_UCSD/gen/for/lib/str/str2str.f
[Previous] [Next]
 NAME:
	Str2StrSet
 PURPOSE:
	Set mode of string insertion in Str2Str
 CALLING SEQUENCE:
	entry Str2StrSet(nFill)
 INPUTS:
	iSet		integer		insertion mode; default: STR__TRIM
					Any of the values in include file
					str2str_inc.h can be used: STR__TRIM,
					STR__NOTRIM,STR__LEFTADJUST,STR__RIGHTADJUST
 OUTPUTS:
	Str2StrSet	integer		previous insertion mode
 CALLS: ***
	itrim
 CALLED BY:
	AskLimit, ParseRepair, SetRotations, bOSFind [1], bOSFind [2], bOSFind [3]
	bOSFindClose, iDir2File, iFile2Dir, iFilePath, iFileStructure, iFltArr
	iGetDirectoryFragment, iGetFileSpec, iGetParentDirectory, iGetTopDirectory
	iSetFileSpec
 SEE ALSO:
	Int2Str, Int2StrSet, Str2Str
 PROCEDURE:
	Str2StrSet is an entry point in function Str2Str.
	Typically it is used before and after one or more Str2Str calls to
	restore a previously set insertion mode:

	iSet = Str2StrSet(STR__NOTRIM)		Set new insertion mode, save old one
	( calls to Str2Str )
	iSet = Str2StrSet(iSet)			Restore old insertion mode
 MODIFICATION HISTORY:
	JAN-1995, Paul Hick (UCSD)


sun $SSW_SMEI_UCSD/gen/for/h/sun.h
[Previous] [Next]
 NAME:
	sun
 PURPOSE:
	Defines parameter constants for various solar constants
 INCLUDED BY:
	ECLIPTIC_HELIOGRAPHIC, IPSBase, KeplerOrbit, MAP_CarrTime, N_CARRINGTON, PA_POLE
	SunRadius, Thomson3DDensity, ThomsonLOS, ThomsonLOS3D, ThomsonLOS3DStep
	ThomsonLOSFar, ThomsonLOSStep, ThomsonS10, Time2Carrington
	Time2EclipticHeliographic, Time2KeplerOrbit, Time2PAnglePole, Time2SunRadius
	Time2smei_eph, UlyssesOrbit, smei_eclipse


SUN_L0B0 $SSW_SMEI_UCSD/gen/for/lib/gen/sun_l0b0.f
[Previous] [Next]
 NAME:
	SUN_L0B0
 PURPOSE:
	Calculate heliographic coordinates of center of the solar disk
 CALLING SEQUENCE:
	subroutine SUN_L0B0(iYr,Doy, L0,B0)
 INPUTS: (angles in degrees)
	iYr	integer		year
	Doy	real		doy of year (including fraction for time of day)
	L0	real		ecliptic longitude offset of observer
				(see procedure)
	B0	real		ecliptic latitude of observer
 OUTPUTS: (angles in degrees)
	L0	real		heliographic longitude and ..
	B0	real		.. latitude of observer
 CALLS: ***
	ECLIPTIC_HELIOGRAPHIC, SunNewcomb
 PROCEDURE:
	The position of the observer is specified in heliocentric ecliptic
	coordinates relative to the Earth, i.e. L0 is the difference between
	the eclip. long. of the observer and ecl. long. of Earth.
	Set L0=0 and B0=0 to get the conventional L0 and B0 (disk center as
	seen from Earth, or sub-Earth point).
 MODIFICATION HISTORY:
	JUN-1993, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


SunNewcomb $SSW_SMEI_UCSD/gen/for/lib/gen/sunnewcomb.f
[Previous] [Next]
 NAME:
	SunNewcomb
 PURPOSE:
	Calculates the true ecliptic coordinates (longitude, latitude and
	distance) of the Sun according to Newcombs theory of solar motion.
	See O. Montenbruck, Practical Ephemeris Calculations, par. 4.1.2, p. 66.
 CATEGORY:
	Celestial mechanics
 CALLING SEQUENCE:
	subroutine SunNewcomb(ID,iYr,Doy,rLng,rLat,rDis)
 CALLS: ***
	Julian, dcosd, dsind
 INPUTS:
	ID	integer		0 = return two-body solution
				1 = take planetary perturbations into account
	iYr	integer		year
	Doy	real		doy of year, including fraction for time of day
 OUTPUTS:
	rLng	double precision	ecliptic longitude in degrees [0,360)
	rLat	double precision	ecliptic latitude  in arcsec
	rDis	double precision	Sun-Earth distance in AU
 CALLED BY:
	EARTH, EARTH_ELIMB, EARTH_WLIMB, SUN_L0B0, SunRadius
 PROCEDURE:
	DLP	long period perturbation of solar mean longitude and mean
		anomaly
	G	mean anomaly of the Sun
	LO	= DLO+SLO/3600 = mean longitude of Sun
	DL	difference between true and mean solar longitude according to
		two body problem
	The precision calculation includes perturbations by planets, oscillatory
	terms with amplitudes less than 8 arcsec.
 ACCURACY:
	A check with the Astronomical Almanac shows:
	(All times are at midnight on the day given)

	  			Normal		Precision	Almanac
	1971	Jan 1	Lng	279.9114	279.91575	279 54' 57.0"  (279.91583)
			Lat	  0.		0.38"		0.42"
			Dist	0.9832947	0.9833006	0.9832998
	1974	Jan 1	Lng	280.1882	280.1874	280 11' 14.94" (280.1875)
			Lat	  0.
			Dist
	1979	Jan 1	Lng	279.9702	279.9708	279 58' 14.90" (279.9708)
			Lat	  0.
			Dist
	1989	Jan 1	Lng	280.5535	280.5525	280 33' 10.44" (280.5529) 
			Lat	  0.
			Dist
 MODIFICATION HISTORY:
	1989, Paul Hick (MPAE,UCSD/CASS; pphick@ucsd.edu)
	10/24/91, Tom Davidson : accuracy test
	AUG-1993, Paul Hick, extension of SunEclLong


SUNRA $SSW_SMEI_UCSD/gen/for/lib/gen/sunra.f
[Previous] [Next]
 NAME:
	SUNRA
 PURPOSE:
	Calculate sidearal time and position of the Sun.
	Good for years 1901 through 2099. Accuracy is 0.006 degree.
 CATEGORY:
	Celestial mechanics
 CALLING SEQUENCE:
	subroutine SUNRA(iYr,iDay,SECS,GST,SLONG,SRASN,SDEC)
 INPUTS:
	iYr	integer
	iDay	integer
	SECS	real		(iYr,iDay,SECS) define the universal time (UT)
 OUTPUTS:
	GST	real		Greenwich sidereal time (degrees)
	SLONG	real		Ecliptic longitude Sun (degrees)
	SRASN	real		Apparent right ascension Sun (degrees)
	SDEC	real		Apparent declination (degrees)
 INCLUDE:
	include		'math.h'
 RESTRICTIONS:
	Only valid for years 1901 through 2099
 MODIFICATION HISTORY:
	From: Geophysical Coordinate Transformations, C.T. Russell, in:
		Cosmic Electrodynamics 2 (1971) 184-196


SunRadius $SSW_SMEI_UCSD/gen/for/lib/gen/sunradius.f
[Previous] [Next]
 NAME:
	SunRadius
 PURPOSE:
	Calculate radius of Sun (in arcseconds) as seen from Earth
 CALLING SEQUENCE:
	function SunRadius(iYr,Doy)
 INPUTS:
	iYr		integer		year
	Doy		integer		doy of year (fraction for time of day)
 OUTPUTS:
	SunRadius	real		solar radius in arcsec at time iYr,Doy
 INCLUDE:
	include		'sun.h'
	include		'math.h'
 CALLS: ***
	SunNewcomb
 PROCEDURE:
	The Earth-Sun distance is calculated by calling SunNewcomb
 MODIFICATION HISTORY:
	AUG-1993, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


SwitchTag $SSW_SMEI_UCSD/gen/for/lib/str/switchtag.f
[Previous] [Next]
 NAME:
	SwitchTag
 PURPOSE:
	Given two tags, check for presence of one of the tags and replace it with the other.
 CATEGORY:
	Strings: tag manipulation
 CALLING SEQUENCE:
	subroutine SwitchTag(cTags,cSep,cTag1,cTag2)
 INPUTS:
	cTags		character*(*)	list of tags, separated by the cSep character
	cSep		character	character used as separater (usually comma)
	cTag1,cTag2	character*(*)	tags (substrings) to be switched
 OUTPUTS:
	cTags		character*(*)	updated list of tags (RemoveTag, SwitchTag only)
 CALLS: ***
	LocateTag, ReplaceTag, itrim
 SEE ALSO:
	RemoveTag
 PROCEDURE:
       One of the two tags must be present in the cTags list. It will be replaced by the other
 MODIFICATION HISTORY:
	NOV-1994, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	JUN-1995, Paul Hick (UCSD; pphick@ucsd.edu), added SwitchTag