@interstellar-tools/temporal 1.1.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  Time and epoch utilities for space applications, from attoseconds to gigayears,
4
4
  with unit normalisation and conversion that the rest of the stack builds on, and
5
- Julian dates on the UTC, TAI, TT and UT1 time scales, with leap seconds.
5
+ Julian dates on the UTC, TAI, TT, UT1, TDB and GPS time scales, with leap
6
+ seconds.
6
7
 
7
8
  ## Documentation
8
9
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './convert-temporal-unit.js';
2
+ export * from './mars-time.js';
2
3
  export * from './normalize-temporal-unit.js';
3
4
  export * from './time-scales.js';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAE3C,cAAc,8BAA8B,CAAC;AAE7C,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAE3C,cAAc,gBAAgB,CAAC;AAE/B,cAAc,8BAA8B,CAAC;AAE7C,cAAc,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './convert-temporal-unit.js';
2
+ export * from './mars-time.js';
2
3
  export * from './normalize-temporal-unit.js';
3
4
  export * from './time-scales.js';
4
5
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAE3C,cAAc,8BAA8B,CAAC;AAE7C,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAE3C,cAAc,gBAAgB,CAAC;AAE/B,cAAc,8BAA8B,CAAC;AAE7C,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,160 @@
1
+ import type { Radians } from '@interstellar-tools/types';
2
+ /**
3
+ * The **Mars Sol Date** of a moment: a continuous count of sols, Mars's mean
4
+ * solar days, like the Julian date for Earth.
5
+ *
6
+ * $$
7
+ * \mathrm{MSD} = \frac{\mathrm{JD_{TT}} - 2\,451\,549.5}{1.0274912517} + 44\,796.0 - 0.0009626
8
+ * $$
9
+ *
10
+ * Where:
11
+ * - $ \mathrm{JD_{TT}} $ is the Julian date in Terrestrial Time (days)
12
+ * - $ 1.0274912517 $ is the sol in Earth days, {@link "@interstellar-tools/constants"!MARS_SOL_DAYS | MARS_SOL_DAYS}
13
+ *
14
+ * ::: info Notes
15
+ *
16
+ * - The count starts on 29 December 1873, at about noon in Greenwich.
17
+ * - Each new sol begins at mean midnight at Airy-0, when
18
+ * {@link coordinatedMarsTime} wraps to 0.
19
+ * - From NASA GISS's Mars24 algorithm, refined from Allison & McEwen (2000).
20
+ *
21
+ * :::
22
+ *
23
+ * @param date - The moment, as a UTC `Date` (on or after 1972-01-01).
24
+ * @returns The Mars Sol Date in **sols**.
25
+ * @throws {TypeError} If `date` is not a valid `Date`.
26
+ * @throws {RangeError} If `date` is before 1972-01-01, where TT isn't defined from the leap seconds.
27
+ * @group Mars time
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * marsSolDate(new Date('2000-01-06T00:00:00Z')); // ≈ 44 795.99976
32
+ * ```
33
+ *
34
+ * @see {@link coordinatedMarsTime}
35
+ * @see https://www.giss.nasa.gov/tools/mars24/help/algorithm.html Mars24 algorithm
36
+ */
37
+ export declare const marsSolDate: (date: Date) => number;
38
+ /**
39
+ * **Coordinated Mars Time** (MTC): the mean solar time at Mars's prime
40
+ * meridian, Airy-0, in hours, like UTC is at Greenwich.
41
+ *
42
+ * $$
43
+ * \mathrm{MTC} = 24 \times (\mathrm{MSD} \bmod 1)
44
+ * $$
45
+ *
46
+ * ::: info Notes
47
+ *
48
+ * - A Mars hour is a 24th of a sol: 1 h 1 m 39 s of Earth time.
49
+ * - It's mean time: the real Sun can be up to about 50 minutes ahead of or behind it,
50
+ * because of Mars's eccentric orbit and tilt, the equation of time.
51
+ *
52
+ * :::
53
+ *
54
+ * @param date - The moment, as a UTC `Date` (on or after 1972-01-01).
55
+ * @returns The time at Airy-0 in **Mars hours**, from 0 up to 24.
56
+ * @throws {TypeError} If `date` is not a valid `Date`.
57
+ * @throws {RangeError} If `date` is before 1972-01-01.
58
+ * @group Mars time
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * // Mars24's first worked example: 23:59:39 at Airy-0
63
+ * coordinatedMarsTime(new Date('2000-01-06T00:00:00Z')); // ≈ 23.99425 h
64
+ * ```
65
+ *
66
+ * @see {@link marsSolDate}
67
+ * @see {@link marsLocalMeanSolarTime}
68
+ */
69
+ export declare const coordinatedMarsTime: (date: Date) => number;
70
+ /**
71
+ * The **local mean solar time on Mars** at a longitude, in hours: Coordinated
72
+ * Mars Time plus the east longitude in hours, 15° to the hour.
73
+ *
74
+ * $$
75
+ * \mathrm{LMST} = \left( \mathrm{MTC} + \lambda \, \frac{24\ \mathrm{h}}{2\pi} \right) \bmod 24\ \mathrm{h}
76
+ * $$
77
+ *
78
+ * Where:
79
+ * - $ \lambda $ is the planetocentric east longitude (rad)
80
+ *
81
+ * ::: info Notes
82
+ *
83
+ * - **East longitude**, as the IAU gives it for Mars. Mars24 counts west
84
+ * longitude, so 184.702° W there is 175.298° E here.
85
+ * - It's mean time, by a Sun that moves evenly. The real Sun can be up to about
86
+ * 50 minutes ahead of or behind it.
87
+ *
88
+ * :::
89
+ *
90
+ * @param date - The moment, as a UTC `Date` (on or after 1972-01-01).
91
+ * @param longitude - The east longitude in **radians** (finite; any turn).
92
+ * @returns The local mean solar time in **Mars hours**, from 0 up to 24.
93
+ * @throws {TypeError} If `date` is not a valid `Date`, or `longitude` is not a finite number.
94
+ * @throws {RangeError} If `date` is before 1972-01-01.
95
+ * @group Mars time
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * const DEG = Math.PI / 180;
100
+ *
101
+ * // Spirit's site, at local midnight on Earth's clock: 00:51 mean time
102
+ * marsLocalMeanSolarTime(
103
+ * new Date('2004-01-03T13:46:31Z'),
104
+ * (175.298 * DEG) as Radians
105
+ * ); // ≈ 0.8519 h
106
+ * ```
107
+ *
108
+ * @see {@link coordinatedMarsTime}
109
+ * @see {@link missionSol}
110
+ */
111
+ export declare const marsLocalMeanSolarTime: (date: Date, longitude: Radians) => number;
112
+ /**
113
+ * The **mission sol** at a landing site: the number of the sol a rover is on,
114
+ * counted from its landing.
115
+ *
116
+ * $$
117
+ * \text{sol} = s_0 + \lfloor \mathrm{MSD} + \lambda / 2\pi \rfloor - \lfloor \mathrm{MSD_{landing}} + \lambda / 2\pi \rfloor
118
+ * $$
119
+ *
120
+ * Where:
121
+ * - $ s_0 $ is the number of the landing sol
122
+ * - $ \lambda $ is the east longitude of the mission's clock (rad)
123
+ *
124
+ * ::: info Notes
125
+ *
126
+ * - A new sol begins at local mean midnight at the site.
127
+ * - **Sol 0 or sol 1?** Curiosity and Perseverance call their landing sol 0.
128
+ * Spirit and Opportunity called it sol 1.
129
+ * - Before landing, the count goes below the landing sol.
130
+ * - Spirit and Opportunity ran on a hybrid of true solar time, a few minutes
131
+ * off mean time: close to their midnights, their count can differ by one.
132
+ *
133
+ * :::
134
+ *
135
+ * @param date - The moment, as a UTC `Date` (on or after 1972-01-01).
136
+ * @param landingDate - The moment of landing, as a UTC `Date` (on or after 1972-01-01).
137
+ * @param longitude - The east longitude of the mission's clock in **radians** (finite).
138
+ * @param firstSol - The number of the landing sol: 0 or 1 (an integer). Defaults to 0.
139
+ * @returns The sol number, an integer.
140
+ * @throws {TypeError} If a date is not a valid `Date`, `longitude` is not a finite number, or `firstSol` is not an integer.
141
+ * @throws {RangeError} If a date is before 1972-01-01.
142
+ * @group Mars time
143
+ *
144
+ * @example
145
+ * ```ts
146
+ * const DEG = Math.PI / 180;
147
+ *
148
+ * // Curiosity landed in Gale crater, its clock at 137.42° E
149
+ * missionSol(
150
+ * new Date('2015-05-30T12:00:00Z'),
151
+ * new Date('2012-08-06T05:17:57Z'),
152
+ * (137.42 * DEG) as Radians
153
+ * ); // 1000
154
+ * ```
155
+ *
156
+ * @see {@link marsLocalMeanSolarTime}
157
+ * @see https://www.giss.nasa.gov/tools/mars24/help/notes.html Mars24 technical notes, on mission sols
158
+ */
159
+ export declare const missionSol: (date: Date, landingDate: Date, longitude: Radians, firstSol?: number) => number;
160
+ //# sourceMappingURL=mars-time.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mars-time.d.ts","sourceRoot":"","sources":["../src/mars-time.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAiBzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,IAAI,KAAG,MAEvB,CAAC;AAEnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,IAAI,KAAG,MACf,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,sBAAsB,GACjC,MAAM,IAAI,EACV,WAAW,OAAO,KACjB,MAIF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,eAAO,MAAM,UAAU,GACrB,MAAM,IAAI,EACV,aAAa,IAAI,EACjB,WAAW,OAAO,EAClB,iBAAY,KACX,MAUF,CAAC"}
@@ -0,0 +1,181 @@
1
+ import { MARS_SOL_DAYS } from '@interstellar-tools/constants';
2
+ import { julianDate } from './time-scales.js';
3
+ // Mars24's reference: MSD 44 796.0 − 0.0009626 at JD 2451549.5 TT, the start
4
+ // of 6 January 2000 on Earth
5
+ const MSD_REFERENCE_JD_TT = 2451549.5;
6
+ const MSD_AT_REFERENCE = 44796 - 0.0009626;
7
+ const TWO_PI = 2 * Math.PI;
8
+ const fraction = (x) => x - Math.floor(x);
9
+ const assertLongitude = (longitude) => {
10
+ if (!Number.isFinite(longitude))
11
+ throw new TypeError(`longitude must be a finite number. Received: ${longitude}`);
12
+ };
13
+ /**
14
+ * The **Mars Sol Date** of a moment: a continuous count of sols, Mars's mean
15
+ * solar days, like the Julian date for Earth.
16
+ *
17
+ * $$
18
+ * \mathrm{MSD} = \frac{\mathrm{JD_{TT}} - 2\,451\,549.5}{1.0274912517} + 44\,796.0 - 0.0009626
19
+ * $$
20
+ *
21
+ * Where:
22
+ * - $ \mathrm{JD_{TT}} $ is the Julian date in Terrestrial Time (days)
23
+ * - $ 1.0274912517 $ is the sol in Earth days, {@link "@interstellar-tools/constants"!MARS_SOL_DAYS | MARS_SOL_DAYS}
24
+ *
25
+ * ::: info Notes
26
+ *
27
+ * - The count starts on 29 December 1873, at about noon in Greenwich.
28
+ * - Each new sol begins at mean midnight at Airy-0, when
29
+ * {@link coordinatedMarsTime} wraps to 0.
30
+ * - From NASA GISS's Mars24 algorithm, refined from Allison & McEwen (2000).
31
+ *
32
+ * :::
33
+ *
34
+ * @param date - The moment, as a UTC `Date` (on or after 1972-01-01).
35
+ * @returns The Mars Sol Date in **sols**.
36
+ * @throws {TypeError} If `date` is not a valid `Date`.
37
+ * @throws {RangeError} If `date` is before 1972-01-01, where TT isn't defined from the leap seconds.
38
+ * @group Mars time
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * marsSolDate(new Date('2000-01-06T00:00:00Z')); // ≈ 44 795.99976
43
+ * ```
44
+ *
45
+ * @see {@link coordinatedMarsTime}
46
+ * @see https://www.giss.nasa.gov/tools/mars24/help/algorithm.html Mars24 algorithm
47
+ */
48
+ export const marsSolDate = (date) => (julianDate(date, 'TT') - MSD_REFERENCE_JD_TT) / MARS_SOL_DAYS +
49
+ MSD_AT_REFERENCE;
50
+ /**
51
+ * **Coordinated Mars Time** (MTC): the mean solar time at Mars's prime
52
+ * meridian, Airy-0, in hours, like UTC is at Greenwich.
53
+ *
54
+ * $$
55
+ * \mathrm{MTC} = 24 \times (\mathrm{MSD} \bmod 1)
56
+ * $$
57
+ *
58
+ * ::: info Notes
59
+ *
60
+ * - A Mars hour is a 24th of a sol: 1 h 1 m 39 s of Earth time.
61
+ * - It's mean time: the real Sun can be up to about 50 minutes ahead of or behind it,
62
+ * because of Mars's eccentric orbit and tilt, the equation of time.
63
+ *
64
+ * :::
65
+ *
66
+ * @param date - The moment, as a UTC `Date` (on or after 1972-01-01).
67
+ * @returns The time at Airy-0 in **Mars hours**, from 0 up to 24.
68
+ * @throws {TypeError} If `date` is not a valid `Date`.
69
+ * @throws {RangeError} If `date` is before 1972-01-01.
70
+ * @group Mars time
71
+ *
72
+ * @example
73
+ * ```ts
74
+ * // Mars24's first worked example: 23:59:39 at Airy-0
75
+ * coordinatedMarsTime(new Date('2000-01-06T00:00:00Z')); // ≈ 23.99425 h
76
+ * ```
77
+ *
78
+ * @see {@link marsSolDate}
79
+ * @see {@link marsLocalMeanSolarTime}
80
+ */
81
+ export const coordinatedMarsTime = (date) => 24 * fraction(marsSolDate(date));
82
+ /**
83
+ * The **local mean solar time on Mars** at a longitude, in hours: Coordinated
84
+ * Mars Time plus the east longitude in hours, 15° to the hour.
85
+ *
86
+ * $$
87
+ * \mathrm{LMST} = \left( \mathrm{MTC} + \lambda \, \frac{24\ \mathrm{h}}{2\pi} \right) \bmod 24\ \mathrm{h}
88
+ * $$
89
+ *
90
+ * Where:
91
+ * - $ \lambda $ is the planetocentric east longitude (rad)
92
+ *
93
+ * ::: info Notes
94
+ *
95
+ * - **East longitude**, as the IAU gives it for Mars. Mars24 counts west
96
+ * longitude, so 184.702° W there is 175.298° E here.
97
+ * - It's mean time, by a Sun that moves evenly. The real Sun can be up to about
98
+ * 50 minutes ahead of or behind it.
99
+ *
100
+ * :::
101
+ *
102
+ * @param date - The moment, as a UTC `Date` (on or after 1972-01-01).
103
+ * @param longitude - The east longitude in **radians** (finite; any turn).
104
+ * @returns The local mean solar time in **Mars hours**, from 0 up to 24.
105
+ * @throws {TypeError} If `date` is not a valid `Date`, or `longitude` is not a finite number.
106
+ * @throws {RangeError} If `date` is before 1972-01-01.
107
+ * @group Mars time
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * const DEG = Math.PI / 180;
112
+ *
113
+ * // Spirit's site, at local midnight on Earth's clock: 00:51 mean time
114
+ * marsLocalMeanSolarTime(
115
+ * new Date('2004-01-03T13:46:31Z'),
116
+ * (175.298 * DEG) as Radians
117
+ * ); // ≈ 0.8519 h
118
+ * ```
119
+ *
120
+ * @see {@link coordinatedMarsTime}
121
+ * @see {@link missionSol}
122
+ */
123
+ export const marsLocalMeanSolarTime = (date, longitude) => {
124
+ assertLongitude(longitude);
125
+ return 24 * fraction(marsSolDate(date) + longitude / TWO_PI);
126
+ };
127
+ /**
128
+ * The **mission sol** at a landing site: the number of the sol a rover is on,
129
+ * counted from its landing.
130
+ *
131
+ * $$
132
+ * \text{sol} = s_0 + \lfloor \mathrm{MSD} + \lambda / 2\pi \rfloor - \lfloor \mathrm{MSD_{landing}} + \lambda / 2\pi \rfloor
133
+ * $$
134
+ *
135
+ * Where:
136
+ * - $ s_0 $ is the number of the landing sol
137
+ * - $ \lambda $ is the east longitude of the mission's clock (rad)
138
+ *
139
+ * ::: info Notes
140
+ *
141
+ * - A new sol begins at local mean midnight at the site.
142
+ * - **Sol 0 or sol 1?** Curiosity and Perseverance call their landing sol 0.
143
+ * Spirit and Opportunity called it sol 1.
144
+ * - Before landing, the count goes below the landing sol.
145
+ * - Spirit and Opportunity ran on a hybrid of true solar time, a few minutes
146
+ * off mean time: close to their midnights, their count can differ by one.
147
+ *
148
+ * :::
149
+ *
150
+ * @param date - The moment, as a UTC `Date` (on or after 1972-01-01).
151
+ * @param landingDate - The moment of landing, as a UTC `Date` (on or after 1972-01-01).
152
+ * @param longitude - The east longitude of the mission's clock in **radians** (finite).
153
+ * @param firstSol - The number of the landing sol: 0 or 1 (an integer). Defaults to 0.
154
+ * @returns The sol number, an integer.
155
+ * @throws {TypeError} If a date is not a valid `Date`, `longitude` is not a finite number, or `firstSol` is not an integer.
156
+ * @throws {RangeError} If a date is before 1972-01-01.
157
+ * @group Mars time
158
+ *
159
+ * @example
160
+ * ```ts
161
+ * const DEG = Math.PI / 180;
162
+ *
163
+ * // Curiosity landed in Gale crater, its clock at 137.42° E
164
+ * missionSol(
165
+ * new Date('2015-05-30T12:00:00Z'),
166
+ * new Date('2012-08-06T05:17:57Z'),
167
+ * (137.42 * DEG) as Radians
168
+ * ); // 1000
169
+ * ```
170
+ *
171
+ * @see {@link marsLocalMeanSolarTime}
172
+ * @see https://www.giss.nasa.gov/tools/mars24/help/notes.html Mars24 technical notes, on mission sols
173
+ */
174
+ export const missionSol = (date, landingDate, longitude, firstSol = 0) => {
175
+ assertLongitude(longitude);
176
+ if (!Number.isInteger(firstSol))
177
+ throw new TypeError(`firstSol must be an integer. Received: ${firstSol}`);
178
+ const local = (moment) => Math.floor(marsSolDate(moment) + longitude / TWO_PI);
179
+ return firstSol + local(date) - local(landingDate);
180
+ };
181
+ //# sourceMappingURL=mars-time.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mars-time.js","sourceRoot":"","sources":["../src/mars-time.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAG9D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,6EAA6E;AAC7E,6BAA6B;AAC7B,MAAM,mBAAmB,GAAG,SAAW,CAAC;AACxC,MAAM,gBAAgB,GAAG,KAAM,GAAG,SAAW,CAAC;AAC9C,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,EA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AS,CAAC,QAAQ,CAAC;QAC7B,MAAM,IAAI,SAAS,CAAC,0CAA0C,QAAQ,EAAE,CAAC,CAAC;IAE5E,MAAM,KAAK,GAAG,CAAC,MAAY,EAAE,EAAE,CAC7B,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,GAAG,MAAM,CAAC,CAAC;IAEvD,OAAO,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC;AACrD,CAAC,CAAC"}
@@ -45,12 +45,14 @@ export declare const taiMinusUtc: (date: Date) => number;
45
45
  *
