File: palDt.c

package info (click to toggle)
starlink-pal 0.9.8-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,808 kB
  • sloc: ansic: 6,689; makefile: 128; sh: 81
file content (125 lines) | stat: -rw-r--r-- 3,631 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
*+
*  Name:
*     palDt

*  Purpose:
*     Estimate the offset between dynamical time and UT

*  Language:
*     Starlink ANSI C

*  Type of Module:
*     Library routine

*  Invocation:
*     double palDt( double epoch );

*  Arguments:
*     epoch = double (Given)
*        Julian epoch (e.g. 1850.0)

*  Returned Value:
*     palDt = double
*        Rough estimate of ET-UT (after 1984, TT-UT) at the
*        given epoch, in seconds.

*  Description:
*     Estimate the offset between dynamical time and Universal Time
*     for a given historical epoch.

*  Authors:
*     TIMJ: Tim Jenness (JAC, Hawaii)
*     PTW: Patrick T. Wallace
*     {enter_new_authors_here}

*  Notes:
*     - Depending on the epoch, one of three parabolic approximations
*       is used:
*
*         before 979    Stephenson & Morrison's 390 BC to AD 948 model
*         979 to 1708   Stephenson & Morrison's 948 to 1600 model
*         after 1708    McCarthy & Babcock's post-1650 model
*
*       The breakpoints are chosen to ensure continuity:  they occur
*       at places where the adjacent models give the same answer as
*       each other.
*     - The accuracy is modest, with errors of up to 20 sec during
*       the interval since 1650, rising to perhaps 30 min by 1000 BC.
*       Comparatively accurate values from AD 1600 are tabulated in
*       the Astronomical Almanac (see section K8 of the 1995 AA).
*     - The use of double-precision for both argument and result is
*       purely for compatibility with other SLALIB time routines.
*     - The models used are based on a lunar tidal acceleration value
*       of -26.00 arcsec per century.
*
*  See Also:
*     Explanatory Supplement to the Astronomical Almanac,
*     ed P.K.Seidelmann, University Science Books (1992),
*     section 2.553, p83.  This contains references to
*     the Stephenson & Morrison and McCarthy & Babcock
*     papers.

*  History:
*     2012-03-08 (TIMJ):
*        Initial version with documentation from SLA/F.
*        Adapted with permission from the Fortran SLALIB library.
*     {enter_further_changes_here}

*  Copyright:
*     Copyright (C) 1995 Rutherford Appleton Laboratory
*     Copyright (C) 2012 Science and Technology Facilities Council.
*     All Rights Reserved.

*  Licence:
*     This program is free software; you can redistribute it and/or
*     modify it under the terms of the GNU General Public License as
*     published by the Free Software Foundation; either version 3 of
*     the License, or (at your option) any later version.
*
*     This program is distributed in the hope that it will be
*     useful, but WITHOUT ANY WARRANTY; without even the implied
*     warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
*     PURPOSE. See the GNU General Public License for more details.
*
*     You should have received a copy of the GNU General Public License
*     along with this program; if not, write to the Free Software
*     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
*     MA 02110-1301, USA.

*  Bugs:
*     {note_any_bugs_here}
*-
*/

#include "pal.h"

double palDt ( double epoch ) {

  double t,w,s;

  /* Centuries since 1800 */
  t = (epoch - 1800.0) / 100.0;

  /* Select model */
  if ( epoch >= 1708.185161980887 ) {

    /* Post-1708: use McCarthy & Babcock */
    w = t - 0.19;
    s = 5.156 + 13.3066 * w * w;

  } else if ( epoch >= 979.0258204760233 ) {

    /* 978-1708: use Stephenson & Morrison's 948-1600 model */
    s = 25.5 * t * t;

  } else {

    /* Pre-979: use Stephenson & Morrison's 390 BC to AD 948 model */
    s = 1360.0 + (320.0 + 44.3*t) * t;

  }

  return s;

}