@essrt/physics 23.0.0 → 23.2.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.
Files changed (36) hide show
  1. package/package.json +7 -2
  2. package/src/constants/coefficients.d.ts +1 -1
  3. package/src/constants/coefficients.js +3 -3
  4. package/src/constants/generated.d.ts +4 -3
  5. package/src/constants/generated.js +6 -5
  6. package/src/constants/units.cjs +20 -0
  7. package/src/deltat/deep-time-chain.js +457 -0
  8. package/src/deltat/deep-time.cjs +42 -13
  9. package/src/deltat/moon-distance-artifact.cjs +6 -3
  10. package/src/earth/deep-orbital-history.cjs +44 -15
  11. package/src/earth/mass-chain.cjs +95 -0
  12. package/src/earth/mean-obliquity-history.cjs +94 -0
  13. package/src/earth/precession-composed.cjs +49 -3
  14. package/src/index.js +17 -0
  15. package/src/layer0/index.js +20 -6
  16. package/src/math/angles.cjs +38 -0
  17. package/src/model.js +76 -227
  18. package/src/moon/arguments.cjs +5 -31
  19. package/src/planets/chain-artifact.js +2 -2
  20. package/src/time/calendar.cjs +165 -0
  21. package/types/constants/coefficients.d.ts +1 -1
  22. package/types/constants/generated.d.ts +4 -3
  23. package/types/constants/units.d.cts +8 -0
  24. package/types/deltat/deep-time-chain.d.ts +266 -0
  25. package/types/deltat/deep-time.d.cts +14 -0
  26. package/types/deltat/moon-distance-artifact.d.cts +3 -0
  27. package/types/earth/deep-orbital-history.d.cts +5 -3
  28. package/types/earth/mass-chain.d.cts +78 -0
  29. package/types/earth/mean-obliquity-history.d.cts +32 -0
  30. package/types/earth/precession-composed.d.cts +11 -1
  31. package/types/index.d.ts +6 -0
  32. package/types/layer0/index.d.ts +3 -2
  33. package/types/math/angles.d.cts +18 -0
  34. package/types/model.d.ts +21 -3
  35. package/types/moon/arguments.d.cts +2 -6
  36. package/types/time/calendar.d.cts +78 -0
@@ -0,0 +1,78 @@
1
+ /** The first Gregorian calendar day, as a calendar date. */
2
+ export const GREGORIAN_START: Readonly<{
3
+ year: 1582;
4
+ month: 10;
5
+ day: 15;
6
+ }>;
7
+ /** The first Gregorian calendar day, as a JD (00:00 UT). */
8
+ export const GREGORIAN_START_JD: 2299160.5;
9
+ /**
10
+ * Calendar date → Julian Day (Meeus 7.1). The calendar is decided by the
11
+ * date itself: Julian before 1582-10-15, Gregorian from it on.
12
+ * @param {number} year astronomical year (0 = 1 BC)
13
+ * @param {number} month 1–12
14
+ * @param {number} day 1–31, may carry a fraction
15
+ * @param {number} [dayFraction=0] added to the day (e.g. hour/24)
16
+ * @returns {number} JD
17
+ */
18
+ export function calendarToJD(year: number, month: number, day: number, dayFraction?: number): number;
19
+ /**
20
+ * Julian Day → calendar date (Meeus ch. 7 inverse). Gregorian for
21
+ * JD ≥ 2299160.5, Julian before.
22
+ * @param {number} jd
23
+ * @returns {{year: number, month: number, day: number, dayFrac: number, calendar: 'Julian'|'Gregorian'}}
24
+ * day the integer day of month, dayFrac in [0, 1) the fraction since 00:00
25
+ */
26
+ export function jdToCalendar(jd: number): {
27
+ year: number;
28
+ month: number;
29
+ day: number;
30
+ dayFrac: number;
31
+ calendar: "Julian" | "Gregorian";
32
+ };
33
+ /**
34
+ * Julian Day → decimal year: the year plus the elapsed fraction of that
35
+ * calendar year (Julian or Gregorian leap rule as the date's calendar has
36
+ * it). Jan 1 00:00 → year exactly. The S3-aligned coordinate of the Sun's
37
+ * secular deviations and the browser's `julianDateToDecimalYear`.
38
+ * @param {number} jd
39
+ * @returns {number}
40
+ */
41
+ export function jdToDecimalYear(jd: number): number;
42
+ /**
43
+ * The day fraction as hours, minutes and whole seconds (floored, as the
44
+ * browser's date strings always did).
45
+ * @param {number} dayFrac in [0, 1)
46
+ * @returns {{hour: number, minute: number, second: number}}
47
+ */
48
+ export function dayFractionToHMS(dayFrac: number): {
49
+ hour: number;
50
+ minute: number;
51
+ second: number;
52
+ };
53
+ /**
54
+ * Proleptic JULIAN calendar date → Julian Day, no reform: the convention the
55
+ * NASA eclipse canons and the Babylonian/Greek record tables use for every
56
+ * pre-1582 date, and the browser's eclipse diagnostics apply to their whole
57
+ * table (so a post-reform Gregorian date in such a table — 1654 Aug 12 —
58
+ * lands ten days late; the tables name the convention). Same expression
59
+ * order as the copies it replaces.
60
+ * @param {number} year astronomical year (0 = 1 BC)
61
+ * @param {number} month 1–12
62
+ * @param {number} day 1–31
63
+ * @param {number} [dayFraction=0] added to the day (e.g. hour/24)
64
+ * @returns {number} JD
65
+ */
66
+ export function julianCalendarToJD(year: number, month: number, day: number, dayFraction?: number): number;
67
+ /**
68
+ * Julian Day → proleptic JULIAN calendar date, no reform (the inverse of
69
+ * `julianCalendarToJD`; the NASA-convention diagnostics' printer).
70
+ * @param {number} jd
71
+ * @returns {{year: number, month: number, day: number, dayFrac: number}}
72
+ */
73
+ export function jdToJulianCalendar(jd: number): {
74
+ year: number;
75
+ month: number;
76
+ day: number;
77
+ dayFrac: number;
78
+ };