46
46
  * Where:
47
47
  * - $ t_{\mathrm{Unix}} $ is the `Date`'s milliseconds since 1970-01-01T00:00:00Z (ms)
48
- * - $ \Delta $ is the scale's lead over UTC: 0 for UTC and UT1, TAI − UTC for TAI, and TAI − UTC + 32.184 s for TT (ms)
48
+ * - $ \Delta $ is the scale's lead over UTC: 0 for UTC and UT1, TAI − UTC for TAI, TAI − UTC − 19 s for GPS, TAI − UTC + 32.184 s for TT, and that plus TDB − TT for TDB (ms)
49
49
  *
50
50
  * ::: info Notes
51
51
  *
52
52
  * - **UT1 is taken as UTC.** They differ by up to 0.9 s; the exact difference
53
53
  * is measured and published by the IERS, and the library fetches nothing.
54
+ * - **TDB − TT** comes from the series in USNO Circular 179 (eq. 2.6), good
55
+ * to 10 µs: within 1.7 ms, largest in early April and early October.
54
56
  * - A Julian date as a double is precise to about 40 µs today.
55
57
  * - UTC Julian dates step over leap seconds, like the `Date` itself: the
56
58
  * difference between two of them in days can be 1 s short. Take differences
@@ -58,11 +60,11 @@ export declare const taiMinusUtc: (date: Date) => number;
58
60
  *
