Changeset 3447
- Timestamp:
- Mar 17, 2005, 6:04:09 PM (21 years ago)
- Location:
- trunk/doc/pslib
- Files:
-
- 2 edited
-
ChangeLogSDRS.tex (modified) (2 diffs)
-
psLibSDRS.tex (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/pslib/ChangeLogSDRS.tex
r3423 r3447 1 %%% $Id: ChangeLogSDRS.tex,v 1.7 4 2005-03-15 20:54:49 priceExp $1 %%% $Id: ChangeLogSDRS.tex,v 1.75 2005-03-18 04:04:09 jhoblitt Exp $ 2 2 3 3 \subsection{Changes from version 00 to version 01} … … 487 487 \item Added \code{psPlaneTransformDeriv}. 488 488 \item Added \code{psImageGrowMask}. 489 \end{itemize} 489 \item Changes to the Time section: 490 \begin{itemize} 491 \item Add \code{psTimeBulliten} enum 492 \item Add \code{leapsecond} member to \code{psTimeType} 493 \item Change \code{psTime.usec} $\rightarrow$ \code{psTime.nsec} (nanoseconds) 494 \item Minor reorganization and additional comments 495 \item Rename \code{psTimeGetTime()} $\rightarrow$ \code{psTimeGetNow()} 496 \item New rules for time system converstion 497 \item Rename \code{psTimeToLST()} $\rightarrow$ \code{psTimeToLMST()} 498 \item Rename \code{psTimeLeapSeconds()} $\rightarrow$ \code{psTimeLeapSecondDelta()} 499 \item Add \code{psTimeIsLeapSecond()} 500 \item ISO8601 format clarifications 501 \item Rename \code{psTimeToISOTime()} $\rightarrow$ \code{psTimeToISO()} 502 \item Add \code{psTimeFromUTC()} 503 \item Add \code{psTimeFromTT()} 504 \item Change \code{psTime} math rules 505 \item Change ``Time Tables'' to have IERS Bulliten A \& B 506 \end{itemize} 507 \end{itemize} -
trunk/doc/pslib/psLibSDRS.tex
r3424 r3447 1 %%% $Id: psLibSDRS.tex,v 1.18 7 2005-03-15 20:57:48 priceExp $1 %%% $Id: psLibSDRS.tex,v 1.188 2005-03-18 04:04:09 jhoblitt Exp $ 2 2 \documentclass[panstarrs,spec]{panstarrs} 3 3 … … 3469 3469 \subsubsection{Overview} 3470 3470 3471 We require a collection of functions to manipulate time data. These 3472 operations primarily consist of conversions between specific time 3473 formats. Internally, PSLib handles times as a structure similar to 3474 the POSIX \code{timeval} which has been extended to track the time 3475 system being represented. 3471 We require a collection of functions to manipulate time data. These operations 3472 primarily consist of conversions between specific time formats. Internally, 3473 PSLib handles times as a structure similar to the POSIX \code{timeval} struct 3474 which has been extended to track the time system being represented. 3475 3476 \subsubsection{Data Types} 3476 3477 3477 3478 \begin{verbatim} 3478 3479 typedef enum { 3479 PS_TIME_TAI, ///< seconds since 1970-01-01T00:00:00Z (Gregorian) 3480 PS_TIME_UTC, ///< seconds since 1970-01-01T00:00:00Z (Gregorian) 3480 PS_TIME_TAI, ///< seconds since 1970-01-01T00:00:00Z (Gregorian), SI seconds 3481 PS_TIME_UTC, ///< seconds since 1970-01-01T00:00:00Z (Gregorian), SI seconds + leapseconds 3482 PS_TIME_UT1, ///< seconds since 1970-01-01T00:00:00Z (Gregorian), variable length seconds 3483 PS_TIME_TT, ///< seconds since 1970-01-01T00:00:00Z (Gregorian), SI seconds 3481 3484 } psTimeType; 3485 3486 typedef enum { 3487 PS_IERS_A, ///< IERS Bulliten A 3488 PS_IERS_B, ///< IERS Bulliten B 3489 } psTimeBulliten; 3482 3490 3483 3491 typedef struct { 3484 3492 psS64 sec; ///< seconds, negative values represent dates before 1970 3485 psU32 usec; ///< microseconds 3493 psU32 nsec; ///< nanseconds 3494 bool leapsecond; ///< if time falls on a UTC leapsecond 3486 3495 psTimeType type; ///< type of time 3487 3496 } psTime; 3488 3497 \end{verbatim} 3489 3498 3490 The corresponding constructor shall be: 3499 \subsubsection{Constructors} 3500 3501 To allocate a new, initalized to zero, \code{psTime}: 3502 3491 3503 \begin{verbatim} 3492 3504 psTime *psTimeAlloc(psTimeType type); 3493 3505 \end{verbatim} 3494 3506 3495 \subsubsection{Current Date and Time} 3496 3497 Get the current time (in given system): 3498 3499 \begin{verbatim} 3500 psTime *psTimeGetTime(psTimeType type); 3507 To allocate a new \code{psTime} set to the current time (in the given system): 3508 3509 \begin{verbatim} 3510 psTime *psTimeGetNow(psTimeType type); 3501 3511 \end{verbatim} 3502 3512 … … 3504 3514 3505 3515 Converting between the \code{psTime} time systems is done with: 3516 3506 3517 \begin{verbatim} 3507 3518 psTime *psTimeConvert(psTime *time, psTimeType type); 3508 3519 \end{verbatim} 3509 This function may be used to convert between \code{PS_TIME_TAI} and 3510 \code{PS_TIME_UTC} time representations. The \code{time} is modified 3511 and returned. 3512 3513 To convert to Local Mean Sidereal Time, it is necessary to provide the 3514 local longitude (specified in radians, positive East of Greenwich) as 3515 well: 3516 % 3517 \begin{verbatim} 3518 psF64 *psTimeToLST(psTime *time, psF64 longitude); 3519 \end{verbatim} 3520 % 3521 The functions may accept either \code{psTimeType}. The \code{time} is 3522 modified and returned. Note that this function must supply the value 3523 UT1-UTC, which is available externally (see \code{psTimeGetUT1Delta}). 3524 The following utility function encapsulates the PSLib mechanism to 3525 extract the value of UT1-UTC: 3526 \begin{verbatim} 3527 double psTimeGetUT1Delta(const psTime *time); 3528 psSphere *psTimeGetPoleCoords(const psTime *time); 3529 \end{verbatim} 3530 3531 Leap seconds are added to UTC in order to keep it within 0.9s of UT1 3532 (which is defined relative to the Earth's rotation, and hence is 3533 useful for astronomical purposes). The following function, 3534 \code{psTimeLeapSeconds}, shall calculate the number of leap seconds 3535 added between two times: 3536 % 3537 \begin{verbatim} 3538 long psTimeLeapSeconds(const psTime *time1, const psTime *time2); 3539 \end{verbatim} 3520 3521 This function may be used to convert between the various \code{psTimeType} time 3522 representations. The \code{time} is modified and returned. Conversion between 3523 all of the \emph{SI} length second systems should be implimented as first 3524 converting to TAI and then to the destination system. UT1 is a special case 3525 for conversion as it uses variable length secounds. Conversation to UT1, via 3526 TAI, is allowed but conversion \emph{from} UT1 is currently forbidden. 3527 3528 To convert to Local Mean Sidereal Time, it is necessary to provide the local 3529 longitude (specified in radians, positive East of Greenwich) as well: 3530 3531 \begin{verbatim} 3532 psF64 *psTimeToLMST(psTime *time, psF64 longitude); 3533 \end{verbatim} 3534 3535 The function may accept any of the \code{psTimeType} types with \emph{SI} 3536 length seconds. The \code{time} is modified and returned. Note that this 3537 function must supply the value $UT1-UTC$, which is available externally (see 3538 \code{psTimeGetUT1Delta()}) and should use the UT1 values interpolated from 3539 IERS bulliten B. The following utility function encapsulates the PSLib 3540 mechanism to extract the value of $UT1-UTC$: 3541 3542 \begin{verbatim} 3543 double psTimeGetUT1Delta(const psTime *time, psTimeBulliten bulliten); 3544 psSphere *psTimeGetPoleCoords(const psTime *time, psTimeBulliten bulliten); 3545 \end{verbatim} 3546 3547 Leap seconds are added to UTC in order to keep it within $0.9s$ of UT1 (which 3548 is defined relative to the Earth's rotation, and hence is useful for 3549 astronomical purposes). 3550 3551 \begin{verbatim} 3552 long psTimeLeapSecondDelta(const psTime *time1, const psTime *time2); 3553 \end{verbatim} 3554 3555 This function calculates the absolute number of leap seconds different between 3556 two times. 3557 3558 \begin{verbatim} 3559 bool psTimeIsLeapSecond(const psTime *utc); 3560 \end{verbatim} 3561 3562 This function only accepts \code{PS_TIME_UTC} objects and determines if the 3563 time is potentaly a leapsecond. 3540 3564 3541 3565 \subsubsection{External Date and Time Formats} 3542 3566 3543 3567 A collection of functions convert from the \code{psTime} types to various 3544 external formats. Note that ISO8601 format is "YYYY-MM-DDThh:mm:ss,sZ" 3568 external formats. The ISO8601 format\footnote{ISO8601:2000(E) - 3569 http://www.pvv.ntnu.no/~nsaa/8601v2000.pdf} we will be using is 3570 "YYYY-MM-DDThh:mm:ss,sZ". \emph{Note that the ISO8601 format is only valid for 3571 the years $0000 .. 9999$. Values out side that range should cause a 3572 \code{NULL} pointer to be returned.} 3545 3573 3546 3574 \begin{verbatim} 3547 3575 psF64 psTimeToJD(const psTime *time); 3548 3576 psF64 psTimeToMJD(const psTime *time); 3549 char *psTimeToISO Time(const psTime *time);3577 char *psTimeToISO(const psTime *time); 3550 3578 timeval *psTimeToTimeval(const psTime *time); 3551 3579 \end{verbatim} 3580 3581 The \code{psTimeToISO()} function will convertion \code{PS_TIME_UTC} objects 3582 with the \code{leapsecond} flag set to represent the number of seconds as 3583 ``:60''. 3552 3584 3553 3585 \subsubsection{Date and Time Parsing} … … 3561 3593 psTime *psTimeFromISO(const char *input); 3562 3594 psTime *psTimeFromTimeval(const timeval *input); 3563 \end{verbatim} 3595 psTime *psTimeFromUTC(psS64 sec, psU32 nsec, bool leapsecond); 3596 psTime *psTimeFromTT(psS64 sec, psU32 nsec); 3597 \end{verbatim} 3598 3599 Where \code{psTimeFromUTC()} will validate that it is possible for the input 3600 time to land on a UTC leapsecond (using \code{psTimeIsLeapSecond()}) if 3601 \code{leapsecond} is set to \code{true}. 3564 3602 3565 3603 \subsubsection{Date and Time Math} … … 3569 3607 psF64 psTimeDelta(const psTime *time1, const psTime *time2); 3570 3608 \end{verbatim} 3571 \code{psTimeMath} adds the \code{delta} (in seconds; may be negative) 3572 to a \code{psTime}. \code{psTimeDelta} gives 3573 the difference between times \code{time1} and \code{time2} (which may 3574 be negative). 3575 3576 Note that in both these, the difference between two times is to be 3577 expressed in \textit{SI} seconds, and not inclusive of leap seconds. 3578 For example, if we add 30 seconds to 1998-12-31T23:59:45Z, the result 3579 is 1999-01-01T00:00:14Z, since a leap second was introduced at 3580 1999-01-01T00:00:00Z. 3581 3582 Time math may only be done on the \code{psTime} TAI type, and so the 3583 functions shall internally convert the \code{psTime} inputs to TAI 3584 before performing the math; this is in order that leap seconds are 3585 accounted for. 3586 3587 The type of the time returned by \code{psTimeMath} shall be the same 3588 as that of the input \code{time}. 3609 3610 \code{psTimeMath} adds the \code{delta} (in seconds; may be negative) to a 3611 \code{psTime}. \code{PS_TIME_UTC} objects will be converted to 3612 \code{PS_TIME_TAI}, before applying the delta, and then back to 3613 \code{PS_TIME_UTC}. \code{psTimeDelta} gives the difference between times 3614 \code{time1} and \code{time2} (which may be negative). 3615 3616 The API documentation should note that when handling UT1, date math is allowed 3617 on the UT1 system but that the seconds are not of \emph{SI} length (this is why 3618 conversion from UT1 is correctly forbidden). It should also be noted that with 3619 \code{psTimeDelta()} it is possible to overflow the dynamic range of a 3620 \code{psS64} (the type of \code{psTime.sec}). 3621 3622 Note that in both these functions, when handling UTC, that the difference 3623 between two times is not inclusive of leap seconds. For example, if we add 30 3624 seconds to 1998-12-31T23:59:45Z, the result is 1999-01-01T00:00:14Z, since a 3625 leap second was introduced at 1999-01-01T00:00:00Z. 3626 3627 Time math may only be done on the of \code{psTime} objects of the same type, 3628 and in the case of UT1, the functions shall internally convert the 3629 \code{psTime} inputs to TAI before performing the math; this is in order that 3630 leap seconds are accounted for. 3631 3632 The type of the time returned by \code{psTimeMath} shall be the same as that of 3633 the input \code{time}. 3589 3634 3590 3635 3591 3636 \subsubsection{Time Tables} 3592 3637 3593 The offset of UTC from UT1, $\Delta $UT = UT1-UTC, as well as the polar3594 motion, $x_p$ and $y_p$, may be determined from table lookups. Tables 3595 are available covering different time periods and with different time 3596 resolution, and so it is important to be able to utilise multiple 3597 tables. Some tables may be foundat:3638 The offset of UTC from UT1, $\Delta UT = UT1-UTC$, as well as the polar motion, 3639 $x_p$ and $y_p$, may be determined from table lookups. Tables are available 3640 covering different time periods and with different time resolution, and so it 3641 is important to be able to utilise multiple tables. Some tables may be found 3642 at: 3598 3643 3599 3644 \begin{itemize} 3600 \item \code{ftp://maia.usno.navy.mil/ser7/ser7.dat} 3601 \item \code{ftp://maia.usno.navy.mil/ser7/finals.all} with explanatory 3602 guide at \code{ftp://maia.usno.navy.mil/ser7/readme.finals} . See also 3603 the web page \code{http://maia.usno.navy.mil/}. 3645 \item IERS Bulliten A \& B (1 year ago $\rightarrow$ now + $\sim$3 months) 3646 \begin{itemize} 3647 \item \code{ftp://maia.usno.navy.mil/ser7/finals.daily} 3648 \end{itemize} 3649 3650 \item IERS Bulliten A \& B (1973-1-2 $\rightarrow$ now + $\sim$1 year) 3651 \begin{itemize} 3652 \item \code{ftp://maia.usno.navy.mil/ser7/finals.all} 3653 \end{itemize} 3654 3655 \item $TAI - UTC$ 3656 \begin{itemize} 3657 \item \code{ftp://maia.usno.navy.mil/ser7/tai-utc.dat} 3658 \end{itemize} 3659 3660 \item $TAI -UTC$ (contains estimates prior to 1972) 3661 \begin{itemize} 3604 3662 \item \code{http://hpiers.obspm.fr/eoppc/eop/eopc01/eopc01.1900-2004} 3605 (contains estimates prior to 1972).3606 3663 \end{itemize} 3664 \end{itemize} 3665 3666 The format of \code{finals.daily} and \code{finals.all} is documented at 3667 \code{ftp://maia.usno.navy.mil/ser7/readme.finals}. 3607 3668 3608 3669 The tables shall reside on local disk in known locations (i.e., there … … 3614 3675 3615 3676 \begin{verbatim} 3616 # Bulletin A, 9 September 2004.3617 # ftp://maia.usno.navy.mil/ser7/ ser7.dat3618 # MJD XP(") YP(") UT1-UTC(s)3619 53258 0.1715 0.4774 -0.45092 3620 53 259 0.1734 0.4757 -0.450393621 53 260 0.1753 0.4741 -0.450123622 53 261 0.1770 0.4724 -0.450153623 53 262 0.1787 0.4708 -0.450453677 # finals.daily, 2005-03-17 3678 # ftp://maia.usno.navy.mil/ser7/finals.daily 3679 # MJD PM-IP PM-X" PM-Y" UT1-YP UT1-UTCs PM-X" PM-Y" UT1-UTCs 3680 # A A A A A B B B 3681 53403.00 I .089198 .207785 I -.5218847 .089220 .207360 -.5219040 3682 53404.00 I .086549 .206873 I -.5224164 .086670 .206850 -.5224260 3683 53405.00 I .083589 .206143 I -.5227681 3684 53406.00 I .081541 .205865 I -.5229582 3624 3685 \end{verbatim} 3625 3686
Note:
See TracChangeset
for help on using the changeset viewer.
