IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 9, 2004, 2:17:59 PM (22 years ago)
Author:
Paul Price
Message:

Added psTimeTable stuff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/pslib/psLibSDRS.tex

    r1766 r1767  
    1 %%% $Id: psLibSDRS.tex,v 1.118 2004-09-09 23:48:55 jhoblitt Exp $
     1%%% $Id: psLibSDRS.tex,v 1.119 2004-09-10 00:17:59 price Exp $
    22\documentclass[panstarrs,spec]{panstarrs}
    33
     
    176176\item Set the error codes for PSLib.
    177177\item Seed the random number generator.
     178\item Read the \code{psTimeTable} configuration file and set up the
     179  appropriate \code{psTimeTable}s and predictions.
    178180\end{itemize}
    179181
     
    32313233Time math is only done on the \code{psTime} TAI type.
    32323234
     3235\subsubsection{Time Tables}
     3236
     3237The offset of UTC from UT1, $\Delta$UT = UT1-UTC, as well as the polar
     3238motion, $x_p$ and $y_p$, may be determined from table lookups.  Tables
     3239are available covering different time periods and with different time
     3240resolution, and so it is important to be able to utilise multiple
     3241tables.  Some tables may be found at:
     3242
     3243\begin{itemize}
     3244\item \code{ftp://maia.usno.navy.mil/ser7/ser7.dat}
     3245\item \code{ftp://maia.usno.navy.mil/ser7/finals.all} with explanatory
     3246  guide at \code{ftp://maia.usno.navy.mil/ser7/readme.finals} . See also
     3247  the web page \code{http://maia.usno.navy.mil/}.
     3248\item \code{http://hpiers.obspm.fr/eoppc/eop/eopc01/eopc01.1900-2004}
     3249  (contains estimates prior to 1972).
     3250\end{itemize}
     3251
     3252The tables shall reside on local disk in known locations (i.e., there
     3253is no need that they are downloaded from the internet and parsed by
     3254PSLib).  The format of these files shall be simple, for speed in
     3255reading: Each line shall contain the MJD, $x_p$ (in arcseconds), $y_p$
     3256(in arcseconds) and $\Delta$UT (in seconds) separated by whitespace;
     3257blank lines and lines commencing with the comment character (the hash
     3258symbol, \code{#}) as the first character shall be ignored.  For
     3259example:
     3260
     3261\begin{verbatim}
     3262# Bulletin A, 9 September 2004.
     3263# ftp://maia.usno.navy.mil/ser7/ser7.dat
     3264# MJD       XP(")   YP(")   UT1-UTC(s)
     326553258       0.1715  0.4774  -0.45092             
     326653259       0.1734  0.4757  -0.45039             
     326753260       0.1753  0.4741  -0.45012             
     326853261       0.1770  0.4724  -0.45015             
     326953262       0.1787  0.4708  -0.45045             
     3270\end{verbatim}
     3271
     3272The location of these files, their priority order, and the ``from''
     3273and ``to'' dates of applicability will be specified through metadata
     3274(\S\ref{sec:timeMetadata}).
     3275
     3276When a value is required, the tables shall shall be checked in
     3277priority order to see if the date is within the range of applicability
     3278for the table.  If a table is found that is applicable, then the
     3279appropriate value shall be derived from linear interpolation between
     3280the nearest entries in the table.  If no table is found that is
     3281applicable, and the required date is later than those covered in the
     3282tables, a warning shall be generated, and a pre-determined formula
     3283shall be applied (\S\ref{sec:timeMetadata}).  For dates prior to those
     3284covered in the tables, the function shall generate a warning and use
     3285pre-determined values (\S\ref{sec:timeMetadata}).
     3286
     3287We define a structure, \code{psTimeTable} to hold a single time table:
     3288\begin{verbatim}
     3289typedef struct {
     3290    const char *filename;               // Filename of time table
     3291    const psF64 validFrom, validTo;     // MJDs of validity of time table
     3292    bool loaded;                        // Has the table been loaded?
     3293    psVector *mjd;                      // MJD data, type is psF64
     3294    psVector *dut;                      // delta UT = UT1 - UTC data
     3295    psVector *xp, *yp;                  // Polar motion data
     3296} psTimeTable;
     3297\end{verbatim}
     3298
     3299The tables shall be read in only when required by the user (hence the
     3300\code{loaded} member); once loaded, the table shall remain in memory
     3301until the termination of the program.  The corresponding constructor
     3302shall be:
     3303\begin{verbatim}
     3304psTimeTable *psTimeTableAlloc(const char *filename, psF64 validFrom, psF64 validTo);
     3305\end{verbatim}
     3306which simply constructs a \code{psTimeTable} with the appropriate
     3307\code{filename}, \code{validFrom} and \code{validTo}.  Upon
     3308construction, the \code{loaded} member shall be set to \code{false},
     3309and the vectors containing the data shall be set to \code{NULL}.
     3310
     3311The function \code{psTimeTableLoad} shall load a specified time
     3312\code{table}, returning \code{true} for success, and \code{false} if
     3313the table failed to load.  If the \code{table} has already been
     3314loaded, then it shall be re-loaded.
     3315\begin{verbatim}
     3316bool psTimeTableLoad(psTimeTable *table);
     3317\end{verbatim}
     3318
     3319Given a time \code{table} and a Modified Julian Date, \code{mjd}, at
     3320which to interpolate values, \code{psTimeTableInterpolate} shall
     3321calculate the appropriate UT1-UTC (\code{dut}; if non-\code{NULL}),
     3322and polar motion (\code{xp,yp}; if non-\code{NULL}) by interpolation
     3323on the table.  If the \code{mjd} is outside the range of the table or
     3324the interpolation was for some other reason unsuccessful, then the
     3325function shall return \code{false}; otherwise the function shall set
     3326those parameters which are non-\code{NULL} (\code{dut,xp,yp}) and
     3327return \code{true}.  If the requested \code{mjd} lies in the range of
     3328the \code{table}, but the \code{table} has not been \code{loaded},
     3329then the function shall call \code{psTimeTableLoad}.
     3330\begin{verbatim}
     3331bool psTimeTableInterpolate(const psTimeTable *table, double *xp,
     3332                            double *yp, double *dut, psF64 mjd);
     3333\end{verbatim}
     3334
     3335\paragraph{Time Metadata}
     3336\label{sec:timeMetadata}
     3337
     3338The following metadata keys will be used in time calculations:
     3339
     3340\begin{tabular}{l|l} \hline
     3341Metadata key & Purpose \\ \hline
     3342psLib.time.tables.files & Time table file names (space-delimited)                          \\
     3343psLib.time.tables.from  & Time tables are valid from these MJDs (vector)                   \\
     3344psLib.time.tables.to    & Time tables are valid to these MJDs (vector)                     \\
     3345psLib.time.before.xp    & Value of XP for before the earliest MJD                          \\
     3346psLib.time.before.yp    & Value of YP for before the earliest MJD                          \\
     3347psLib.time.before.dut   & Value of UT1-UTC for before the earliest MJD                     \\
     3348pslib.time.predict.xp   & A vector containing the $x_p$ prediction formula coefficients    \\
     3349pslib.time.predict.yp   & A vector containing the $y_p$ prediction formula coefficients    \\
     3350pslib.time.predict.mjd  & A value containing the MJD offset for temporary variables        \\
     3351pslib.time.predict.dut  & A vector containing the UT1-UTC prediction formula coefficients  \\
     3352\hline
     3353\end{tabular}
     3354
     3355These metadata keys shall reside in a configuration file
     3356(\S\ref{sec:configspec}), \code{psTime.config}, which shall be loaded
     3357into a \code{psMetadata} structure private to \code{psTime}, as part
     3358of \code{psLibInit}.  An example of \code{psTime.config} follows:
     3359
     3360\begin{verbatim}
     3361# This configuration file specifies values required for time calculations by psLib.
     3362psLib.time.tables.n     U8      2                                               # Number of time tables
     3363psLib.time.tables.files STR     bulletinA_09Sep2004.dat eopc01_1900_2004.40.dat # These are the file names
     3364@psLib.time.tables.from F64     53258.0, 15020.0                                # Valid from these MJDs
     3365@psLib.time.tables.to   F64     53622.0, 53258.0                                # Valid to these MJDs
     3366psLib.time.before.xp    F64     0.0                     # Value of XP for before the earliest MJD
     3367psLib.time.before.yp    F64     0.0                     # Value of YP for before the earliest MJD
     3368psLib.time.before.dut   F64     0.0                     # Value of UT1-UTC for before the earliest MJD
     3369                                                       
     3370# Now follows formulae for predicting ahead of the most recent available table entry.
     3371# xp = [0] + [1]*cos A + [2]*sin A + [3]*cos C + [4]*sin C
     3372# yp = [0] + [1]*cos A + [2]*sin A + [3]*cos C + [4]*sin C
     3373# A = 2*pi*(MJD - pslib.time.predict.mjd)/365.25
     3374# C = 2*pi*(MJD - pslib.time.predict.mjd)/435.0
     3375# dut = ut1-utc = [0] + [1]*(MJD - [2]) - (UT2-UT1)
     3376# ut2-ut1 = 0.022 sin(2*pi*T) - 0.012 cos(2*pi*T) - 0.006 sin(4*pi*T) + 0.007 cos(4*pi*T)
     3377# T = 2000.0 + (MJD - 51544.03)/365.2422
     3378@psLib.time.predict.xp  F64     0.0569, 0.0555, -0.0200, 0.0513, 0.1483
     3379@psLib.time.predict.yp  F64     0.3498, -0.0176, -0.0498, 0.1483, -0.0513
     3380psLib.time.predict.mjd  F64     53257.0
     3381@psLib.time.predict.dut F64     -0.4944, -0.00023, 53262.0
     3382\end{verbatim}
     3383
    32333384%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    32343385
Note: See TracChangeset for help on using the changeset viewer.