[Previous]
[Next]
NAME:
t3d_oblique
PURPOSE:
Implements 3D transformation matrix for oblique projections
CATEGORY:
gen/idl/math
CALLING SEQUENCE:
t3d_oblique, Array, /reset, oblique=oblique
INPUTS:
Array array[4,4]; type: any
Matrix used as the starting transformation.
If omitted !P.T is used; not used if /reset is set.
OPTIONAL INPUTS:
/reset if set start out with the identity matrix
matrix=matrix
if set to a named variable, the result is returned in this
parameter and !P.T is not modified.
oblique=oblique
A two-element vector of oblique projection parameters.
Points are projected onto the XY plane at Z=0 as follows:
x' = x + z(d COS(a)), and y' = y + z(d SIN(a)).
where oblique[0] = d, and oblique[1] = a.
OUTPUTS:
!P.T unless the keyword MATRIX is supplied, in which case the result
is returned in MATRIX and !P.T is not affected.
CALLED BY:
setup3d
SIDE EFFECTS:
!P.T is changed if the keyword MATRIX is not set.
PROCEDURE:
Modidifies the oblique projection in IDL t3d.pro by settinr
r[2,2] = 1.0 instead of 0.0
This preserves the z-component in an oblique projection.
MODIFICATION HISTORY:
JUN-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
TagArray
PURPOSE:
(First check whether the IDL functions strjoin and/or
STRSPLIT can do what you need)
Combine string arrays into single string separated by
separator character, or v.v.
CATEGORY:
Toolbox: generic
CALLING SEQUENCE:
FUNCTION TagArray, tag_in, sep, nonull=nonull, split=split
INPUTS:
tag scalar, array; type: string
if scalar, or /split keyword set:
the string is decomposed into elements separated by the
'sep' character(s). The result is returned as a string array
with one dimension more than the input array: the leading
dimension is the number of tags found (see RESTRICTIONS).
if array: the elements in the array are
concatenated, separated by the 'sep' character
OPTIONAL INPUT PARAMETERS:
sep scalar, or array; type: 1-char string: default is a scalar and depends on OS
if /split is used then 'sep' can be an array of 1-char separator strings
/nonull if extracting tags, discard null-string tags
/split if 'tag' is an array that needs to be decomposed then
split needs to be set (by default, arrays are
concatenated; a scalar is always decomposed, even
if /split is not set).
OUTPUTS:
R either a string array of tags, or a scalar string
of concatenated tags.
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar, IsType
CALLED BY:
TimeSplit
RESTRICTIONS:
If keyword /split is set than the first elements in the 'tag' array is analyzed
for the presence of separators. The result is applied to all strings. So all
strings in 'tag' must have the same structure: same length and separators in the
same positions.
SIDE EFFECTS:
Note that an array[1] is treated differently from a scalar.
An array[1] is returned unmodified as a scalar
it is NOT decomposed if it contains 'sep' characters.
EXAMPLE:
t = tagarray('1998:337:23:53.000',[':','.']
results in:
t =['1998','337','23','53','000']
PROCEDURE:
The default separator is a comma on 'Win32', a colon on 'linux'
On other OS it is a colon (as on linux).
MODIFICATION HISTORY:
NOV-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
thomson_common
PURPOSE:
Contains common block definition used by
Thomson scattering functions
CATEGORY:
Physics: Thomson scattering
CALLING SEQUENCE:
@thomson_common.pro
INCLUDED BY:
ThomsonLOSDensity, ThomsonSetupLOS
PROCEDURE:
MODIFICATION HISTORY:
JULY-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
Thomson_doc
PURPOSE:
Documentation only. Collects all links to the Thomson scattering
package and a link to a pdf with additional information.
CATEGORY:
Documentation
SEE ALSO:
ThomsonBase, ThomsonBrightness, ThomsonElectron, ThomsonElectronFar
ThomsonLOSDensity, ThomsonLOSFar, ThomsonLOSRomb, ThomsonLOSStep
ThomsonMidpoint, ThomsonMidpointFar, ThomsonMidpointFnc, ThomsonPDistance
ThomsonPDistanceFar, ThomsonRadialFilter, ThomsonS10, ThomsonSetupLOS
ThomsonSetupRomb, ThomsonSolarFlux, ThomsonSoup, ThomsonTang, ThomsonTangMRad
thomson_common
PROCEDURE:
See http://supercat.ucsd.edu/reports/thomson.pdf
MODIFICATION HISTORY:
JUL-2002, 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, It, Itr
INPUTS:
ElSun array distance Sun-observer (in solar radii)
SinChi array sine of angle Sun-Electron-Observer
U array limb darkening coefficient
OUTPUTS:
Result array scattered intensity
P array polarization; P=Itr/ThomsonBase (-1<=P<=1)
Itr array tangential minus radial intensity; same units as ThomsonBase.
It array radial intensity; same units as ThomsonBase
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
ThomsonSoup
CALLED BY:
ThomsonElectron, ThomsonLOSStep, ThomsonTang, ThomsonTangMRad
PROCEDURE:
> Based on Chapter 6, Section 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: It = (1-u)*CC+u*DD
From Eq. 19: Itr = sin^2(Chi)*[(1-u)AA+u*DD]
> The last two arguments (It, Itr) are returned for use by function ThomsonIntegral.
MODIFICATION HISTORY:
JUL-1996, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
ThomsonBrightness
PURPOSE:
Calculates weights for integrating Thomson scattering signal
CATEGORY:
Physics: Thomson scattering
CALLING SEQUENCE:
FUNCTION ThomsonBrightness, rr_earth, R, F, f3darg, $
ut_earth = ut_earth , $
pa_earth = pa_earth , $
elo_earth = elo_earth , $
elo_sun = elo_sun , $
degrees = degrees
INPUTS:
rr_earth array[3] NOT USED; for 'plain' sky map
array[3,N] NOT USED; for 'transit' sky map
NOT USED; heliographic coordinates of Earth for lines of sight
R array[3,N,L,M] (N,L may be 1 or absent)
locations of all segments for all lines of sight
in spherical coordinates (usually heliographic)
This can be a grid of NxL lines of sight with M
segments along each line of sight
R[0,*,*,*] : longitude
R[1,*,*,*] : latitude
R[2,*,*,*] : heliocentric distance (AU)
F array[N,L,M] normalized densities n*(r/r0)^2 at los segments (electrons/cm^-3)
f3darg array[4] f3darg[0] Line of sight step size (AU)
f3darg[1] Limb darkening constant
f3darg[2] Apparent magnitude Sun at 1 AU
f3darg[3] 0=Intensity; 1: Tangential; 2: Tang-Rad
OPTIONAL INPUT PARAMETERS:
/degrees if set all input angles should be in degrees (default: radians)
ut_earth array[1] not used
pa_earth array[N,L,M] not used
elo_earth array[N,L,M] angle Sun-Earth-LOS segment (i.e. conventional elongation angle)
elo_sun array[N,L,M] angle Earth-Sun-LOS segment
OUTPUTS:
R array[N,L,M] weight factors W(s) at location s along line of sight in S10
Intensity B = Sum( W(s) ) = Sum( I(s)n(s)ds )
INCLUDE:
@compile_opt.pro ; On error, return to caller
EXTERNAL BY:
RemoteView_Display2D, vu_earthskymap, vu_lineofsight
CALLS: ***
SubArray, ThomsonElectron, ToRadians
PROCEDURE:
ThomsonElectron returns 10^-26 S10. Multiply by the step size along the line
of sight in cm (f3darg[0]*!sun.au*10^13) and multiply with the remaining
10^-13. The value returned is a brightness in S10 for each line of sight segment.
MODIFICATION HISTORY:
SEP-1999, Paul Hick (UCSD/CASS)
SEP-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Removed restriction on dimensions of R,F,elo_earth,elo_sun.
F, elo_earth, elo_sun should all have the same structure, while
R should have an additional leading dimension of size 3.
[Previous]
[Next]
NAME:
ThomsonElectron
PURPOSE:
Determines the Thomson scattering intensity from single coronal electron.
If /S10 is set then return brightness of one electron per square degree
of sky in S10 units
CALLING SEQUENCE:
FUNCTION ThomsonElectron, SinChi, P, rsun=RSun, au=au, udark=udark, apm=APM, s10=S10, tangonly=tangonly, tangmrad=tangmrad
INPUTS:
SinChi array; type: float
sine of angle Sun-Electron-Observer
OPTIONAL INPUT PARAMETERS:
rsun=RSun array; type: float; default: 1 AU
distance Sun-Electron
udark=idark array; type: float; default: 0
limb darkening coefficient
/au if set all distances are in AU (default: solar radii)
/s10 if set then return brightness is in S10
apm=APM apparent magnitude of Sun (only needed if /S10 is set)
/tangonly return tangential intensity, It
/tangmrad return tangential - radial intensity, Itr
OUTPUTS:
Result array; type: float
scattered intensity; units depend on setting of /S10
/S10 NOT set: 10^-26 times the flux from the solar disk incident
on the electron (effectively the units are 10^-26 cm^2/sterad)
/S10 set; 10^-26 S10 units
P array: type: float
polarization (-1<=P<=1)
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar, IsType, ThomsonBase, ThomsonS10, ThomsonSolarFlux, ToSolarRadii
CALLED BY:
ThomsonBrightness
PROCEDURE:
Based on Chapter 6, Section 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
Rs = 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*Rs^2)*I0*(1-U/3) (erg/s/sterad)
The flux incident on the electron at distance Rsun is
F=i/RSun^2=Pi*I0*(1-U/3)*(Rs/RSun)^2 (erg/s/cm^2)
If /S10 NOT set then the ratio
I/F = 0.5*Sigma*Func(Omega,Chi)/( (Rs/RSun)^2*(1-U/3) )
is returned here, except for a factor 10^-26 (from Sigma).
> The flux received from the solar disk by an observer at distance RObs
(rather than the electron) is i/RObs^2 = F*(RSun/RObs)^2 (erg/s/cm^2).
The scattered flux from the electron incident on the observer is
I/S^2 (erg/s/cm^2). The ratio (I/F)*(RObs/(RSun*S))^2 gives
the flux received from the electron in units of the flux received by
the observer from the solar disk.
> The conversion to S10 is done by multiplying with the conversion
factor returned by ThomsonS10
MODIFICATION HISTORY:
JUL-1996, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
ThomsonElectronFar
PURPOSE:
Determines the intensity scattered from single coronal electron
by Thomson scattering in the limit of large electron-Sun distance
(limit Omega->0; ElSun->Infinity)
Get Thomson scattering brightness of one electron per square degree
of sky in S10 units in limit of large electron-Sun distance
CALLING SEQUENCE:
FUNCTION ThomsonElectronFar, SinChi, P, rsun=RSun, au=au, apm=APM, s10=S10
INPUTS:
SinChi array; type: float
sine of angle Sun-Electron-Observer
OPTIONAL INPUT PARAMETERS:
APM array; type: float
apparent magnitude of the Sun
rsun=RSun array; type: float
distance Sun-Electron (in solar radii)
OUTPUTS:
Result array; type: float
scattered intensity; units depend on /S10 setting
S10 NOT set: 10^-26 times the flux from the solar disk incident on the electron
S10 set : 10^-26 S10
P array polarization (-1<=P<=1)
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar, ThomsonS10, ToSolarRadii
PROCEDURE:
> Based on Chapter 6, Section 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).
> The flux received from the solar disk by the observer (rather than the
electron) is i/ScSun^2 = F*(ElSun/ScSun)^2 (erg/s/cm^2).
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 by
the observer from the solar disk.
> 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- at 1 AU from the solar
disk (erg/s/cm^2) (compare ThomsonElectron; the only difference
is that ElSun is replaced by r0=1 AU in the unit determination)
> STEP 2: Convert to units of the flux -incident- at 1 AU from a 10th
magnitude star: multiply by 10^((10-M)/2.5). (Apparent
magnitude, M=-2.5*log(Flux)).
!!! M is an apparent magnitude as observed at 1 AU. This is why
1 AU was used in step 2, rather than the observer-Sun
distance ScSun.
> 10^-48 = 10^-26*10^-26*10^4:
10^-26 from Sigma; 10^-26 from 1/ScEl^2; 10^4 from 10^(10/2.5)
MODIFICATION HISTORY:
JUL-1996, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
ThomsonLOSDensity
PURPOSE:
CATEGORY:
sat/idl/toolbox/thomson
CALLING SEQUENCE:
FUNCTION ThomsonLOSDensity, S
INPUTS:
S array[k]; type: float
topocentric distance electron-observer (in solar radii)
OUTPUTS:
F array; type: float
density at electron location (in electrons/cm^-3)
INCLUDE:
@compile_opt.pro ; On error, return to caller
@thomson_common.pro ; Dummy comment
CALLS: ***
CvPointOnLos, EulerRotate, IsType, REVERSE, SuperArray, boost, destroyvar
CALLED BY:
ThomsonLOSStep, ThomsonTang, ThomsonTangMRad
PROCEDURE:
> The observer locations and directions of the lines of sight are
first setup in a common block by ThomsonSetupLOS.
> The distance along the lines of sight 'S', in combination with
the common block variables are used to get the heliocentric coordinates
of all line-of-sight locations.
> The function 'density' is a user-defined function, which returns the
density for a given heliocentric location.
The function is called using the IDL call_function routine.
> If no density function is specified than a 1/r^2 density with a
1 electrons/cm^3 density at 1 AU is used.
MODIFICATION HISTORY:
JAN-1998, Paul Hick (UCSD)
JUN-2001, Paul Hick (UCSD/CASS)
Added /grid keyword
JUL-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Removed /grid keyword again
Added some code to allow calculation to work for observers
out of the ecliptic (with i.e. with ecliptic latitude
not zero).
[Previous]
[Next]
NAME:
ThomsonLOSFar
PURPOSE:
Determines the integrated intensity along a line of sight for electron
Thomson scattering in a 1/r^2 density distribution in the limit of
small angular size of the Sun (with density at 1 AU of 1 electron/cm^-3)
CALLING SEQUENCE:
F = ThomsonLOSFar(RSun, Elo, P, lower=lower, upper=upper, /degrees, /au, apm=apm, /s10)
INPUTS:
RSun array[n]; type: float
distance of observer from Sun
Elo array[m]; type: float
elongation of line of sight (l.o.s.)
(Elo=0 is the direction to the Sun)
OPTIONAL INPUT PARAMETERS:
lower=lower
array; type: float; default: 0
lower lmit of integration along line of sight
upper=upper
array; type: float: default: !values.f_inifinity
upper limit of integration along line of sight
(negative value integrates up to infinity)
/degrees if set all angles are in degrees (default:radians)
/au if set all distance are in AU (default: solar radii)
/s10 return brightness in S10 units
apm=apm apparent magnitude of Sun at 1 AU
(needed only if /S10 is set)
OUTPUTS:
Result array[n,m]; type: float
Integrated Thomson scattering intensity;
units depend on setting of /S10:
/S10 NOT set: per sterad in units of 10^-16 times the flux received
from the solar disk (at the observer location
/S10 set: S10 units
P array[n,m]; type: float
polarization
CALLS: ***
InfiniteValue, InitVar, IsType, SyncArgs, ThomsonFarY, ThomsonS10, ToRadians
ToSolarRadii, boost, destroyvar
SEE ALSO:
ThomsonLOSRomb, ThomsonLOSStep
PROCEDURE:
> Calculates an analytical expression for the integral along the
entire line of sight 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.
> The electron density in the solar wind at 1 AU (cm^-3) is set to 1 cm^-3.
> Coronal density n(s) = n0*(r0/r(s))^2 (r0=a AU)
Intensity/electron I(s) = 0.5*Pi*Sigma*I0*Func(Omega,Chi)
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}
> The result is expressed in units of the flux received from the solar
disk by the observer:
F = (Pi*Rs^2)*I0*(1-U/3) / RSun^2 (erg/s/cm^2)
= Pi*I0*(1-U/3)* (Rs/RSun)^2
> 10^-13 = 10^-26*10^13
Factor 10^-26 is from the Thomson cross section, Sigma
Factor 10^13 is from the integration step size
MODIFICATION HISTORY:
1990, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
ThomsonLOSRomb
PURPOSE:
Calculates integrated line-of-sight intensity for
Thomson scattering using Romberg integration.
CATEGORY:
Physics: Thomson scattering
CALLING SEQUENCE:
FUNCTION ThomsonLOSRomb, pos, los, P, $
lower = lower , $
upper = upper , $
density = density , $
degrees = degrees , $
au = au , $
udark = udark , $
apm = apm , $
s10 = S10
INPUTS:
pos array[3,n]; type: float
heliocentric location of observer:
(ecliptic) longitude and latitude; and heliocentric distance
(a scalar 'pos' is interpreted as [0,0,pos])
los array[2,m]; type: float
topocentric (ecliptic) longitude and latitude of line of sight
relative to Sun-observer direction
(a scalar 'los' is interpreted as [los,0])
OPTIONAL INPUT PARAMETERS:
/s10 if set intensities are returned in S10 units
In this case the apparent magnitude APM MUST BE SPECIFIED
udark=udark scalar; type: float; default: 0
limb darkening constant
apm=apm scalar; type: float
apparent magnitude of Sun
density=density
scalar; type: string; default: undefined
name of function used to calculate the electron density.
Keyword is passed to ThomsonSetupLOS.
lower=lower
scalar; type: float; default: 0
Lower limit of los integration (solar radii)
If Lower <=0 then Lower = 0 is used.
upper=upper
scalar; type: float; default: 9000 solar radii
Upper limit of los integration (solar radii)
If Lower <=0 then Upper = 9000.0 solar radii (~40 AU) is used.
/degrees if set all angles are in degrees (default: radians)
/au if set all distances are in AU (default: solar radii)
OUTPUTS:
Result scalar[n,m]; type: float
Integrated Thomson scattering intensity;
units depend on setting of /S10:
/S10 NOT set: per sterad in units of 10^-16 times the flux received
from the solar disk (at the observer location
/S10 set: S10 units
P[n,m] scalar; type: float
polarization
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InfiniteValue, InitVar, IsType, SyncArgs, SyncDims, ThomsonS10, ThomsonSetupLOS
ThomsonSetupRomb, ThomsonSolarFlux, ToRadians, ToSolarRadii, boost, destroyvar
sphere_distance
EXTERNAL:
ThomsonTang, ThomsonTangMRad
CALLED BY:
ThomsonMidpoint, ThomsonMidpointFnc
SEE ALSO:
ThomsonLOSStep
PROCEDURE:
> The lower and upper limits can actually be 1-dim arrays, but that is
probably not useful.
> If no 'density' function is specified then a 1/r^2 density is used with
density of 1 at 1 AU.
MODIFICATION HISTORY:
SEP-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
ThomsonLOSStep
PURPOSE:
Calculates integrated line-of-sight intensity for Thomson scattering.
Integration is implemented as a sum over steps of equal size.
CATEGORY:
Physics: Thomson scattering
CALLING SEQUENCE:
FUNCTION ThomsonLOSStep, Pos_, Dir_, P, $
lower = Lower , $
upper = Upper , $
nstep = nstep , $
density = density , $
degrees = degrees , $
au = au , $
apm = APM , $
udark = udark , $
s10 = S10
INPUTS:
Pos_ array[3,n]; type: float
heliocentric location of observer:
(ecliptic) longitude and latitude; and heliocentric
distance
(the 2nd dim can be absent, or can represent multiple
dimensions)
Dir_ array[2,m]; type: float
topocentric (ecliptic) longitude and latitude of line of sight
relative to Sun-observer direction
(the 2nd dim can be absent, or can represent multiple
dimensions)
OPTIONAL INPUT PARAMETERS:
/s10 if set intensities are returned in S10 units
In this case the apparent magnitude APM MUST BE SPECIFIED
udark=udark scalar; type: float; default: 0
limb darkening constant
apm=APM scalar; type: float
apparent magnitude of Sun
density=density
scalar; type: string; default: undefined
name of function used to calculate the electron density.
Keyword is passed to ThomsonSetupLOS.
lower=Lower
scalar; type: float; default: 0
Lower limit of los integration (solar radii)
If Lower <=0 then Lower = 0 is used.
upper=Upper
scalar; type: float; default: 9000 solar radii
Upper limit of los integration (solar radii)
If Lower <=0 then Upper = 9000.0 solar radii (~40 AU) is used.
nstep=nstep
scalar; type: integer; default: 100
number of elements in which to divide the range [Lower, Upper]
/degrees if set all angles are in degrees (default: radians)
/au if set all distances are in AU (default: solar radii)
OUTPUTS:
Result array[n,m]; type: double
Integrated Thomson scattering intensity;
units depend on setting of /S10:
/S10 NOT set: per sterad in units of 10^-16 times the flux received
from the solar disk (at the observer location
/S10 set: S10 units
P array[n,m]; type: float
Polarization
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
Distance2Sun, InitVar, IsType, SuperArray, ThomsonBase, ThomsonLOSDensity
ThomsonS10, ThomsonSetupLOS, ThomsonSolarFlux, ToRadians, ToSolarRadii, boost
destroyvar, gridgen, sphere_distance
SEE ALSO:
ThomsonLOSFar, ThomsonLOSRomb
PROCEDURE:
Densities are calculated by ThomsonLOSDensity.
MODIFICATION HISTORY:
SEP-1999, Paul Hick (UCSD/CASS)
AUG-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Observer location can now also be an array.
In addition the observer does not have to be in the ecliptic
anymore.
[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, udark=udark, degrees=degrees, au=au
INPUTS:
ScSun scalar distance of spacecraft from Sun
Elo scalar elongation of s/c line of sight (l.o.s.) in degrees.
Elo=0 is the direction to the Sun
OPTIONAL INPUT PARAMETERS:
udark=udark scalar; type: float; default: 0
limb darkening constant
/degrees if set all angles are in degrees (default is radians)
/au if set all distances are in AU (default: solar radii)
OUTPUTS:
ThomsonMidPoint
scalar point on l.o.s. where intensity is half the total
integrated intensity
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar, ThomsonLOSRomb, ToRadians, ToSolarRadii, nrZBrent, nrZbrac
EXTERNAL:
ThomsonMidpointFnc
PROCEDURE:
First nrZbrac is used to bracket the zero of function ThomsonMidpointFnc.
Then nrZBrent is used to locate the zero.
MODIFICATION HISTORY:
JAN-1997, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
ThomsonMidpointFar
PURPOSE:
Calculate position along line of sight where the integrated
intensity is half of the intensity integrated along the
entire line of sight (treating the Sun as a point source
CALLING SEQUENCE:
S = ThomsonMidpoint(ScSun,Elo,U,/degrees)
INPUTS:
ScSun array distance of spacecraft from Sun in AU
Elo array elongation of s/c line of sight (l.o.s.) in degrees.
Elo=0 is the direction to the Sun
OUTPUTS:
ThomsonMidPointFar
array point on l.o.s. where intensity is half the total
integrated intensity
CALLS: ***
BadValue, SyncArgs, ThomsonMidFar, ToRadians, nrZBrent, nrZbrac
EXTERNAL:
RESTRICTIONS:
PROCEDURE:
MODIFICATION HISTORY:
JAN-1997, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
ThomsonMidpointFnc
PURPOSE:
Internal use by ThomsonMidpoint.
CALLING SEQUENCE:
FUNCTION ThomsonMidpointFnc, S, arg ; Internal use only
INPUTS:
S scalar; type: float
distance along line of sight in solar radii
arg array(4}; type: float
[R,E,udark,halfint]
R = heliocentric distance observer in solar radii
E = elongation in radians
udark = limb darkening constant
halfint = half the intensity from 0 to infinity
OUTPUTS:
R scalar; type: float
integrated intensity upto distance S - halfint
INCLUDE:
@compile_opt.pro ; On error, return to caller
EXTERNAL BY:
ThomsonMidpoint
CALLS: ***
ThomsonLOSRomb
PROCEDURE:
Returns the difference between line-of-sight integrated intensity
up to specified distance S and half the integrated intensity over the
entire line of sight. I.e. the distance S which makes this function zero is
what ThomsonMidpoint is looking for.
No density function is passed to ThomsonLOSRomb, so a 1/r^2 density is assumed.
MODIFICATION HISTORY:
JAN-1997, Paul Hick (UCSD)
[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 array distance Sun-Electron (in solar radii)
U array limb darkening coefficient
P array polarization (-1<=P<=1)
OUTPUTS:
ThomsonPDistance
array distance to the plane of the sky (solar radii) (>=0)
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
BadValue, SyncArgs, 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=-1. 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)
[Previous]
[Next]
NAME:
ThomsonPDistanceFar
PURPOSE:
Find the distance to the plane of the sky where a single electron
would have a given polarization in the limit of large electron-Sun
distance
CALLING SEQUENCE:
FUNCTION ThomsonPDistanceFar, ElSun, P
INPUTS:
ElSun array distance Sun-Electron (in solar radii)
P array polarization (-1<=P<=1)
OUTPUTS:
ThomsonPDistance
array distance to the plane of the sky (in solar radii) (>=0)
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
BadValue, SyncArgs
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=-1. 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)
[Previous]
[Next]
NAME:
ThomsonRadialFilter
PURPOSE:
CATEGORY:
sat/idl/toolbox/thomson
CALLING SEQUENCE:
FUNCTION ThomsonRadialFilter, elo_sun, degrees=degrees, elo_one=elo_one
INPUTS:
elo_sun array; type: float
elongations (angle between line of sight and
direction to Sun).
OPTIONAL INPUT PARAMETERS:
elo_one=elo_one
scalar; type: float: default: 90 degrees
elongation at which radial filter has value of unity.
i.e. the filter scales to equivalent brightness at
this elongation
/degrees if set, then elo_sun should be in degrees
OUTPUTS:
F array of same type as 'elo_sun'; type: float
radial filter; dividing by F should remove the steep dropoff
in the Thomson scattering brightness.
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
IsType, ToRadians
CALLED BY:
RemoteView_Display2D, vu_earthskymap, vu_lineofsight
PROCEDURE:
Currently the radial filter is the dropoff with elongation in a 1/r^2
density in the limit of small angular size of the Sun.
MODIFICATION HISTORY:
FEB-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
ThomsonS10
PURPOSE:
(Internal use only) Convert to S10 units
CALLING SEQUENCE:
FUNCTION ThomsonS10, DSun, APM
INPUTS:
DSun array; type: float
distance to Sun (in solar radii)
APM array; type: float
apparent magnitude Sun at 1 AU
OUTPUTS:
R array; type: float
Conversion factor to S10 units. 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.
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLED BY:
ThomsonElectron, ThomsonElectronFar, ThomsonLOSFar, ThomsonLOSRomb
ThomsonLOSStep
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 S away from the observer. The electron
is radiating by Thomson scattering of sunlight.
The conversion is done in two steps:
> STEP 1: Convert to units of the flux -incident- at r0 = 1 AU from the
solar disk: multiply by (r0/DSun)^2
(M is an apparent magnitude as observed at 1 AU. This is why
1 AU is used, rather than the observer-Sun distance RObs).
> STEP 2: Convert to units of the flux -incident- at 1 AU from a 10th
magnitude star: multiply by 10^((10-M)/2.5). (Apparent
magnitude, M=-2.5*log(Flux)).
MODIFICATION HISTORY:
JUL-1996, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
ThomsonSetupLOS
PURPOSE:
Sets up common block used by ThomsonLOSDensity to
calculate electron density at specified locations
CATEGORY:
Physics: Thomson scattering
CALLING SEQUENCE:
PRO ThomsonSetupLOS, PosIn, DirIn, density=densityIn
INPUTS:
Pos array[3,n]; type: float
heliocentric location(s) of observer:
(longitude and latitude in radians;
and heliocentric distance in solar radii)
Dir array[2,m]; type: float
topocentric longitude and latitude of
lines of sight relative to Sun-observer
direction (in radians)
OPTIONAL INPUT PARAMETERS:
density=density
scalar; type: string; default: undefined
name of function to be called to calculate
the electron density. This function takes
a single argument:
R array[3,n]; type: float
heliocentric locations where density is
to be evaluated, usually
ecliptic longitude and latitude (radians)
and heliocentric distance (solar radii)
OUTPUTS:
(stored in common block)
INCLUDE:
@compile_opt.pro ; On error, return to caller
@thomson_common.pro ; Dummy comment
CALLS: ***
IsType, boost, destroyvar
CALLED BY:
ThomsonLOSRomb, ThomsonLOSStep
SEE ALSO:
ThomsonLOSDensity
PROCEDURE:
The input is stored in common block thomson_common.
ThomsonLOSDensity uses these together with an input
argument S (1-dim array[k]) specifying distances
along the line of sight, and calculates densities
at locations Loc[k,m,n] (k locations on m lines
of sight at n locations.
MODIFICATION HISTORY:
JAN-1998, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
ThomsonSetupRomb
PURPOSE:
Controls Romberg integration in ThomsonLOSRomb
Internal use only
CATEGORY:
Physics: Thomson scattering
CALLING SEQUENCE:
PRO ThomsonSetupRomb, RSun_, Elo_, U_
INPUTS:
RSun scalar: type: float
Observer-Sun distance (solar radii)
Elo scalar; type: float
Elongation (radians)
U scalar; type: float
Limb darkening constant
OUTPUTS:
(stored in common block)
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLED BY:
ThomsonLOSRomb
COMMON BLOCKS:
common ThomsonIntegrand, RSun, Elo, U
PROCEDURE:
ThomsonSetupIntegrand sets up the common block accessed by
ThomsonTang and ThomsonTangMRad (these two functions
are used as arguments to the IDL QRomb and QRomo functions.
MODIFICATION HISTORY:
SEP-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
ThomsonSolarFlux
PURPOSE:
Calculates the flux from the solar disk incident on
an observer at given distance from Sun
CATEGORY:
Thomson scattering
CALLING SEQUENCE:
FUNCTION ThomsonSolarFlux, R, U
INPUTS:
R array; type: float; default: 1 AU
distance from Sun (in solar radii)
U array; type: float; default: zero
limb darkening constant
OUTPUTS:
Flux array; type: float
flux from the solar disk in units of pi*I0
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar
CALLED BY:
ThomsonElectron, ThomsonLOSRomb, ThomsonLOSStep
PROCEDURE:
The flux from the solar disk expressed in the intensity at
the center of the disk, I0, is pi*I0*(1-u/3)*(Rsun/R)^2.
MODIFICATION HISTORY:
AUG-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
ThomsonSoup
PURPOSE:
(Used internally only).
Calculates constant needed for calculating Thomson scattering intensities
CALLING SEQUENCE:
PRO ThomsonSoup, ElSun, U, It, Itr, aa=AA,bb=BB,cc=CC,dd=DD
INPUTS:
ElSun array[*] Electron-Sun distance in solar radii (=1./sine(Omega))
U array[*],scalar limb darkening constant
OUTPUTS:
rIt,rItr real constants
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLED BY:
ThomsonBase, ThomsonPDistance
RESTRICTIONS:
Distance ElSun must be greater than one solar radii
(if its smaller then ElSun=1 is used)
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[cm]/dElectronSun[cm].
MODIFICATION HISTORY:
JUL-1996, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
ThomsonTang
PURPOSE:
Controls Romberg integration in ThomsonLOSRomb
Internal use only
CATEGORY:
Physics: Thomson scattering
CALLING SEQUENCE:
FUNCTION ThomsonTang, S
INPUTS:
S
OUTPUTS:
INCLUDE:
@compile_opt.pro ; On error, return to caller
EXTERNAL BY:
ThomsonLOSRomb
COMMON BLOCKS:
common ThomsonIntegrand, RSun, Elo, U
CALLS: ***
Distance2Sun, ThomsonBase, ThomsonLOSDensity
PROCEDURE:
ThomsonSetupRomb sets up the common block accessed by ThomsonTang
and ThomsonTangMRad (these two functions are used as arguments to the
IDL QRomb and QRomo functions).
MODIFICATION HISTORY:
SEP-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
ThomsonTangMRad
PURPOSE:
Controls Romberg integration in ThomsonLOSRomb
Internal use only
CATEGORY:
Physics: Thomson scattering
CALLING SEQUENCE:
FUNCTION ThomsonTangMRad, S
INPUTS:
S
OUTPUTS:
INCLUDE:
@compile_opt.pro ; On error, return to caller
EXTERNAL BY:
ThomsonLOSRomb
COMMON BLOCKS:
common ThomsonIntegrand, RSun, Elo, U
CALLS: ***
Distance2Sun, ThomsonBase, ThomsonLOSDensity
PROCEDURE:
ThomsonSetupRomb sets up the common block accessed by
ThomsonTang and ThomsonTangMRad (these two functions are
used as arguments to the IDL QRomb and QRomo functions).
MODIFICATION HISTORY:
SEP-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
ThomsonUBVConst
PURPOSE:
Defines apparent solar magnitudes and limb darkening
constants to be used for the Helios UBV system
CALLING SEQUENCE:
FUNCTION ThomsonUBVConst, C
INPUTS:
C scalar; type: integer
1,2,3 for U,B,V light, resp.
OUTPUTS:
R array[2]; type: float
R[0]: limb darkening constant
R[1]: apparent magnitude of the Sun
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLED BY:
RemoteView_Display2D, vu_earthskymap, vu_lineofsight
RESTRICTIONS:
1<=C<=3; if C out of range then C=1 is used
PROCEDURE:
> UHOS(LT) is the limb darkening coefficient for Helios photometer
light from the U/B/V filter (C=1,2,3). From a graph in
RAUMFAHRTFORSCHUNG by LEINERT et al. LAMBDA=3650,4300,5250 A for U,B,V
light. From Allen (1985), p. 171, U=0.80,0.77,0.62 by linear
interpolation.
> LUM is the luminosity of the solar disk in E14 S10 units:
LUM = LSUN/LS10 = 10**((10-MSUN)/2.5), with MSUN (from Allen)
-25.96,-26.09,-26.73 for U,B and V light respectively.
MODIFICATION HISTORY:
JUL-1996, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
TimeArray
PURPOSE:
Converts time structure to array and v.v.
CATEGORY:
gen/idl/toolbox/time
CALLING SEQUENCE:
u = TimeArray(t [,/linear])
INPUTS:
t array; type: time structure array, or non-structure
array[2,*], array[*]
time to be converted from array to structure or v.v.
OPTIONAL INPUT PARAMETERS:
/linear returns scalar integer instead of 2-element integer
OUTPUTS:
u array; type: array[2,*] or time structure
converted time
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar, IsType, SubArray, SuperArray, TimePieces, TimeStandardize
CALLED BY:
Carrington, IsBadTime, TimeOrigin
PROCEDURE:
> If the input time is a structure array[*] then it is returned as an
integer array[2,*] (with days and fract-day units) If /linear is set
then an integer array[*] is returned in fract-day units
> If an non-structure array is input then it should be an array[2,*]
(leading dimension of 2) if /linear NOT set, or an array[1,*] if
/linear is set. This is returned as a structure array.
MODIFICATION HISTORY:
JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
TimeDay
PURPOSE:
Converts numerical day value to time structure and v.v
CATEGORY:
gen/idl/toolbox/time
CALLING SEQUENCE:
FUNCTION TimeDay, t
INPUTS:
t array; type: time structure or any numerical type
OUTPUTS:
Result array; type: nummerical or time structure
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
IsTime, TimePieces, TimeStandardize
CALLED BY:
TimeGet, TimeSet
RESTRICTIONS:
This function is for use in TimeGet and TimeSet only.
Other code should make calls to TimeGet or TimeSet:
u = TimeSet(day=t,/diff)
u = TimeGet(day=t,/diff)
SIDE EFFECTS:
Accesses !TimeUnits.in_day
PROCEDURE:
> If the input is a type structure than is an integer array
if all the fractions of a day are zero, or else a double array
is returned
> If the input is a numerical array then it is converted to
a time structure with the integer part as the number of days,
and the fraction as time of day.
MODIFICATION HISTORY:
JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
TimeEaster
PURPOSE:
Get date for Easter in given year
CATEGORY:
gen/idl/toolbox/time
CALLING SEQUENCE:
FUNCTION TimeEaster, T
INPUTS:
T scalar or array; type: numerical or time structure
OPTIONAL INPUT PARAMETERS:
/scalar passed to TimeSet
OUTPUTS:
Result
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
IsTime, TimeGet, TimeSet, TimeUnit
PROCEDURE:
From http://charon.nmsu.edu/~lhuber/leaphist.html
MODIFICATION HISTORY:
JUL-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
TimeFixYear
PURPOSE:
Complete year specified in 2 digits
CATEGORY:
Tricks
CALLING SEQUENCE:
Y = TimeFixYear(Yr)
INPUTS:
Yr array; type: integer
OUTPUTS:
Y array; type integer
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLED BY:
InsituTimeSeries, TimeSplit, getnagoyasources, getootyasources, nagoya_glevel
sgp4_eph, sgp4_tlm
PROCEDURE:
Where 0<=Yr<=50, Yr is changed to 2000+Yr
Where 50<Yr<100, Yr is changed to 1900+Yr
Everywhere else Yr is unmodified
MODIFICATION HISTORY:
AUG-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
TimeGet
PURPOSE:
Get information from time structure
CATEGORY:
gen/idl/toolbox/time
CALLING SEQUENCE:
FUNCTION TimeGet, t, unit , $
difference = difference , $
full = full , $
d2000 = d2000 , $
jd = jd , $
mjd = mjd , $
njd = njd , $
jepoch = jepoch , $
bepoch = bepoch , $
djepoch = djepoch , $
dbepoch = dbepoch , $
smei = smei , $
carrington_ = carrington_ , $
botime = botime , $
eotime = eotime , $
bomonth = bomonth , $
eomonth = eomonth , $
fotime = fotime , $
roundt = roundt , $
dow = dow , $
month = month , $
dom = dom , $
doy = doy , $
yrmd = yrmd , $
yrdoy = yrdoy , $
dhms = dhms , $
scalar = scalar , $
year = year , $
yr = yr , $
day = day , $
hour = hour , $
hr = hr , $
minute = minute , $
sec = sec , $
msec = msec , $
ydoy = ydoy , $
ymd = ymd , $
sys = sys , $
vms = vms , $
iso8601 = iso8601 , $
_ymd = _ymd , $
_ydoy = _ydoy , $
format = format , $
_extra = _extra
INPUTS:
t array[*]; type: time structure
input times
unit scalar; type: integer; default: none
integer identifying one of the time units year,
day, hour, minute, sec or msec. Should be a return
value of the fnc TimeUnit.
Alternatively, setting one of the keywords /year, /day, /hour,
/minute, /sec or /msec accomplishes the same.
/yr is the same as /year
/hr is the same as /hour.
'unit' must be set for keywords /full, /botime, /roundt.
If 'unit' is set without any of these keywords present then
the associated time unit is extracted from 't'.
OPTIONAL INPUT PARAMETERS:
/difference by default the input time is treated as an absolute
time, i.e. a time relative to the time origin !TimeZero.
If /difference is set then the input time is treated
as a time difference, i.e. the returned values will be
be independent of !TimeZero.
The distinction is significant if !TimeZero is set to an
irregular time, e.g. if the time origin is 2000 Jan 1,
00:00:03, and t = 0, then
TimeGet(/sec ) returns 3 while
TimeGet(/sec, /diff) returns 0.
Internally the difference is that by default the time
!TimeZero+t is processed, while with /diff set only the
input time t is processed Note that !TimeZero+t is the
number of days elapsed since 2000 Jan 1, 0 UT.
For keywords extracting calendar date information
setting /difference is somewhat tricky because the calculation
assumes that time is specified relative to 2000 Jan 1, 0 UT
(i.e. !TimeZero+t). Setting /difference would produce wrong
results unless the input t itself already has !TimeZero added to it.
/full used only if 'unit' is set
converts to units of 'unit'
/botime used only if 'unit' is set
truncates to 'unit'
roundt=roundt If one of the TimeString keywords (see below)
is set:
/roundt is passed to TimeString
If none of the TimeString keywords is set:
used only if 'unit' is set,
and rounds to 'unit'
/jd extract Julian date
/mjd extract modified Julian date
/njd extract days since 2000 Jan 1.5
/jepoch extract Julian epoch
/djepoch extract Julian epoch - 2000
/bepoch extract Besselian epoch
/dbepoch extract Besselian epoch - 1900
/d2000 extract days since 2000/01/01 00 UT (???)
/dow extract day of week
/month extract month (integer between 1 and 12)
to convert to 3-char strings, see TimeMonth
/dom extract day of month (with fraction for time of day)
/doy extract day of year (with fraction for time of day)
/scalar if set and only one time is specified (i.e. T is array[1])
then the result is output as a scalar (by default the
output will also be an array[1] (note: this only applies if
the output is not a time structure, since structures are
always arrays).
Any one of the following keywords trigger a conversion of
the input to string format. See TimeString for more information.
format=format
/ydoy
/ymd
/sys
/vms
/iso8601
/_ymd
/_ydoy
OUTPUTS:
u = TimeGet( t, /dhms [, /difference])
u array[5,*]; type: integer
input time split into days, hours, minutes, sec and msec
u[0,*] days
u[1,*] hours
u[2,*] minutes
u[3,*] seconds
u[4,*] milli-seconds
u = TimeGet( t, /full [, /difference, $
[unit, /year, /day, /hour, /minute, /sec, /msec]])
u array[*]; type: numerical type, usually double
input time in units of 'unit'
/year time converted to Julian years
/day time converted to days
/hour time converted to hours
/minute time converted to minutes
/sec time converted to seconds
/msec time converted to milli-seconds
Internally a recursive call to TimeGet is made with /difference
and /dhms set.
u = TimeGet( t, /botime [, /difference, $
[unit, /year, /day, /hour, /minute, /sec, /msec]])
u = TimeGet( t, /eotime [, /difference, $
[unit, /year, /day, /hour, /minute, /sec, /msec]])
u array[*]; type: time structure
input time truncate to 'unit'
/year time truncated to start/end of year (doy=1.0)
(though technically legal you probably don't want
to specify /difference with this keyword).
/day time truncated to start/end of day
/hour time truncated to start/end of hour
/minute time truncated to start/end of minute
/sec time truncated to start/end of second
/msec time truncated to start/end of milli-second
If /difference is NOT set then 'u' is returned relative to
the internal time origin !TimeZero (i.e. !TimeZero is subtracted
after the truncation has been done).
u = TimeGet( t, /bomonth [, /difference)
u = TimeGet( t, /eomonth [, /difference)
u array[*]; type: time structure
input time truncate to start/end of month
If /difference is NOT set then 'u' is returned relative to
the internal time origin !TimeZero (i.e. !TimeZero is subtracted
after the truncation has been done).
u = TimeGet( t, /fotime [, /difference, /full, $
[unit, /year, /day, /hour, /minute, /sec, /msec]])
u array[*]; type: time structure (/full NOT set) or numerical
(/full SET).
fraction of time left after subtracting the result
of TimeGet(t,/botime).
/year fraction of year left
/day fraction of day left
/hour fraction of hour left
/minute fraction of minute left
/sec fraction of second left
/msec fraction of milli-second left
If /full is SET then the remaining fraction is converted
into time units 'unit'. This is a shortcut for two TimeGet calls:
u = TimeGet(t, /fotime, /day, /full)
is the same as:
u = TimeGet(t, /fotime, /day)
u = TimeGet(u, /diff, /full, /day)
u = TimeGet( t, unit, roundt=roundt [, /difference])
u = TimeGet( t, /roundt [, /difference, $
[year=year, day=day, hour=hour, minute=minute, sec=sec, msec=msec]])
u array[*]; type: time structure
rounded input time
year = year time rounded to 'year' Julian years
(same as setting day=365.25d0)
day = day time rounded to 'day' days
hour = hour time rounded to 'hour' hours
minute = minute time rounded to 'minute' minutes
sec = sec time rounded to 'sec' seconds
msec = msec time rounded to 'msec' milli-second
Setting e.g. /day is the same as day=1, i.e. rounding occurs
to the nearest unit of time specified.
If /difference is NOT set then 'u' is returned relative to
the internal time origin !TimeZero (i.e. !TimeZero is subtracted
after the rounding has been done).
u = TimeGet( t [, /difference, $
[unit, /year, /day, /hour, /minute, /sec, /msec]])
u array[*]; type: integer
specified time-component extracted from 'u'
year = year year (integer array)
day = day day of year (integer array)
The calendar keywords /julian and jul2greg affect
the result (see TimeYDoy).
(though technically legal you probably don't want
to specify /difference with these two keywords).
hour = hour hours
minute = minute minutes
sec = sec seconds
msec = msec milli-seconds
These four are implemented as recursive calls to
TimeGet with /difference and /dhms set.
u = TimeGet( t, /d2000 [ , /difference] ) # days since 2000 Jan 1, 0 UT
u = TimeGet( t, /jd [ , /difference] ) Julian days
u = TimeGet( t, /mjd [ , /difference] ) Modified Julian days, JD-2400000
u = TimeGet( t, /njd [ , /difference] ) New Julian days = days since 2000 Jan 1, 12 UT
u = TimeGet( t, /jepoch [ , /difference] ) Julian epoch
u = TimeGet( t, /bepoch [ , /difference] ) Besselian epoch
u array[*]; type; numerical
calendar date 't' converted to indicated format
If /difference is used, make sure that t reflects elapsed times since
2000 Jan 1, 0 UT.
u = TimeGet( t, /dow [ , /difference] )
u array[*]; type: string
day of week as 2-char string, 'SUN','MON', etc.
If /difference is used, make sure that t reflects elapsed times since
2000 Jan 1, 0 UT.
u = TimeGet( t, /month [ , /difference] )
u array[*]; type: integer
month as integer 1-12. To convert to 3-char strings,
'JAN','FEB', etc.; see TimeMonth).
If /difference is used, make sure that t reflects elapsed
times since 2000 Jan 1, 0 UT.
The calendar keywords /julian and jul2greg affect the result
(see TimeYDoy).
u = TimeGet( t, /dom [ , /difference] )
u = TimeGet( t, /doy [ , /difference] )
array[*]; type: numerical
day of the month or year with fraction for time of day.
If /difference is used, make sure that t reflects elapsed
times since 2000 Jan 1, 0 UT.
The calendar keywords /julian and jul2greg affect the result
(see TimeYDoy).
u = TimeGet( t, /yrmd [ , /difference] )
array[3,*]; type: numerical
year, month and day of the month (with fraction for time of day).
If /difference is used, make sure that t reflects elapsed
times since 2000 Jan 1, 0 UT.
The calendar keywords /julian and jul2greg affect the result
(see TimeYDoy).
u = TimeGet( t, /yrdoy [ , /difference] )
array[*]; type: numerical
year and day of the year (with fraction for time of day).
If /difference is used, make sure that t reflects elapsed
times since 2000 Jan 1, 0 UT.
The calendar keywords /julian and jul2greg affect the result
(see TimeYDoy).
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLED BY:
CvSky_Equatorial, CvSky_GSM, CvSky_Geographic, CvSky_Heliographic, CvSky_IHG
CvSky_Precess, GeographicInfo, HOSOrbit, InsituTimeSeries, KeplerOrbit, NewcombSun
PA_Pole, PlotEarthSkymap, PlotPlanarCut, PlotPolarSkymap, PlotSolarDisk
RemoteView_BodyLoc, RemoteView_CMEDensity, RemoteView_Display2D
RemoteView_Display3D, RemoteView_FOV, StereoAOrbit, StereoBOrbit, TimeEaster
TimeGST, TimeOp, TimeSet, TimeSplit, TimeString, TimeSystem, TimeXAxis, TimeYDate
TimeYDoy, UlyssesOrbit, clock, forecast, forecast_html, forecast_info
forecast_movie, getnagoyasources, getootyasources, getsmeiasources, img_read
jpl_eph, lsqLinearFit, maygeometry, mk_celias, mpc_comets, mpc_eph
mpc_minor_planets, mpc_orbit_eph, nagoya_glevel, qEphem, qImage_cw_Property
qImage_cw_Where, qLine_Curve, qLine_FitPlot, qRemoteView, qRemoteView_Calculate
qRemoteView_ChangeTimes, qRemoteView_Pick, qnagoya, qnagoya_pointsources
qsmei_sky_pick, skyd_cat, skyd_equ, skyd_version, smei_base_testcase, smei_buf
smei_buf_get, smei_buf_getframe, smei_buf_prep, smei_buf_read, smei_coriolis
smei_filename, smei_filepath, smei_frm_base, smei_frm_cp, smei_frm_cvhdr
smei_frm_eclipse, smei_frm_findpoint, smei_frm_info, smei_frm_read
smei_frm_summary, smei_frm_track, smei_frm_where, smei_getfile, smei_hdr_get
smei_hdr_make, smei_hdr_plot, smei_hdr_update, smei_mkdrives, smei_mksidereal
smei_orbits_stat, smei_sgp4_orbits, smei_shutterwrong, smei_sky_track
smei_star_fit, smei_star_remove, smei_star_show, smei_star_writepnt
smei_zld_remove, smeidb_mounted, stardistance, stopwatch, usno_eph, vu_earthskymap
vu_extract, vu_get_page, vu_getdata, vu_image, vu_insitu, vu_insitu_raw
vu_insitucurve, vu_lineofsight, vu_localskymap, vu_mean, vu_movie
vu_nagoyasourcemap, vu_new_time, vu_planarcut, vu_read, vu_remoteview, vu_select
vu_solardisk, vu_synopticmap, vu_update_hours, vu_update_marker, vu_vox_write
vu_whatis, vu_write, wso_read, www_help_tree
RESTRICTIONS:
If the return value is a one-element non-structure it is returned as a 1-element array,
unless /scalar is set.
CALLS: ***
Carrington, InitVar, IsType, SubArray, SuperArray, TimeDay, TimeOp, TimePieces, TimeSet
TimeShift, TimeStandardize, TimeString, TimeUnit, TimeYDate, TimeYDoy, smei_coriolis
PROCEDURE:
MODIFICATION HISTORY:
SEP-1999, Paul Hick (UCSD/CASS)
NOV-2003, Paul Hick (UCSD/CASS)
Fixed bug in use of /botime keyword
JAN-2004, Paul Hick (UCSD/CASS)
Fairly substantial rewrite, converting from the old time structure
with year,doy,h,m,s,msec fields to the new structure with two integer fields.
APR-2004, Paul Hick (UCSD/CASS)
Fixed bug with /roundt for rounding to hours, minutes, seconds or milliseconds
JUL-2004, Paul Hick (UCSD/CASS)
Added /eotime keyword
JUL-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
If input arg t is a string it is now converted to a time
structure using TimeSet.
Renamed keyword /ydoy to /yrdoy (to avoid conflict with
keyword /ydoy of function TimeString).
Added a list of keywords passed to TimeString:
/ydoy, /ymd, /sys, /vms, /_ymd, /_ydoy, format=format
If any one of these keywords is set then TimeString is called
with the same keyword.
With this change it should no longer be necessary to call
TimeString directly. Instead call TimeGet with the same keywords.
Removed keyword /stringt (not needed anymore)
JUL-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added /bomonth and /eomonth keywords.
[Previous]
[Next]
NAME:
TimeGST
PURPOSE:
Calculate Greenwich Sidereal Time from UT
Good for years 1901 through 2099. Accuracy is 0.006 degree.
CATEGORY:
Celestial mechanics
CALLING SEQUENCE:
gst = TimeGST(T, /degrees)
INPUTS:
T array; type: time structure
universal time (UT)
OPTIONAL INPUT PARAMETERS:
/degrees if set output is in degrees (default: radians)
OUTPUTS:
gst array; type: double
Greenwich sidereal time
INCLUDE:
@compile_opt.pro ; Return to caller
CALLS: ***
TimeGet, TimeOp, TimeSet, TimeUnit, ToDegrees
CALLED BY:
EarthTransit3DLoc, GeographicInfo
RESTRICTIONS:
Only valid for years 1901 through 2099
PROCEDURE:
Local Sidereal Time (LST) is defined as the Hour Angle of the
vernal equinox. GST is RA of local meridian at Greenwich
MODIFICATION HISTORY:
See: C.T. Russell, Geophysical Coordinate Transformations,
in: Cosmic Electrodynamics 2 (1971) 184-196
[Previous]
[Next]
NAME:
TimeInterpol
PURPOSE:
Interpolation of a function of time.
CATEGORY:
Tell time
CALLING SEQUENCE:
F = TimeInterpol(FF, TT, T, Unit, _extra=_extra)
INPUTS:
FF array[n]; type: any numerical array
list of function values
TT array[n]; type: time structure
list of times where function values FF are supplied
T array[m]; type: time structure
list of times where interpolates are needed
OPTIONAL INPUT PARAMETERS:
Unit scalar; type: integer; default: TimeUnit(/days)
time units used for the interpolation (see PROCEDURE)
_extra=_extra
extra keyword passed to IDL function 'interpol'
OUTPUTS:
F array[n]; type: same as FF
list of interpolated values at times T
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
INTERPOL, InitVar, IsType, SyncDims, TimeOp, TimeUnit
CALLED BY:
mpc_eph, vu_atlocation, vu_gettime, vu_insitu_raw, vu_mean, vu_remoteview
vu_timeseries
PROCEDURE:
Input arrays TT and T are converted to time differences relative to
TT[0] in units specified by the Unit argument. Interpolation is done
with the IDL interpol function using these time difference arrays.
MODIFICATION HISTORY:
MAR-2001, Paul Hick (UCSD/CASS)
SEP-2001, Paul Hick (UCSD/CASS)
Added interpolation on multidimensional arrays
JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added check for new time of time structure
[Previous]
[Next]
NAME:
TimeLimits
PURPOSE:
Extract information about a array of times
CATEGORY:
Tell time
CALLING SEQUENCE:
FUNCTION TimeLimits, T, unit, $
mint = mint , $
maxt = maxt , $
bounds = bounds, $
range = range , $
mid = mid , $
t0 = t0
INPUTS:
T array; type: time structure
times to be processed
OPTIONAL INPUT PARAMETERS:
unit scalar; type: integer
If'unit' is not specified all times are returned
as a time structure
If 'unit' ist specified then times are returned
as a difference from T[0] in units of 'unit'.
/mint return earliest time
/maxt return latest time
/mid return center time
/bounds return earliest and latest time
(earliest time = R[0], latest time = R[1])
This is the default if no keyword is specified.
/range (use only with chronological or reverse
chronological arrays, SEE RESTRICTIONS)
return earliest and latest time,
The pair of times is returned in the
same order as they occur in the input array T,
e.g. if the array is in reverse chronological order
than R[0] is the latest, and R[1] the earliest time.
(this keyword is primarily use in plotting routines
to reverse the time axis).
OUTPUTS:
R array[1], array[2]; type: time structure of float
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar, IsType, MEAN, TimeOp, TimeUnit
CALLED BY:
InsituTimeSeries, TimeLInterpol, TimeXAxis, lsqLinearFit, mpc_eph, qLine_Curve
qView_GetData, sgp4_eph, sgp4_tlm, smei_buf_getframe, smei_buf_prep, smei_buf_read
smei_frm_eclipse, smei_frm_findpoint, smei_frm_smoothdark, smei_frm_summary
smei_getfile, smei_hdr_get, smei_hdr_plot, smei_hdr_update, smei_sky
smei_star_fit, vu_insitucurve
RESTRICTIONS:
If the min and max time is required for an input array T that is
not (reverse) chronological the /range keyword can produce unexpected
results (the minimum time may end up in R[1], not R[0]).
Use trange = TimeLimits(T,/bounds) if you need to be sure
that the minimum time is R[0] and the maximum time R[1].
PROCEDURE:
R = TimeLimits(T, /mint [, unit])
R = TimeLimits(T, /maxt [, unit])
R = TimeLimits(T, /mid [, unit])
R = TimeLimits(T, /bounds[, unit])
R = TimeLimits(T, /range [, unit])
MODIFICATION HISTORY:
NOV-1999, Paul Hick (UCSD/CASS)
SEP-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added /bounds keyword
[Previous]
[Next]
NAME:
TimeLInterpol
PURPOSE:
Linear interpolation on a function of time
CATEGORY:
gen/idl/toolbox/time
CALLING SEQUENCE:
FUNCTION TimeLInterpol, ff, tt, t, unit, $
scalar = scalar , $
inear = inear , $
dtnear = dtnear , $
ilow = ilow , $
dtlow = dtlow , $
fraction= fraction , $
ihigh = ihigh , $
dthigh = dthigh
INPUTS:
ff array[n]; type: any
function values
if ff does not exist then the array index
lindgen(n) is used
tt array[n]; type: time structure
UT times
t array[m]; type: time structure
times were interpolated values are needed
OPTIONAL INPUTS:
/scalar if n=1 then return values will be scalars instead
of array[1]
OUTPUTS:
inear = inear
dtnear = dtnear
ilow = ilow
dtlow = dtlow
ihigh = ihigh
dthigh = dthigh
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
ArrayLocation, InitVar, IsType, TimeLimits, TimeOp, TimeUnit
CALLED BY:
smei_coriolis, smei_orb_fractions
PROCEDURE:
MODIFICATION HISTORY:
DEC-2005, Paul Hick (UCSD/CASS)
[Previous]
[Next]
NAME:
TimeMonth
PURPOSE:
Converts integer month to 3-char month and v.v.
CATEGORY:
gen/idl/toolbox/time
CALLING SEQUENCE:
FUNCTION TimeMonth, month, check=check, year=year
INPUTS:
month scalar or array; type: integer or string
if integer then values must be between 1 and 12
if char then values must be one of
JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC
(case insensitive).
OPTIONAL INPUT PARAMETERS:
/check if set then no conversion is done, but the input
array is checked to make sure all entries are valid.
The input array must be numeric (usually integer).
year=year if /check is set, or numeric input is converted to string
then months outside the range 1-12 are mapped back
into the range 1-12. In this case 'year' is updated
accordingly where the month was changed.
(e.g. if month=14 and year=2003 on input, then
month=2 and year=2004 is returned).
OUTPUTS:
mon same array type as input; type; string or integer
converted month array
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar, IsType, SyncArgs
CALLED BY:
TimeSet, TimeString, TimeYDate
PROCEDURE:
MODIFICATION HISTORY:
JAN-2004, Paul Hick (UCSD/CASS)
MAY-2008, Paul Hick (UCSD/CASS)
Integer month input is now mapped to range 1,12
instead of aborting when outside this range.
JUL-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added keyword 'year'.
[Previous]
[Next]
NAME:
TimeOp
PURPOSE:
Simple operations on times
CATEGORY:
gen/idl/toolbox/time
CALLING SEQUENCE:
FUNCTION TimeOp, t, u, unit , $
add = add , $
subtract = subtract , $
meant = meant , $
times = times , $
divide = divide , $
wt = wt , $
wu = wu , $
units = units , $
old_units = old_units , $
new_units = new_units , $
signdiff = signdiff
v = TimeOp(t,u, /add)
v = TimeOp(t,u, /subtract)
v = TimeOp(t,u, /meant, wt=wt, wu=wu)
u = TimeOp(t, /units, old_units=old_units, new_units=new_units)
INPUTS:
t array; type: time structure
u array; type: time structure
OPTIONAL INPUT PARAMETERS:
/add if set, add t and u (not that u in this case is interpreted
as a time difference
/subtract if set, get the time difference t-u
/meant return a weighted mean of t and u (with weights wt and wu)
/times
/divide
/units if set convert from 'old_units' to 'new_units'
If none of the above keywords is set then /subtract is assumed.
wt=wt scalar or array; type: double; default: 1d0-wu or 0.5d0
weight for first time array (t)
wu=wu scalar or array; type: double; default: 1d0-wt or 0.5d0
weight for second time array (u)
Input is converted to double if necessary
old_units=old_units
scalar; type: integer; default: !TimeUnits.in_day
# times per day currently stored in t
new_units=new_units
scalar; type: integer; default: !TimeUnits.tiny
new units
OUTPUTS:
u array; type: time structure
added times
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar, IsType, TimeGet, TimePieces, TimeSet, TimeStandardize, TimeUnit
CALLED BY:
Carrington, EarthTransit3DLoc, GeographicInfo, InsituTimeSeries, IsBadTime
PlotCurve, RemoteView_BodyLoc, RemoteView_CMEDensity, RemoteView_Init_FOV
TimeGST, TimeGet, TimeInterpol, TimeLInterpol, TimeLimits, TimeOrigin, TimeScale
TimeSet, TimeShift, TimeSplit, TimeSystem, TimeXAxis, big_orbit, even_light, forecast
forecast_cfg, forecast_ice, forecast_info, forecast_movie, getnagoyasources
getootyasources, getsmeiasources, jpl_eph, jpl_test, mpc_eph, nso_fe_plot
qImage_cw_DrawEphem, qLine_Curve, qView_UpdateTime, run_map, run_map_vm, sgp4_eph
sgp4_tlm, smei_base_testcase, smei_buf, smei_buf_getframe, smei_buf_prep
smei_buf_read, smei_buf_splitfile, smei_camera_gain, smei_coriolis
smei_filepath, smei_frm_cp, smei_frm_cvhdr, smei_frm_findpoint, smei_frm_info
smei_frm_read, smei_frm_smoothdark, smei_frm_summary, smei_getfile, smei_hdr_get
smei_hdr_make, smei_hdr_plot, smei_hdr_update, smei_mkdrives, smei_orb_fractions
smei_orbits_stat, smei_sgp4_orbits, smei_sky_read, smei_sky_track, smei_star_fit
smei_star_remove, smei_zld_remove, stardistance, stopwatch, vu_atlocation
vu_getdata, vu_gettime, vu_header, vu_insitu, vu_insitu_raw, vu_insitucurve
vu_is_sequence, vu_localskymap, vu_mean, vu_movie, vu_nagoyasourcemap, vu_new_time
vu_select, vu_timeseries, vu_update_hours, vu_update_marker, vu_vox_draworbit
vu_vox_write, vu_weight, vu_whatis, www_help_tree
PROCEDURE:
/meant set:
If neither wu nor wt are specified then the unweighted mean time
(t+u)/2 is returned.
If only one weight is defined then the other weight is set to
1-(specified) weight, i.e. a weighted mean is calculated:
wt*t+(1-wt(u)) or (1-wu)*t+wu*t
If both weights are specified the wt*t+wu*u is returned.
Uses !TimeUnits
Note that the units in the returned time are not necessarily consistent
anymore with !TimeUnits.in_day. It is the users responsibility to make
sure that this does not lead to mayhem.
MODIFICATION HISTORY:
JAN-2004, Paul Hick (UCSD/CASS)
APR-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Fixed bug in calculation of signdiff
Added keyword /scalar to TimeGet call used to get signdiff.
Signdiff is now a returned as a scalar if both t and u are
1-element time structure arrays.
[Previous]
[Next]
NAME:
TimeOrigin
PURPOSE:
Converts time structure to array and v.v.
CATEGORY:
gen/idl/toolbox/time
CALLING SEQUENCE:
u = TimeOrigin(t)
INPUTS:
t0 /get NOT set:
array[1]; type: time structure
time origin additional offset to the origin
defined in keywords /d2000, /jd, /mjd, /njd
OPTIONAL INPUT PARAMETERS:
/get if set then the current settings are returned in t0
/time do not change the origin, only change time units
/d2000 if set then the origin is set to 2000 Jan 1, 0 UT
(plus t0 if specified).
/jd if set then the origin is set to JD=0
(plus t0 if specified)
/mjd if set then the origin is set to JD=2400000
(plus t0 if specified)
/njd if set then the origin is set to 2000 Jan 1, 12 UT
(plus t0 if specified)
units_in_day=units_in_day
scalar; type: integer; default: !TimeUnits.in_day
# times per day
OUTPUTS:
u array; type: array[2,*] or time structure
converted time
OPTIONAL OUTPUT PARAMETERS:
t0 /get SET: current settings of time origin and time units
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar, IsType, TimeArray, TimeOp
CALLED BY:
Carrington, TimeShift
PROCEDURE:
Uses structure definition in !TheTime
MODIFICATION HISTORY:
JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
TimePieces
PURPOSE:
Manipulate time structures
CATEGORY:
gen/idl/toolbox/time
CALLING SEQUENCE:
v = TimePieces(t, [p ,/days, /tiny, /units])
INPUTS:
t array; type: time structure; default: !TheTime
times
p array; type: integer
time component to be entered into 't'
OPTIONAL INPUT PARAMETERS:
/days return # whole days in t
/units return fraction of day in current units
/tiny return fractions of day in smallest permitted
time units (as set in !TimeU.tiny)
OUTPUTS:
v array; type: integer
returns a part of the input time.
If /days and /tiny NOT set:
fraction of day in current units
(as set by !TimeUnits.in_day)
If /day SET:
# whole days in t
If /tiny SET:
fraction of day in smallest permitted units
(as set by !TimeUnits.tiny)
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar, IsType
CALLED BY:
TimeArray, TimeDay, TimeGet, TimeOp, TimeSet, TimeStandardize
RESTRICTIONS:
The assumption is made that !TimeUnits.tiny is an
integer multiple of TimeUnits.in_day. If this is not the case
integer truncation occurs, with probably pretty nasty side effects.
PROCEDURE:
As much as possible all access to the fields in the time
structure should be channelled through this function.
MODIFICATION HISTORY:
JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
timeposn
PURPOSE:
Finds location of time in string
CATEGORY:
gen/idl/toolbox/time
CALLING SEQUENCE:
FUNCTION timeposn, names_, $
front = front , $
back = back , $
time = time , $
cbreak = cbreak, $
format = format, $
extract = extract,$
part = part , $
length = length
INPUTS:
names array; type: string
strings containing times
OPTIONAL INPUT PARAMETERS:
cbreak=cbreak scalar or 2-element array; type: string; default: '_' (underscore)
separator between time fields. The 2nd, if present is
used as separator between hrs, min and seconds fields.
part=part scalar; type: string
usually part='name'. 'names' is treated as
a file name and only part 'part' of the name
is processed (e.g. GetFileSpec(names,part=part)
only processed the file name part after stripping
directory and extension)
/extract return times (i.e. as also returned in keyword 'time')
OUTPUTS:
p array; type: long
position in 'names' where the time starts
-1 if no time was found
OPTIONAL OUTPUT PARAMETERS:
time=time array; type: time structure
times extracted from 'names'.
Set to !TheTime if no time was found
front=front array; type: string
part of 'names' preceeding the time
back=back array; type: string
part of 'names' trailing the time
format=format array; type: string
format string used to extract the time with TimeSet
length=length array; type: integer
format length, i.e. strlen(format)
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
GetFileSpec, InitVar, IsType, SyncArgs, TimePosn_add, TimePosn_backcheck
TimePosn_test, TimeSet, UNIQ, boost, strposn
CALLED BY:
skyd_cat, skyd_equ, smei_buf_splitfile, smei_coriolis, smei_filename
smei_frm_read, smei_getfile, smei_hdr_update, smei_orb_fractions, smei_property
smeidb_mounted
PROCEDURE:
YMD and YDOY type formats are accepted:
YYYY[_DOY_HHMMSS] and YYYY[_MN_DD_HHMMSS]
where the parts between brackets are optional.
The date and time of day can be separated by a space (instead
of a cbreak char. A separate cbreak can be specified for the
hours, minutes and seconds field (usually a colon).
IF a millisecond field is present it can be separated from
the minutes field by a dot.
EXAMPLE:
Format YYYY/MN/DD hh:mm:ss.fff is detected with cbreak=['/',':']
MODIFICATION HISTORY:
JUL-2005, Paul Hick (UCSD/CASS)
DEC-2007, Paul Hick (UCSD/CASS)
Added /reverse_order to TimePosn_test call that searches
for the year field.
MAR-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added keywords /extract, part=part and length=length.
Added code to process cbreak='' (null_string)
[Previous]
[Next]
NAME:
TimePosn_add
PURPOSE:
Internal use for TimePosn only
INPUTS:
format
times
back
slack
piece scalar; type: string
piece of format string for time (e.g. 'YYYY')
CALLING SEQUENCE:
PRO TimePosn_add, format,times,back,slack,f,b,trail,cc,is_too, piece
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLED BY:
timeposn
MODIFICATION HISTORY:
[Previous]
[Next]
NAME:
TimePosn_backcheck
PURPOSE:
Internal use for TimePosn only
CALLING SEQUENCE:
FUNCTION TimePosn_backcheck, back, check
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLED BY:
timeposn
MODIFICATION HISTORY:
[Previous]
[Next]
NAME:
TimePosn_test
PURPOSE:
(Internal use by timeposn only)
Tests for a numb