t3d_array $SMEI/for/h/t3d_array.h
[Previous] [Next]
 NAME:
	t3d_array
 PURPOSE:
	Defines paramater constants for entries in header for tomography output files
 CALLING SEQUENCE:
	include 't3d_array.h'
 INCLUDED BY:
	BuildSourceSurface, CheckMass, ExtractInsitu, GetLOSValue, LOSClean, LOSIntegralG
	LOSIntegralV, LOSPosition, LOSProjection, LOSReach, LOSSanityCheck, LOSTweak
	LOSWeights, SW_Model_Kinematic, SetGrid, T3D_Read_B, T3D_get_grid, T3D_show
	T3D_write_bb, T3D_write_nv, Write3D_bb, Write3D_bb_UT, Write3D_bb_XC, Write3D_bbtt
	Write3D_nv, Write3D_nv_UT, Write3D_nv_XC, ipsd, ipsg2, ipsg2s, ipsg2t
 PROCEDURE:
 MODIFICATION HISTORY:
	???-????, Paul Hick (UCSD/CASS)
	OCT-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Added T3D_MARKER


T3D_fill_global $SMEI/for/lib/t3d_get_grid.f
[Previous] [Next]
 NAME:
	T3D_fill_global
 PURPOSE:
	Fill 'global' section of t3d array.
 CALLING SEQUENCE:
	entry T3D_fill_global(t3dx, I__MODE, kIter,nIter,NCoff,TT,dTT,RR,dRR,
     &		nLng,nLat,nRad,nTim,PWN_V,PWN_G,PWR_V,PWR_G,D1AU,
     &		SMOOTH_V,SMOOTH_D, FILL_V,FILL_D,SMOOTH_TIME_V,SMOOTH_TIME_D,ClipLng, Scale)
 CALLS: ***
	BadR4, Flt2Str, Int2Str, Int2StrSet, Str2Str, T3D_marker, Time2Carrington
	Time2GetOrigin, Time2PutOrigin, Time2Round, Time2SetOrigin2000, Time2Str
	XCvarFormat
 CALLED BY:
	write3D_infotd3D
 PROCEDURE:
	Entry point in T3D_get_grid.
	Still in use in some time-dependent tomography versions. 
	Probably should be replaced by calls to T3D_get, etc.


T3D_fill_time $SMEI/for/lib/t3d_get_grid.f
[Previous] [Next]
 NAME:
	T3D_fill_time
 PURPOSE:
	Fill 'global' section of t3d array.
 CALLING SEQUENCE:
	entry T3D_fill_time(t3dx, iTime, TT, XCbegMAT,XCendMAT,XCbegROI,XCendROI)
 CALLS: ***
	BadR4, Flt2Str, Int2Str, Int2StrSet, Str2Str, T3D_marker, Time2Carrington
	Time2GetOrigin, Time2PutOrigin, Time2Round, Time2SetOrigin2000, Time2Str
	XCvarFormat
 CALLED BY:
	write3D_infotd3D
 PROCEDURE:
	Entry point in T3D_get_grid.
	Still in use in some time-dependent tomography versions. 
	Probably should be replaced by calls to T3D_get, etc.


T3D_get $SMEI/for/lib/t3d_get_grid.f
[Previous] [Next]
 NAME:
	T3D_get
 PURPOSE:
	Retrieves real entry in t3d array
 CALLING SEQUENCE:
	entry T3D_get(ID, IOFF, V)
 INPUTS:
	ID		integer		identified position in t3d array to be retrieved
					This should be the name of one of the parameters
					defined in t3d_array
	IOFF		integer		=0: only t3d(ID) is retrieved
					>0: t3d(ID..ID-1+IOFF) are retrieved
	V(*)		real		value(s) retrieved from t3d array
 CALLS: ***
	BadR4, Flt2Str, Int2Str, Int2StrSet, Str2Str, T3D_marker, Time2Carrington
	Time2GetOrigin, Time2PutOrigin, Time2Round, Time2SetOrigin2000, Time2Str
	XCvarFormat
 CALLED BY:
	ExtractInsitu, LOSPosition, LOSWeights, SW_Model_Kinematic, Write3D_bb, Write3D_nv
	Write3D_nv_UT, Write3D_nv_XC
 PROCEDURE:
	Entry point in T3D_get_grid


