@interstellar-tools/temporal 1.2.0 → 1.3.1
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/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/mars-time.d.ts +160 -0
- package/dist/mars-time.d.ts.map +1 -0
- package/dist/mars-time.js +181 -0
- package/dist/mars-time.js.map +1 -0
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -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
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,EAAE,CAAC;AAC3B,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAClD,MAAM,eAAe,GAAG,CAAC,SAAiB,EAAE,EAAE;IAC5C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC7B,MAAM,IAAI,SAAS,CACjB,gDAAgD,SAAS,EAAE,CAC5D,CAAC;AACN,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAU,EAAU,EAAE,CAChD,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,mBAAmB,CAAC,GAAG,aAAa;IAC9D,gBAAgB,CAAC;AAEnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAU,EAAU,EAAE,CACxD,EAAE,GAAG,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,IAAU,EACV,SAAkB,EACV,EAAE;IACV,eAAe,CAAC,SAAS,CAAC,CAAC;IAE3B,OAAO,EAAE,GAAG,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,SAAS,GAAG,MAAM,CAAC,CAAC;AAC/D,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,IAAU,EACV,WAAiB,EACjB,SAAkB,EAClB,QAAQ,GAAG,CAAC,EACJ,EAAE;IACV,eAAe,CAAC,SAAS,CAAC,CAAC;IAE3B,IAAI,CAAC,MAAM,CAAC,SAAS,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interstellar-tools/temporal",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
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": "^
|
|
116
|
-
"@interstellar-tools/types": "^
|
|
115
|
+
"@interstellar-tools/constants": "^2.0.0",
|
|
116
|
+
"@interstellar-tools/types": "^2.0.0"
|
|
117
117
|
},
|
|
118
118
|
"devDependencies": {
|
|
119
119
|
"@types/node": "^24.19.2",
|