59
61
  * :::
60
62
  *
61
- * @param date - The moment, as a UTC `Date` (on or after 1972-01-01 for TAI and TT).
63
+ * @param date - The moment, as a UTC `Date` (on or after 1972-01-01 for TAI, TT, TDB and GPS).
62
64
  * @param scale - The time scale to count in. Defaults to `UTC`.
63
65
  * @returns The Julian date in **days**.
64
66
  * @throws {TypeError} If `date` is not a valid `Date`.
65
- * @throws {RangeError} If `scale` is not a {@link TimeScaleType}, or `date` is before 1972-01-01 for TAI and TT.
67
+ * @throws {RangeError} If `scale` is not a {@link TimeScaleType}, or `date` is before 1972-01-01 for TAI, TT, TDB and GPS.
66
68
  * @group Time scales
67
69
  *
68
70
  * @example
@@ -71,7 +73,10 @@ export declare const taiMinusUtc: (date: Date) => number;
71
73
  *
72
74
  * julianDate(J2000_UTC, 'TT'); // 2451545: J2000 is JD 2451545.0 TT
73
75
  * julianDate(J2000_UTC); // 2451544.999257: 64.184 s earlier on the UTC clock
76
+ * julianDate(J2000_UTC, 'GPS'); // 2451544.999408: 13 s ahead of UTC in 2000
74
77
  * ```
78
+ *
79
+ * @see https://aa.usno.navy.mil/publications/Circular_179 USNO Circular 179, for TDB
75
80
  */
76
81
  export declare const julianDate: (date: Date, scale?: TimeScaleType) => number;
77
82
  /**
@@ -82,11 +87,11 @@ export declare const julianDate: (date: Date, scale?: TimeScaleType) => number;
82
87
  * \mathrm{MJD} = \mathrm{JD} - 2\,400\,000.5
83
88
  * $$
84
89
  *
85
- * @param date - The moment, as a UTC `Date` (on or after 1972-01-01 for TAI and TT).
90
+ * @param date - The moment, as a UTC `Date` (on or after 1972-01-01 for TAI, TT, TDB and GPS).
86
91
  * @param scale - The time scale to count in. Defaults to `UTC`.
87
92
  * @returns The modified Julian date in **days**.
88
93
  * @throws {TypeError} If `date` is not a valid `Date`.
89
- * @throws {RangeError} If `scale` is not a {@link TimeScaleType}, or `date` is before 1972-01-01 for TAI and TT.
94
+ * @throws {RangeError} If `scale` is not a {@link TimeScaleType}, or `date` is before 1972-01-01 for TAI, TT, TDB and GPS.
90
95
  * @group Time scales
91
96
  * @see {@link julianDate}
92
97
  *
@@ -112,7 +117,7 @@ export declare const modifiedJulianDate: (date: Date, scale?: TimeScaleType) =>
112
117
  * @param scale - The time scale the Julian date counts in. Defaults to `UTC`.
113
118
  * @returns The moment as a `Date`.
114
119
  * @throws {TypeError} If `jd` is not a finite number.
115
- * @throws {RangeError} If `scale` is not a {@link TimeScaleType}, the moment is before 1972-01-01 for TAI and TT, or it's outside the range of a `Date`.
120
+ * @throws {RangeError} If `scale` is not a {@link TimeScaleType}, the moment is before 1972-01-01 for TAI, TT, TDB and GPS, or it's outside the range of a `Date`.
116
121
  * @group Time scales
117
122
  *
118
123
  * @example
@@ -1 +1 @@
1
- {"version":3,"file":"time-scales.d.ts","sourceRoot":"","sources":["../src/time-scales.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AA8C/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,IAAI,KAAG,MACR,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,UAAU,GACrB,MAAM,IAAI,EACV,QAAO,aAAqB,KAC3B,MASF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,kBAAkB,GAC7B,MAAM,IAAI,EACV,QAAO,aAAqB,KAC3B,MAUF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,kBAAkB,GAC7B,IAAI,MAAM,EACV,QAAO,aAAqB,KAC3B,IAmCF,CAAC"}
1
+ {"version":3,"file":"time-scales.d.ts","sourceRoot":"","sources":["../src/time-scales.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAgF/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,IAAI,KAAG,MACR,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,UAAU,GACrB,MAAM,IAAI,EACV,QAAO,aAAqB,KAC3B,MASF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,kBAAkB,GAC7B,MAAM,IAAI,EACV,QAAO,aAAqB,KAC3B,MAUF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,kBAAkB,GAC7B,IAAI,MAAM,EACV,QAAO,aAAqB,KAC3B,IAwCF,CAAC"}
@@ -4,7 +4,19 @@ const STEPS = LEAP_SECONDS.map(({ date, taiMinusUtc }) => ({
4
4
  ms: Date.parse(`${date}T00:00:00Z`),
5
5
  taiMinusUtc
6
6
  }));
7
- const SCALES = ['UTC', 'TAI', 'TT', 'UT1'];
7
+ const SCALES = [
8
+ 'UTC',
9
+ 'TAI',
10
+ 'TT',
11
+ 'UT1',
12
+ 'TDB',
13
+ 'GPS'
14
+ ];
15
+ // GPS time was set to UTC on 1980-01-06, when TAI − UTC was 19 s, and has
16
+ // taken no leap seconds since
17
+ const TAI_MINUS_GPS_SECONDS = 19;
18
+ // Julian date of J2000.0
19
+ const JD_J2000 = 2451545;
8
20
  const assertDate = (date) => {
9
21
  if (!(date instanceof Date) || !Number.isFinite(date.getTime()))
10
22
  throw new TypeError(`date must be a valid Date. Received: ${String(date)}`);
@@ -17,7 +29,7 @@ const assertScale = (scale) => {
17
29
  // TAI − UTC in s at a UTC instant in Unix ms
18
30
  const leapSecondsAt = (ms) => {
19
31
  if (ms < STEPS[0].ms)
20
- throw new RangeError(`TAI and TT are only defined here from 1972-01-01, when UTC began to step by whole leap seconds. Received: ${new Date(ms).toISOString()}`);
32
+ throw new RangeError(`TAI, TT, TDB and GPS time are only defined here from 1972-01-01, when UTC began to step by whole leap seconds. Received: ${new Date(ms).toISOString()}`);
21
33
  let taiMinusUtc = STEPS[0].taiMinusUtc;
22
34
  for (const step of STEPS) {
23
35
  if (ms < step.ms)
@@ -26,12 +38,29 @@ const leapSecondsAt = (ms) => {
26
38
  }
27
39
  return taiMinusUtc;
28
40
  };
41
+ // TDB − TT in ms at a TT instant in Unix ms: USNO Circular 179, eq. 2.6,
42
+ // good to 10 µs
43
+ const tdbMinusTt = (ms) => {
44
+ const t = (ms / MILLISECONDS_PER_DAY + JULIAN_DATE_UNIX_EPOCH - JD_J2000) / 36525;
45
+ return (1.657 * Math.sin(628.3076 * t + 6.2401) +
46
+ 0.022 * Math.sin(575.3385 * t + 4.297) +
47
+ 0.014 * Math.sin(1256.6152 * t + 6.1969) +
48
+ 0.005 * Math.sin(606.9777 * t + 4.0212) +
49
+ 0.005 * Math.sin(52.9691 * t + 0.4444) +
50
+ 0.002 * Math.sin(21.3299 * t + 5.5431) +
51
+ 0.01 * t * Math.sin(628.3076 * t + 4.249));
52
+ };
29
53
  // The scale's lead over UTC, in ms, at a UTC instant in Unix ms
30
54
  const leadOverUtc = (ms, scale) => {
31
55
  if (scale === 'UTC' || scale === 'UT1')
32
56
  return 0;
33
57
  const tai = 1000 * leapSecondsAt(ms);
34
- return scale === 'TT' ? tai + 1000 * TT_MINUS_TAI_SECONDS : tai;
58
+ if (scale === 'TAI')
59
+ return tai;
60
+ if (scale === 'GPS')
61
+ return tai - 1000 * TAI_MINUS_GPS_SECONDS;
62
+ const tt = tai + 1000 * TT_MINUS_TAI_SECONDS;
63
+ return scale === 'TT' ? tt : tt + tdbMinusTt(ms + tt);
35
64
  };
36
65
  /**
37
66
  * **TAI − UTC**, in **s**, at a moment: the number of leap seconds so far, plus
@@ -79,12 +108,14 @@ export const taiMinusUtc = (date) => leapSecondsAt(assertDate(date));
79
108
  *
80
109
  * Where:
81
110
  * - $ t_{\mathrm{Unix}} $ is the `Date`'s milliseconds since 1970-01-01T00:00:00Z (ms)
82
- * - $ \Delta $ is the scale's lead over UTC: 0 for UTC and UT1, TAI − UTC for TAI, and TAI − UTC + 32.184 s for TT (ms)
111
+ * - $ \Delta $ is the scale's lead over UTC: 0 for UTC and UT1, TAI − UTC for TAI, TAI − UTC − 19 s for GPS, TAI − UTC + 32.184 s for TT, and that plus TDB − TT for TDB (ms)
83
112
  *
84
113
  * ::: info Notes
85
114
  *
86
115
  * - **UT1 is taken as UTC.** They differ by up to 0.9 s; the exact difference
87
116
  * is measured and published by the IERS, and the library fetches nothing.
117
+ * - **TDB − TT** comes from the series in USNO Circular 179 (eq. 2.6), good
118
+ * to 10 µs: within 1.7 ms, largest in early April and early October.
88
119
  * - A Julian date as a double is precise to about 40 µs today.
89
120
  * - UTC Julian dates step over leap seconds, like the `Date` itself: the
90
121
  * difference between two of them in days can be 1 s short. Take differences
@@ -92,11 +123,11 @@ export const taiMinusUtc = (date) => leapSecondsAt(assertDate(date));
92
123
  *
93
124
  * :::
94
125
  *
95
- * @param date - The moment, as a UTC `Date` (on or after 1972-01-01 for TAI and TT).
126
+ * @param date - The moment, as a UTC `Date` (on or after 1972-01-01 for TAI, TT, TDB and GPS).
96
127
  * @param scale - The time scale to count in. Defaults to `UTC`.
97
128
  * @returns The Julian date in **days**.
98
129
  * @throws {TypeError} If `date` is not a valid `Date`.
99
- * @throws {RangeError} If `scale` is not a {@link TimeScaleType}, or `date` is before 1972-01-01 for TAI and TT.
130
+ * @throws {RangeError} If `scale` is not a {@link TimeScaleType}, or `date` is before 1972-01-01 for TAI, TT, TDB and GPS.
100
131
  * @group Time scales
101
132
  *
102
133
  * @example
@@ -105,7 +136,10 @@ export const taiMinusUtc = (date) => leapSecondsAt(assertDate(date));
105
136
  *
106
137
  * julianDate(J2000_UTC, 'TT'); // 2451545: J2000 is JD 2451545.0 TT
107
138
  * julianDate(J2000_UTC); // 2451544.999257: 64.184 s earlier on the UTC clock
139
+ * julianDate(J2000_UTC, 'GPS'); // 2451544.999408: 13 s ahead of UTC in 2000
108
140
  * ```