T3D_get_all $SMEI/for/lib/t3d_get_grid.f
[Previous] [Next]
 NAME:
	T3D_get_all
 PURPOSE:
	Retrieves whole t3d array
 CALLING SEQUENCE:
	entry T3D_get_all(t3dx)
 OUTPUTS:
	t3dx(T3D__NELEMENTS)	real	received content of t3d_array
					(the size T3D__NELEMENTS is defined in
					include file t3d_array
 CALLS: ***
	BadR4, Flt2Str, Int2Str, Int2StrSet, Str2Str, T3D_marker, Time2Carrington
	Time2GetOrigin, Time2PutOrigin, Time2Round, Time2SetOrigin2000, Time2Str
	XCvarFormat
 PROCEDURE:
	Entry point in T3D_get_grid


T3D_get_grid $SMEI/for/lib/t3d_get_grid.f
[Previous] [Next]
 NAME:
	T3D_get_grid
 PURPOSE:
	Retrieve grid related constants from t3d array
 CATEGORY:
	Tomography
 CALLING SEQUENCE:
	subroutine T3D_get_grid(TT,dTT,RR,dRR,nLng,nLat,nRad,nTim, dTTi,nLng1,nLat1)
 OUTPUTS:
	TT, dTT		real		time and time increment
	RR, dRR		real		source surface distance and radial increment
	nLng,nLat,nRad,nTim
			integer		# elements in each dimension of the numerical grid

	A few auxiliary variables:

	dTTi		real		1./dTT; will be zero if dTT=0.0
	nLng1		integer		nLng-1
	nLat1		integer		nLat-1
 CALLS: ***
	BadR4, Flt2Str, Int2Str, Int2StrSet, Str2Str, T3D_marker, Time2Carrington
	Time2GetOrigin, Time2PutOrigin, Time2Round, Time2SetOrigin2000, Time2Str
	XCvarFormat
 CALLED BY:
	BuildSourceSurface, CheckMass, ExtractInsitu, GetLOSValue, LOSReach
	SW_Model_Kinematic, T3D_Read_B, Write3D_bb, Write3D_bb_UT, Write3D_bb_XC
	Write3D_bbtt, Write3D_nv, Write3D_nv_UT, Write3D_nv_XC, ipsg2, ipsg2s, ipsg2t
 SEE ALSO:
	T3D_get, T3D_iget, T3D_iset, T3D_set
 INCLUDE:
	include		't3d_array.h'
	include		'str2str_inc.h'
 PROCEDURE:
	The array t3d stores all the information about a specific reconstruction.
	Typically most of the entries are filled in the main program and are
	updated/extracted as needed using the subroutines lister under SEE ALSO above

	The entries are roughly divided in 'global' entries (applying to the
	reconstruction in general) and 'time-dependent' entries (different for every
	time step in a time-dependent reconstruction).

	I__MODE		integer		several bits are used to control program execution

	NL_V		integer		# velocity lines of sight
	NL_G		integer		# g-level lines of sight
	dLOS		real		step size along line of sight (AU)
	NLOS		integer		# steps along line of sight
	BINX_V		real		Min. # los crossings in bin at source surface for V
	BINX_D		real		Min. # los crossings in bin at source surface for G

	kIter		integer		iteration number
	nIter		integer		max. # iterations

	NCoff		integer		Carrington variable offset
					This value needs to be added to XCbeg, XCend, XCbegROI,
					XCendROI and XCTime to get the actual Carrington variable.

	TT		real		start time as Carrington variable (- NCoff)
	dTT		real		time resolution as Carrington variable
					(if nTim=1 then the values of TT and dTT do not matter)
					If the time-dependent reconstruction is not in equal
					steps set TT and dTT to BadR4

	RR		real		radial distance of source surface (AU)
	dRR		real		radial resolution (AU)

	nLng		integer		# longitudes covering [0,360] degrees
	nLat		integer		# latitudes covering [-90,90] degrees
	nRad		integer		# radial distance covering [RR,RR+(nRad-1)*dRR]
	nTim		integer		# times covering [TT,TT+(nTim-1)*dTT]

	PWN_V,PWN_G	real		power determining density dependence of g-level
	PWR_V,PWN_G	real		power determining dependence on radial dependence of g-level

	D1AU		real		density at 1 AU (cm^-3)

	SMOOTH_V, SMOOTH_D
			real		width for smoothing velocity and density maps
	FILL_V, FILL_D	real		width for filling holes in velicity and density maps
	SMOOTH_TIME_V, SMOOTH_TIME_D
			real		width for smoothing over time for velocity and density

	ClipLng		real		clip longitude (argument for GridSphere)
	
	Scale(4)	real		extra scaling factor for data arrays
					These are pairs of y-intercept and slope values
					for each of data sets output to file. 
					(set these to 0,1 or BadR4 if no scaling is required)
	R_PWR(3)	real		power of r applied when writing data to file
					(typically 0 for velocity, 2 for density, 2 for
					radial magnetic field, 1 for azimuthal magnetic field).
 MODIFICATION HISTORY:
	JAN-2001, Paul Hick (UCSD/CASS)
	AUG-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Added arguments NL_V, NL_G, dLOS, NLOS.


T3D_get_mode $SMEI/for/lib/t3d_get_grid.f
[Previous] [Next]
 NAME:
	T3D_get_mode
 CALLING SEQUENCE
	entry T3D_get_mode(IB,ION)
 INPUTS:
	IB	integer		integer between 0 and 31 identifying
				a bit in t3d(T3D__MODE)
 OUTPUTS:
	ION	integer		0 if bit is not set
				1 if bit is set
 CALLS: ***
	BadR4, Flt2Str, Int2Str, Int2StrSet, Str2Str, T3D_marker, Time2Carrington
	Time2GetOrigin, Time2PutOrigin, Time2Round, Time2SetOrigin2000, Time2Str
	XCvarFormat
 CALLED BY:
	T3D_Read_B
 PROCEDURE:
	Entry point in T3D_get_grid


t3d_grid2_fnc $SMEI/user/pphick/for/h/t3d_grid2_fnc.h
[Previous] [Next]
 NAME:
	t3d_grid2_fnc
 PURPOSE:
	Defines statement function for conversion between heliographic coordinates
	and array index and v.v. in tomography program.
 PROCEDURE:
	nLng, nLat, nRad and nTim are usually pulled out of the t3d array.

	Each of the conversions is a linear transformation from
	range [xb,xe] to [yb,ye].
	For all index ranges the start value is 0.5 and the end value is
	N+0.5, covered by N steps.


t3d_grid_fnc $SMEI/for/h/t3d_grid_fnc.h
[Previous] [Next]
 NAME:
	t3d_grid_fnc
 PURPOSE:
	Defines statement function for conversion between heliographic coordinates
	and array index and v.v. in tomography program.
 INCLUDED BY:
	BuildSourceSurface, CheckMass, GetLOSValue, LOSReach, SW_Model_Kinematic
	Write3D_bb, Write3D_bb_UT, Write3D_bb_XC, Write3D_bbtt, Write3D_nv, Write3D_nv_UT
	Write3D_nv_XC
 RESTRICTIONS:
	Contains statement functions, so must be called at the end
	of the declaration section.
 PROCEDURE:
	Statement functions for converting between modified Carrington variables and latitudes
	(deg) and array indices.
	nLng, nLat will usually be provided as arguments to the subroutine using this include file.
	Note that the following variable must be defined before the functions are called
		nLng1=nLng-1
		nLat1=nLat-1
		XCrange=XCend-XCbeg

	XCindx	:	X=XCbeg -> I=nLng	X=XCend -> I=1
	XCvar	:	I=nLng	-> X=XCbeg	I=1	-> X=XCend

	XCmod	:	maps any XC value into the range [XCbeg,XCend] by a mod(XCrange) operation

	XLindx	:	X=-90	-> J=1		X=90	-> J=nLat
	XLdeg	:	J=1	-> X=-90	J=nLat	-> X=90


T3D_header $SMEI/for/lib/t3d_get_grid.f
[Previous] [Next]
 NAME:
	T3D_header
 PURPOSE:
	Creates array of strings from t3d array
 CALLING SEQUENCE:
	entry T3D_header(cType, cFile, nStr, cStr, nLen)
 INPUTS:
	cType*(*)	character	used as prefix for output file name
					(e.g. 'nv3d')
 OUTPUTS:
	cFile*(*)	character	name for output file
					starts with cType, appended is the time assigned to the
					matrix in F9.4 format.
					For time-dependent tomography (t3d(T3D__DTT) > 0) an
					integer marker is added (see T3D_marker).
					Finally, the iteration number is added if the
					iteration number t3d(T3D__ITERATION) is less/equal
					than the total number of iterations t3d(T3D__INTERATIONS).
					The resulting file name looks like:
						nv3d1234.5678		(corotating tomography)
						nv3d1234.5678_12345	(time-dependent tomography)

						nv3d1234.5678_123	(corotating tomography)
						nv3d1234.5678_12345_123	(time-dependent tomography) 
	nStr		integer		max. # header strings available (this should be set
					by the caller to T3D__NELEMENTS defined in include file
					t3d_array.h.
	cStr*(nStr)	character	character array used to store header strings
	nLen		integer		actual # header strings used
 CALLS: ***
	BadR4, Flt2Str, Int2Str, Int2StrSet, Str2Str, T3D_marker, Time2Carrington
	Time2GetOrigin, Time2PutOrigin, Time2Round, Time2SetOrigin2000, Time2Str
	XCvarFormat
 CALLED BY:
	T3D_show, T3D_write_bb, T3D_write_nv
 PROCEDURE:
	Entry point in T3D_get_grid.
 MODIFICATION HISTORY:
	SEP-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added separate entry to header for the file name prefix cType
	    Now XCvarFormat is used to write Carrington variables
	    Now T3D__MODE_TIME instead of T3D__DTT is used to determine whether
	    corotating or time-dependent tomography is run (this determines
	    whether or not a marker value is added to the file names).


T3D_iget $SMEI/for/lib/t3d_get_grid.f
[Previous] [Next]
 NAME:
	T3D_iget
 PURPOSE:
	Retrieves integer entry in t3d array
 CALLING SEQUENCE:
	entry T3D_iget(ID, IOFF, IV)
 INPUTS:
	ID		integer		identified position in t3d array to be retrieved
					This should be the name of one of the parameters
					defined in t3d_array
	IOFF		integer		=0: only t3d(ID) is retrieved
					>0: t3d(ID...ID-1+IOFF) are retrieved
	IV		integer		value(s) retrieved from t3d array (converted to
					nearest integer)
 CALLS: ***
	BadR4, Flt2Str, Int2Str, Int2StrSet, Str2Str, T3D_marker, Time2Carrington
	Time2GetOrigin, Time2PutOrigin, Time2Round, Time2SetOrigin2000, Time2Str
	XCvarFormat
 CALLED BY:
	BuildSourceSurface, CheckMass, ExtractInsitu, GetLOSValue, LOSClean, LOSIntegralG
	LOSIntegralV, LOSPosition, LOSProjection, LOSReach, LOSSanityCheck, LOSTweak
	LOSWeights, SW_Model_Kinematic, SetGrid, T3D_Read_B, T3D_write_bb, T3D_write_nv
	Write3D_bb_UT, Write3D_bb_XC, Write3D_bbtt, Write3D_nv_UT, Write3D_nv_XC, ipsg2
	ipsg2s, ipsg2t
 PROCEDURE:
	Entry point in T3D_get_grid


t3d_index $SMEI/for/h/t3d_index.h
[Previous] [Next]
 NAME:
	t3d_index
 PURPOSE:
	Parameter definitions
 INCLUDED BY:
	BuildSourceSurface, GetLOSValue, LOSClean, LOSPosition, LOSProjection, LOSReach
	LOSWeights, ReadVIPSValidData, SW_Model_Kinematic, Write3D_bb_UT, Write3D_bb_XC
	Write3D_nv_UT, Write3D_nv_XC, ipsd, ipsg2, ipsg2s, ipsg2t
 PROCEDURE:


T3D_iset $SMEI/for/lib/t3d_get_grid.f
[Previous] [Next]
 NAME:
	T3D_iset
 PURPOSE:
	Sets integer entry in t3d array
 CALLING SEQUENCE:
	entry T3D_iset(ID, IOFF, IV)
 INPUTS:
	ID		integer		identified position in t3d array to be updated
					This should be the name of one of the parameters
					defined in t3d_array
	IOFF		integer		=0: only t3d(ID) is updated
					>0: t3d(ID...ID-1+IOFF) are updated
	IV		integer		value(s) updated in t3d array
 CALLS: ***
	BadR4, Flt2Str, Int2Str, Int2StrSet, Str2Str, T3D_marker, Time2Carrington
	Time2GetOrigin, Time2PutOrigin, Time2Round, Time2SetOrigin2000, Time2Str
	XCvarFormat
 CALLED BY:
	LOSClean, LOSReach, SetGrid, Write3D_bb_UT, Write3D_bb_XC, Write3D_bbtt
	Write3D_nv_UT, Write3D_nv_XC, ipsd, ipsdt, ipsg2, ipsg2s, ipsg2t
 PROCEDURE:
	Entry point in T3D_get_grid


t3d_loc_fnc $SMEI/for/h/t3d_loc_fnc.h
[Previous] [Next]
 NAME:
	t3d_loc_fnc
 PURPOSE:
	Statements functions calculating linear index in
	multi-dimensional arrays.
 CATEGORY:
	Include
 CALLING SEQUENCE:
	include		't3d_loc_fnc.h'
 INCLUDED BY:
	BuildSourceSurface, CheckMass, GetLOSValue, LOSClean, LOSIntegralG, LOSPosition
	LOSProjection, LOSReach, LOSWeights, SW_Model_Kinematic, Write3D_bb_UT
	Write3D_bb_XC, Write3D_nv_UT, Write3D_nv_XC
 RESTRICTIONS:
	Contains statement function, so must be called at the end
	of the declaration section.
 PROCEDURE:
 >	The main reason for using these statement functions is to avoid
	having to pass all dimensions of multi-dimensional arrays as arguments
	to functions and subroutines. Instead the t3d array is passed,
	containing all the necessary information.

 >	The information in t3d needs is used to set up all required
	constants (nLng, nLat, etc.). This is done in the include file
	't3d_loc_exec.h'

 >	PRJ__N is defined in include file 'los_param.h'
 MODIFICATION HISTORY:
	AUG-2001, Paul Hick (UCSD; pphick@ucsd.edu)


T3D_marker $SMEI/for/lib/t3d_marker.f
[Previous] [Next]
 NAME:
	T3D_marker
 PURPOSE:
	Checks a set for 3D tomography output for the number of files for a
	specific Carrington rotation. A counter is appended to the input file
	name which is one higher than the number of files found.
 CATEGORY:
	tomography
 CALLING SEQUENCE:
	integer function T3D_marker(cFile, icount)
 INPUTS:
	cFile		character*(*)
				file name identifier of the form nv3d1234.6789
				where 1234.6789 is a modified Carrington variable
 OUTPUTS:
	T3D_marker
			integer
				effective length of return value cType
	cFile		character*(*)
				file name identifier of the form nv3d1234.6789_nnn
				where 1234.6789 is a modified Carrington variable,
				and nnnnn is a 5-digit integer.
				The highest counter value is determined by searching
				the working directory.
				If no file with a counter is found then 00001 is appended.
	icount		integer
				value of counter
 CALLS: ***
	Int2Str, Int2StrSet, Say, Str2Flt, Str2Str, T3D_marker_num, iGetFileSpec, iSearch
	iSetFileSpec, itrim
 CALLED BY:
	T3D_fill_global, T3D_fill_time, T3D_get, T3D_get_all, T3D_get_grid, T3D_get_mode
	T3D_header, T3D_iget, T3D_iset, T3D_set, T3D_set_mode, ipsd, ipsg2, ipsg2s, ipsg2t
 INCLUDE:
	include		'filparts.h'
	include		'str2str_inc.h'
 PROCEDURE:
	All numbers in the file type part of cType (.6789_nnn) are extracted.
	The 2nd number should be the integer nnn.
 MODIFICATION HISTORY:
	FEB-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


T3D_marker_num $SMEI/for/lib/t3d_marker_num.f
[Previous] [Next]
 NAME:
	T3D_marker_num
 CALLING SEQUENCE:
	subroutine T3D_marker_num(iMode, cFile, iNum)
 CALLED BY:
	T3D_marker
 INCLUDE:
	include		'filparts.h'
	include		'str2str_inc.h'
 CALLS: ***
	Int2Str, Int2StrSet, Str2Flt, iGetFileSpec, iPutFileSpec, iSetFileSpec
 MODIFICATION HISTORY:
	FEB-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


t3d_param $SMEI/for/h/t3d_param.h
[Previous] [Next]
 NAME:
	t3d_param
 PURPOSE:
	Defines several control parameters for tomography programs.
	Each parameter sets a bit in integer I__MODE. This argument is set
	in the main program and is passed to several subroutines as first
	argument. These subroutines test the bit by a doing a logical
	AND operation (using iand).
 INCLUDED BY:
	BuildSourceSurface, GetLOSValue, IPSConstraints, LOSClean, LOSIntegralG
	LOSIntegralV, LOSPosition, LOSProjection, LOSReach, LOSSanityCheck, LOSTweak
	LOSWeights, SW_Model_Kinematic, SetGrid, T3D_write_nv, Write3D_bb_UT
	Write3D_bb_XC, Write3D_nv_UT, Write3D_nv_XC, ipsg2, ipsg2s, ipsg2t
 PROCEDURE: 
	TOM__MOD : is set to active mod-360 calculations. For time-dependent
		reconstructions this should always be set.
	TOM__DIFF: is set to make corrections at the source surface based on differences of
		between observed and model los values. Default is ratios
	TOM__POINTP: is set to start with a point-P initial condition (default is a flat
		source surface


T3D_Read_B $SMEI/for/lib/t3d_read_b.f
[Previous] [Next]
 NAME:
	T3D_Read_B
 PURPOSE:
	Get RTN magnetic field components at source surface
	(currently we only worry about the radial component)
 CATEGORY:
	I/O
 CALLING SEQUENCE:
	logical function T3D_Read_B(cWild,BListFnc,BReadFnc,TTime,XCbeg,XCend,BR)
 INPUTS:
	cWild*(*)	character	wild card specification for locating magnetic field files
					either a straightforward wildcard spec or specified in
					the format used by ForeignFile.

	BListFnc	external	name of integer function ued by MapReadSingle and MapReadTimes
	BReadFnc	external	name of integer function used to read individual files

	TTime(nTim)	real		(time-dependent tomography only)
					Times at which magnetic field is required
	XCbeg(nTim)	real		start Carrington variable of matrix (- NCoff)
	XCend(nTim)	real		end Carrington variable of matrix (- NCoff)
					(range of matrix typically is three Carrington rotations)
 OUTPUTS:
	BR(nLng,nLat,nTim)	real	radial magnetic field
 CALLS: ***
	ArrR4Bad, ArrR4GetMinMax, MapReadSingle, MapReadTimes, Say, T3D_get_grid
	T3D_get_mode, T3D_iget, cInt2Str, cXCvarFormat
 CALLED BY:
	BField_Choose, BField_Get
 INCLUDE:
	include		'sun.h'
	include		't3d_array.h'
 EXTERNAL:
	external	BListFnc
	external	BReadFnc
 PROCEDURE:
	The main program should indicate whether magnetic fields are to
	be retrieved for corotating or time-dependent tomography by adding the
	following two lines, including a call to T3D_set_mode:

	For corotating tomography:

	include		't3d_array.h'
	call T3D_set_mode(T3D__MODE_TIME,0)

	For time-dependent tomography:

	include		't3d_array.h'
	call T3D_set_mode(T3D__MODE_TIME,1)

	This information is retrieved by a T3D_get_mode call. Depending
	on the retrieved setting MapReadSingle or MapReadTimes is called for
	corotating and time-dependent tomography, respectively.
 MODIFICATION HISTORY:
	MAY-2002, Paul Hick (UCSD/CASS)
	SEP-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Made argument names consistent with MapReadSingle
	    and MapReadTimes.


T3D_set $SMEI/for/lib/t3d_get_grid.f
[Previous] [Next]
 NAME:
	T3D_set
 PURPOSE:
	Sets real entry in t3d array
 CALLING SEQUENCE:
	entry T3D_set(ID, IOFF, V)
 INPUTS:
	ID		integer		identified position in t3d array to be updated
					This should be the name of one of the parameters
					defined in t3d_array
	IOFF		integer		=0: only t3d(ID) is updated
					>0: t3d(ID..ID-1+IOFF) are updated
	V		real		value(s) updated in t3d array
 CALLS: ***
	BadR4, Flt2Str, Int2Str, Int2StrSet, Str2Str, T3D_marker, Time2Carrington
	Time2GetOrigin, Time2PutOrigin, Time2Round, Time2SetOrigin2000, Time2Str
	XCvarFormat
 CALLED BY:
	SetGrid, Write3D_bb, Write3D_bb_UT, Write3D_bb_XC, Write3D_bbtt, Write3D_nv
	Write3D_nv_UT, Write3D_nv_XC, ipsd, ipsdt, ipsg2, ipsg2s, ipsg2t, write3D_infotd3D
 PROCEDURE:
	Entry point in T3D_get_grid


T3D_set_mode $SMEI/for/lib/t3d_get_grid.f
[Previous] [Next]
 NAME:
	T3D_set_mode
 CALLING SEQUENCE
	entry T3D_set_mode(IB,ION)
 INPUTS:
	IB	integer		integer between 0 and 31 identifying
				a bit in t3d(T3D__MODE)
	ION	integer		0 if bit should be cleared
				1 if bit should be set
 OUTPUTS:
	none
 CALLS: ***
	BadR4, Flt2Str, Int2Str, Int2StrSet, Str2Str, T3D_marker, Time2Carrington
	Time2GetOrigin, Time2PutOrigin, Time2Round, Time2SetOrigin2000, Time2Str
	XCvarFormat
 CALLED BY:
	ipsd, ipsdt
 PROCEDURE:
	Entry point in T3D_get_grid


T3D_show $SMEI/for/lib/t3d_show.f
[Previous] [Next]
 NAME:
	T3D_show
 CALLING SEQUENCE:
	subroutine T3D_show()
 CALLED BY:
	ipsg2, ipsg2s, ipsg2t
 INCLUDE:
	include		't3d_array.h'
 CALLS: ***
	Say, T3D_header, itrim


T3D_write_bb $SMEI/for/lib/t3d_write_bb.f
[Previous] [Next]
 NAME:
	T3D_write_bb
 PURPOSE:
	Write tomography plasma (magnetic field) output to t3d* file
 CALLING SEQUENCE:
	subroutine T3D_write_bb(cPrefix, t3d, BR3D, BT3D, BN3D, iStrAdd, cStrAdd, cFile)
 INPUTS:
	cPrefix			character*4
					prefix used to start name of output file
	t3d(*)			real	(not used anymore)

	BR3D(nLng,nLat,nRad)	real
	BT3D(nLng,nLat,nRad)	real
	BN3D(nLng,nLat,nRad)	real

	iStrAdd			integer	# strings to be added to the file header
	cStrAdd(*)*(*)		character
					strings to be added to file header
					Only strings with non-zero length are written.
					All strings receive the prefix 'User: '
 OUTPUTS:
	(to file b3d*)
	cFile*(*)		character
					name of t3d* output file
					only the name and type is set. The file is
					created in the current directory.
 CALLED BY:
	Write3D_bb, Write3D_bb_UT, Write3D_bb_XC, Write3D_bbtt
 INCLUDE:
	include 	't3d_array.h'
 CALLS: ***
	T3D_header, T3D_iget, WR2DARR, itrim
 PROCEDURE:
	DEC-2000, Kevin Nguyen, Paul Hick (UCSD; pphick@ucsd.edu)
	NOV-2001, Tamsen Dunn (UCSD; tdunn@ucsd.edu)
		Removed time dimension. Subroutine should now be called inside the time
		loop in the time-dependent tomography.


T3D_write_nv $SMEI/for/lib/t3d_write_nv.f
[Previous] [Next]
 NAME:
	T3D_write_nv
 PURPOSE:
	Write tomography plasma (density and velocity) output to t3d* file.
 CATEGORY:
	I/O
 CALLING SEQUENCE:
	subroutine T3D_write_nv(cPrefix, t3d,VSS,DSS,V3D,D3D,iStrAdd,cStrAdd, cFile)
 INPUTS:
	cPrefix			character*4
					prefix used to start the name of the output file
					(default is 'nv3d')
	t3d(*)			real	(not used anymore)

	VSS (nLng,nLat)		real	velocity map at source surface (km/s)
	DSS (nLng,nlat)		real	normalized density at source surface (cm^-3)
	V3D (nLng,nLat,nRad)	real	3D velocity matrix (km/s)
	D3D (nLng,nLat,nRad)	real	3D normalized density matrix (cm^-3)

	iStrAdd			integer	# strings to be added to the file header
	cStrAdd(*)*(*)		character
					strings to be added to file header
					Only strings with non-zero length are written.
					All strings receive the prefix 'User: '
 OUTPUTS:
	(to file t3d*)
	cFile*(*)		character
					name of t3d* output file
					only the name and type is set. The file is
					created in the current directory.
 CALLS: ***
	Str2Str, T3D_header, T3D_iget, WR2DARR, itrim
 CALLED BY:
	Write3D_nv, Write3D_nv_UT, Write3D_nv_XC, write3D_infotd3D
 INCLUDE:
	include		't3d_param.h'
	include		't3d_array.h'
 PROCEDURE:
 MODIFICATION HISTORY:
	DEC-2000, Kevin Nguyen, Paul Hick (UCSD; pphick@ucsd.edu)


T_FILTER $SMEI/for/lib/hos/t_filter.f
[Previous] [Next]
 NAME:
	T_FILTER
 PURPOSE:
	Subtracts a 'continuum' from the intensity.
 CATEGORY:
	Data processing
 CALLING SEQUENCE:
	subroutine T_FILTER(ICNT,NS,T,ZZ,PP,IDAY,NDEV,DSIG,NBUF,SN,SF,SFF)
 INPUTS:
	ICNT		integer		number of times (measurement cycles)
	NS		integer		# sectors used
	NPTS		integer		not used
	T(ICNT)		real		array containing times for each MC
	ZZ(NS,ICNT)	real		two-dim array with intensities for all sectors
	PP(ICNT)	integer		array identifying the photometer for each MC
	IDAY		integer		window width (in days) for time averaging
					(see PROCEDURE)
	NDEV		integer		glitch level
	DSIG		real		multiplication factor for standard deviation
	NBUF		integer		buffer size
 OUTPUTS:
	SN(NS,NBUF)	integer		scratch array        
	SF(NS,NBUF)	real		scratch array
	SFF(NS,NBUF)	real		scratch array
 CALLS: ***
	ArrR4Zero, AskI4, AskR4, BadR4, Say
 CALLED BY:
	HOSRunningMean, READ_HOS
 RESTRICTIONS:
	For the 90 degree photometer the intensity and pB are expected in 
	sectors 1 and 2, respectively
 PROCEDURE:
	Subtracts a 'continuum' from the intensity ZZ. The continuum consists
	of a running mean over IDAY days, minus a multiple DSIG of the standard 
	deviation for that running mean. 
	The averaging is done for all points in the interval ('window') 
		T-IDAY/2.<= T<= T+IDAY/2. 
	The residuals are returned in ZZ.
	If single point glitches are detected these are removed (flagged).

	The window width IDAY, glitch level NDEV and level adjustement factor
	DSIG can be set explicitly in the calling program. Alternatively, if
	IDAY < 0 is passed, then user is prompted for IDAY, NDEV and DSIG.

	If IDAY = 0 then the input arrays are returned unmodified
 MODIFICATION HISTORY:
	1989, Paul Hick (UCSD)


T_GST $SMEI/ucsd/gen/for/lib/gen/t_gst.f
[Previous] [Next]
 NAME:
	T_GST
 PURPOSE:
	Calculate Greenwich Sidereal Time.
	Good for years 1901 through 2099. Accuracy is 0.006 degree.
 CATEGORY:
	Celestial mechanics
 CALLING SEQUENCE:
	function T_GST(iYr,iDoy,SECS)
 INPUTS:
	iYr	integer
	iDoy	integer
	SECS	real		(iYr,iDoy,SECS) define the universal time (UT)
 OUTPUTS:
	T_GST	real		Greenwich sidereal time (degrees)
 CALLED BY:
	ReadG
 RESTRICTIONS:
	Only valid for years 1901 through 2099
 PROCEDURE:
	Local Sidereal Time	= Hour Angle of the vernal equinox
				= Right Ascension of zenith
	For star X : RA(X)+HA(X)=LST
 MODIFICATION HISTORY:
	Extracted from:
	Geophysical Coordinate Transformations, C.T. Russell, in:
		Cosmic Electrodynamics 2 (1971) 184-196


tand $SMEI/ucsd/gen/for/os/goniod.f
[Previous] [Next]
 NAME:
	tand
 CALLING SEQUENCE:
	entry tand(a)
 INPUTS:
	a	real		angle in degrees
 CALLED BY:
	PA_POLE, PRECESSION_APPROX, Time2PrecesssionLtd, shift_MOD [2]
 SEE ALSO:
	cosd
 MODIFICATION HISTORY:
	JAN-2001, Paul Hick (UCSD; pphick@ucsd.edu)


TheFit $SMEI/user/pphick/for/main/thefit.f
[Previous] [Next]
 NAME:
	TheFit
 PURPOSE:
	Subtracts a zodiacal light model from the raw zodiacal light data.
 CATEGORY:
	Data processing
 CALLING SEQUENCE:
	program THEFIT
 INPUTS:
	Helios data file containing data for one color and one filter.
 OUTPUTS:
	Graphics to screen; binary Helios file with normalized data; ASCII file
	THEFIT.DAT containing results of LSQ fits.
 CALLS: ***
	AskI4, AskR4, AskR8, AskWhat, AskYN, BadR4, BadR8, CLEARWINDOW, DRAW, DRAWBOX, DustAsymmetry
	Flt2Str, GETCHARINFO, GinBar, HOSRead, HOSWrite, IGETDEVILIMITS, ISETBOTTOMJUSTIFY
	ISETCENTERJUSTIFY, ISETHORIZJUSTIFY, ISETRIGHTJUSTIFY, ISETSYSNORMAL
	ISETSYSUSER, ISETTERMANDPLOT, ISETTERMOFF, ISETTOPJUSTIFY, ISETVERTJUSTIFY
	ISWITCHGRAPHICSOFF, ISWITCHGRAPHICSON, IndexR8, Int2Str, LAPSEDTIME, LSQ_CHECK_FIT
	LSQ_REDUCED_FIT, LSQ_SLEDGEHAMMER, LSQ_UITBIJTER, MOVE, MOVEDRAW, NOUT, RemoveTag, Say
	Str2Str, Str2StrSet, TimeSystem, USRDF, XYLABEL, bIsXEvent, bOpenFile, dcosd, dsind
	hardcopy, iFreeLun, iGetFileSpec, iHOSInfo, iPutFileSpec, iSetFileSpec, itrim
 INCLUDE:
	include		'e9_hos.h' !(NOT USED ANYMORE)
	include		'hos_e9.h'
	include		'filparts.h'
	include		'str2str_inc.h'
 COMMON BLOCKS:
	common	/FIT/		FLNG(MXC)   ,CLNG(MXC)   ,SLNG(MXC)   ,FINT(MXC), NFIT
	common	/REJECT/ 	FLNGREJ(MXC),CLNGREJ(MXC),SLNGREJ(MXC),FINTREJ(MXC),NREJ
	common	/FITPARAM/ 	E,A,B,PHI,CHI, /FITPOW/ POW
	common	/BESTFIT/ 	A_IN,B_IN,PHI_IN,POW_IN,CHI_IN,DEV_IN,DSIG_IN,IPLOT
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 >>	The zodiacal light curve to is obtained by fitting the function
	I = A+B*(1+E*cos(LNG-LNGP+PHI))**POW to the data. E and LNGP are 
	ellipticity and ecliptic longitude of the perihelion of the HELIOS
	orbit; LNG is the spacecraft ecliptic longitude. The parameters A,PHI
	and POW are fitted in a least square sense.
 >>	The input data files contain raw data (as taken from tape by HERDA)
	which are processed first using CONNECT.
 >>>>	USE ONLY OUTPUT FILES OF CONNECT AS INPUT FILES FOR THIS PROGRAM.
	These files contain chronologically ordered data for one particular
	color and one particular filter and may contain data for up to three
	photometers. The names for these files have the form XyrLF_doy.ZLD
 >>	After substraction of the intensity of the zodiacal dust cloud, the
	residual data are stored on the files XyrLF_doy.DAT
 MODIFICATION HISTORY:


THOM_WTF $SMEI/for/lib/thom_wtf.f
[Previous] [Next]
 NAME:
	THOM_WTF
 PURPOSE:
	Determines the intensity contribution from single electron at
	specified location on line of sight
 CALLING SEQUENCE:
	function THOM_WTF(ScSun,ElSc,Elo,iChan)
 INPUTS:	(read-only)
	ScSun	real	distance of spacecraft from Sun in AU
	ElSc	real	distance of spacecraft from electron in AU
	Elo	real	elongation of s/c line of sight (l.o.s.) in degrees.
		Elo = 0 is the direction to the Sun
	iChan	integer	channel ID used for setting limb darkening
			coefficient and solar luminosity
		1 = Helios U channel
		2 = Helios B channel
		3 = Helios V channel
 OUTPUTS:
	THOM_INT real	Thomson scattering intensity in S10 units
 CALLS: ***
	cosd, sind
 CALLED BY:
	MkLOSWeights
 PROCEDURE:
	The program is based on Chapter 6, Section B of Billings
	"A guide to the solar corona".

	The constant 835.9088 = SIGMA/2.*AU*DEG2/RSun**2*E14
	where SIGMA is the Thomson scattering cross section
       (7.94x10^-26 cm**2/sterrad); AU is the astronomical unit in
	cm; DEG2 is a opening angle of (pi/180)**2 sterrad
	around the line of sight; RSun is the solar radius in AU.
   >	U is the limb darkening coefficient for light LT. From a graph in
	RAUMFAHRTFORSCHUNG by LEINERT et al. LAMBDA=3650,4300,5250 A for U,B,V
	light. From Allen (1985), p. 171, U=0.80,0.77,0.62 by linear
	interpolation.
   >	LUM is the luminosity of the solar disk in E14 S10 units:
	LUM = LSUN/LS10 = 10**((10-MSUN)/2.5) in units of 10^14,
       with MSUN (from Allen) -25.96,-26.09,-26.73 for U,B and V
       light respectively.
 MODIFICATION HISTORY:
	1990, Paul Hick (UCSD)


thomson $SMEI/ucsd/gen/for/h/thomson.h
[Previous] [Next]
 NAME:
	thomson
 PURPOSE:
	Defines several constants used by the Thomson scattering package
 INCLUDED BY:
	ThomsonFarY, ThomsonLOS3DStep, ThomsonLOSStep, ThomsonMidpointFar


Thomson3DDensity $SMEI/ucsd/gen/for/lib/thomson/thomson3ddensity.f
[Previous] [Next]
 NAME:
	Thomson3DDensity
 PURPOSE:
	Implements 1/r^2 density, for use in ThomsonLOSDensity
 CATEGORY:
 CALLING SEQUENCE:
	function Thomson3DDensity(ElLng,ElLat,ElSun)
 INPUTS:
	ElLng			real	heliocentric (ecliptic) longitude (deg)
	ElLat			real	heliocentric (ecliptic) latitude (deg)
	ElSun			real	heliocentric distance (solar radii)
 OUTPUTS:
	Thomson3DDensity	real	density (electrons/cm^3)
 CALLS:
 CALLED BY:
	ThomsonLOSDensity, ThomsonSetupLOS
 INCLUDE:
	include		'sun.h'
 PROCEDURE:
 >	At 1 AU a density of 5 cm^-3 is assumed.
 >	Called by ThomsonLOSDensity, which in turn is called by the
	ThomsonLOS3D* functions to  calculate line of sight intensities.
 >	Can be replaced by any function calculating the density in a
	heliocentric coordinate system.
 MODIFICATION HISTORY:
	JAN-1998, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


ThomsonBase $SMEI/ucsd/gen/for/lib/thomson/thomsonbase.f
[Previous] [Next]
 NAME:
	ThomsonBase
 PURPOSE:
	(Used internally only)
	Determines the intensity scattered from single coronal electron
	by Thomson scattering
 CALLING SEQUENCE:
	function ThomsonBase(ElSun,SinChi,U, P,rIt,rItr)
 INPUTS:
	ElSun	real	Electron-Sun distance (solar radii) = 1./sine(Omega)
	SinChi	real	angle Sun-Electron-Observer (degrees)
	U	real	limb darkening coefficient
 OUTPUTS:
	ThomsonBase
		real	scattered intensity
	P	real	polarization; P=rItr/ThomsonBase (-1<=P<=1)
	rItr	real	tangential minus radial intensity; same units as ThomsonBase.
	rIt	real	radial intensity; same units as ThomsonBase
 CALLS: ***
	ThomsonSoup
 CALLED BY:
	LOSWeights, ThomsonElectron, ThomsonLOS3DStep, ThomsonLOSStep
	ThomsonSetupIntegrand, ThomsonTang, ThomsonTang3D, ThomsonTangMRad
	ThomsonTangMRad3D
 PROCEDURE:
 >	See Chapt. 6, Sect. B of Billings' "A guide to the solar corona" (p.150)
	Sigma	= Thomson cross section=7.96x10^-26 cm^2/sterad
	Omega	= angular size of Sun from electron
	Chi	= angle Sun-Electron-Observer
	I0	= intensity at disk center
	RSun	= solar radius = 7x10^10 cm

	Billings specifies the scattered intensity in the form
		I=0.5*Pi*Sigma*I0*Func(Omega,Chi) (erg/s/sterad)
	This subroutine only deals with Func(Omega,Chi):
		From Eq. 18: rIt  = (1-u)*CC+u*DD
		From Eq. 19: rItr = sin^2(Chi)*[(1-u)AA+u*DD]
 >	The last two arguments (rIt, rItr) are returned for use by
	functions ThomsonLOS*.
 MODIFICATION HISTORY:
	JUL-1996, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


ThomsonElectron $SMEI/ucsd/gen/for/lib/thomson/thomsonelectron.f
[Previous] [Next]
 NAME:
	ThomsonElectron
 PURPOSE:
	Determines the intensity scattered from single coronal electron
	by Thomson scattering
 CALLING SEQUENCE:
	function ThomsonElectron(ElSun,SinChi,U, P)
 INPUTS:
	ElSun	real	distance Sun-Electron (in solar radii)
	SinChi	real	sine of angle Sun-Electron-Observer
	U	real	limb darkening coefficient
 OUTPUTS:
	ThomsonElectron
		real	scattered intensity; units: 10^-26 times the
			flux from the solar disk -incident- on the electron
	P	real	polarization	(-1<=P<=1)
 CALLS: ***
	ThomsonBase
 CALLED BY:
	ThomsonElectronS10
 INCLUDE:
	include		'phys.h'
 PROCEDURE:
 >	See Chapt. 6, Sect. B of Billings' "A guide to the solar corona" (p.150)
	Sigma	= Thomson cross section=7.96x10^-26 cm^2/sterad
	Omega	= angular size of Sun from electron
	Chi	= angle Sun-Electron-Observer
	I0	= intensity at disk center
	RSun	= solar radius = 7x10^10 cm

	Billings specifies the scattered intensity in the form
		I=0.5*Pi*Sigma*I0*Func(Omega,Chi) (erg/s/sterad)
	The average intensity coming from the solar disk is
		i=(Pi*RSun^2)*I0*(1-U/3) (erg/s/sterad)
	The flux incident on the electron is F=i/ElSun^2 (erg/s/cm^2)
	The ratio
		I/F = 0.5*Sigma*Func(Omega,Chi)/( (RSun/ElSun)^2*(1-U/3) )
	is returned here, except for a factor 10^-26 (from Sigma).

 >	For purposes of integration along a line of sight
		B = Int[0,Inf]{ n(s) I(s) ds}
	I(s) (the scattered intensity per election) should be in units
	of the flux received from the solar disk by the observer at ScSun
	(rather than the electron). This is
		I(s) =(I/Fobs) = (I/F)*(ScSun/ElSun)^2
		     = 0.5*Sigma*Func(Omega,Chi)/( (RSun/ScSun)^2*(1-U/3) )
	Note that the s-dependence is restricted to Func(Omega,Chi)

 >	The scattered flux from the electron incident on the observer is
	I/ScEl^2  (erg/s/cm^2).
 >	The ratio (I/F)*(ScSun/(ElSun*ScEl))^2 gives the flux received from
	the electron in units of the flux received from the solar disk by
	the observer.
 MODIFICATION HISTORY:
	JUL-1996, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


ThomsonElectronFar $SMEI/ucsd/gen/for/lib/thomson/thomsonelectronfar.f
[Previous] [Next]
 NAME:
	ThomsonElectronFar
 PURPOSE:
	Determines the intensity scattered from single coronal electron
	in the limit of small angular size of the Sun
 CALLING SEQUENCE:
	function ThomsonElectronFar(SinChi, P)
 INPUTS:
	SinChi	real	sine of angle Sun-Electron-Observer
 OUTPUTS:
	ThomsonElectronFar
		real	scattered intensity; units: 10^-26 times the
			flux from the solar disk incident on the electron
	P	real	polarization	(-1<=P<=1)
 CALLED BY:
	ThomsonElectronS10Far
 INCLUDE:
	include		'phys.h'
 PROCEDURE:
	See ThomsonElectron
	Limit: Solar diameter -> 0; Electron-Sun distance -> Infinity
 MODIFICATION HISTORY:
	JUL-1996, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


ThomsonElectronS10 $SMEI/ucsd/gen/for/lib/thomson/thomsonelectrons10.f
[Previous] [Next]
 NAME:
	ThomsonElectronS10
 PURPOSE:
	Determines the intensity scattered from single coronal electron
	by Thomson scattering in S10 units
 CALLING SEQUENCE:
	function ThomsonElectronS10(ElSun,SinChi,U,APM, P)
 INPUTS:
	ElSun	real	distance Sun-Electron (solar radii)
	SinChi	real	sine of angle Sun-Electron-Observer
	U	real	limb darkening coefficient
	APM	real	apparent magnitude of the Sun
 OUTPUTS:
	ThomsonElectronS10
		real	scattered intensity (10^-26 S10)
	P	real	polarization
 CALLS: ***
	ThomsonElectron, ThomsonS10
 PROCEDURE:
 >	An S10 unit is `the brightness of one 10th magnitude star per square
	degree of sky'. Replace the star by an electron at the same location
	in the sky, and at distance ScEl away from the observer. The electron
	is radiating by Thomson scattering of sunlight.
 >	STEP 1: Calculate the intensity (erg/s/sterad) -emitted- by the electron
		in units of the flux -incident- on the electron from the solar
		disk (erg/s/cm^2) (i.e. call ThomsonElectron)
 >	STEP 2: Convert to S10 units with ThomsonS10
 >	10^-26 comes from the Thomson scattering cross section, Sigma

 >	For purposes of integration along a line of sight
		B = Int[0,Inf]{ n(s) I(s) ds}
	the returned value can be used directly to get the integrated intensity
	in 10-26 S10 if the density is specified in cm^-3 and the step size in cm.
 RESTRICTIONS:
 >	To convert to intensity -incident- on the observer from the 
	electron one needs to multiply by 1/ScEl^2. This is NOT done here.
 >	A previous version of this subroutine (THOM_WTF) returned the quantity
	835.9088/(1-U/3)*(10^(10-APM)/2.5*1E-14)*I
	where I is the intensity returned by ThomsonBase and the constant
	835.9088 = (PHYS__THOMSON*1E-26)/2.*(SUN__AU*1E13)*(MATH__RPD/SUN__RAU)^2*E14
	This result can be retrieved from this version by multiplying by
	(SUN__AU*1E13)*1E-26
 MODIFICATION HISTORY:
	JUL-1996, Paul Hick (UCSD/CASS; ppick@ucsd.edu)


ThomsonElectronS10Far $SMEI/ucsd/gen/for/lib/thomson/thomsonelectrons10far.f
[Previous] [Next]
 NAME:
	ThomsonElectronS10Far
 PURPOSE:
	Determines the intensity scattered from single coronal electron
	by Thomson scattering in S10 units in the limit of small angular diameter
	of the Sun.
 CALLING SEQUENCE:
	function ThomsonElectronS10Far(ElSun,SinChi,APM, P)
 INPUTS:
	ElSun	real	distance Sun-Electron (solar radii)
	SinChi	real	sine of angle Sun-Electron-Observer
	APM	real	apparent magnitude of the Sun
 OUTPUTS:
	ThomsonElectronS10Far
		real	scattered intensity (10^-26 S10)
	P	real	polarization
 CALLS: ***
	ThomsonElectronFar, ThomsonS10
 PROCEDURE:
	See ThomsonElectronS10
	Limit: Solar diameter -> 0; Electron-Sun distance -> Infinity
 MODIFICATION HISTORY:
	JUL-1996, Paul Hick (UCSD/CASS; ppick@ucsd.edu)


ThomsonFarY $SMEI/ucsd/gen/for/lib/thomson/thomsonfary.f
[Previous] [Next]
 NAME:
	ThomsonFarY
 PURPOSE:
	(internal use only)
 CALLING SEQUENCE:
	subroutine ThomsonFarY(Y,Elo,I,It,Itr)	! Elo in radians
 INPUTS:
 OUTPUTS:
 CALLED BY:
	ThomsonLOSFar
 INCLUDE:
	include		'math.h'
	include		'thomson.h'
 MODIFICATION HISTORY:
	1996, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


ThomsonLOS $SMEI/ucsd/gen/for/lib/thomson/thomsonlos.f
[Previous] [Next]
 NAME:
	ThomsonLOS
 PURPOSE:
	Determines the integrated intensity along a line of sight for
	electron Thomson scattering in a 1/r^2 density using Romberg integration.
 CALLING SEQUENCE:
	function ThomsonLOS(SLower,SUpper,ScSun,Elo,U, P)
 INPUTS:	(the input values are retained on return):
	SLower	real	lower limit of integration (solar radii)
	SUpper	real	upper limit of integration (solar radii)
			If SUpper<0 the upper limit is effectively infinity:
			      SUpper is set to the parameter MATH__PINF (=1.e30) solar radii
	ScSun	real	heliocentric distance of observer (solar radii)
	Elo	real	elongation of s/c line of sight (l.o.s.) in degrees.
			(Elo=0 is the direction to the Sun)
	U	real	limb darkening constant
 OUTPUTS:
	F	real	Integrated Thomson scattering intensity received
			per sterad in units of 10^-16 times the flux received
			from the solar disk (at the observer location).
	P	real	polarization
 CALLS: ***
	MidInf, ThomsonSetupIntegrand, ThomsonTang, ThomsonTangMRad, cosd, nrQRomb, nrQRomo
 CALLED BY:
	ThomsonLOSS10, ThomsonMid, ThomsonSetupMid
 INCLUDE:
	include		'sun.h'
	include		'phys.h'
	include		'math.h'
 EXTERNAL:
	external	ThomsonTang
	external	ThomsonTangMRad
	external	MidInf
 RESTRICTIONS:
 >	For a 1/r^2 density the observer is specified by a heliocentric 
	distance and the orientation of the line of sight by an elongation.
 >	For a user-specified density function (see Thomson3DDensity) the 
	observer is specified in heliocentric spherical coordinates (usually
	ecliptic coordinates): longitude, latitude and distance. The line of
	sight orientation is specified in topocentric spherical coordinates
	(again usually ecliptic coordinates): longitude and latitude only.
	The topocentric longitude is defined relative to the Sun-observer
	direction (see subroutine Point_On_LOS for more information).
 >	ThomsonLOSStep, ThomsonLOS3DStep: BE CAREFUL !!!
	if a finite integration range [0,SUpper] is used to represent an
	integration [0,infinity], the value of SUpper should be selected
	carefully to avoid that the missing mass (between [SUpper,infinity])
	introduces large errors. E.g. for ScSun < 1 AU, SUpper=2 AU introduces
	errors of the order of 6-7% on some lines of light. For ScSun > 1 AU
	this gets worse very rapidly.
 PROCEDURE:
 >	ThomsonLOSStep, ThomsonLOS3DStep:
	calculates the integral by straightforward summing of contributions
	from nStep intervals between SLower and SUpper.
 >	ThomsonLOS, ThomsonLOS3D:
	calculates the integral using Romberg integration between SLower and
	SUpper. If SUpper<0 then the integration is extended along the line of
	sight until the integral has converged sufficiently. This effectively
	represents an integration along the entire line of sight.
 >	ThomsonLOSFar:
	calculates an analytical expression for the integral along the
	entire line of sight for a 1/r^2 density in the limit of small angular
	size of the Sun.

 >	The integrated intensity incident on the observer has cgs units of
	erg/s/cm^2/sterad. The flux from the Sun incident on the observer has
	cgs units of erg/s/cm^2, so the ratio will have units 1/sterad.
 >	denAU	electron density in the solar wind at 1 AU (cm^-3)
 >	In principle, the calculation of the density in the DO-loop can
	be replaced by a call to a function calculating any desired radial
	density profile.
 >	Coronal density		n(s) = denAU*(r0/r(s))^2,  r0 = 1 AU
	Intensity/electron	I(s) = 0.5*Pi*Sigma*I0*Func(Omega,Chi)
				(r and s are in units of AU)
	The integral has the form
		B = Integral[0,inf]{n(s)I(s)ds}
		  = 0.5*Pi*Sigma*I0*Integral[0,inf]{n(s) Func(Omega,Chi) ds}
	Func(Omega,Chi) is returned by ThomsonBase. The integral is calculated
	by taking nStep steps from 0 to SUpper AU.
 >	The result is expressed in units of the flux received from the solar
	disk by the observer:
		F = (Pi*RSun^2)*I0*(1-U/3) / ScSun^2 (erg/s/cm^2)
		  = Pi*I0*(1-U/3)* (RSun/ScSun)^2
 >	10^-16 = 10^-26*10^10
	Factor 10^-26 is from the Thomson cross section, Sigma
	Factor 10^10  is from the integration step size (in solar radii)
 MODIFICATION HISTORY:
	1996, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


ThomsonLOS3D $SMEI/ucsd/gen/for/lib/thomson/thomsonlos3d.f
[Previous] [Next]
 NAME:
	ThomsonLOS3D
 PURPOSE:
	Determines the integrated intensity along a line of sight for
	electron Thomson scattering for a user-defined density using Romberg integration
 CALLING SEQUENCE:
	function ThomsonLOS3D(SLower,SUpper,ScLng,ScLat,ScSun,SLng,SLat,U, P)
 INPUTS:	(the input values are retained on return):
	SLower	real	lower limit of integration (solar radii)
	SUpper	real	upper limit of integration (solar radii)
			If SUpper<0 the upper limit is effectively infinity:
			      SUpper is set to the parameter MATH__PINF (=1.e30) solar radii
	ScLng	real	heliocentric longitude of observer (deg)
	ScLat	real	heliocentric latitude of observer (deg)
	ScSun	real	heliocentric distance of observer (solar radii)
	SLng	real	topocentric longitude line of sight relative to
			Sun-observer direction
	SLat	real	topocentric longitude line of sight relative to
			Sun-observer direction
	U	real	limb darkening constant
 OUTPUTS:
	ThomsonLOS3D
		real	Integrated Thomson scattering intensity received
			per sterad in units of 10^-16 times the flux received
			from the solar disk (at the observer location).
	P	real	polarization
 CALLS: ***
	MidInf, ThomsonSetupIntegrand, ThomsonSetupLOS, ThomsonTang3D, ThomsonTangMRad3D
	acosd, cosd, nrQRomb, nrQRomo
 CALLED BY:
	ThomsonLOS3DS10
 INCLUDE:
	include		'sun.h'
	include		'phys.h'
	include		'math.h'
 EXTERNAL:
	external	ThomsonTang3D
	external	ThomsonTangMRad3D
	external	MidInf
 RESTRICTIONS:
 PROCEDURE:
	See ThomsonLOS
 MODIFICATION HISTORY:
	1996, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


ThomsonLOS3DS10 $SMEI/ucsd/gen/for/lib/thomson/thomsonlos3ds10.f
[Previous] [Next]
 NAME:
	ThomsonLOS3DS10
 PURPOSE:
	Determines the intensity along a line of sight of electron Thomson 
	scattering in S10 units
 CALLING SEQUENCE:
	function ThomsonLOS3DS10(SLower,SUpper,ScLng,ScLat,ScSun,SLng,SLat,U,APM, P)
 CALLS: ***
	ThomsonLOS3D, ThomsonS10
 PROCEDURE:
	See ThomsonLOSS10
 MODIFICATION HISTORY:
	1996, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


ThomsonLOS3DS10Step $SMEI/ucsd/gen/for/lib/thomson/thomsonlos3ds10step.f
[Previous] [Next]
 NAME:
	ThomsonLOS3DS10Step
 PURPOSE:
	Determines the intensity along a line of sight of electron Thomson 
	scattering in S10 units
 CALLING SEQUENCE:
	function ThomsonLOS3DS10Step(SLower,SUpper,nStep,ScLng,ScLat,ScSun,SLng,SLat,U,APM, P)
 CALLS: ***
	ThomsonLOS3DStep, ThomsonS10
 PROCEDURE:
	See ThomsonLOSS10
 MODIFICATION HISTORY:
	1996, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


ThomsonLOS3DStep $SMEI/ucsd/gen/for/lib/thomson/thomsonlos3dstep.f
[Previous] [Next]
 NAME:
	ThomsonLOS3DStep
 PURPOSE:
	Determines the integrated intensity along a line of sight for electron
	Thomson scattering for a user-specified density by summing nStep
	line-of-sight segments.
 CALLING SEQUENCE:
	function ThomsonLOS3DStep(SLower,SUpper,nStep,ScLng,ScLat,ScSun,SLng,SLat,U,P)
 INPUTS:	(the input values are retained on return):
	SLower	real	lower limit of integration (solar radii)
	SUpper	real	upper limit of integration (solar radii)
			If SUpper<0 the upper limit is effectively infinity:
			      SUpper is set to the parameter MATH__PINF (=1.e30) solar radii
	nStep	integer	# integration steps (i.e. stepsize is SUpper/nStep)
	ScLng	real	heliocentric longitude of observer (deg)
	ScLat	real	heliocentric latitude of observer (deg)
	ScSun	real	heliocentric distance of observer (solar radii)
	SLng	real	topocentric longitude line of sight relative to
			Sun-observer direction
	SLat	real	topocentric longitude line of sight relative to
			Sun-observer direction
	U	real	limb darkening constant
 OUTPUTS:
	F	real	Integrated Thomson scattering intensity received
			per sterad in units of 10^-16 times the flux received
			from the solar disk (at the observer location).
	P	real	polarization
 CALLS: ***
	ElSunDistance, ThomsonBase, ThomsonLOSDensity, ThomsonSetupLOS, acosd, cosd
 CALLED BY:
	ThomsonLOS3DS10Step
 INCLUDE:
	include		'sun.h'
	include		'phys.h'
	include		'thomson.h'
 PROCEDURE:
	See ThomsonLOS
 MODIFICATION HISTORY:
	1996, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


ThomsonLOSDensity $SMEI/ucsd/gen/for/lib/thomson/thomsonlosdensity.f
[Previous] [Next]
 NAME:
	ThomsonLOSDensity
 PURPOSE:
 CATEGORY:
 CALLING SEQUENCE:
	function ThomsonLOSDensity(ScEl)
 INPUTS:
	ScEl			real	topocentric distance electron-observer (in 
					solar radii)
 OUTPUTS:
	ThomsonLOSDensity	real	density at electron location
					(in electrons/cm^-3)
 CALLS: ***
	POINT_ON_LOS, Thomson3DDensity
 CALLED BY:
	ThomsonLOS3DStep, ThomsonSetupIntegrand, ThomsonTang, ThomsonTang3D
	ThomsonTangMRad, ThomsonTangMRad3D
 SEE ALSO:
	ThomsonSetupLOS
 PROCEDURE:
 >	ThomsonSetupLOS stores the input variables internally for use by
	ThomsonLOSDensity.
 >	ThomsonLOSDensity uses its argument ScEl, and ScSun, SLng and SLat,
	and uses Point_On_LOS to get the heliocentric coordinates of the
	electron. Then Thomson3DDensity is called to get the density.
 >	Thomson3DDensity is a user-defined function, which returns the
	density for a given heliocentric location, specified as longitude,
	latitude (deg) and distance (solar radii).
		D = Thomson3DDensity(ScLng+ElLng,ScLat+ElLat,ScSun*ElSun)
 MODIFICATION HISTORY:
	JAN-1998, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


ThomsonLOSFar $SMEI/ucsd/gen/for/lib/thomson/thomsonlosfar.f
[Previous] [Next]
 NAME:
	ThomsonLOSFar
 PURPOSE:
	Determines the integrated intensity along a line of sight for electron
	Thomson scattering in the limit of small angular size of the Sun
	for a 1/r^2 density.
 CALLING SEQUENCE:
	function ThomsonLOSFar(SLower,SUpper,ScSun,Elo, P)
 INPUTS:	(the input values are retained on return):
	SLower	real	lower limit of integration (solar radii)
	SUpper	real	upper limit of integration (solar radii)
			If SUpper<0 the upper limit is effectively infinity:
			      SUpper is set to the parameter MATH__PINF (=1.e30) solar radii
	ScSun	real	heliocentric distance of observer (solar radii)
	Elo	real	elongation of s/c line of sight (l.o.s.) in degrees.
			(Elo=0 is the direction to the Sun)
 OUTPUTS:
	ThomsonLOSFar
		real	Integrated Thomson scattering intensity received
			per sterad in units of 10^-16 times the flux received
			from the solar disk (at the observer location).
	P	real	polarization
 CALLS: ***
	ThomsonFarY
 CALLED BY:
	ThomsonLOSS10Far
 INCLUDE:
	include		'sun.h'
	include		'phys.h'
	include		'math.h'
 PROCEDURE:
	See ThomsonLOS
	Density at 1 AU of 5 cm^-3 is assumed.
 MODIFICATION HISTORY:
	1996, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


ThomsonLOSS10 $SMEI/ucsd/gen/for/lib/thomson/thomsonloss10.f
[Previous] [Next]
 NAME:
	ThomsonLOSS10
 PURPOSE:
	Determines the intensity along a line of sight of electron Thomson 
	scattering in S10 units
 CALLING SEQUENCE:
	function ThomsonLOSS10(SLower,SUpper,ScSun,Elo,U,APM, P)
 INPUTS:	(the input values are retained on return):
	SLower	real	lower limit of integration (solar radii)
	SUpper	real	upper limit of integration (solar radii)
	nStep	integer	# integration steps (i.e. stepsize is SUpper/nStep)
	ScSun	real	distance of spacecraft from Sun (solar radii
	ScLng	real	heliocentric longitude of observer (deg)
	ScLat	real	heliocentric latitude of observer (deg)
	ScSun	real	heliocentric distance of observer (solar radii)
	Elo	real	elongation of s/c line of sight (l.o.s.; deg)
			Elo=0 is the direction to the Sun
	SLng	real	topocentric longitude line of sight relative to
			Sun-observer direction
	SLat	real	topocentric longitude line of sight relative to
			Sun-observer direction
	U	real	limb darkening constant
	M	real	apparent magnitude of the Sun
 OUTPUTS:
	F	real	integrated Thomson scattering intensity (S10)
	P	real	polarization
 CALLS: ***
	ThomsonLOS, ThomsonS10
 PROCEDURE:
 >	ThomsonLOS returns the integrated intensity incident per sterad
	on the observer in units of the flux received from the solar disk.
 >	STEP 1: multiply by 1 square degree to get the integrated intensity
		per square degree.
 >	STEP 2: convert to units of the flux received from the solar disk
		at 1 AU: multiply by 1/ScSun^2
 >	STEP 3: convert to units of the flux received from a 10th magnitude
		star: multiply by 10^((10-M)/2.5)
		(apparent magnitude, M=-2.5*log(Flux)).
 MODIFICATION HISTORY:
	1996, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


ThomsonLOSS10Far $SMEI/ucsd/gen/for/lib/thomson/thomsonloss10far.f
[Previous] [Next]
 NAME:
	ThomsonLOSS10Far
 PURPOSE:
	Determines the intensity along a line of sight of electron Thomson 
	scattering in S10 units
 CALLING SEQUENCE:
	function ThomsonLOSS10Far(SLower,SUpper,ScSun,Elo,APM, P)
 CALLS: ***
	ThomsonLOSFar, ThomsonS10
 CALLED BY:
	READ_HOS
 PROCEDURE:
	See ThomsonLOSS10
 MODIFICATION HISTORY:
	1996, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


ThomsonLOSS10Step $SMEI/ucsd/gen/for/lib/thomson/thomsonloss10step.f
[Previous] [Next]
 NAME:
	ThomsonLOSS10Step
 PURPOSE:
	Determines the intensity along a line of sight of electron Thomson 
	scattering in S10 units
 CALLING SEQUENCE:
	function ThomsonLOSS10Step(SLower,SUpper,nStep,ScSun,Elo,U,APM, P)
 CALLS: ***
	ThomsonLOSStep, ThomsonS10
 PROCEDURE:
	See ThomsonLOSS10
 MODIFICATION HISTORY:
	1996, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


ThomsonLOSStep $SMEI/ucsd/gen/for/lib/thomson/thomsonlosstep.f
[Previous] [Next]
 NAME:
	ThomsonLOSStep
 PURPOSE:
	Determines the integrated intensity along a line of sight for electron
	Thomson scattering for a 1/r^2 density by summing nStep line-of-sight
	segments.
 CALLING SEQUENCE:
	function ThomsonLOSStep(SLower,SUpper,nStep, ScSun,Elo,U, P)
 INPUTS:	(the input values are retained on return):
	SLower	real	lower limit of integration (solar radii)
	SUpper	real	upper limit of integration (solar radii)
			If SUpper<0 the upper limit is effectively infinity:
			      SUpper is set to the parameter MATH__PINF (=1.e30) solar radii
	nStep	integer	# integration steps (i.e. stepsize is SUpper/nStep)
	ScSun	real	heliocentric distance of observer (solar radii)
	Elo	real	elongation of s/c line of sight (l.o.s.) in degrees.
			(Elo=0 is the direction to the Sun)
	U	real	limb darkening constant
 OUTPUTS:
	ThomsonLOSStep
		real	Integrated Thomson scattering intensity received
			per sterad in units of 10^-16 times the flux received
			from the solar disk (at the observer location).
	P	real	polarization
 CALLS: ***
	ElSunDistance, ThomsonBase
 CALLED BY:
	ThomsonLOSS10Step
 INCLUDE:
	include		'sun.h'
	include		'phys.h'
	include		'math.h'
	include		'thomson.h'
 PROCEDURE:
	See ThomsonLOS
 MODIFICATION HISTORY:
	1996, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


ThomsonMid $SMEI/ucsd/gen/for/lib/thomson/thomsonmid.f
[Previous] [Next]
 NAME:
	ThomsonMid
 CALLING SEQUENCE:
	function ThomsonMid(S)			! Internal use only
 CALLS: ***
	ThomsonLOS
 CALLED BY:
	ThomsonMidpoint
 EXTERNAL BY:
	ThomsonMidpoint
 INCLUDE:
	include		'math.h'


ThomsonMidFar $SMEI/ucsd/gen/for/lib/thomson/thomsonmidfar.f
[Previous] [Next]
 NAME:
	ThomsonMidFar
 CALLING SEQUENCE:
	function ThomsonMidFar(S)		! Internal use only
 CALLED BY:
	ThomsonMidpointFar
 EXTERNAL BY:
	ThomsonMidpointFar
 INCLUDE:
	include		'math.h'		! Input S in units of Observer-Sun distance


ThomsonMidpoint $SMEI/ucsd/gen/for/lib/thomson/thomsonmidpoint.f
[Previous] [Next]
 NAME:
	ThomsonMidpoint
 PURPOSE:
	Calculate position along line of sight where the integrated
	intensity is half of the intensity integrated along the
	entire line of sight
 CALLING SEQUENCE:
	function ThomsonMidpoint(ScSun,Elo,U)
 INPUTS:
	ScSun		real	distance of spacecraft from Sun (solar radii)
	Elo		real	elongation of s/c line of sight (l.o.s.) in degrees.
				Elo=0 is the direction to the Sun
 OUTPUTS:
	ThomsonMidpoint	real	point on l.o.s. where intensity is half the total
				integrated intensity
 INCLUDE:
	include		'math.h'
 EXTERNAL:
	external	ThomsonMid
 CALLS: ***
	BadR4, ThomsonMid, ThomsonSetupMid, cosd, nrZBrent, nrZbrac
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	JAN-1997, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


ThomsonMidpointFar $SMEI/ucsd/gen/for/lib/thomson/thomsonmidpointfar.f
[Previous] [Next]
 NAME:
	ThomsonMidpointFar
 CALLING SEQUENCE:
	function ThomsonMidpointFar(ScSun,Elo)
 INCLUDE:
	include		'math.h'
	include		'thomson.h'
 EXTERNAL:
	external 	ThomsonMidFar
 CALLS: ***
	BadR4, ThomsonMidFar, ThomsonSetupMidFar, cosd, nrZBrent, nrZbrac, sind


ThomsonPDistance $SMEI/ucsd/gen/for/lib/thomson/thomsonpdistance.f
[Previous] [Next]
 NAME:
	ThomsonPDistance
 PURPOSE:
	Find the distance to the plane of the sky where a single electron
	would have a given polarization.
 CALLING SEQUENCE:
	function ThomsonPDistance(ElSun,U,P)
 INPUTS:
	ElSun	real	distance Sun-Electron (in solar radii)
	U	real	limb darkening coefficient
	P	real	polarization	(-1<=P<=1)
 OUTPUTS:
	ThomsonPDistance
		real	distance to the plane of the sky (solar radii) (>=0)
			(ElSun*cos(Chi))
 CALLS: ***
	BadR4, ThomsonSoup
 PROCEDURE:
 >	The distance to the plane of the sky is given as a positive number.
	There are two locations on either side of the plane of the sky
	which match the polarization.
 >	An electron can only produce a positive polarization. If a negative
	polarization is specified, then D=BadR4() is returned
 >	An electron can only produce a polarization below a certain maximum
	(less than one). If a polarization above the maximum value is specified
	the D=-1. is returned.
 MODIFICATION HISTORY:
	JUL-1996, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


ThomsonPDistanceFar $SMEI/ucsd/gen/for/lib/thomson/thomsonpdistancefar.f
[Previous] [Next]
 NAME:
	ThomsonPDistanceFar
 PURPOSE:
	Find the distance to the plane of the sky where a single electron
	would have a given polarization.
 CALLING SEQUENCE:
	function ThomsonPDistanceFar(ElSun,P)
 INPUTS:
	ElSun	real	distance Sun-Electron (in solar radii)
	P	real	polarization	(-1<=P<=1)
 OUTPUTS:
	ThomsonPDistanceFar
		real	distance to the plane of the sky (solar radii) (>=0)
			(ElSun*cos(Chi))
 CALLS: ***
	BadR4
 PROCEDURE:
	See ThomsonPDistance
	Distance to plane of sky (solar radii): ElSun*cos(Chi)
	Limit: Solar diameter -> 0; Electron-Sun distance -> Infinity


ThomsonS10 $SMEI/ucsd/gen/for/lib/thomson/thomsons10.f
[Previous] [Next]
 NAME:
	ThomsonS10
 PURPOSE:
	Convert to S10 units (Used internally only).
 CALLING SEQUENCE:
	function ThomsonS10(DSun,APM)
 INPUTS:
	DSun		real	distance to Sun (in solar radii)
	APM		real	apparent magnitude Sun at 1 AU
 OUTPUTS:
	ThomsonS10	real	Conversion factor
 CALLED BY:
	ThomsonElectronS10, ThomsonElectronS10Far, ThomsonLOS3DS10
	ThomsonLOS3DS10Step, ThomsonLOSS10, ThomsonLOSS10Far, ThomsonLOSS10Step
 INCLUDE:
	include		'math.h'
	include		'sun.h'
 PROCEDURE:
	If F is a flux in units of the flux incident from the solar
	disk at heliocentric distance DSun, then R*F is the same flux in
	S10 units.
	The conversion is done in two steps:
	1. Convert to units of the flux -incident- at r0 = 1 AU from the solar
	   disk: multiply by (r0/DSun)^2
	2. Convert to unit of flux from 1 10th magnitude star per square
	   degree: multiply by (Pi/180)^2*10^((10-M)/2.5).
	(Apparent magnitude, M=-2.5*log(Flux)).
	Step 1 is needed because M is an apparent magnitude as observed at 1 AU.
 MODIFICATION HISTORY:
	JUL-1996, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


ThomsonSetupIntegrand $SMEI/ucsd/gen/for/lib/thomson/thomsontang.f
[Previous] [Next]
 NAME:
	ThomsonSetupIntegrand
 PURPOSE:
	(internal use only)
 CALLING SEQUENCE:
	entry ThomsonSetupIntegrand(ScSunIn,EloIn,UIn)
 CALLS: ***
	ElSunDistance, ThomsonBase, ThomsonLOSDensity
 CALLED BY:
	ThomsonLOS, ThomsonLOS3D


ThomsonSetupLOS $SMEI/ucsd/gen/for/lib/thomson/thomsonlosdensity.f
[Previous] [Next]
 NAME:
	ThomsonSetupLOS
 PURPOSE:
 CATEGORY:
 CALLING SEQUENCE:
	entry ThomsonSetupLOS(ScLngIn,ScLatIn,ScSunIn,SLngIn,SLatIn)
 INPUTS:
	ScLngIn		real	heliocentric (ecliptic) longitude observer (deg)
	ScLatIn		real	heliocentric (ecliptic) latitude observer (deg)
	ScSunIn		real	heliocentric distance observer (in solar radii)
	SLngIn		real	topocentric (ecliptic) longitude line of sight
				relative to Sun-observer direction
	SLatIn		real	topocentric (ecliptic) longitude line of sight
				relative to Sun-observer direction
 OUTPUTS:
	ThomsonSetupLOS	real	always 1
 CALLS: ***
	POINT_ON_LOS, Thomson3DDensity
 CALLED BY:
	ThomsonLOS3D, ThomsonLOS3DStep
 SEE ALSO:
	ThomsonLOSDensity
 PROCEDURE:
 >	Entry point in ThomsonLOSDensity
 >	Only serves to store the input variables internally for use by
	ThomsonLOSDensity.
 MODIFICATION HISTORY:
	JAN-1998, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


ThomsonSetupMid $SMEI/ucsd/gen/for/lib/thomson/thomsonmid.f
[Previous] [Next]
 NAME:
	ThomsonSetupMid
 CALLING SEQUENCE:
	entry ThomsonSetupMid(ScSunIn,EloIn,UIn)
 CALLS: ***
	ThomsonLOS
 CALLED BY:
	ThomsonMidpoint
 PROCEDURE:
	Entry point in ThomsonMid


ThomsonSetupMidFar $SMEI/ucsd/gen/for/lib/thomson/thomsonmidfar.f
[Previous] [Next]
 NAME:
	ThomsonSetupMidFar
 CALLING SEQUENCE:
	entry ThomsonSetupMidFar(EloIn)		! Internal use only
 CALLED BY:
	ThomsonMidpointFar
 PROCEDURE:
	Entry point in ThomsonSetupMidFar


ThomsonSoup $SMEI/ucsd/gen/for/lib/thomson/thomsonsoup.f
[Previous] [Next]
 NAME:
	ThomsonSoup
 PURPOSE:
	(Used internally only).
	Calculates constants needed for Thomson scattering intensities
 CALLING SEQUENCE:
	subroutine ThomsonSoup(ElSun,U,rIt,rItr)
 INPUTS:
	ElSun	real	Electron-Sun distance (in solar radii) = 1./sine(Omega)
	U	real	limb darkening constant
 OUTPUTS:
	rIt,rItr real	constants
 CALLED BY:
	ThomsonBase, ThomsonPDistance
 RESTRICTIONS:
	ElSun is restricted to values larger than one solar radius.
	(smaller values are treated as equal to one solar radius).
 PROCEDURE:
 >	See Billings, Guide to the solar corona (Chapter 6, p. 150)
	Academic Press (1966)
 >	The constants are functions of the angular size, Omega, of the
	Sun as seen from the electron, and the limb darkening constant U.
	Sin(Omega) = RSun/dElectronSun.
 MODIFICATION HISTORY:
	JUL-1996, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


ThomsonTang $SMEI/ucsd/gen/for/lib/thomson/thomsontang.f
[Previous] [Next]
 NAME:
	ThomsonTang
 PURPOSE:
	(internal use only) Tangential intensity in 1/r^2 density
 CALLING SEQUENCE:
	function ThomsonTang(S)
 CALLS: ***
	ElSunDistance, ThomsonBase, ThomsonLOSDensity
 CALLED BY:
	ThomsonLOS
 EXTERNAL BY:
	ThomsonLOS


ThomsonTang3D $SMEI/ucsd/gen/for/lib/thomson/thomsontang.f
[Previous] [Next]
 NAME:
	ThomsonTang3D
 PURPOSE:
	(internal use only)
 CALLING SEQUENCE:
	entry ThomsonTang3D(S)
 CALLS: ***
	ElSunDistance, ThomsonBase, ThomsonLOSDensity
 CALLED BY:
	ThomsonLOS3D
 EXTERNAL BY:
	ThomsonLOS3D


ThomsonTangMRad $SMEI/ucsd/gen/for/lib/thomson/thomsontang.f
[Previous] [Next]
 NAME:
	ThomsonTangMRad
 PURPOSE:
	(internal use only) Tangential minus radial intensity in 1/r^2 density
 CALLING SEQUENCE:
	entry ThomsonTangMRad(S)
 CALLS: ***
	ElSunDistance, ThomsonBase, ThomsonLOSDensity
 CALLED BY:
	ThomsonLOS
 EXTERNAL BY:
	ThomsonLOS


ThomsonTangMRad3D $SMEI/ucsd/gen/for/lib/thomson/thomsontang.f
[Previous] [Next]
 NAME:
	ThomsonTangMRad3D
 PURPOSE:
	(internal use only) Tangential minus radial intensity
 CALLING SEQUENCE:
	entry ThomsonTangMRad3D(S)
 CALLS: ***
	ElSunDistance, ThomsonBase, ThomsonLOSDensity
 CALLED BY:
	ThomsonLOS3D
 EXTERNAL BY:
	ThomsonLOS3D


ThomsonUBVConst $SMEI/ucsd/gen/for/lib/thomson/thomsonubvconst.f
[Previous] [Next]
 NAME:
	ThomsonUBVConst
 PURPOSE:
	Defines apparent solar magnitudes and limb darkening
	constants to be used for the Helios UBV system
 CALLING SEQUENCE:
	subroutine ThomsonUBVConst(LT,U,APM)
 INPUTS:
	LT	integer		= 1,2,3 for U,B,V light, resp.
 OUTPUTS:
	U	real		limb darkening constant
	APM	integer		apparent magnitude of the Sun
 CALLS:
	(none)
 CALLED BY:
	LOSWeights, READ_HOS
 RESTRICTIONS:
	1<=LT<=3
 PROCEDURE:
 >	Parameters for LT (HOS__U,HOS__B,HOS__V) are defined in the include file
	thomson.h. Use these rather than hardwiring the values 1,2,3.
 >	UHOS(LT) is the limb darkening coefficient for Helios photometer
	light from the U/B/V filter (LT=1,2,3). From a graph in RAUMFAHRT-
	FORSCHUNG by LEINERT et al. LAMBDA=3650,4300,5250 A for U,B,V light.
	From Allen (1985), p. 171, U=0.80,0.77,0.62 by linear interpolation.
 >	APMHOS(LT) is the apparent magnitude of the Sun for U,B and V light.
 MODIFICATION HISTORY:
	JUL-1996, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time1Add $SMEI/ucsd/gen/for/lib/time/time1add.f
[Previous] [Next]
 NAME:
	Time1Add
 PURPOSE:
	Adds 1-element standard times
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time1Add(t,dt,u)
 INPUTS:
	n	integer		# times
	t	integer		1-element standard time
	dt	integer		1-element standard time
 OUTPUTS
	u	integer		1-element standard time t+dt
 PROCEDURE:
	The two times are simply added together.
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time1ChangeUnits $SMEI/ucsd/gen/for/lib/time/time1changeunits.f
[Previous] [Next]
 NAME:
	Time1ChangeUnits
 PURPOSE:
	Change fract-day units
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time1ChangeUnits(units,new_units,t,u)
 INPUTS:
	units		integer		# current units in day
	new_units	integer		# new units in day
	t		integer		1-element standard time
 OUTPUTS:
	u		integer		modified 1-element standard time 
 CALLS: ***
	Time2ConvertUnits
 PROCEDURE:
	Typically this routine is used to convert to smaller frac-day units,
	e.g. from hours to seconds. In this case the conversion is exact
	When converting to larger units (new_units smaller than units)
	then round-off will usually occur, i.e. the conversion is not exact.
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time1Day $SMEI/ucsd/gen/for/lib/time/time1day.f
[Previous] [Next]
 NAME:
	Time1Day
 PURPOSE:
	Convert 1-element standard time to single precision day
	(with time of day included as fraction of day) and v.v.
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time1Day(id,t,day)
 INPUTS:
	id		integer		0: convert from time to fractional day
					1: convert from fractional day to time
	t		integer		id=0: 1-element standard time
	day		real*4		id=1: day with fraction for time of day
 OUTPUTS
	day		real*4		id=0: day with fraction for time of day
	t		integer		id=1: 1-element standard time
 CALLS: ***
	Time1to2, Time2Day, Time2to1
 PROCEDURE:
	See Time2Day
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time1Day8 $SMEI/ucsd/gen/for/lib/time/time1day8.f
[Previous] [Next]
 NAME:
	Time1Day8
 PURPOSE:
	Convert 1-element standard time to double precision day
	(with time of day included as fraction of day) and v.v.
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time1Day8(id,t,day)
 INPUTS:
	id		integer			0: convert from time to fractional day
						1: convert from fractional day to time
	t		integer			id=0: 1-element standard time
	day		double precision	id=1: day with fraction for time of day
 OUTPUTS
	day		double precision	id=0: day with fraction for time of day
	t		integer			id=1: 1-element standard time
 CALLS: ***
	Time1to2, Time2Day8, Time2to1
 PROCEDURE:
	See Time2Day8
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time1Delta $SMEI/ucsd/gen/for/lib/time/time1delta.f
[Previous] [Next]
 NAME:
	Time1Delta
 PURPOSE:
	Get difference between 1-element standard times
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time1Delta(t,u,dt)
 INPUTS:
	t	integer		1-element standard time
	u	integer		1-element standard time
 OUTPUTS
	dt	integer		1-element time difference t-u
 PROCEDURE:
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time1DHMS $SMEI/ucsd/gen/for/lib/time/time1dhms.f
[Previous] [Next]
 NAME:
	Time1DHMS
 PURPOSE:
	Get hour,minute,second,smallest time unit from start of day
	for 1-element standard time
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time1DHMS(t,hms)
 INPUTS:
	t		integer		1-element standard time
 OUTPUTS:
	hms(4)		integer		hour,minute,second,milliseconc
 CALLS: ***
	Time1to2, Time2DHMS
 SEE ALSO:
	Time1HMS, Time2HMS
 PROCEDURE:
	See Time2DHMS
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time1DOW $SMEI/ucsd/gen/for/lib/time/time1dow.f
[Previous] [Next]
 NAME:
	Time1DOW
 PURPOSE:
	Get day of week as 3-char string from 1-element standard time
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	character*3 function Time1DOW(t)
 INPUTS:
	t		integer		1-element standard time
 OUTPUTS
	Time1DOW	character*3	day of week
 CALLS: ***
	Time1to2, Time2DOW
 PROCEDURE:
	See Time2DOW
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time1HMS $SMEI/ucsd/gen/for/lib/time/time1hms.f
[Previous] [Next]
 NAME:
	Time1HMS
 PURPOSE:
	Convert fraction of day for 1-elements standard time
	to hour,minute,second,fraction of second. (Note that this is NOT
	the hms since the start of day)
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time1HMS(id,t,hms)
 INPUTS:
	id		integer		0  converts time to hms
					1  converts hms to time
	t		integer		id=0: 1-element standard time
	hms(4)		integer		id=1: hour,minute,second,milliseconc
 OUTPUTS:
	t		integer		id=0: 1-element standard time
	hms(4)		integer		id=1: hour,minute,second,milliseconc
 CALLS: ***
	Time1to2, Time2HMS, Time2to1
 SEE ALSO:
	Time1DHMS, Time1to2, Time2DHMS, Time2to1
 PROCEDURE:
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time1Interpolate $SMEI/ucsd/gen/for/lib/time/time1interpolate.f
[Previous] [Next]
 NAME:
	Time1Interpolate
 PURPOSE:
	Interpolate times
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time1interpolate(w,t1,t2,tt)
 INPUTS:
	w		double precision	fraction used for interpolation
	t1		integer			1-element standard time
	t2		integer			1-element standard time
 OUTPUTS
	tt		integer			interpolated 1-element standard time
 PROCEDURE:
	tt = (1-ft)*t1+ft*t2
	i.e. if ft=0 then tt=t1 and if ft=1 then tt=t2
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time1JD $SMEI/ucsd/gen/for/lib/time/time1twothousand.f
[Previous] [Next]
 NAME:
	Time1JD
 PURPOSE:
	Convert from 1-element standard time to Julian day and v.v
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	entry Time1JD(id,t,u)
 INPUTS:
	id		integer		0  converts time to Julian day
					1  converts Julian day to time
	t		integer		id=0: time relative to current origin
					id=1: time in Julian day
 OUTPUTS:
	u		integer		id=0: time in Julian day
					id=1: time relative to current origin
 CALLS: ***
	Time1StandardOrigin, Time2GetOrigin2000, Time2GetOriginJD, Time2GetOriginMJD
 PROCEDURE:
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time1MJD $SMEI/ucsd/gen/for/lib/time/time1twothousand.f
[Previous] [Next]
 NAME:
	Time1MJD
 PURPOSE:
	Convert from 1-element standard time to modified Julian day and v.v.
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	entry Time1MJD(id,t,u)
 INPUTS:
	id		integer		0  converts time to modified Julian day
					1  converts modified Julian day to time
	n		integer		# times
	t		integer		id=0: time relative to current origin
					id=1: time in modified Julian days
 OUTPUTS:
	u		integer		id=0: time in modified Julian day
					id=1: time relative to current origin
 CALLS: ***
	Time1StandardOrigin, Time2GetOrigin2000, Time2GetOriginJD, Time2GetOriginMJD
 PROCEDURE:
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time1Round $SMEI/ucsd/gen/for/lib/time/time1round.f
[Previous] [Next]
 NAME:
	Time1Round
 PURPOSE:
	Rounds 1-element standard time
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time1Round(hms,t,u)
 INPUTS:
	hms(4)		integer
	t		integer
 OUTPUTS:
	u		integer
 CALLS: ***
	Time1to2, Time2Round, Time2to1
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (pphick@ucsd.edu)


Time1Split $SMEI/ucsd/gen/for/lib/time/time1split.f
[Previous] [Next]
 NAME:
	Time1Split
 PURPOSE:
	Convert string time to 1-element standard time
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time1Split(ctemplate,ct,t)
 INPUTS:
	ctemplate	character*(*)	string template for output string
	ct		character*(*)	time string
 OUTPUTS
	t		integer		1-element standard time
 CALLS: ***
	Time2Split, Time2to1
 PROCEDURE:
	See Time2Split
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time1StandardOrigin $SMEI/ucsd/gen/for/lib/time/time1standardorigin.f
[Previous] [Next]
 NAME:
	Time1StandardOrigin
 PURPOSE:
	Convert between 1-element standard time to time relative to
	one of the standard origins.
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time1StandardOrigin(t0,id,t,u)
 INPUTS:
	t0(3)		integer		standard origin
	id		integer		0  converts to time relative to standard origin
					1  converts from time relative to standard origin
	t		integer		id=0: time relative to current origin
					id=1: time relative to new (standard) origin
 OUTPUTS:
	u		integer		id=0: time relative to new (standard) origin
					id=1: time relative to current origin
 CALLS: ***
	Time1to2, Time2StandardOrigin, Time2to1
 CALLED BY:
	Time1JD, Time1MJD, Time1TwoThousand
 PROCEDURE:
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time1Str $SMEI/ucsd/gen/for/lib/time/time1str.f
[Previous] [Next]
 NAME:
	Time1Str
 PURPOSE:
	Convert 1-element standard time to string
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	integer function Time1Str(ctemplate,t,ct)
 INPUTS:
	ctemplate	character*(*)	string template for output string
	t(2)		integer		1-element standard time
 OUTPUTS
	ct		character*(*)	time string
 CALLS: ***
	Time1to2, Time2Str
 PROCEDURE:
	See Time2Str
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time1System $SMEI/ucsd/gen/for/lib/time/time1system.f
[Previous] [Next]
 NAME:
	Time1System
 PURPOSE:
	Get system time
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time1System(t)
 OUTPUTS:
	u(2)		integer		rounded 2-element standard time
 CALLS: ***
	Time2System, Time2to1
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (pphick@ucsd.edu)


Time1to2 $SMEI/ucsd/gen/for/lib/time/time1to2.f
[Previous] [Next]
 NAME:
	Time1to2
 PURPOSE:
	Convert 1-element time to 2-element time
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time1to2(t1,t2)
 INPUTS:
	t1		integer		1-element time
 OUTPUTS
	t2(2)		integer		2-element time
 CALLS: ***
	Time2Standardize
 CALLED BY:
	Time1DHMS, Time1DOW, Time1Day, Time1Day8, Time1HMS, Time1Round, Time1StandardOrigin
	Time1Str, Time1YDoy, Time1YMD, Time2HMS
 PROCEDURE:
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time1TwoThousand $SMEI/ucsd/gen/for/lib/time/time1twothousand.f
[Previous] [Next]
 NAME:
	Time1TwoThousand
 PURPOSE:
	Convert from 1-element standard time to time relative to
	2000 Jan 1, 0 UT and v.v.
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time1TwoThousand(id,t,u)
 INPUTS:
	id		integer		0  converts to time relative to 2000 Jan 1, 0 UT
					1  converts from time relative to 2000 Jan 1, 0 UT
	t		integer		id=0: time relative to current origin
					id=1: time relative to 2000 Jan 1, 0 UT
 OUTPUTS:
	u		integer		id=0: time relative to 2000 Jan 1, 0 UT
					id=1: time relative to current origin
 CALLS: ***
	Time1StandardOrigin, Time2GetOrigin2000, Time2GetOriginJD, Time2GetOriginMJD
 PROCEDURE:
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time1YDoy $SMEI/ucsd/gen/for/lib/time/time1ydoy.f
[Previous] [Next]
 NAME:
	Time1YDoy
 PURPOSE:
	Converts year/doy of year to 1-element standard time and v.v.
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time1YDoy(id,t,yr,doy)
 INPUTS:
	id		integer		=0  time to year/doy
					=1  year/doy to time
	t		integer		id=0: time relative to current origin
	yr		integer		id=1: year
	doy(2)		integer		id=1: day of year (doy(2) is fraction of
						day in units set by Time2SetOrigin2000)
 OUTPUTS:
	yr		integer		id=1: year
	doy(2)		integer		id=1: day of year (doy(2) is fraction of
						day in units set by Time2SetOrigin2000)
	t		integer		id=0: times relative to current origin
 CALLS: ***
	Time1to2, Time2YDoy, Time2to1
 PROCEDURE:
	See Time2YDoy
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time1YMD $SMEI/ucsd/gen/for/lib/time/time1ymd.f
[Previous] [Next]
 NAME:
	Time1YMD
 PURPOSE:
	Converts dates (Yr,Month,Day) to 1-element standard time and v.v.
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time1YMD(id,t,yr,mon,day)
 INPUTS:
	id		integer		=0  time to date (yr,month,day)
					=1  date (yr,month,day) to time

	t		integer		id=0: time relative to current origin
	yr		integer		id=1: year; the year xxxBC should be entered as -xxx+1.
	mon		integer		id=1: month (1,..,12)
	day(2)		integer		id=1: day of month (day(2) is fraction of day
						in units set by Time2SetOrigin2000
 OUTPUTS:
	yr		integer		id=0: year; the year xxxBC should be entered as -xxx+1.
	mon		integer		id=0: month (1,..,12)
	day(2)		integer		id=0: day of month (day(2) is fraction of day
						in units set by Time2SetOrigin2000
	t		integer		id=1: time relative to current time origin
 CALLS: ***
	Time1to2, Time2YMD, Time2to1
 PROCEDURE:
	See Time2YMD
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2Add $SMEI/ucsd/gen/for/lib/time/time2add.f
[Previous] [Next]
 NAME:
	Time2Add
 PURPOSE:
	Adds times
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time2Add(t,dt,u)
 INPUTS:
	t (2)		integer		2-element standard time
	dt(2)		integer		2-element standard time
 OUTPUTS
	u(2)		integer		2-element standard time t+dt
 CALLS: ***
	Time2Standardize
 CALLED BY:
	Time2Carrington, Time2CarringtonT0, Time2Local2UT, Time2Split, Time2Time
	smei_orbit2, smei_orbit_period2, smei_orbit_time2
 PROCEDURE:
	The two time components are simply added together, followed
	by a call to Time2Standardize on the summed times.
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2Carrington $SMEI/ucsd/gen/for/lib/time/time2carrington.f
[Previous] [Next]
 NAME:
	Time2Carrington
 PURPOSE:
	Calculate the 'modified Carrington variable' for a given spacecraft
	position at a given time tt and v.v.
 CATEGORY:
	Celestial mechanics
 CALLING SEQUENCE:
	subroutine Time2Carrington(id,tt,nc,xc)
 INPUTS:
	id		integer			id=0: time --> Carrington variable
						id=1: Carington variable --> time
	tt(2)		integer			id=0: UT time
	nc		integer			id=1: Carrington rotation
	xc		double precision	id=1: fraction of Carrington rotation
 OUTPUTS:
	nc		integer			id=0: Carrington rotation
	xc		double precision	id=0: fraction of Carrington rotation
	tt(2)		integer			id=1: UT time
 CALLED BY:
	BList_NSO_NOAA, BList_WSO_NOAA, T3D_fill_global, T3D_fill_time, T3D_get
	T3D_get_all, T3D_get_grid, T3D_get_mode, T3D_header, T3D_iget, T3D_iset, T3D_set
	T3D_set_mode, Time2CarringtonN
 INCLUDE:
	include		'sun.h'
	include		'fortime.h'
 CALLS: ***
	HLngEarth, Say, Time2Add, Time2ChangeUnits, Time2ConvertUnits, Time2Day8, Time2Delta
	Time2JD, Time2to1
 RESTRICTIONS:
 >	It is assumed that a time origin has been defined (using e.g. TimeInit()).
 >	Calculations are done internally with time in milli-second precision.
	This has several side-effects:
	- If the time units in effect are smaller then the origin should be put at an integer
	  multiple of milli-second, or it will be rounded to the nearest milli-second.
	- For id=0, the actual time is rounded to the nearest milli-second
	- For id=1, the returned time will be rounded to the nearest time unit in effect when
	  the subroutine was called. 
 PROCEDURE:
 >	DEFINITION: Modified Carrington variable
	For a given time 'tt' the spacecraft position is inside Carrington
	rotation 'nc' at heliographic location (Lng,Lat).
	The rotation number 'nc' and the longitude Lng are combined in the
	'modified Carrington variable' by
		xc = nc+(360-Lng)/360
	i.e. the integer part of 'xc' identifies the Carrington rotation,
	and the fraction the heliographic longitude; as the spacecraft moves
	across Carrington rotation 'nc', 'xc' increases from 'nc' to 'nc'+1.

 >	The approximate start time is estimated based on the starttime of
	Carrington rotation 1750 and the synodic rotation rate of Earth.
	A refinement is made using the actual heliographic longitude of Earth
	returned by HLngEarth.
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS)
	FEB-2004, Paul Hick (UCSD/CASS)
		Fixed bug in iteration loop for conversion from Carrington variable
		to time. The iteration would sometimes go into an infinite loop,
		bouncing between two times 1 msec apart.
	APR-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Fixed bug that disables abort if iteration count is exceeded.


Time2CarringtonN $SMEI/ucsd/gen/for/lib/time/time2carringtonn.f
[Previous] [Next]
 NAME:
	Time2CarringtonN
 PURPOSE:
	Get Carrington rotation number for given time tt
 CALLING SEQUENCE:
	integer function Time2CarringtonN(tt)
 INPUTS:
	tt(2)		integer		2-element standard time
 OUTPUTS:
	Time2CarringtonN
			integer		Carrington rotation number
	tt(2)		integer		start time of rotation Time2CarringtonN
 CALLS: ***
	Time2Carrington
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2CarringtonT0 $SMEI/ucsd/gen/for/lib/time/time2carringtont0.f
[Previous] [Next]
 NAME:
	Time2CarringtonT0
 PURPOSE:
	Calculate list of start times for subsequent 'Carrington rotations'
 CATEGORY:
	Celestial mechanics
 CALLING SEQUENCE:
	subroutine Time2CarringtonT0(ScName,tt,dtt,ncar,jdcar)
 INPUTS:
	ScName		double precision	external function; identifies spacecraft
	tt(2)		integer			2-element standard time
	dtt		integer			1-element time for required accuracy for start times
	ncar		integer			# start times to be calculated
 OUTPUTS:
	jdcar(2,ncar)	integer			Carrington start times as 2-element standard
						times relative to current origin.
 INCLUDE:
	include		'fortime.h'
 CALLS: ***
	Dbl2Str, Say, Str2Str, Time2Add, Time2Day, Time2Day8, Time2Delta, Time2Interpolate
	Time2JD, Time2Str, Time2to1
 PROCEDURE:
 >	ScName must be declared EXTERNAL in the calling program unit.
	ScName is a user-written function which calculates the heliographic
		longitude XLNG of a spacecraft for a given time iYr,Doy
	The call to ScName has the form:
		XLNG = ScName(itt)
	where tt(2) is an integer 2-element standard time input and
	XLNG (real*4) is output.
 >	itt(2) is the time where the search for start times begins.
	the first nCar Carrington start times after iYr,Doy_IN are calculated
 >	The spacecraft is supposed to move in the ecliptic, circling the Sun in
	the same direction as Earth (direct motion)
 >	The start time of a new Carrington rotation is defined as the time for
	which the heliographic longitude of the spacecraft is zero.
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2ChangeUnits $SMEI/ucsd/gen/for/lib/time/time2changeunits.f
[Previous] [Next]
 NAME:
	Time2ChangeUnits
 PURPOSE:
	Change internal fract-day units
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time2ChangeUnits(units_in_day)
 INPUTS:
	units_in_day		integer		# current units in day
 CALLED BY:
	Time2Carrington, Time2GetOrigin, Time2GetOrigin2000, Time2GetOriginJD
	Time2GetOriginMJD, Time2PutOrigin, Time2SetOrigin2000, Time2SetOriginIn2000
	Time2SetOriginJD, Time2SetOriginMJD
 INCLUDE:
	include		'fortime.h'
 CALLS: ***
	Time2ConvertUnits
 PROCEDURE:
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2ConvertUnits $SMEI/ucsd/gen/for/lib/time/time2convertunits.f
[Previous] [Next]
 NAME:
	Time2ConvertUnits
 PURPOSE:
	Change fract-day units
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time2ConvertUnits(units,new_units,t,u)
 INPUTS:
	units		integer		# current units in day
	new_units	integer		# new units in day
	t(2)		integer		2-element standard time
 OUTPUTS:
	u(2)		integer		modified 2-element standard time 
 CALLED BY:
	Time1ChangeUnits, Time2Carrington, Time2ChangeUnits, Time2SetOriginInJD
	Time2SetOriginInMJD, Time2SetOriginInTime, Time2StandardOrigin
 PROCEDURE:
	Typically this routine is used to convert to smaller frac-day units,
	e.g. from hours to seconds. In this case the conversion is exact
	When converting to larger units (new_units smaller than units)
	then round-off will usually occur, i.e. the conversion is not exact.
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2Day $SMEI/ucsd/gen/for/lib/time/time2day.f
[Previous] [Next]
 NAME:
	Time2Day
 PURPOSE:
	Convert standard times to single precision day
	(with fraction for time of day) and v.v.
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time2Day(id,t,day)
 INPUTS:
	id		integer		0: convert from standard time to day
					1: convert from day to standard time
	t(2)		integer		id=0: 2-element standard times
	day		real		id=1: day with time of day as fraction
 OUTPUTS
	day		real		id=0: day with time of day as fraction
	t(2)		integer		id=1: 2-element standard times 
 CALLS: ***
	Time2Units
 CALLED BY:
	Local2UT, Time1Day, Time2CarringtonT0, smei_frm_c3fudge, smei_frm_ped_guess
	smei_frm_ratio
 PROCEDURE:
	The conversion id=0 is not exact, but rounds to the nearest
	fract-day unit.
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2Day8 $SMEI/ucsd/gen/for/lib/time/time2day8.f
[Previous] [Next]
 NAME:
	Time2Day8
 PURPOSE:
	Convert standard times to double precision day
	(with fraction for time of day) and v.v.
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time2Day8(id,t,day)
 INPUTS:
	id		integer			0: convert from standard time to day
						1: convert from day to standard time
	t(2)		integer			id=0: 2-element standard times
	day		double precision	id=1: day with time of day as fraction
 OUTPUTS
	day		double precision	id=0: day with time of day as fraction
	t(2)		integer			id=1: 2-element standard times 
 CALLS: ***
	Time2Units
 CALLED BY:
	NicHdr, Time1Day8, Time2Carrington, Time2CarringtonT0, Time2EclipticHeliographic
	Time2GST, Time2JEpoch, Time2KeplerOrbit, Time2Line, Time2PAnglePole, Time2Str
	Time2SunRA, Time2Time, Time2jpl_eph, Time2smei_eph, jpl_message, smei_orbit2
	smei_orbit_period2, smei_orbit_time2, smei_skyd_fts, smei_skyd_init
	smei_skyd_make, smei_skyd_sky
 PROCEDURE:
	The conversion id=0 is not exact, but rounds to the nearest
	fract-day unit.
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2Delta $SMEI/ucsd/gen/for/lib/time/time2delta.f
[Previous] [Next]
 NAME:
	Time2Delta
 PURPOSE:
	Get difference between times
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time2Delta(t,u,dt)
 INPUTS:
	t(2)		integer		2-element standard time
	u(2)		integer		2-element standard time
 OUTPUTS
	dt(2)		integer		2-element standard time t-u
 CALLS: ***
	Time2Standardize
 CALLED BY:
	NicHdr, StopWatchSub, Time2Carrington, Time2CarringtonT0
	Time2EclipticHeliographic, Time2StandardOrigin, Time2jpl_eph, Time2smei_eph
	TimeLapsed, smei_cal_get, smei_cal_init, smei_frm_c3fudge, smei_frm_ped_guess
	smei_frm_ratio, smei_orbit2, smei_orbit_period2, smei_orbit_time2, smei_skyd_fts
	smei_skyd_init, smei_skyd_make, smei_skyd_sky
 PROCEDURE:
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2DHMS $SMEI/ucsd/gen/for/lib/time/time2dhms.f
[Previous] [Next]
 NAME:
	Time2DHMS
 PURPOSE:
	Get hour,minute,second,smallest time unit from start of day
	for 2-element standard time
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time2DHMS(t,hms)
 INPUTS:
	t(2)		integer		2-element standard time relative to current origin
 OUTPUTS:
	hms(4)		integer		hour,minute,second,milliseconc
 CALLS: ***
	Time2HMS, Time2YDoy
 CALLED BY:
	Time1DHMS, smei_frm_c3fudge, smei_frm_ped_guess, smei_frm_ratio
 PROCEDURE:
	The time origin is shifted to the start of day for the
	current origin. Then Time2HMS is called.
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2Differ $SMEI/ucsd/gen/for/lib/time/time2differ.f
[Previous] [Next]
 NAME:
	Time2Differ
 PURPOSE:
	Get difference between times
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	integer function Time2Differ(t,u)
 INPUTS:
	t(2)		integer		2-element standard time
	u(2)		integer		2-element standard time
 OUTPUTS
	Time2Differ	integer		-1,0,1 if t earlier,same,later than u
 CALLS: ***
	Time2Standardize
 CALLED BY:
	Time2smei_eph, smei_cal_get, smei_cal_init, smei_foreign, smei_frm_get
	smei_frm_getfirst, smei_frm_getnext, smei_frm_path, smei_skyd_fts
	smei_skyd_init, smei_skyd_make, smei_skyd_sky
 PROCEDURE:
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2DOW $SMEI/ucsd/gen/for/lib/time/time2dow.f
[Previous] [Next]
 NAME:
	Time2DOW
 PURPOSE:
	Get day of week as 3-char string
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	character*3 function Time2DOW(t)
 INPUTS:
	t (2)
 OUTPUTS
	Time2DOW	character*3	one of SAT,SUN,MON,TUE,WED,THU,FRI
 CALLS: ***
	Time2TwoThousand
 CALLED BY:
	Time1DOW, Time2Str
 PROCEDURE:
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2EclipticEquatorial $SMEI/ucsd/gen/for/lib/time/time2eclipticequatorial.f
[Previous] [Next]
 NAME:
	Time2EclipticEquatorial
 PURPOSE:
	Converts ecliptic coordinates into equatorial coordinates or v.v.
 CATEGORY:
	Math: coordinate transformation
 CALLING SEQUENCE:
	subroutine Time2EclipticEquatorial(id,tt,phi,lat)
 CALLS: ***
	Time2JEpoch, rotated
 INPUTS:
	id	integer			id=0: ecliptic     ---> equatorial
					id=1: equatorial   ---> ecliptic
	tt(2)	integer			2-element standard time of current date
	phi	double precision	ecliptic longitude/right ascension for equinox of current date
	lat	double precision	ecliptic latitude/declination for equinox of current date
 OUTPUTS:
	phi	double precision	right ascension/ecliptic longitude
	lat	double precision	declination/ecliptic latitude
 CALLS: ***
	Time2JEpoch, rotated
 PROCEDURE:
	See O. Montenbruck, Practical Ephemeris Calculations, p. 11
	If ID not equal 0 or 1 then ID = 0 is assumed.
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2EclipticHeliographic $SMEI/ucsd/gen/for/lib/time/time2eclipticheliographic.f
[Previous] [Next]
 NAME:
	Time2EclipticHeliographic
 PURPOSE:
	Converts ecliptic coordinates into heliographic coordinates or v.v.
 CATEGORY:
	Math: coordinate transformation
 CALLING SEQUENCE:
	subroutine Time2EclipticHeliographic(id,tt,phi,lat)
 INPUTS:
	id	integer			id=0: ecliptic     ---> heliographic
					id=1: heliographic ---> ecliptic
	tt(2)	integer			2-element standard time of current date
	phi	double precision	ecliptic/heliographic longitude for equinox of current date/
	lat	double precision	ecliptic/heliographic latitude for equinox of current date/
 OUTPUTS:
	phi	double precision	heliographic/ecliptic longitude
	lat	double precision	heliographic/ecliptic latitude
 CALLED BY:
	HLngEarth, HLngEastLimb, HLngWestLimb, Time2SunL0B0
 INCLUDE:
	include		'sun.h'
 CALLS: ***
	Time2Day8, Time2Delta, Time2JD, Time2YDoy, rotated
 SIDE EFFECTS:
	ALFA	-90 deg. plus ecliptic longitude of ascending node of solar 
		equator on ecliptic
	BETA	inclination of solar equator with respect to ecliptic
	GAMMA	90 deg. plus angle from ascending node to heliographic prime 
		meridian 
 PROCEDURE:
 	See R. Green, Spherical Astronomy, Cambridge UP, 1985, Section 17.7,
	p. 430.
 MODIFICATION HISTORY:
	Paul Hick (MPAE,UCSD/CASS; pphick@ucsd.edu)


Time2GetOrigin $SMEI/ucsd/gen/for/lib/time/time2getorigin.f
[Previous] [Next]
 NAME:
	Time2GetOrigin
 PURPOSE:
	Retrieve current time origin and fract-day units
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time2GetOrigin(t3)
 OUTPUTS:
	t3(3)		integer		current time origin
 CALLS: ***
	Time2ChangeUnits, Time2Standardize
 CALLED BY:
	T3D_fill_global, T3D_fill_time, T3D_get, T3D_get_all, T3D_get_grid, T3D_get_mode
	T3D_header, T3D_iget, T3D_iset, T3D_set, T3D_set_mode, Time2SetOriginInJD
	Time2SetOriginInMJD, Time2SetOriginInTime, Time2StandardOrigin
 INCLUDE:
	include		'fortime.h'
 PROCEDURE:
	Used to save current settings for restoration by
	Time2PutOrigin
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2GetOrigin2000 $SMEI/ucsd/gen/for/lib/time/time2getorigin.f
[Previous] [Next]
 NAME:
	Time2GetOrigin2000
 PURPOSE:
	Get origin for 2000 Jan 1, 0 UT
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	entry Time2GetOrigin2000(t3)
 CALLS: ***
	Time2ChangeUnits, Time2Standardize
 CALLED BY:
	Time1JD, Time1MJD, Time1TwoThousand, Time2JD, Time2MJD, Time2TwoThousand
 PROCEDURE:
	Initializes the time origin to 2000 Jan 1, 0 UT.
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2GetOriginJD $SMEI/ucsd/gen/for/lib/time/time2getorigin.f
[Previous] [Next]
 NAME:
	Time2GetOriginJD
 PURPOSE:
	Get origin for Julian days
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	entry Time2GetOriginJD(t3)
 CALLS: ***
	Time2ChangeUnits, Time2Standardize
 CALLED BY:
	Time1JD, Time1MJD, Time1TwoThousand, Time2JD, Time2MJD, Time2SetOriginInJD
	Time2SetOriginInMJD, Time2SetOriginInTime, Time2TwoThousand
 PROCEDURE:
	Initializes the time origin to 2000 Jan 1, 0 UT.
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2GetOriginMJD $SMEI/ucsd/gen/for/lib/time/time2getorigin.f
[Previous] [Next]
 NAME:
	Time2GetOriginMJD
 PURPOSE:
	Get origin for modified Julian days
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	entry Time2GetOriginMJD(t3)
 CALLS: ***
	Time2ChangeUnits, Time2Standardize
 CALLED BY:
	Time1JD, Time1MJD, Time1TwoThousand, Time2JD, Time2MJD, Time2SetOriginInJD
	Time2SetOriginInMJD, Time2SetOriginInTime, Time2TwoThousand
 PROCEDURE:
	Initializes the time origin to 2000 Jan 1, 0 UT.
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2GST $SMEI/ucsd/gen/for/lib/time/time2gst.f
[Previous] [Next]
 NAME:
	Time2GST
 PURPOSE:
	Calculate Greenwich Sidereal Time.
	Good for years 1901 through 2099. Accuracy is 0.006 degree.
 CATEGORY:
	Celestial mechanics
 CALLING SEQUENCE:
	double precision function Time2GST(tt)
 INPUTS:
	tt(2)		integer			time
 OUTPUTS:
	Time2TGST	double precision	Greenwich sidereal time (degrees)
 CALLS: ***
	Time2Day8, Time2YDoy
 RESTRICTIONS:
	Only valid for years 1901 through 2099
 PROCEDURE:
	Local Sidereal Time	= Hour Angle of the vernal equinox
				= Right Ascension of zenith
	For star X : RA(X)+HA(X)=LST
 MODIFICATION HISTORY:
	Extracted from:
	Geophysical Coordinate Transformations, C.T. Russell, in:
		Cosmic Electrodynamics 2 (1971) 184-196


Time2HMS $SMEI/ucsd/gen/for/lib/time/time2hms.f
[Previous] [Next]
 NAME:
	Time2HMS
 PURPOSE:
	Convert fraction of day for 2-element standard time
	to hour,minute,second,smallest time unit. (Note that this is NOT
	the hms since the start of day)
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time2HMS(id,t,hms)
 INPUTS:
	id		integer		0  converts time to hms
					1  converts hms to time
	t(2)		integer		id=0:	times relative to current origin
	hms(4)		integer		id=1:	hms(1): hour
						hms(2): minute
						hms(3): second
						hms(4): fraction of second
							(currently millisecond)
 OUTPUTS:
	t(2)		integer		id=1: times relative to current origin
	hms(4)		integer		id=0:	hms(1): hour
						hms(2): minute
						hms(3): second
						hms(4): fraction of second
							(currently millisecond)
 CALLS: ***
	Time1to2, Time2Standardize, Time2Units
 CALLED BY:
	NicHdr, Time1HMS, Time2DHMS, Time2Local2UT, Time2Round, Time2Split, Time2Str
	Time2System, Time2Time, smei_hdr_time, smei_skyd_fts, smei_skyd_init
	smei_skyd_make, smei_skyd_sky
 SEE ALSO:
	Time2DHMS
 PROCEDURE:
	id=0: time --> hms
	Time t is processed first by Time2Standardize. Then t(2) (the remaining
	fraction of the day) is converted to hr, min, sec, frac. seconds.
	If the input time is standardized already then t(1) is not changed or used.

	id=1: hms --> time
	hms is converted to the current fractional units, effectively turning it
	into a 1-element standard time. It is then converted to a 2-element
	time using Time1to2. If hms represents a positive fraction of a day
	(less then one) then t(1) will be zero.
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2Interpolate $SMEI/ucsd/gen/for/lib/time/time2interpolate.f
[Previous] [Next]
 NAME:
	Time2Interpolate
 PURPOSE:
	Interpolate times
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time2Interpolate(w,t,u,tt)
 INPUTS:
	w		double precision	fraction used for interpolation
	t(2)		integer			2-element standard time
	u(2)		integer			2-element standard time
 OUTPUTS
	tt(2)		integer			interpolated 2-element standard time
 CALLS: ***
	Time2Standardize, Time2Units
 CALLED BY:
	Time2CarringtonT0
 PROCEDURE:
	tt = (1-ft)*t+ft*u
	i.e. if ft=0 then tt=t and if ft=1 then tt=u
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2JD $SMEI/ucsd/gen/for/lib/time/time2twothousand.f
[Previous] [Next]
 NAME:
	Time2JD
 PURPOSE:
	Convert from 2-element standard time and Julian day and v.v.
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	entry Time2JD(id,t,u)
 INPUTS:
	id		integer		0  converts time to Julian days
					1  converts Julian days to time
	t(2)		integer		id=0: time relative to current origin
					id=1: time in Julian day
 OUTPUTS:
	u(2)		integer		id=0: time in Julian day
					id=1: time relative to current origin
 CALLS: ***
	Time2GetOrigin2000, Time2GetOriginJD, Time2GetOriginMJD, Time2StandardOrigin
 CALLED BY:
	NicHdr, Time2Carrington, Time2CarringtonT0, Time2EclipticHeliographic, Time2Line
	Time2Str, Time2jpl_eph, jpl_message
 PROCEDURE:
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2JEpoch $SMEI/ucsd/gen/for/lib/time/time2jepoch.f
[Previous] [Next]
 NAME:
	Time2JEpoch
 PURPOSE:
	Converts Julian epoch to 2-element standard time and v.v.
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time2JEpoch(id,t,jepoch)
 INPUTS:
	t(2)		integer			times
 OUTPUTS
	jepoch		double precision	Julian epoch
 CALLS: ***
	Time2Day8, Time2TwoThousand
 CALLED BY:
	Time2EclipticEquatorial, Time2Line, Time2PlanetOrbit, Time2Precession
	Time2PrecesssionLtd, Time2Str, Time2SunNewcomb
 PROCEDURE:
	J2000.0 = 2000 January 1.5d TDB = JD 2451545.0
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2jpl_eph $SMEI/ucsd/gen/for/lib/time/time2jpl_eph.f
[Previous] [Next]
 NAME:
	Time2jpl_eph
 PURPOSE:
	Read the JPL planetary ephemeris and gives position and velocity of body NTARG
	with respect to body NCENT
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	logical function Time2jpl_eph(tt,ntarg,ncent,rrd,bKm,bBary)
 INPUTS:
	tt(2)	integer	2-element standard time
	ntarg	integer	number of the body whose position and velocity are needed
	ncent	integer	number of the body used as the origin
			(see jpl_eph2 for numbering system)
	bKm	logical	flag setting the units of the output (default: .FALSE.)
			bKM	= .TRUE. : KM and KM/SEC
				= .FALSE.: AU and AU/DAY
			bKM determines the time unit for nutations and librations
			The angles are always in radians.
	bBary	logical	flag defining the output center (default: .FALSE.)
			(affects only the 9 planets)
			bBary	= .TRUE. : center is solar system barycenter
				= .FALSE.: center is Sun
 OUTPUTS:
	rrd(6)	double precision
			Position (AU or km) and velocity (AU/day or km/s) of NTARG with
			respect to NCENT
			For librations the units are radians and radians/day
			For nutations the first four will be set (units of radians and
			radians/day).
	Time2jpl_eph	logical	status indicator
			will be .FALSE. if input time was outside range of ephemeris
			file or if there was a read error. Otherwise .TRUE.
 CALLS: ***
	Time2Day8, Time2Delta, Time2JD, Time2YDoy, jpl_eph2
 CALLED BY:
	smei_eclipse, smei_hdr_eph
 PROCEDURE:
	Time2jpl_eph is just a wrapper for jpl_eph2.
	The only difference is in the first argument (the time).
 MODIFICATION HISTORY:


Time2KeplerOrbit $SMEI/ucsd/gen/for/lib/time/time2keplerorbit.f
[Previous] [Next]
 NAME:
	Time2KeplerOrbit
 PURPOSE:
	Calculate orbital positions and velocities for elliptic and
	hyperbolic Kepler orbits.
 CATEGORY:
	Celestial mechanics: two-body problem
 CALLING SEQUENCE:
	subroutine Time2KeplerOrbit(tt,m1i,m2i,OrbitElement,Position,Velocity)
 INPUTS:
	tt(2)		integer		time difference with epoch t0
	m1		double precision primary mass (in solar masses)
					if m1 <=0 then m1 = 1 (solar mass) is used
	m2		double precision secondary mass (in solar masses)
					if m2 < 0 then m2 = 0 is used. 
	OrbitElement(6)	double precision orbital elements at epoch t0:
					1: semi-major axis (AU)
					2: eccentricity
					3: inclination of orbital plane to ecliptic (deg)
					4: ecliptic longitude ascending node (deg)
					5: longitude of perihelion (deg)
					   = angle(longitude ascending node)+
					     argument of perihelion
					6: mean longitude at epoch t0 (deg)
	!! Argument of perihelion = angle(ascending node-perihelion)
	!! If the orbital inclination (element 3) is zero, then the longitude of the
		node (element 4) is not used, and the longitude of the perihelion and
		the mean longitude at t0 become ecliptic longitudes.
 OUTPUTS:
	Position(3)	double precision position vector relative to m1:
					1: ecliptic longitude (deg),
					2: ecliptic latitude (deg),
					3: radial distance (AU)
	Velocity(5)	double precision velocity vector relative to m1:
					1: ecliptic longitude (deg),
					2: ecliptic latitude (deg),
					3: velocity (AU/day),
					4: tangential velocity (AU/day),
					5: radial velocity (AU/day)
 CALLED BY:
	Time2PlanetOrbit
 EXTERNAL TYPE:
	double precision	EqKeplerd
 EXTERNAL:
	external		EqKeplerd
 INCLUDE:
	include		'math.h'
	include		'sun.h'
 COMMON TYPE:
	double precision	M
	double precision	ee
 COMMON BLOCKS:
	common	/KEPLERD/ 	M,ee
 CALLS: ***
	EqKeplerd, Time2Day8, datan2d, dcosd, dsind, nrZBrentd, rotated
 PROCEDURE:
 >	Basic two-body problem (see Green, p. 163-164)
 >	The time of perihelion passage can be used as epoch t0.
	In that case the mean longitude (at epoch t0) is equal to
	the longitude of the perihelion; i.e.
		OrbitElement(5) = OrbitElement(6)
 MODIFICATION HISTORY:
	JUN-1997, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	Adapted from IDL procedure KeplerOrbit


Time2Line $SMEI/ucsd/gen/for/lib/time/time2line.f
[Previous] [Next]
 NAME:
	Time2Line
 PURPOSE:
	Display time of day
 CATEGORY:
	Time keeping
 CALLING SEQUENCE:
	subroutine Time2Line()
 CALLS: ***
	Time2Day8, Time2JD, Time2JEpoch, Time2Str, Time2System, Time2YDoy, itrim
 PROCEDURE:
	Uses routine Time2System to get system time.
	Displays time of day, date, Doy, year and JD on one line
 MODIFICATION HISTORY:
	Paul Hick (ARC)


Time2Local2UT $SMEI/ucsd/gen/for/lib/time/time2local2ut.f
[Previous] [Next]
 NAME:
	Time2Local2UT
 PURPOSE:
       Read system clock, including fraction of day, convert to day of year, 
       and calculate the day of year in Universal Time (Greenwich).
 CATEGORY:
	Time calculation
 CALLING SEQUENCE:
	subroutine Time2Local2UT(hr,t)
 INPUTS:
	hr	integer		offset time (in hours) from Greenwich
				(i.e. UT-local time)
 OUTPUTS:
	t(2)	integer		2-element standard time
 CALLS: ***
	Time2Add, Time2HMS, Time2System
 CALLED BY:
	Local2UT
 PROCEDURE:
	Time2System is used to get the system time.
	The specified offset (in hours) is added.
 MODIFICATION HISTORY:
	NOV-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2MJD $SMEI/ucsd/gen/for/lib/time/time2twothousand.f
[Previous] [Next]
 NAME:
	Time2MJD
 PURPOSE:
	Convert from 2-element standard time to modified Julian day and v.v.
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	entry Time2MJD(id,t,u)
 INPUTS:
	id		integer		0  converts time to modified Julian day
					1  converts modified Julian day to time
	t(2)		integer		id=0: time relative to current origin
					id=1: time in modified Julian days
 OUTPUTS:
	u(2)		integer		id=0: time in modified Julian days
					id=1: time relative to current origin
 CALLS: ***
	Time2GetOrigin2000, Time2GetOriginJD, Time2GetOriginMJD, Time2StandardOrigin
 CALLED BY:
	smei_skyd_fts, smei_skyd_init, smei_skyd_make, smei_skyd_sky
 PROCEDURE:
	The modified Julian day is defined as MJD = JD-2400000.5
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2Month $SMEI/ucsd/gen/for/lib/time/time2month.f
[Previous] [Next]
 NAME:
	Time2Month
 PURPOSE:
	Get integer month from 3-char month string
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	integer function Time2Month(cmon)
 INPUTS:
	cmon		character*3	3-char month
 OUTPUTS
	Time2Month	integer		integer month in 1,..,12
 CALLS: ***
	uppercase
 CALLED BY:
	Time2Split
 PROCEDURE:
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2MonthStr $SMEI/ucsd/gen/for/lib/time/time2monthstr.f
[Previous] [Next]
 NAME:
	Time2MonthStr
 PURPOSE:
	Get day of month as 3-char string
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	character*3 function Time2MonthStr(mon)
 INPUTS:
	mon		integer
 OUTPUTS
	Time2MonthStr	character*3	one of JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC
 CALLED BY:
	Time2Str
 PROCEDURE:
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2PAnglePole $SMEI/ucsd/gen/for/lib/time/time2panglepole.f
[Previous] [Next]
 NAME:
	Time2PAnglePole
 PURPOSE:
	Calculate the position angle of the solar poles
 CATEGORY:
	Astronomy: celestial physics
 CALLING SEQUENCE:
	double precision function Time2PAnglePole(id,tt,lng)
 INPUTS:
	ID	integer			= 1,-1 : Get PA relative to Equatorial North of Earth
					= 2,-2 : Get PA relative to Ecliptic North
					ID>0 gets the PA of the north pole
					ID<0 gets the PA of the south pole
	tt 	integer			time
	lng	double precision	Ecliptic longitude of Sun as viewed from
					observer (i.e. topocentric longitude)
 OUTPUTS:
	Time2PAnglePole
		double precision	Position angle in degrees
 INCLUDE:
	include		'sun.h'
 CALLS: ***
	Time2Day8, Time2YDoy, datand, dcosd, dtand
 PROCEDURE:
 >	For given time tt and ecliptic longitude of the Sun (as seen
	from an observer in the ecliptic plane) the position of angle
	of the solar pole is calculated, either relative to ecliptic or to
	equatiorial North.
	See Spherical Astronomy pp. 430-433 by Green, Robin M., Cambridge UP (1985)
	(The position angle is measured counterclockwise, i.e. toward the east,
	from North)
 >	PA(south pole) = PA(north pole)+180
 MODIFICATION HISTORY:
	JUL-1992, Tom Davidson, Paul Hick (UCSD/CASS)
	JAN-2004, Paul Hick (UCSD/CASS)
		Introduced 2-elements integer standard time


Time2PlanetOrbit $SMEI/ucsd/gen/for/lib/time/time2planetorbit.f
[Previous] [Next]
 NAME:
	Time2PlanetOrbit
 PURPOSE:
	Calculate positions and velocities for planets as a simple Kepler orbit
 CATEGORY:
	Celestial mechanics
 CALLING SEQUENCE:
	subroutine Time2PlanetOrbit(iPlanet,tt,rr,vv)
 INPUTS:
	iPlanet		integer		Planet identifier
					1: Mercury
					2: Venus
					3: Earth/Moon
					4: Mars
					5: Jupiter
					6: Saturn
					7: Uranus
					8: Neptune
					9: Pluto
	tt(2)		integer		time
 OUTPUTS:
	rr(3)		real		position vector relative to m1:
					1: ecliptic longitude (deg),
					2: ecliptic latitude (deg),
					3: radial distance (AU)
	vv(5)		real		velocity vector relative to m1:
					1: ecliptic longitude (deg),
					2: ecliptic latitude (deg),
					3: velocity (AU/day),
					4: tangential velocity (AU/day),
					5: radial velocity (AU/day)
 CALLS: ***
	Time2JEpoch, Time2KeplerOrbit
 RESTRICTIONS:
	The orbit is strictly a two-body solution. No perturbations of
	any kind are taken into account.
 PROCEDURE:
	The orbital parameters are hardwired. The calculation is done
	by a call to KeplerOrbit.
 MODIFICATION HISTORY:
	May 1997, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2Precession $SMEI/ucsd/gen/for/lib/time/time2precession.f
[Previous] [Next]
 NAME:
	Time2Precession
 PURPOSE:
	Converts ecliptic coordinates for epoch JEpoch1 to epoch JEpoch2,
	i.e. corrects for precession between the two epochs.
	Uses the 'rotate' subroutine to transform between frames of reference
	and hence is 'exact'.
 CATEGORY:
	Celestial mechanics
 CALLING SEQUENCE:
	subroutine Time2Precession(tt1,tt2,lambda,beta)
 CALLS: ***
	Time2JEpoch, rotated
 INPUTS:
	tt1		integer			initial epoch
	tt2		integer			final epoch
	lambda		double precision	ecliptic longitude for tt1 (deg)
	beta		double precision	ecliptic latitude  for tt1 (deg)
 OUTPUTS:
	lambda		double precision	ecliptic longitude for tt2 (deg)
	beta		double precision	ecliptic latitude  for tt2 (deg)
 PROCEDURE:
	See R. Green, Spherical Astronomy, Cambridge UP, 1985, Sect. 9.5, p. 217
	(1) First transform ecliptic longitude and latitude to equatorial right
	    ascension and declination (for initial epoch);
	(2) Transform equatorial coordinates for initial epoch to epoch J2000.0;
	(3) Calculate equatorial coordinates for epoch J2000.0 to final epoch;
	(4) Transform back to ecliptic coordinates (for final epoch).

	EPS		inclination between ecliptic and equator
	ZETA,Z,THETA	precession angles
 MODIFICATION HISTORY:
	1989, Paul Hick (MPAE,UCSD/CASS; pphick@ucsd.edu)


Time2PrecesssionLtd $SMEI/ucsd/gen/for/lib/time/time2precessionltd.f
[Previous] [Next]
 NAME:
	Time2PrecesssionLtd
 PURPOSE:
	Converts ecliptic coordinates for epoch JEpoch1 to epoch JEpoch2,
	i.e. corrects for precession between the two epochs.
	Uses a first order approximation and gives good results only for
	time differences of several decades or less.
 CATEGORY:
	Celestial mechanics
 CALLING SEQUENCE:
	subroutine Time2PrecessionLtd(tt1,tt2,lambda,beta)
 CALLS:
	Time2JEpoch, cosd, sind, tand
 INPUTS:
	tt1		integer			initial epoch
	tt2		integer			final epoch
	lambda		double precision	ecliptic longitude for tt1 (deg)
	beta		double precision	ecliptic latitude  for tt1 (deg)
 OUTPUTS:
	lambda		double precision	ecliptic longitude for tt2 (deg)
	beta		double precision	ecliptic latitude  for tt2 (deg)
 PROCEDURE:
	See R. Green, Spherical Astronomy, Cambridge UP, 1985, Sect. 9.7, p 222
	A,B,C	precession constants
 MODIFICATION HISTORY:


Time2PutOrigin $SMEI/ucsd/gen/for/lib/time/time2getorigin.f
[Previous] [Next]
 NAME:
	Time2PutOrigin
 PURPOSE:
	Restore saved time origin and fract-day units
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	entry Time2PutOrigin(t3)
 OUTPUTS:
	t3(3)		integer		current time origin
 CALLS: ***
	Time2ChangeUnits, Time2Standardize
 CALLED BY:
	T3D_fill_global, T3D_fill_time, T3D_get, T3D_get_all, T3D_get_grid, T3D_get_mode
	T3D_header, T3D_iget, T3D_iset, T3D_set, T3D_set_mode
 PROCEDURE:
	Used to restore saved settings by Time2GetOrigin
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2Round $SMEI/ucsd/gen/for/lib/time/time2round.f
[Previous] [Next]
 NAME:
	Time2Round
 PURPOSE:
	Round time
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time2Round(hms,t,u)
 INPUTS:
	hms(4)		integer
	t(2)		integer		2-element standard time
 OUTPUTS:
	u(2)		integer		rounded 2-element standard time
 CALLS: ***
	Time2HMS, Time2Units, Time2YDoy
 CALLED BY:
	T3D_fill_global, T3D_fill_time, T3D_get, T3D_get_all, T3D_get_grid, T3D_get_mode
	T3D_header, T3D_iget, T3D_iset, T3D_set, T3D_set_mode, Time1Round
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (pphick@ucsd.edu)


Time2SetOrigin2000 $SMEI/ucsd/gen/for/lib/time/time2getorigin.f
[Previous] [Next]
 NAME:
	Time2SetOrigin2000
 PURPOSE:
	Initialize time tracking by setting origin to 2000 Jan 1, 0 UT
	with frac. day units in hours
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	entry Time2SetOrigin2000(units_in_day)
 CALLS: ***
	Time2ChangeUnits, Time2Standardize
 CALLED BY:
	T3D_fill_global, T3D_fill_time, T3D_get, T3D_get_all, T3D_get_grid, T3D_get_mode
	T3D_header, T3D_iget, T3D_iset, T3D_set, T3D_set_mode
 PROCEDURE:
	Initializes the time origin to 2000 Jan 1, 0 UT with milliseconds to
	keep track of the fraction of a day..

	The origin and time scale is saved internally into a 3-element integer	
	A 2-element standard time is a 2-element integer array defining the time difference
	from the current time origin: t2=[ta,tb] corresponds to a time ta+tb/units_in_day days after
	the time origin. Here units_in_day is defined by the value of idt, e.g. if idt=TIME__UNIT_MSEC
	(the default) then units_in_day=86400000.

	A 1-element standard time is a scalar integer: t1 corresponds to a time t1/units_in_day days
	after the time origin.

	Using 1-element times saves memory, but limits the range of possible of times to the number hours,
	minutes, seconds, etc. that can be fitted into an integer*4.
	Using 2-element times takes more memory but extends the range to the number of days that
	can be fitted into an integer*4.

	The time origin t0 is specified as a 2-element standard time relative to the absolute time
	origin, e.g. to set the time origin to 2000 Jan 1.0, set t0=[0,0] (this is the default).
	Once the time origin and the time scale have been set, all times are defined as 1- or 2-element
	standard times relative to the time origin.
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2SetOriginIn2000 $SMEI/ucsd/gen/for/lib/time/time2getorigin.f
[Previous] [Next]
 NAME:
	Time2SetOriginIn2000
 PURPOSE:
	Initialize time tracking by setting origin and frac-day units
	specified relative to 2000 Jan 1, 0 UT..
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	entry Time2SetOriginIn2000(t3)
 INPUTS:
	t3(3)		integer		time origin defined relative to the
					absolute time origin 2000, Jan 1, 0 UT.
					t0(1): # days
					t0(2): # units in fractional day
					t0(3): # units in whole day

					t0(3) should be set by using one of the parameters defined
					in include file fortime.h:
					Parameter name		Unit is:
					TIME__HOURS_IN_DAY	hours
					TIME__MINUTES_IN_DAY	minutes
					TIME__SECONDS_IN_DAY	seconds		
					TIME__DSEC_IN_DAY	decisecond (0.1 s)
					TIME__CSEC_IN_DAY	centisecond (0.01 s)
					TIME__MSEC_IN_DAY	millisecond (0.001 s)
 CALLS: ***
	Time2ChangeUnits, Time2Standardize
 CALLED BY:
	Time2SetOriginInJD, Time2SetOriginInMJD, Time2SetOriginInTime
 SIDE EFFECTS:
	Updates common block included in fortime.h
 PROCEDURE:
	The specified t3 is added to the absolute time origin 2000 Jan 1.0 to define the new
	origin.
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2SetOriginInJD $SMEI/ucsd/gen/for/lib/time/time2setorigin.f
[Previous] [Next]
 NAME:
	Time2SetOriginInJD
 PURPOSE:
	Initialize time tracking by setting origin and frac-day units
	specified relative to Julian Day 0.0
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time2SetOriginInJD(t3)
 INPUTS:
	t3(3)		integer		Julian day as 2-element standard time
 CALLS: ***
	Time2ConvertUnits, Time2GetOrigin, Time2GetOriginJD, Time2GetOriginMJD
	Time2SetOriginIn2000
 CALLED BY:
	Time2Time
 SIDE EFFECTS:
	Updates common block included in fortime.h
 PROCEDURE:
	Julian days are sometimes specified after subtracting some large
	offset e.g. NBIG = 2400000, 2440000 or 2450000

	The corresponding time origin is [-2451545+NBIG,43200000], i.e.
		T0=[-51545,43200000] for NBIG = 2400000
		T0=[-51544,       0] for NBIG = 2400000.5 (Modified Julian Day)
		T0=[-11545,43200000] for NBIG = 2440000
		T0=[-11544,       0] for NBIG = 2440000.5
		T0=[- 1545,43200000] for NBIG = 2450000
		T0=[- 1544,       0] for NBIG = 2450000.5
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2SetOriginInMJD $SMEI/ucsd/gen/for/lib/time/time2setorigin.f
[Previous] [Next]
 NAME:
	Time2SetOriginInMJD
 PURPOSE:
	Initialize time tracking by setting origin and frac-day units
	specified relative to Modified Julian Day 0.0 (= JD 2400000.5)
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	entry Time2SetOriginInMJD(t3)
 INPUTS:
	t3(3)		integer		2-element time in modified Julian days
 CALLS: ***
	Time2ConvertUnits, Time2GetOrigin, Time2GetOriginJD, Time2GetOriginMJD
	Time2SetOriginIn2000
 SIDE EFFECTS:
	Updates common block included in fortime.h
 PROCEDURE:
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2SetOriginInTime $SMEI/ucsd/gen/for/lib/time/time2setorigin.f
[Previous] [Next]
 NAME:
	Time2SetOriginInTime
 PURPOSE:
	Change time origin and frac-day units specified relative to current origin
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	entry Time2SetOriginInTime(t3)
 INPUTS:
	t3(3)		integer		2-element time relative to current origin
 CALLS: ***
	Time2ConvertUnits, Time2GetOrigin, Time2GetOriginJD, Time2GetOriginMJD
	Time2SetOriginIn2000
 SIDE EFFECTS:
	Updates common block included in fortime.h
 PROCEDURE:
	Assumes that an origin has already been defined, i.e. this routine
	can be used to change the origin and/or frac.-day units.
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2SetOriginJD $SMEI/ucsd/gen/for/lib/time/time2getorigin.f
[Previous] [Next]
 NAME:
	Time2SetOriginJD
 PURPOSE:
	Initialize time tracking by setting origin to Julian day zero
	with frac. day units in hours
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	entry Time2SetOriginJD(units_in_day)
 CALLS: ***
	Time2ChangeUnits, Time2Standardize
 PROCEDURE:
	Initializes the time origin to Julian day 0
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2SetOriginMJD $SMEI/ucsd/gen/for/lib/time/time2getorigin.f
[Previous] [Next]
 NAME:
	Time2SetOriginMJD
 PURPOSE:
	Initialize time tracking by setting origin to Modified
	Julian day 0 with frac. day units in hours
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	entry Time2SetOriginMJD(units_in_day)
 CALLS: ***
	Time2ChangeUnits, Time2Standardize
 PROCEDURE:
	Initializes the time origin to Modified Julian day 0
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2smei_eph $SMEI/ucsd/gen/for/lib/time/time2smei_eph.f
[Previous] [Next]
 NAME:
	Time2smei_eph
 PURPOSE:
	Get location of Coriolis spacecraft in ECI coordinates.
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	logical function Time2smei_eph(tt,rr,bKm)
 INPUTS:
	tt(2)		integer			UT time
	bKm		logical			return distance in km instead of AU
 OUTPUTS:
	rr(6)		double precision	location and velocity
 CALLS: ***
	SGP4D, Say, Time2Day8, Time2Delta, Time2Differ, Time2YDoy, bOpenFile, iFilePath
	iFreeLun, itrim
 CALLED BY:
	Time2smei_quaternion, smei_eclipse, smei_hdr_eph
 IMPLICIT:
	implicit double precision (A-H,O-Z)
 INCLUDE:
	include		'openfile.h'
	include		'dirspec.h'
	include		'filparts.h'
	include		'sun.h'
 COMMON BLOCKS:
	common	/E1/	XMO,XNODEO,OMEGAO,EO,XINCL,XNO,XNDT2O,XNDD6O,BSTAR,X,Y,Z,XDOT,YDOT,ZDOT,EPOCH,DS50
	common	/C1/	CK2,CK4,E6A,QOMS2T,S,TOTHRD,XJ3,XKE,XKMPER,XMNPDA,AE
	common	/C2/	DE2RA,PI,PIO2,TWOPI,X3PIO2
 MODIFICATION HISTORY:
	FEB-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2smei_quaternion $SMEI/ucsd/gen/for/lib/time/time2smei_quaternion.f
[Previous] [Next]
 NAME:
	Time2smei_quaternion
 PURPOSE:
	Get estimate of Coriolis spacecraft
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time2smei_quaternion(tt,camera,id,qq)
 INPUTS:
	tt(2)		integer			UT time
	camera		integer			camera number
	id		integer		=0: return Coriolis quaternion
					=1: return sky-to-cam quaternion
					=2: return cam-to-sky quaternion
 OUTPUTS:
	qq(4)		double precision	quaternion
 CALLS: ***
	Time2smei_eph, dacosd, datan2d, quaternion_inverse, quaternion_multiply
	rotate_dcm2quat, rotate_euler2dcm
 CALLED BY:
	smei_skyd_fts, smei_skyd_init, smei_skyd_make, smei_skyd_sky
 SEE ALSO:
	smei_hdr_quaternion
 PROCEDURE:
 >	For id=0 the resulting spacecraft quaternion connect the
	HAFB camera frame with the ECI (J2000 Equat) coordinate
	frame, i.e. this is the quaternion that is found in
	the header of the SMEI frame.
	The assumption is made that the spacecraft is in its
	nominal attitude with the HAFB z-axis pointing to the nadir
	and the HAFB x-axis along the velocity vector.
 >	For id=1 and 2 the resulting quaternion connects the
	UCSD camera frame with the ECI coordinate frame
 MODIFICATION HISTORY:
	JUL-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2Split $SMEI/ucsd/gen/for/lib/time/time2split.f
[Previous] [Next]
 NAME:
	Time2Split
 PURPOSE:
	Convert string time arrays to integer
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time2Split(ctemplate_,ct,t)
 INPUTS:
	ctemplate	character*(*)	character template describing
					time format
	ct		character*(*)	string time
 OUTPUTS
	t(2)		integer		# 2-element standard time
 CALLED BY:
	BList_NSO_NOAA, BList_WSO_NOAA, StopWatchSub, Time1Split, Time2Time
	smei_Time2Split, smei_orbit_info2
 INCLUDE:
	include		'fortime.h'
 CALLS: ***
	Say, Time2Add, Time2HMS, Time2Month, Time2Template, Time2YDoy, Time2YMD, itrim
 PROCEDURE:
	The template can contain any combination of the following strings
	'YEAR', 'YYYY', 'YY', 'DOY','MON','MN','DD','hh','mm','ss'
	The corresponding substrings are extracted from ct and are
	interpreted as follows to construct the time:
	'YEAR','YYYY'		year
	'YY'			2-digit year (<= 50: 1900 is added)
					     (>  50: 2000 is added)
	'DOY'			day of year
	'MON'			month as 3-char string
	'MN'			month as two-digit number
	'DD'			day of month
	'hh','mm','ss'		hours, minutes and seconds of day
	'f','ff','fff', etc.	fraction of second
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS)
	NOV-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Bug fix. units_in_second needed to be divided by another 60.


Time2Standardize $SMEI/ucsd/gen/for/lib/time/time2standardize.f
[Previous] [Next]
 NAME:
	Time2Standardize
 PURPOSE:
	Makes sure that a time array is in standard format
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time2Standardize(t2,u2)
 INPUTS:
	t2(2)		integer		time array
 OUTPUTS:
	u2(2)		integer		standardized time array
 CALLED BY:
	Time1to2, Time2Add, Time2Delta, Time2Differ, Time2GetOrigin, Time2GetOrigin2000
	Time2GetOriginJD, Time2GetOriginMJD, Time2HMS, Time2Interpolate, Time2PutOrigin
	Time2SetOrigin2000, Time2SetOriginIn2000, Time2SetOriginJD, Time2SetOriginMJD
	Time2YDoy
 INCLUDE:
	include		'fortime.h'
 PROCEDURE:
 >	t2(1) is the number of days since the time origin
	t2(2) is the number of fractionak-day units.
 >	'Standardization' just means making sure that u2(2)
	is positive and less than one day (e.g. 86400000 if units
	used are millisecond)
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2StandardOrigin $SMEI/ucsd/gen/for/lib/time/time2standardorigin.f
[Previous] [Next]
 NAME:
	Time2StandardOrigin
 PURPOSE:
	Convert from 2-element standard time relative to current origin to time
	relative to one of the standard origins and v.v.
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time2StandardOrigin(t0,id,t,u)
 INPUTS:
	t0(3)		integer		standard origin
	id		integer		0  converts to time relative to standard origin
					1  converts from time relative to standard origin
	t(2)		integer		id=0: time relative to current origin
					id=1: time relative to new (standard) origin
 OUTPUTS:
	u(2)		integer		id=0: time relative to new (standard) origin
					id=1: time relative to current origin
 CALLS: ***
	Time2ConvertUnits, Time2Delta, Time2GetOrigin, Time2Units
 CALLED BY:
	Time1StandardOrigin, Time2JD, Time2MJD, Time2TwoThousand
 PROCEDURE:
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2Str $SMEI/ucsd/gen/for/lib/time/time2str.f
[Previous] [Next]
 NAME:
	Time2Str
 PURPOSE:
	Convert integer time arrays to string YYYY/MM/DD hh:mm:ss.mss
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	integer function Time2Str(ctemplate,t,ct)
 INPUTS:
	ctemplate	character*(*)	time format string
	t (2)		integer		time
 OUTPUTS
	Time2Str	integer		length of ctemplate
	ct		character*(*)	time string (with effective length
					of Time2Str
 CALLED BY:
	NicHdr, Peep, StopWatchSub, T3D_fill_global, T3D_fill_time, T3D_get, T3D_get_all
	T3D_get_grid, T3D_get_mode, T3D_header, T3D_iget, T3D_iset, T3D_set, T3D_set_mode
	Time1Str, Time2CarringtonT0, Time2Line, Time2Time, cTime2Str, cTime2System
	smei_base, smei_cal, smei_cal_bin, smei_cal_write, smei_frm_c3fudge, smei_frm_fts
	smei_frm_getlist, smei_frm_path, smei_frm_read, smei_frm_read_get_sdark
	smei_orb, smei_orb_mkname, smei_orb_write, smei_skyd, smei_skyd_fts
	smei_skyd_init, smei_skyd_make, smei_skyd_sky
 INCLUDE:
	include		'fortime.h'
 CALLS: ***
	Time2DOW, Time2Day8, Time2HMS, Time2JD, Time2JEpoch, Time2MonthStr, Time2Template
	Time2YDoy, Time2YMD, d2c, itrim
 PROCEDURE:
	The template can contain any combination of the following strings
	'YEAR', 'YYYY', 'YY', 'DOY','MON','MN','DD','hh','mm','ss'
	The corresponding substrings in ct are filled as follows:
	'YEAR','YYYY'		year
	'YY'			2-digit year (<= 50: 1900 is added)
					     (>  50: 2000 is added)
	'DOY'			day of year
	'MON'			month as 3-char string
	'MN'			month as two-digit number
	'DD'			day of month
	'hh','mm','ss'		hours, minutes and seconds of day
	'f','ff','fff', etc.	fraction of second
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS)
	JUL-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Replaced all write statements by calls to d2c to avoid I/O
	    recursion in g77.


Time2SunL0B0 $SMEI/ucsd/gen/for/lib/time/time2sunl0b0.f
[Previous] [Next]
 NAME:
	Time2SunL0B0
 PURPOSE:
	Calculate heliographic coordinates of center of the solar disk
 CALLING SEQUENCE:
	subroutine Time2SunL0B0(tt,L0,B0)
 INPUTS: (angles in degrees)
	tt(2)	integer			time
	L0	double precision	ecliptic longitude offset of observer
					(see procedure)
	B0	double precision	ecliptic latitude of observer
 OUTPUTS: (angles in degrees)
	L0	double precision	heliographic longitude and ..
	B0	double precision	.. latitude of observer
 CALLS: ***
	Time2EclipticHeliographic, Time2SunNewcomb
 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)


Time2SunNewcomb $SMEI/ucsd/gen/for/lib/time/time2sunnewcomb.f
[Previous] [Next]
 NAME:
	Time2SunNewcomb
 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 Time2SunNewcomb(id,tt,lng,lat,dis)
 CALLS: ***
	Time2JEpoch, dcosd, dsind
 INPUTS:
	id	integer		0 = return two-body solution
				1 = take planetary perturbations into account
	tt(2)	integer		time
 OUTPUTS:
	lng	double precision	ecliptic longitude in degrees [0,360)
	lat	double precsion		ecliptic latitude  in arcsec
	dis	double precision	Sun-Earth distance in AU
 CALLED BY:
	HLngEarth, HLngEastLimb, HLngWestLimb, Time2SunL0B0, Time2SunRadius
 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)
	10/24/91, Tom Davidson : accuracy test
	AUG-1993, Paul Hick, extension of SunEclLong
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
		Introduced 2-element integer standard times. Added prefix Time2 to name.


Time2SunRA $SMEI/ucsd/gen/for/lib/time/time2sunra.f
[Previous] [Next]
 NAME:
	Time2SunRA
 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 Time2SunRA(tt,GST,SLONG,SRASN,SDEC)
 INPUTS:
	tt(2)	integer			UT time
 OUTPUTS:
	GST	double precision	Greenwich sidereal time (degrees)
	SLONG	double precision	Ecliptic longitude Sun (degrees)
	SRASN	double precision	Apparent right ascension Sun (degrees)
	SDEC	double precision	Apparent declination (degrees)
 INCLUDE:
	include		'math.h'
 CALLS: ***
	Time2Day8, Time2YDoy
 RESTRICTIONS:
	Only valid for years 1901 through 2099
 MODIFICATION HISTORY:
	From: Geophysical Coordinate Transformations, C.T. Russell, in:
		Cosmic Electrodynamics 2 (1971) 184-196


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


Time2System $SMEI/ucsd/gen/for/os/fnc/time2system.f
[Previous] [Next]
 NAME:
	Time2System
 PURPOSE:
	Retrieve system time using intrinsic IDATE and ITIME functions
 CATEGORY:
	gen/for/os
 CALLING SEQUENCE:
	subroutine Time2System(tt)
	!use ifport			! Needed for Intel 9.1 compiler
 INPUTS:                               ! (not for 10.0 compiler anymore)
	(none)
 OUTPUTS:
	tt(2)		integer		system time
 CALLS: ***
	IDATE, ITIME, Time2HMS, Time2YMD, get_compiler [1], get_compiler [2]
 CALLED BY:
	StopWatchSub, Time1System, Time2Line, Time2Local2UT, TimeLapsed, TimeOut
	cTime2System, smei_orb_write, smei_skyd_fts, smei_skyd_init, smei_skyd_make
	smei_skyd_sky
 PROCEDURE:
	Calls system functions IDATE and ITIME
	This is available on all Fortran compilers we used so far
	(with various quirks), except for gfortran 4.0.0 and earlier.
	For gfortran the C file gnu_intrinsic contains C-versions
	for IDATE and ITIME. Linking this file should fix that.
 MODIFICATION HISTORY:
	JUL-2005, Paul Hick (UCSD/CASS)
	DEC-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    The Intel 9.1 compiler needs the statement
		use ifport
	    following the subroutine declaration above.


Time2Template $SMEI/ucsd/gen/for/lib/time/time2template.f
[Previous] [Next]
 NAME:
	Time2Template
 PURPOS:
 CALLING SEQUENCE:
	subroutine Time2Template(ctemplate,ct)
 PURPOSE:
 CALLS: ***
	itrim
 CALLED BY:
	Time2Split, Time2Str
 MODIFICATION HISTORY:
	JUL-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2Time $SMEI/user/pphick/for/main/time2time.f
[Previous] [Next]
 NAME:
	Time2Time
 PURPOSE:
	Converts time from JST to UT
 CATEGORY:
	user/phick/for/main
 CALLING SEQUENCE:
	program Time2Time
	echo  Wed, 26 Nov 2003 00:01:39 +0900 (JST) | time2time -email
 INPUTS:
	The line piped into Time2Time is a time in the form
	Wed, 26 Nov 2003 00:01:39 +0900
 OUTPUTS:
	Time string in form 2003/11/26 15:01:39
	i.e. the input time converted to UT.
 INCLUDE:
	include		'fortime.h'
 CALLS: ***
	ForeignArg, LocFirst, Time2Add, Time2Day8, Time2HMS, Time2SetOriginInJD, Time2Split
	Time2Str, itrim
 PROCEDURE:
 MODIFICATION HISTORY:
	NOV-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2to1 $SMEI/ucsd/gen/for/lib/time/time2to1.f
[Previous] [Next]
 NAME:
	Time2to1
 PURPOSE:
	Convert 2-element time to 1-element time
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time2to1(t2,t1)
 INPUTS:
	t2(2)		integer		2-element time
 OUTPUTS
	t1		integer		1-element time
 CALLS: ***
	Time2Units
 CALLED BY:
	Time1Day, Time1Day8, Time1HMS, Time1Round, Time1Split, Time1StandardOrigin
	Time1System, Time1YDoy, Time1YMD, Time2Carrington, Time2CarringtonT0, TimeLapsed
 PROCEDURE:
 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2TropicalYear $SMEI/ucsd/gen/for/lib/time/time2tropicalyear.f
[Previous] [Next]
 NAME:
	Time2TropicalYear
 PURPOSE:
	Calculated mean length of tropical year (time between vernal
	equinoxes).
 CALLING SEQUENCE:
	subroutine Time2TropicalYear(tt,dt)
 INPUTS:
	tt(2)		integer		time
 OUTPUTS:
	dt(2)		integer		length of tropical year
 PROCEDURE:
	Laskar 1986
 MODIFICATION HISTORY:
	OCT-2005, Paul Hick (UCSD/CASS)


Time2TwoThousand $SMEI/ucsd/gen/for/lib/time/time2twothousand.f
[Previous] [Next]
 NAME:
	Time2TwoThousand
 PURPOSE:
	Convert from 2-element standard time relative to current origin to
	times relative to 2000 Jan 1, 0 UT and v.v.
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time2TwoThousand(id,t,u)
 INPUTS:
	id		integer		0  converts to times relative to 2000 Jan 1, 0 UT
					1  converts from times relative to 2000 Jan 1, 0 UT
	t(2)		integer		id=0: time relative to current origin
					id=1: time relative to 2000 Jan 1, 0 UT
 OUTPUTS:
	u(2)		integer		id=0: time relative to 2000 Jan 1, 0 UT
					id=1: time relative to current origin
 CALLS: ***
	Time2GetOrigin2000, Time2GetOriginJD, Time2GetOriginMJD, Time2StandardOrigin
 CALLED BY:
	Time2DOW, Time2JEpoch, Time2YDoy
 PROCEDURE:
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2Units $SMEI/ucsd/gen/for/lib/time/time2units.f
[Previous] [Next]
 NAME:
	Time2Units
 PURPOSE:
	Get current setting of fract-day units
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	integer function Time2Units()
 INPUTS:
	None
 OUTPUTS:
	Time2Units	integer		# units in day used to store fractional days
 CALLED BY:
	Time2Day, Time2Day8, Time2HMS, Time2Interpolate, Time2Round, Time2StandardOrigin
	Time2to1, TimeOut
 INCLUDE:
	include		'fortime.h'
 SIDE EFFECTS:
 PROCEDURE:
	By default fractional days are stored in millisecond (in which case
	86400000 is returned; see Time2SetOrigin2000)
 MODIFICATION HISTORY:
	JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


Time2YDoy $SMEI/ucsd/gen/for/lib/time/time2ydoy.f
[Previous] [Next]
 NAME:
	Time2YDoy
 PURPOSE:
	Convert time to year and day of year and v.v.
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time2YDoy(id,t,yr,doy)
 INPUTS:
	id		integer		=0  time to year/doy
					=1  year/doy to time
	t(2)		integer		id=0: times relative to current time origin
	yr		integer		id=1: year
	doy(2)		integer		id=1: day of year (doy(2) is # fract-day units)
 OUTPUTS:
	yr		integer		id=0: year
	doy(2)		integer		id=0: day of year (doy(2) is # fract-day units)
	t(2)		integer		id=1: times relative to current time origin
 CALLS: ***
	Time2Standardize, Time2TwoThousand
 CALLED BY:
	Local2UT, NicHdr, Time1YDoy, Time2DHMS, Time2EclipticHeliographic, Time2GST
	Time2Line, Time2PAnglePole, Time2Round, Time2Split, Time2Str, Time2SunRA, Time2YMD
	Time2jpl_eph, Time2smei_eph, smei_frm_path, smei_hdr_time
 PROCEDURE:
	Dates before 5 october 1582 are interpreted as Julian dates;
	after 15 october as Gregorian dates.
	5 october 1582 (Julian) = 15 october 1582 (Gregorian).

	RJD	'relative' Julian day = (Julian day - 2451544.5)      
	J2000.0 = 2000 January 1.5d TDB = JD 2451545.0
	JD 2451544.5 = 2000 January 1.0d (i.e. 1 January, midnight)
	Check:	JD 2398220.0 =  1854 Jan.  1.5d
		JD 2299161.0 =  1582 Oct. 15.5d (Gregorian calender)
			     =  1582 Oct.  5.5d (Julian calender)
				(Doy = 278.5)
		JD       0.0 = -4712 Jan.  1.5d

	JEpoch 1900 = JD 2415020.0 = Jan 0.5 1900
	JEpoch 2000 = JD 2451545.0 = Jan 1.5 2000

	BEpoch = 1900+(JD -2415020.31352)/365.242198781
	       = 1900+(RJD+  36524.18648)/365.242198781
	Check:  BEpoch 1950.0 = JD 2433282.423 = Jan 0.923 1950
		BEpoch 1982.0 = JD 2444970.174 = Jan 0.674 1982

 MODIFICATION HISTORY:
	OCT-2003, Paul Hick (MPAE,UCSD/CASS; pphick@ucsd.edu)


Time2YMD $SMEI/ucsd/gen/for/lib/time/time2ymd.f
[Previous] [Next]
 NAME:
	Time2YMD
 PURPOSE:
	Converts (Yr,Month,Day) to (Yr,Doy) and v.v.
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	subroutine Time2YMD(id,t,yr,mon,day)
 INPUTS:
	id		integer		=0  time to date (yr,month,day)
					=1  date (yr,month,day) to time
	t(2)		integer		id=0: times relative to current time origin
	yr		integer		id=1: year; the year xxxBC should be entered as -xxx+1.
	mon		integer		id=1: month (1,..,12)
	day(2)		integer		id=1: day of month (day(2) is # fract-day units
 OUTPUTS:
	yr		integer		id=0: year; the year xxxBC should be entered as -xxx+1.
	mon		integer		id=0: month (1,..,12)
	day(2)		integer		day of month (day(2) is fraction of day
					in units set by Time2SetOrigin2000.

	id = 1:

	t(2)		integer		times relative to current time origin
 CALLS: ***
	Time2YDoy
 CALLED BY:
	Time1YMD, Time2Split, Time2Str, Time2System, smei_frm_c3fudge, smei_frm_ped_guess
	smei_frm_ratio
 RESTRICTIONS:
 >>>	For ID=0 (date --> doy) the input for the month may be given in the form
	of a char-string cMon or as an integer iMon. cMon takes precedence
	over iMon: first cMon is checked for valid input; if cMon is not valid
	iMon is used (if iMon is invalid too, the program is aborted).
 >>>	ADVICE: ALWAYS use cMon for input.
	Upon output the values of cMon and iMon are always consistent.
	The returned value for cMon is always in uppercase.
 PROCEDURE:
	Dates before 5 october 1582 are interpreted as Julian dates; after 15
	october as Gregorian dates.
 >>>	5 october 1582 (Julian) = 15 october 1582 (Gregorian).
 MODIFICATION HISTORY:
	1989-1990, Paul Hick (MPAE,UCSD/CASS; pphick@ucsd.edu)


timecoordinates $SMEI/for/h/timecoordinates.h
[Previous] [Next]
 NAME:
	timecoordinates
 INCLUDED BY:
	mapcoordinates
 RESTRICTIONS:
	Contains executable statements
 PROCEDURE:
	This include file contains the time coordinates to use to 
	convert Carrington variable to time from beginning of observations


TimeLapsed $SMEI/ucsd/gen/for/lib/time/timelapsed.f
[Previous] [Next]
 NAME:
	TimeLapsed
 PURPOSE:
	Determine time elapsed since specified time
 CALLING SEQUENCE:
	integer function TimeLapsed(u)
 INPUTS:
	u(2)	integer		standard time
 OUTPUTS:
	nt	integer		time elapsed since u
				in current units used for the time of
				day (usually msec; see Time2Units)
 CALLS: ***
	Time2Delta, Time2System, Time2to1
 CALLED BY:
	TimeOut
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	JUL-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


TimeOut $SMEI/ucsd/gen/for/os/fnc/timeout.f
[Previous] [Next]
 NAME:
	TimeOut
 PURPOSE:
	Pause program execution for specified number of seconds
 CALLING SEQUENCE:
	subroutine TimeOut(ns,nd)
 INPUTS:
	ns	integer		time-out period (seconds)
	nd	integer		time (in seconds) interval that
				a check is made whether time ns has
				elapsed (i.e. process sleeps for
				nd seconds at a time).
				If nd<0 the process sleeps for ns sec.
 OUTPUTS:
	Display on screen if nd > 0 only
 CALLS: ***
	SLEEP, Time2System, Time2Units, TimeLapsed
 CALLED BY:
	HOSPlot_bCommand, LogModFile
 RESTRICTIONS:
 >	Uses 1H+ to write to screen. Probably does not work on
	every terminal.
 >	Currently uses function 'sleep' to go to sleep for nd
	seconds at at time. On VMS this will not work (should use
	lib$wait instead).
 MODIFICATION HISTORY:
	JUL-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


timer $SMEI/for/main/timer.f
[Previous] [Next]
 NAME:
	timer
 PURPOSE:
	Display elapsed time since given start time
 CALLING SEQUENCE:
	program timer
 INPUTS:
	start_time_string and stop time_string are times in absolute time format
	as returned by the lexical function f$time(). The start time must be
	specified. The stop time is optional (default is the current system time)
 OUTPUTS:
	Displayed on screen
 CALLS: ***
	ForeignInput, Say, StopWatch
 RESTRICTIONS:
	Stop time must be later than start time
 PROCEDURE:
	On VMS create symbol TIMER = "$ $EXE:TIMER". Then use:
	timer start_time_string [stop_time_string]
	See StopWatch
 MODIFICATION HISTORY:
	Lindau, JAN-1993, Paul Hick (UCSD)


TimeSmooth $SMEI/for/tdlib/timesmooth.f
[Previous] [Next]
 NAME:
	TimeSmooth
 PURPOSE:
	Smoothes a three-dimensional array in time by filtering with a 
	Gaussian filter.  The third dimension in the array is assumed to be 
	evenly-spaced.
 CALLING SEQUENCE:
	subroutine Timesmooth(nLng,nLat,nT,Z,iFillBadZ,Widtime,Wclip,Ztmp)
 INPUTS:
	nLng		integer		# longitudes
	nLat		integer		# latitudes
	nT		integer		# times
	Z(nLng,nLat,nT)	real		3D array of function values
	iFillBadZ	integer	     0: Invalid elements remain invalid;
					valid elements are replaced by a
					smoothed value
				     1: All elements (valid and invalid) are
					replaced by smoothed values.
				     2: Invalid elements are replaced by
					smoothed values; valid elements remain
					untouched.
	Widtime		real		Width of Gaussian used for time
					smoothing (in units of nT)
	Wclip		real		amplitude of Gaussian clipping 
					relative to midpoint
	Ztmp(nLng,nLat,nT) real		3D temporary array of function values  
 OUTPUTS:
	Z(nLng,nLat,nR)	real		smoothed array of function values
 CALLS: ***
	BadR4
 CALLED BY:
	MkDMaptdn, MkShiftdn, MkVMaptdN, ipsdt
 PROCEDURE:
 MODIFICATION HISTORY:
	Sept-1999, B. Jackson (UCSD)


TinyR4 $SMEI/ucsd/gen/for/lib/bytes/tinyr4.f
[Previous] [Next]
 NAME:
	TinyR4
 PURPOSE:
	Provides a generic very small number
 CATEGORY:
	gen/for/lib
 CALLING SEQUENCE:
	function TinyR4()
 INPUTS:
	(none)
 OUTPUTS:
	X	real	very small number
 CALLS:
	(none)
 CALLED BY:
	Pandora
 SEE ALSO:
	BadI4, BadR4, BadR8, pInfR4
 INCLUDE:
	include		'math.h'
 PROCEDURE:
	The TinyR4 number is pulled out of the include file.
 MODIFICATION HISTORY:
	SEP-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)