[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)
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
[Previous]
[Next]
NAME:
tand
CALLING SEQUENCE:
entry tand(a)
INPUTS:
a real angle in degrees
CALLED BY:
PA_POLE, PRECESSION_APPROX, Time2PrecesssionLtd
SEE ALSO:
cosd
MODIFICATION HISTORY:
JAN-2001, Paul Hick (UCSD; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
thomson
PURPOSE:
Defines several constants used by the Thomson scattering package
INCLUDED BY:
ThomsonFarY, ThomsonLOS3DStep, ThomsonLOSStep, ThomsonMidpointFar
[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)
[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:
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)
[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)
[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)
[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)
[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)
[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)
[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)
[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)
[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)
[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)
[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)
[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)
[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)
[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)
[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
PROCEDURE:
See ThomsonLOSS10
MODIFICATION HISTORY:
1996, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[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)
[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)
[Previous]
[Next]
NAME:
ThomsonMid
CALLING SEQUENCE:
function ThomsonMid(S) ! Internal use only
CALLS: ***
ThomsonLOS
CALLED BY:
ThomsonMidpoint
EXTERNAL BY:
ThomsonMidpoint
INCLUDE:
include 'math.h'
[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
[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)
[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
[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)
[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
[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)
[Previous]
[Next]
NAME:
ThomsonSetupIntegrand
PURPOSE:
(internal use only)
CALLING SEQUENCE:
entry ThomsonSetupIntegrand(ScSunIn,EloIn,UIn)
CALLS: ***
ElSunDistance, ThomsonBase, ThomsonLOSDensity
CALLED BY:
ThomsonLOS, ThomsonLOS3D
[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)
[Previous]
[Next]
NAME:
ThomsonSetupMid
CALLING SEQUENCE:
entry ThomsonSetupMid(ScSunIn,EloIn,UIn)
CALLS: ***
ThomsonLOS
CALLED BY:
ThomsonMidpoint
PROCEDURE:
Entry point in ThomsonMid
[Previous]
[Next]
NAME:
ThomsonSetupMidFar
CALLING SEQUENCE:
entry ThomsonSetupMidFar(EloIn) ! Internal use only
CALLED BY:
ThomsonMidpointFar
PROCEDURE:
Entry point in ThomsonSetupMidFar
[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)
[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
[Previous]
[Next]
NAME:
ThomsonTang3D
PURPOSE:
(internal use only)
CALLING SEQUENCE:
entry ThomsonTang3D(S)
CALLS: ***
ElSunDistance, ThomsonBase, ThomsonLOSDensity
CALLED BY:
ThomsonLOS3D
EXTERNAL BY:
ThomsonLOS3D
[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
[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
[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)
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)
[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)
[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)
[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)
[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)
[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)
[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)
[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)
[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)
[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)
[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)
[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)
[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)
[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)
[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)
[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)
[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)
[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)
[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)
[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)
[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)
[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, 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)
[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:
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.
[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)
[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)
[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)
[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)
[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)
[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, 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)
[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)
[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)
[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)
[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)
[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)
[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)
[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:
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)
[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)
[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)
[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)
[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
[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, 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)
[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)
[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)
[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)
[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:
[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
[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)
[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)
[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)
[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)
[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)
[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
[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)
[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)
[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:
[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
PROCEDURE:
Used to restore saved settings by Time2GetOrigin
MODIFICATION HISTORY:
JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[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:
Time1Round
MODIFICATION HISTORY:
JAN-2004, Paul Hick (pphick@ucsd.edu)
[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
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)
[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)
[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
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)
[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)
[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)
[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)
[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)
[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 [1].h'
include 'dirspec [2].h'
include 'dirspec [3].h'
include 'dirspec [4].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)
[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)
[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:
StopWatchSub, Time1Split, 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.
[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)
[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)
[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, Time1Str, Time2CarringtonT0, Time2Line, 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.
[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)
[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.
[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
[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)
[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.
[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)
[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)
[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)
[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)
[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)
[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)
[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)
[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)
[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:
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)
[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)
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)