141
+ *
142
+ * @see https://aa.usno.navy.mil/publications/Circular_179 USNO Circular 179, for TDB
109
143
  */
110
144
  export const julianDate = (date, scale = 'UTC') => {
111
145
  const ms = assertDate(date);
@@ -121,11 +155,11 @@ export const julianDate = (date, scale = 'UTC') => {
121
155
  * \mathrm{MJD} = \mathrm{JD} - 2\,400\,000.5
122
156
  * $$
123
157
  *
124
- * @param date - The moment, as a UTC `Date` (on or after 1972-01-01 for TAI and TT).
158
+ * @param date - The moment, as a UTC `Date` (on or after 1972-01-01 for TAI, TT, TDB and GPS).
125
159
  * @param scale - The time scale to count in. Defaults to `UTC`.
126
160
  * @returns The modified Julian date in **days**.
127
161
  * @throws {TypeError} If `date` is not a valid `Date`.
128
- * @throws {RangeError} If `scale` is not a {@link TimeScaleType}, or `date` is before 1972-01-01 for TAI and TT.
162
+ * @throws {RangeError} If `scale` is not a {@link TimeScaleType}, or `date` is before 1972-01-01 for TAI, TT, TDB and GPS.
129
163
  * @group Time scales
130
164
  * @see {@link julianDate}
131
165
  *
@@ -157,7 +191,7 @@ export const modifiedJulianDate = (date, scale = 'UTC') => {
157
191
  * @param scale - The time scale the Julian date counts in. Defaults to `UTC`.
158
192
  * @returns The moment as a `Date`.
159
193
  * @throws {TypeError} If `jd` is not a finite number.
160
- * @throws {RangeError} If `scale` is not a {@link TimeScaleType}, the moment is before 1972-01-01 for TAI and TT, or it's outside the range of a `Date`.
194
+ * @throws {RangeError} If `scale` is not a {@link TimeScaleType}, the moment is before 1972-01-01 for TAI, TT, TDB and GPS, or it's outside the range of a `Date`.
161
195
  * @group Time scales
162
196
  *
163
197
  * @example
@@ -169,13 +203,18 @@ export const dateFromJulianDate = (jd, scale = 'UTC') => {
169
203
  if (!Number.isFinite(jd))
170
204
  throw new TypeError(`jd must be a finite number. Received: ${jd}`);
171
205
  assertScale(scale);
172
- // Milliseconds since 1970-01-01T00:00:00 on the scale's clock
173
- const onScale = Math.round((jd - JULIAN_DATE_UNIX_EPOCH) * MILLISECONDS_PER_DAY);
206
+ // Milliseconds since 1970-01-01T00:00:00 on the scale's clock, TT for TDB
207
+ const exact = (jd - JULIAN_DATE_UNIX_EPOCH) * MILLISECONDS_PER_DAY;
208
+ const onScale = Math.round(scale === 'TDB' ? exact - tdbMinusTt(exact) : exact);
174
209
  let ms = onScale;
175
- if (scale === 'TAI' || scale === 'TT') {
176
- // The leap seconds depend on the UTC moment: guess with the scale's own
177
- // time, then settle on the offset at the guess
178
- const tai = scale === 'TT' ? onScale - 1000 * TT_MINUS_TAI_SECONDS : onScale;
210
+ if (scale !== 'UTC' && scale !== 'UT1') {
211
+ // Back to TAI, then to UTC. The leap seconds depend on the UTC moment:
212
+ // guess with TAI, then settle on the offset at the guess
213
+ const tai = scale === 'TAI'
214
+ ? onScale
215
+ : scale === 'GPS'
216
+ ? onScale + 1000 * TAI_MINUS_GPS_SECONDS
217
+ : onScale - 1000 * TT_MINUS_TAI_SECONDS;
179
218
  const guess = tai - 1000 * leapSecondsAt(tai);
180
219
  const offset = leapSecondsAt(guess);
181
220
  ms = tai - 1000 * offset;
@@ -1 +1 @@
1
- {"version":3,"file":"time-scales.js","sourceRoot":"","sources":["../src/time-scales.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,oBAAoB,EACpB,2BAA2B,EAC3B,oBAAoB,EACrB,MAAM,+BAA+B,CAAC;AAGvC,0DAA0D;AAC1D,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC;IACzD,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,YAAY,CAAC;IACnC,WAAW;CACZ,CAAC,CAAC,CAAC;AACJ,MAAM,MAAM,GAA6B,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AACrE,MAAM,UAAU,GAAG,CAAC,IAAU,EAAU,EAAE;IACxC,IAAI,CAAC,CAAC,IAAI,YAAY,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAC7D,MAAM,IAAI,SAAS,CAAC,wCAAwC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC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AE,CAAC,CAAC;IAE1B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAClC,MAAM,IAAI,UAAU,CAAC,gDAAgD,EAAE,EAAE,CAAC,CAAC;IAE7E,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@interstellar-tools/temporal",
3
- "version": "1.1.1",
3
+ "version": "1.3.0",
4
4
  "description": "Time and epoch utilities for space applications (e.g., building blocks toward Julian dates, conversions, and ephemeris-friendly time handling).",
5
5
  "keywords": [
6
6
  "temporal",
@@ -112,8 +112,8 @@
112
112
  "test:ci": "glob-bin -c \"node --import tsx --test --no-warnings --experimental-test-coverage --test-coverage-include='src/**' --test-coverage-exclude='**/__tests__/**' --test-coverage-lines=100 --test-coverage-branches=100 --test-coverage-functions=100 --test-reporter=cobertura --test-reporter-destination=coverage/cobertura-coverage.xml --test-reporter=spec --test-reporter-destination=stdout\" \"**/__tests__/**/*.spec.ts\""
113
113
  },
114
114
  "dependencies": {
115
- "@interstellar-tools/constants": "^1.2.0",
116
- "@interstellar-tools/types": "^1.6.0"
115
+ "@interstellar-tools/constants": "^1.4.0",
116
+ "@interstellar-tools/types": "^1.12.0"
117
117
  },
118
118
  "devDependencies": {
119
119
  "@types/node": "^24.19.2",