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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! Time code.
pub use S06;
use crate*;
/// Julian Date to Julian Epoch. (`eraEpj`)
///
/// Given:
/// * `dj1`,`dj2`: Julian Date (see note)
///
/// Returned (function value):
/// * Julian Epoch
///
/// # Note:
///
/// * The Julian Date is supplied in two pieces, in the usual ERFA manner, which
/// is designed to preserve time resolution. The Julian Date is available as
/// a single number by adding `dj1` and `dj2`. The maximum resolution is
/// achieved if `dj1` is 2451545.0 (J2000.0).
///
/// # Reference:
///
/// * Lieske, J.H., 1979, Astron.Astrophys. 73, 282.
///
/// Julian Epoch to Julian Date. (`eraEpj2jd`)
///
/// Given:
/// * `epj`: Julian Epoch (e.g. 1996.8)
///
/// Returned:
/// * `djm0`: MJD zero-point: always 2400000.5
/// * `djm`: Modified Julian Date
///
/// # Note:
///
/// * The Julian Date is returned in two pieces, in the usual ERFA manner, which
/// is designed to preserve time resolution. The Julian Date is available as
/// a single number by adding `djm0` and `djm`.
///
/// # Reference:
///
/// * Lieske, J.H., 1979, Astron.Astrophys. 73, 282.
///
/// Greenwich apparent sidereal time (consistent with IAU 2000 and 2006
/// resolutions). (`eraGst06a`)
///
/// Given:
/// * `uta`,`utb`: UT1 as a 2-part Julian Date (Notes 1,2)
/// * `tta`,`ttb`: TT as a 2-part Julian Date (Notes 1,2)
///
/// Returned:
/// * Greenwich apparent sidereal time (radians)
///
/// # Notes:
///
/// 1) The UT1 and TT dates `uta+utb` and `tta+ttb` respectively, are both
/// Julian Dates, apportioned in any convenient way between the argument
/// pairs. For example, `JD(UT1)=2450123.7` could be expressed in any of
/// these ways, among others:
///
/// | `uta` | `utb` | |
/// |-----------|---------|--------------------|
/// | 2450123.7 | 0.0 | JD method |
/// | 2451545.0 | -1421.3 | J2000 method |
/// | 2400000.5 | 50123.2 | MJD method |
/// | 2450123.5 | 0.2 | date & time method |
///
/// The JD method is the most natural and convenient to use in cases where
/// the loss of several decimal digits of resolution is acceptable (in the
/// case of UT; the TT is not at all critical in this respect). The J2000
/// and MJD methods are good compromises between resolution and convenience.
/// For UT, the date & time method is best matched to the algorithm that is
/// used by the Earth rotation angle function, called internally: maximum
/// precision is delivered when the `uta` argument is for 0hrs UT1 on the day
/// in question and the utb argument lies in the range 0 to 1, or vice versa.
///
/// 2) Both UT1 and TT are required, UT1 to predict the Earth rotation and TT to
/// predict the effects of precession-nutation. If UT1 is used for both
/// purposes, errors of order 100 microarcseconds result.
///
/// 3) This GAST is compatible with the IAU 2000/2006 resolutions and must be
/// used only in conjunction with IAU 2006 precession and IAU 2000A nutation.
///
/// 4) The result is returned in the range 0 to 2pi.
///
/// # Reference:
///
/// * Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
///
/// Greenwich apparent sidereal time, IAU 2006, given the NPB matrix.
/// (`eraGst06`)
///
/// Given:
/// * `uta`,`utb`: UT1 as a 2-part Julian Date (Notes 1,2)
/// * `tta`,`ttb`: TT as a 2-part Julian Date (Notes 1,2)
/// * `rnpb`: nutation x precession x bias matrix
///
/// Returned:
/// * Greenwich apparent sidereal time (radians)
///
/// # Notes:
///
/// 1) The UT1 and TT dates `uta+utb` and `tta+ttb` respectively, are both
/// Julian Dates, apportioned in any convenient way between the argument
/// pairs. For example, `JD(UT1)=2450123.7` could be expressed in any of
/// these ways, among others:
///
/// | `uta` | `utb` | |
/// |-----------|---------|--------------------|
/// | 2450123.7 | 0.0 | JD method |
/// | 2451545.0 | -1421.3 | J2000 method |
/// | 2400000.5 | 50123.2 | MJD method |
/// | 2450123.5 | 0.2 | date & time method |
///
/// The JD method is the most natural and convenient to use in cases where
/// the loss of several decimal digits of resolution is acceptable (in the
/// case of UT; the TT is not at all critical in this respect). The J2000
/// and MJD methods are good compromises between resolution and convenience.
/// For UT, the date & time method is best matched to the algorithm that is
/// used by the Earth rotation angle function, called internally: maximum
/// precision is delivered when the `uta` argument is for 0hrs UT1 on the day
/// in question and the utb argument lies in the range 0 to 1, or vice versa.
///
/// 2) Both UT1 and TT are required, UT1 to predict the Earth rotation and TT to
/// predict the effects of precession-nutation. If UT1 is used for both
/// purposes, errors of order 100 microarcseconds result.
///
/// 3) Although the function uses the IAU 2006 series for s+XY/2, it is
/// otherwise independent of the precession-nutation model and can in
/// practice be used with any equinox-based NPB matrix.
///
/// 4) The result is returned in the range 0 to 2pi.
///
/// # Reference:
///
/// * Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
///
/// Greenwich mean sidereal time (consistent with IAU 2006 precession).
/// (`eraGmst06`)
///
/// Given:
/// * `uta`,`utb`: UT1 as a 2-part Julian Date (Notes 1,2)
/// * `tta`,`ttb`: TT as a 2-part Julian Date (Notes 1,2)
///
/// Returned:
/// * Greenwich mean sidereal time (radians)
///
/// # Notes:
///
/// 1) The UT1 and TT dates `uta+utb` and `tta+ttb` respectively, are both
/// Julian Dates, apportioned in any convenient way between the argument
/// pairs. For example, `JD=2450123.7` could be expressed in any of these
/// ways, among others:
///
/// | Part A | Part B | |
/// |-----------|---------|--------------------|
/// | 2450123.7 | 0.0 | JD method |
/// | 2451545.0 | -1421.3 | J2000 method |
/// | 2400000.5 | 50123.2 | MJD method |
/// | 2450123.5 | 0.2 | date & time method |
///
/// The JD method is the most natural and convenient to use in cases where
/// the loss of several decimal digits of resolution is acceptable (in the
/// case of UT; the TT is not at all critical in this respect). The J2000
/// and MJD methods are good compromises between resolution and convenience.
/// For UT, the date & time method is best matched to the algorithm that is
/// used by the Earth rotation angle function, called internally: maximum
/// precision is delivered when the `uta` argument is for 0hrs UT1 on the day
/// in question and the utb argument lies in the range 0 to 1, or vice versa.
///
/// 2) Both UT1 and TT are required, UT1 to predict the Earth rotation and TT to
/// predict the effects of precession. If UT1 is used for both purposes,
/// errors of order 100 microarcseconds result.
///
/// 3) This GMST is compatible with the IAU 2006 precession and must not be used
/// with other precession models.
///
/// 4) The result is returned in the range 0 to 2pi.
///
/// # Reference:
///
/// * Capitaine, N., Wallace, P.T. & Chapront, J., 2005, Astron.Astrophys. 432,
/// 355
///