| ttrans |
|
Table of contents
Procedure
TTRANS ( Time transformation )
SUBROUTINE TTRANS ( FROM, TO, TVEC )
Abstract
Transform a time vector from one representation and system
to another.
Required_Reading
TIME
Keywords
PARSING
TIME
Declarations
IMPLICIT NONE
INCLUDE 'zzctr.inc'
INTEGER MXCOMP
PARAMETER ( MXCOMP = 10 )
CHARACTER*(*) FROM
CHARACTER*(*) TO
DOUBLE PRECISION TVEC ( MXCOMP )
Brief_I/O
VARIABLE I/O DESCRIPTION
-------- --- --------------------------------------------------
MXCOMP P maximum number of components allowed for TVEC.
TO I description of a time vector.
FROM I description of a time vector.
TVEC I-O time vector representing an epoch.
Detailed_Input
TVEC is called a time vector. It is an array of double
precision numbers that represent some epoch. To
determine its meaning you must examine the string
FROM. Note that the number of significant entries
in TVEC is implied by FROM.
FROM,
TO are two strings used to describe the type of time vector
TVEC. FROM is the type of the input vector TVEC and
TO is the type of the output TVEC
The interpretation of TVEC is as follows:
TYPE Interpretation of TVEC
------ -------------------------------------------
YMD(F) - year, month, day, hour, minutes, seconds
YD(F) - year, day-of-year, hour, minutes, seconds
YD.D(F) - year, number of days past beginning of year
DAYSEC - calendar days past 1 jan 1 AD,
seconds past beg day
DP2000 - calendar days past 1 jan 2000,
seconds past beg day
JDUTC - julian date UTC.
FORMAL - seconds in the formal calendar since J2000.
YWD(F) - year, week, day, hour, minutes, seconds
YMWD(F) - year, month, week, day, hour, minutes,
seconds
TAI - atomic seconds past Atomic J2000.
TDT - Terrestrial Dynamical Time
TDB - Barycentric Dynamical Time
JED - Julian Ephemeris Date (based on TDB)
ET - Ephemeris time (same as TDB)
JDTDB - Julian Date based on TDB (same as JED)
JDTDT - Julian Date based on TDT
The number of components of TVEC implied by TYPE is
as follows:
YMD - 6
YD - 5
JDUTC - 1
FORMAL - 1
YD.D - 2
DAYSEC - 2
DP2000 - 2
YWD - 6
YMWD - 7
TAI - 1
TDT - 1
TDB - 1
JED - 1
ET - 1
JDTDB - 1
JDTDT - 1
For all types, only the last component of the
time vector may be non-integer. If other components
have fractional parts only their truncated integer
components will be recognized.
YMD and YD
These types are assumed to be different
representations on UTC time markers. Thus
the hour, minutes and seconds portions all
represent time elapsed
since the beginning of a day. As such the
seconds portion of HMS may range up to (but
not include) 61 on days when positive leap
seconds occur and may range up to (but not
include) 59 on days during which negative
leapseconds occur.
YD.D type.
Y is the calendar year used in civil time keeping
D is the day of the calendar year --- for any time
during the first of January, the integer portion
of the day will be 1.
The fractional portion is the fractional part of
the specific day. Thus the amount of time
specified by the fractional portion of the day
depends upon whether or not the day has a leap
second. ".D" can be computed from the formula
number of seconds past beginning of day
.D = ---------------------------------------
number of UTC seconds in the day.
FORMAL type.
The FORMAL type for TVEC gives the number of
seconds past the epoch J2000 (noon Jan 1 2000)
on the formal calendar (no leap seconds ---
all days contain 86400 seconds) The formal clock
is simply held still for one second during
positive leap seconds. Times during leap seconds
cannot be represented in this system.
This system is converted internally to a
calendar days past epoch and seconds
past beginning of day form. For this reason,
times that occur during a positive leap second
can never be represented. Moreover, if a negative
leapsecond occurs, times that occur during the
``missing'' leapsecond will simply be placed
at the beginning of the next day. Thus two
different FORMAL times can represent the
same time around a negative leap second.
FORMAL time is equivalent to somewhat parochial
``UTC seconds past J2000'' that is produced
by the SPICE routine TPARSE.
JDUTC type.
This system is similar to the FORMAL system
described above. All days are assumed to have
86400 seconds. All numbers of the form
integer + 0.5
fall at the beginning of calendar UTC days.
There is no way to represent times during a
positive leapsecond. Times during missing
negative leap seconds are represented in two ways.
DAYSEC type.
This time vector has the form of calendar
days since January 1, of the year 1 A.D.
and number of seconds past the beginning of the
calendar day.
(January 2 of the year 1 A.D. is 1 calendar
day past January 1, 1 A.D.)
DP2000 type.
This time vector has the same form as DAYSEC
time vectors. The only difference is that
the reference epoch is JAN 1, 2000.
YWD and YMWD types.
These time vectors are used to specify a time
that are most conveniently expressed by phrases
such as "the third Monday of every month" or
"Beginning with the second Wednesday of the new
year and every 4th Wednesday thereafter."
The hours, minutes and seconds components of
these time vectors are the
same as for the Year-Month-Day and Year-Day UTC
time vectors.
The Y component refers to the calendar year, and
in the YMWD vector, the M component refers to
the calendar month.
The W component refers to the week of the
Year (YWD) or Month (YMWD). The first week
begins on the first day of the year or the first
day of the month. The D component is the day of the
week with 1 corresponding to Sunday, 2 to Monday,
and so on with 7 corresponding to Saturday.
Thus the YMWD time vector
1991
11
3
5
12
0
0
refers to 12:00:00 on the third Thursday of
November of 1991.
The YWD time vector
1997
11
4
13
5
11
refers to 12:05:11 on the eleventh Wednesday
of 1997.
Formal Calendar Time Vectors
============================
The types YMDF, YDF, YD.D(F), YWDF, YMWDF are similar
to the corresponding base types: YMD, YD, YD.D, YWD
and YMWD. However, these types represent formal
time vectors. Each day contains exactly 86400 seconds.
The difference between formal and non-formal systems
can only be seen during a positive leapsecond or
during the second following a negative leapsecond.
Epochs during a positive leapsecond on input are
placed in the first second of the next day. Epochs
during a positive leapsecond on output are held
at 00:00:00 of the next day.
Epochs during the first second following a negative
leapsecond are counted as belonging to the previous
day if both the input and output types are formal
types.
Calendars
=====================
In all time vectors for which a year is specified,
the year is assumed to belong to the Gregorian
Calendar---every 4th year is a leapyear except
for centuries (such as 1900) that are not divisible
by 400. This calendar is formally extended
indefinitely backward and forward in time.
Note that the Gregorian Calendar did not
formally exist prior to October 15, 1582. Prior to
that time the Julian Calendar was used (in the
Julian Calendar every 4th year is a leapyear, including
all centuries).
If you have epochs relative to the Julian calendar,
the SPICE routine JUL2GR is available for converting
to the formal Gregorian Calendar.
Epochs Prior to 1972
=====================
UTC as it exists today, was adopted in 1972. For
epochs prior to 1972, it is assumed that the difference
between TAI and UTC is a constant value.
Years prior to 1 A.D.
=====================
A year belonging to the B.C. era, may be
represented by subtracting the year from 1.
Thus to specify 27 B.C (Gregorian) set the
year component of the time vector to -26.
Notes:
======
The FORMAL and JDUTC types should not be used
for times near a leap second. However, for times
removed from leap seconds they pose no problems.
The DAYSEC and DP2000 are useful for representing
times that are given in atomic seconds past some
reference epoch other than J2000.
Detailed_Output
TVEC is the time vector corresponding to the input
time vector but with components consistent with
the type specified by input variable TO.
Parameters
MXCOMP is the maximum number of components that can appear in
TVEC.
Exceptions
1) If the type of either FROM or TO is not recognized, the
error SPICE(UNKNONWNTIMESYSTEM) is signaled.
2) If a leapseconds kernel has not been loaded prior a call
to TTRANS, the error SPICE(NOLEAPSECONDS) is signaled.
3) If epochs associated with leapseconds in the leapseconds
kernel are not in increasing order, the error
SPICE(BADLEAPSECONDS) is signaled.
Files
None.
Particulars
This routine is the fundamental translator between various
representations of time in the SPICE system. However, it
is intended to be a mid-level routine that few user's should
have need of calling.
In addition to translating between time systems, this routine
can be used to normalize the components of a time string
so that they are in the normal range for a particular
representation. This allows you to easily do arithmetic
with epochs.
Examples
Suppose you need to convert a time expressed as seconds
past J2000 (TDB) to Pacific Daylight time. The following
example shows how you might use TTRANS to accomplish this
task.
TVEC(1) = ET
CALL TTRANS ( 'TDB', 'YMD', TVEC )
The seconds component of PDT is the same as the seconds
component of UTC. We save and add the UTC-PDT offset
to the hours and minutes component of the time vector.
SECNDS = TVEC(6)
TVEC(6) = 0.0D0
TVEC(4) = TVEC(4) - 7.0D0
TVEC(5) = TVEC(5) + 0.0D0
CALL TTRANS ( 'YMDF', 'YMDF', TVEC )
Now reset the seconds component to the original value
and pass the time vector to some formatting routine.
TVEC(6) = SECNDS
Restrictions
None.
Literature_References
None.
Author_and_Institution
N.J. Bachman (JPL)
J. Diaz del Rio (ODC Space)
B.V. Semenov (JPL)
W.L. Taber (JPL)
E.D. Wright (JPL)
Version
SPICELIB Version 1.6.0, 05-SEP-2021 (EDW) (JDR)
Edited the header to comply with NAIF standard.
Removed INT casts in HMSSEC calls. The casts prevent
correct calculation of TDB time for non integer hour
and minute values in time strings from STR2ET.
Removed reference to FURNSH from the "LSK variable
not present" long error message.
SPICELIB Version 1.5.0, 09-SEP-2013 (BVS)
Updated to keep track of the POOL counter and call ZZCVPOOL.
SPICELIB Version 1.4.0, 05-MAR-2009 (NJB)
Bug fix: this routine now keeps track of whether its
kernel pool look-up succeeded. If not, a kernel pool
lookup is attempted on the next call to this routine.
SPICELIB Version 1.3.0, 15-NOV-2006 (NJB)
A reference to RTPOOL was replaced by a reference
to GDPOOL.
SPICELIB Version 1.2.0, 24-OCT-2005 (NJB)
Updated to remove non-standard use of duplicate arguments
in RMAIND and RMAINI calls. Changed reference to LDPOOL to
reference to FURNSH in an error message.
SPICELIB Version 1.1.0, 09-JUN-1999 (WLT)
The routine was modified so that uniform time system
transformations (see UNITIM) are handled without
performing intermediate computations. This gives a slight
improvement in the accuracy of some computations.
In addition, two unused variables were removed.
SPICELIB Version 1.0.0, 17-SEP-1996 (WLT)
|
Fri Dec 31 18:37:03 2021