astraeus 0.7.0 → 0.8.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/CHANGELOG.md +189 -0
- package/README.md +202 -38
- package/data/ephemerides/planets/planets.json +1 -1
- package/package.json +5 -4
- package/src/api/AstraeusScene.d.ts +21 -5
- package/src/api/AstraeusScene.js +34 -10
- package/src/api/AstraeusScene.node.js +34 -10
- package/src/api/assembleScene.d.ts +36 -0
- package/src/api/assembleScene.js +175 -0
- package/src/api/bodySetChecks.d.ts +10 -0
- package/src/api/bodySetChecks.js +117 -0
- package/src/api/bodySetInput.d.ts +81 -0
- package/src/api/bodySetInput.js +1 -0
- package/src/api/containingBlock.d.ts +6 -0
- package/src/api/containingBlock.js +16 -0
- package/src/api/data.d.ts +17 -5
- package/src/api/data.js +28 -10
- package/src/api/definitionOf.d.ts +16 -0
- package/src/api/definitionOf.js +20 -0
- package/src/api/errors.d.ts +63 -1
- package/src/api/frozenCopy.d.ts +6 -0
- package/src/api/frozenCopy.js +26 -0
- package/src/api/group.d.ts +8 -2
- package/src/api/group.js +24 -5
- package/src/api/index.d.ts +18 -7
- package/src/api/index.js +2 -2
- package/src/api/index.node.js +2 -2
- package/src/api/listeners.d.ts +5 -0
- package/src/api/listeners.js +25 -0
- package/src/api/look.d.ts +47 -0
- package/src/api/look.js +1 -0
- package/src/api/lookInput.d.ts +3 -0
- package/src/api/lookInput.js +41 -0
- package/src/api/moonPanelInput.d.ts +60 -0
- package/src/api/moonPanelInput.js +1 -0
- package/src/api/mount.d.ts +9 -19
- package/src/api/mount.js +27 -13
- package/src/api/mount.node.js +27 -13
- package/src/api/pathProvenance.js +1 -1
- package/src/api/pickerInput.d.ts +25 -0
- package/src/api/pickerInput.js +1 -0
- package/src/api/planBodies.d.ts +72 -0
- package/src/api/planBodies.js +300 -0
- package/src/api/planBodySets.d.ts +68 -0
- package/src/api/planBodySets.js +234 -0
- package/src/api/planCamera.d.ts +83 -0
- package/src/api/planCamera.js +184 -0
- package/src/api/planGroups.d.ts +36 -0
- package/src/api/planGroups.js +103 -0
- package/src/api/planMoonPanel.d.ts +19 -0
- package/src/api/planMoonPanel.js +104 -0
- package/src/api/planPaths.d.ts +40 -0
- package/src/api/planPaths.js +212 -0
- package/src/api/planPicker.d.ts +12 -0
- package/src/api/planPicker.js +40 -0
- package/src/api/planPlaces.d.ts +16 -0
- package/src/api/planPlaces.js +99 -0
- package/src/api/planStory.d.ts +26 -0
- package/src/api/planStory.js +66 -0
- package/src/api/planTimeline.d.ts +27 -0
- package/src/api/planTimeline.js +68 -0
- package/src/api/planViews.d.ts +25 -0
- package/src/api/planViews.js +35 -0
- package/src/api/prepared.js +4 -1
- package/src/api/renamedInputs.d.ts +15 -0
- package/src/api/renamedInputs.js +39 -0
- package/src/api/scene.d.ts +162 -68
- package/src/api/scene.js +247 -793
- package/src/api/sceneFreeze.d.ts +4 -0
- package/src/api/sceneFreeze.js +10 -0
- package/src/api/sceneReads.d.ts +171 -0
- package/src/api/sceneReads.js +6 -0
- package/src/api/story.d.ts +49 -19
- package/src/api/story.js +54 -22
- package/src/api/sunOrbit.js +9 -11
- package/src/api/time.d.ts +2 -1
- package/src/api/time.js +2 -1
- package/src/api/viewerCamera.d.ts +22 -0
- package/src/api/viewerCamera.js +84 -0
- package/src/api/viewerClock.d.ts +30 -0
- package/src/api/viewerClock.js +85 -0
- package/src/api/viewerFirstDraw.d.ts +14 -0
- package/src/api/viewerFirstDraw.js +26 -0
- package/src/api/viewerHandle.d.ts +85 -0
- package/src/api/viewerHandle.js +32 -0
- package/src/api/viewerLink.d.ts +88 -15
- package/src/api/viewerLink.js +117 -75
- package/src/api/viewerLooks.d.ts +19 -0
- package/src/api/viewerLooks.js +37 -0
- package/src/api/viewerPicker.d.ts +22 -0
- package/src/api/viewerPicker.js +49 -0
- package/src/api/viewerSelection.d.ts +30 -0
- package/src/api/viewerSelection.js +46 -0
- package/src/api/viewerViews.d.ts +10 -0
- package/src/api/viewerViews.js +18 -0
- package/src/api/viewerZones.d.ts +20 -0
- package/src/api/viewerZones.js +47 -0
- package/src/api/views.d.ts +7 -6
- package/src/api/views.js +12 -6
- package/src/app/App.d.ts +5 -3
- package/src/app/App.js +211 -82
- package/src/app/App.node.js +211 -82
- package/src/app/AstraeusScene.d.ts +18 -2
- package/src/app/AstraeusScene.js +4 -4
- package/src/app/BodyView.d.ts +4 -1
- package/src/app/BodyView.js +2 -2
- package/src/app/CameraController.d.ts +6 -0
- package/src/app/DeveloperSettings.d.ts +1 -4
- package/src/app/DeveloperSettings.js +6 -10
- package/src/app/FeatureMarkers.d.ts +4 -3
- package/src/app/FeatureMarkers.js +8 -13
- package/src/app/FrameRateSection.js +2 -1
- package/src/app/OrbitSetView.js +1 -1
- package/src/app/SettingControls.d.ts +11 -3
- package/src/app/SettingControls.js +10 -2
- package/src/app/SkyView.d.ts +3 -10
- package/src/app/SkyView.js +6 -28
- package/src/app/address.d.ts +16 -0
- package/src/app/address.js +31 -0
- package/src/app/bodyDraw.d.ts +10 -7
- package/src/app/bodyDraw.js +12 -32
- package/src/app/bodyMetrics.js +2 -2
- package/src/app/bodySet.d.ts +4 -20
- package/src/app/bodySet.js +5 -16
- package/src/app/debugReadout.js +1 -1
- package/src/app/displaySwitches.d.ts +4 -0
- package/src/app/displaySwitches.js +6 -0
- package/src/app/experienceDefinition.d.ts +11 -23
- package/src/app/listSwitch.d.ts +8 -14
- package/src/app/listSwitch.js +3 -10
- package/src/app/liveLook.d.ts +39 -0
- package/src/app/liveLook.js +66 -0
- package/src/app/look.d.ts +36 -0
- package/src/app/look.js +61 -0
- package/src/app/mission.d.ts +1 -1
- package/src/app/mission.js +1 -1
- package/src/app/openClock.d.ts +3 -2
- package/src/app/openClock.js +3 -3
- package/src/app/sceneCamera.d.ts +2 -0
- package/src/app/sceneCamera.js +11 -1
- package/src/app/sceneFrame.d.ts +4 -4
- package/src/app/sceneFrame.js +13 -8
- package/src/app/sceneHooks.js +3 -2
- package/src/app/style.css +114 -139
- package/src/app/trackedMetrics.d.ts +10 -3
- package/src/app/trackedMetrics.js +22 -11
- package/src/app/viewLink.d.ts +10 -32
- package/src/app/viewLink.js +10 -49
- package/src/app/viewerPort.d.ts +52 -0
- package/src/app/views.d.ts +3 -0
- package/src/assets/bodies/galileanMoons.js +1 -2
- package/src/assets/bodies/io.js +2 -2
- package/src/assets/bodies/listedMoons.d.ts +1 -1
- package/src/assets/bodies/listedMoons.js +2 -3
- package/src/assets/bodies/planetSystemMaps.js +2 -3
- package/src/assets/bodies/venus.js +2 -6
- package/src/assets/catalogue.js +1 -2
- package/src/assets/licence.d.ts +3 -3
- package/src/assets/licence.js +3 -3
- package/src/assets/pictures.d.ts +15 -12
- package/src/assets/pictures.js +24 -20
- package/src/assets/sky.d.ts +6 -5
- package/src/assets/sky.js +6 -9
- package/src/assets/visual.d.ts +4 -0
- package/src/core/astronomyAdapter.d.ts +1 -1
- package/src/core/astronomyAdapter.js +3 -3
- package/src/core/bodies/index.d.ts +0 -4
- package/src/core/bodies/index.js +14 -18
- package/src/core/bodies/jupiter.js +1 -1
- package/src/core/bodies/jupiterData.d.ts +0 -1
- package/src/core/bodies/jupiterData.js +2 -5
- package/src/core/bodies/mars.js +1 -1
- package/src/core/bodies/mercury.js +1 -1
- package/src/core/bodies/moonSystem.d.ts +1 -1
- package/src/core/bodies/moonSystem.js +102 -55
- package/src/core/bodies/outerPlanetRingData.js +2 -2
- package/src/core/bodies/outerPlanets.d.ts +2 -3
- package/src/core/bodies/outerPlanets.js +4 -13
- package/src/core/bodies/planetMoons.d.ts +0 -2
- package/src/core/bodies/planetMoons.js +1 -18
- package/src/core/bodies/planetRecords.d.ts +8 -2
- package/src/core/bodies/planetRecords.js +13 -5
- package/src/core/bodies/planetTrajectory.d.ts +21 -4
- package/src/core/bodies/planetTrajectory.js +29 -5
- package/src/core/bodies/venus.js +1 -1
- package/src/core/bodySetFamilies.d.ts +20 -0
- package/src/core/bodySetFamilies.js +14 -0
- package/src/core/chebyshevEphemeris.js +1 -1
- package/src/core/elementsBody.d.ts +8 -4
- package/src/core/elementsBody.js +32 -11
- package/src/core/elementsGroup.d.ts +27 -0
- package/src/core/elementsGroup.js +85 -0
- package/src/core/events.d.ts +2 -0
- package/src/core/events.js +2 -0
- package/src/core/illumination.js +1 -1
- package/src/core/listedOrbitGroup.d.ts +2 -0
- package/src/core/listedOrbitGroup.js +11 -7
- package/src/core/moonListText.d.ts +6 -0
- package/src/core/moonListText.js +19 -0
- package/src/core/moonTrajectory.js +1 -1
- package/src/core/pacing.d.ts +38 -3
- package/src/core/pacing.js +55 -4
- package/src/core/planetModels.d.ts +1 -1
- package/src/core/planetModels.js +3 -3
- package/src/core/planetSeries.d.ts +10 -2
- package/src/core/planetSeries.js +17 -3
- package/src/core/pointGroup.js +1 -1
- package/src/core/provenance.d.ts +2 -1
- package/src/core/provenance.js +2 -2
- package/src/core/referenceCenters.js +5 -5
- package/src/core/sampledTrajectory.js +1 -1
- package/src/core/scalePolicy.d.ts +1 -0
- package/src/core/startView.d.ts +19 -0
- package/src/core/startView.js +28 -0
- package/src/core/state.d.ts +6 -2
- package/src/core/state.js +3 -3
- package/src/core/storyPanels.d.ts +63 -0
- package/src/core/storyPanels.js +111 -0
- package/src/core/sunCentredSources.d.ts +4 -0
- package/src/core/sunCentredSources.js +9 -2
- package/src/core/timeInput.d.ts +4 -0
- package/src/core/timeInput.js +4 -0
- package/src/shell/AstraeusShell.d.ts +18 -2
- package/src/shell/AstraeusShell.js +53 -14
- package/src/shell/AstraeusShell.node.js +53 -14
- package/src/shell/Collapsible.d.ts +4 -3
- package/src/shell/Collapsible.js +5 -5
- package/src/shell/ControlsDrawer.d.ts +1 -1
- package/src/shell/ControlsDrawer.js +3 -1
- package/src/shell/DisplaySwitches.js +2 -1
- package/src/shell/InfoPanel.d.ts +3 -1
- package/src/shell/InfoPanel.js +5 -4
- package/src/shell/MoonFamilyPanel.js +1 -1
- package/src/shell/ObjectControls.d.ts +3 -1
- package/src/shell/ObjectControls.js +2 -2
- package/src/shell/Sources.d.ts +5 -3
- package/src/shell/Sources.js +5 -5
- package/src/shell/StoryPanelView.d.ts +4 -3
- package/src/shell/StoryPanelView.js +8 -6
- package/src/shell/SwitchControl.d.ts +5 -11
- package/src/shell/SwitchControl.js +2 -20
- package/src/shell/TimelineBar.css +81 -81
- package/src/shell/TimelineBar.d.ts +5 -2
- package/src/shell/TimelineBar.js +9 -8
- package/src/shell/TimelineBar.node.js +9 -8
- package/src/shell/TopBar.css +22 -22
- package/src/shell/TopBar.d.ts +5 -1
- package/src/shell/TopBar.js +2 -2
- package/src/shell/TopBar.node.js +2 -2
- package/src/shell/bootLoader.d.ts +4 -10
- package/src/shell/bootLoader.js +6 -52
- package/src/shell/embedded.css +18 -18
- package/src/shell/experience.d.ts +1 -1
- package/src/shell/moonFamilies.d.ts +2 -6
- package/src/shell/moonFamilies.js +2 -18
- package/src/shell/phone.css +58 -58
- package/src/shell/storyPanels.d.ts +2 -53
- package/src/shell/storyPanels.js +1 -106
- package/src/shell/style.css +153 -134
- package/src/shell/useDrawers.d.ts +3 -2
- package/src/shell/useDrawers.js +4 -3
- package/src/shell/viewerKeys.d.ts +8 -0
- package/src/shell/viewerKeys.js +16 -0
- package/src/synthetic/syntheticDefinition.js +20 -24
- package/src/synthetic/syntheticJourneyScene.js +3 -3
- package/src/synthetic/syntheticProbeDefinition.js +2 -1
- package/src/synthetic/syntheticViewsDefinition.d.ts +0 -3
- package/src/synthetic/syntheticViewsDefinition.js +10 -16
- package/data/moons/jupiter.json +0 -3333
- package/data/moons/neptune.json +0 -555
- package/data/moons/pluto.json +0 -205
- package/data/moons/saturn.json +0 -8267
- package/data/moons/uranus.json +0 -887
- package/src/app/addressNavigation.d.ts +0 -17
- package/src/app/addressNavigation.js +0 -16
- package/src/assets/bodies/jupiterMoonCatalogue.d.ts +0 -3
- package/src/assets/bodies/jupiterMoonCatalogue.js +0 -4
- package/src/assets/bodies/outerPlanetCatalogues.d.ts +0 -7
- package/src/assets/bodies/outerPlanetCatalogues.js +0 -8
- package/src/assets/bodies/swiftTuttle.d.ts +0 -12
- package/src/assets/bodies/swiftTuttle.js +0 -13
- package/src/assets/moonCatalogue.d.ts +0 -49
- package/src/assets/moonCatalogue.js +0 -80
- package/src/core/bodies/outerPlanetData.d.ts +0 -4
- package/src/core/bodies/outerPlanetData.js +0 -13
- package/src/core/bodies/swiftTuttle.d.ts +0 -46
- package/src/core/bodies/swiftTuttle.js +0 -106
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Jupiter's core
|
|
3
|
-
*
|
|
4
|
-
* through core).
|
|
2
|
+
* Jupiter's core ring file as it is read (O-025 Decision 8: planet data is core): the ring bands (data/rings/jupiter.json). Raw JSON: src/assets
|
|
3
|
+
* parses and checks it (layer rule: assets reach data through core). The moon lists live in the planets' data packages (O-059 T-270).
|
|
5
4
|
*/
|
|
6
|
-
import moonCatalogueFile from "../../../data/moons/jupiter.json" with { type: "json" };
|
|
7
5
|
import ringFile from "../../../data/rings/jupiter.json" with { type: "json" };
|
|
8
|
-
export const JUPITER_MOON_CATALOGUE_FILE = moonCatalogueFile;
|
|
9
6
|
export const JUPITER_RING_FILE = ringFile;
|
package/src/core/bodies/mars.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createProvenance } from "../provenance.js";
|
|
2
2
|
import { IAU_REPORT, PLANET_VALIDATED_UTC, planetEphemeris, ROTATION_LIMITATION } from "./planetRecords.js";
|
|
3
|
-
export const MARS_EPHEMERIS = planetEphemeris("Mars", "
|
|
3
|
+
export const MARS_EPHEMERIS = planetEphemeris("Mars", "499", "DE441 with the Mars satellite ephemeris mar099", "Within 0.6 km of Horizons' Mars on 2 January of each year 1972 to 2044, with or without the Mars moon package (O-063 T-290).", "Until the Mars moon package is loaded (it covers 2010 to 2029) Mars sits at its system barycentre, under a metre from its centre.");
|
|
4
4
|
/** Mars pole and prime meridian from the IAU 2015 report: degrees, pole per Julian century, W per day, from J2000 TDB. */
|
|
5
5
|
export const MARS_ROTATION = Object.freeze({
|
|
6
6
|
poleRaDeg: [317.269202, -0.10927547],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createProvenance } from "../provenance.js";
|
|
2
2
|
import { IAU_REPORT, PLANET_VALIDATED_UTC, planetEphemeris, ROTATION_LIMITATION } from "./planetRecords.js";
|
|
3
|
-
export const MERCURY_EPHEMERIS = planetEphemeris("Mercury", "
|
|
3
|
+
export const MERCURY_EPHEMERIS = planetEphemeris("Mercury", "199", "DE441 (Mercury has no moons: its barycentre, 1, is the planet)", "Within 0.4 km of Horizons' Mercury on 2 January of each year 1972 to 2044 (O-063 T-290); the fit is within 0.62 km of Horizons at independent dates 1950 to 2045.");
|
|
4
4
|
/** Mercury pole and prime meridian from the IAU 2015 report: degrees, pole per Julian century, W per day, from J2000 TDB. */
|
|
5
5
|
export const MERCURY_ROTATION = Object.freeze({
|
|
6
6
|
poleRaDeg: [281.0103, -0.0328],
|
|
@@ -75,7 +75,7 @@ export interface MoonSystem {
|
|
|
75
75
|
provideIndex(loadIndex: () => Promise<unknown>): void;
|
|
76
76
|
/** Hands in a set built elsewhere (tests read the committed chunks from disk). */
|
|
77
77
|
install(ephemeris: ChebyshevEphemeris | null): void;
|
|
78
|
-
/**
|
|
78
|
+
/** Reads the index once, then fetches and decodes the chunks this request needs that the set does not hold or another request is not already fetching. */
|
|
79
79
|
load(load: MoonSystemLoad): Promise<ChebyshevEphemeris>;
|
|
80
80
|
/** One osculating orbital period (ms) of a body about the centre at `timeUtcMs`, from its fitted state; Infinity when unbound. */
|
|
81
81
|
osculatingPeriodMs(ephemeris: ChebyshevEphemeris, body: BodyId, timeUtcMs: number): number;
|
|
@@ -2,6 +2,7 @@ import { moonOrientationFromOrbit } from "../bodyOrientation.js";
|
|
|
2
2
|
import { ChebyshevEphemeris, parseEphemerisIndex } from "../chebyshevEphemeris.js";
|
|
3
3
|
import { iauOrientation } from "../iauRotation.js";
|
|
4
4
|
import { periodAboutBalanceS } from "../orbitPeriod.js";
|
|
5
|
+
import { NotLoadedError } from "../planetSeries.js";
|
|
5
6
|
import { createProvenance } from "../provenance.js";
|
|
6
7
|
import { assertUtcUnixMs, createState } from "../state.js";
|
|
7
8
|
/** The span the committed fits cover (T-096, T-114: 2010-01-01 to 2030-01-01 TDB, chunked per calendar year; the same for every system). */
|
|
@@ -52,7 +53,16 @@ const HISTORY_MARGIN = 1.05;
|
|
|
52
53
|
const DECODE_SLICE_MS = 8;
|
|
53
54
|
/** Half the time step (s) the orbit-derived tidal-lock orientation looks along the orbit, as Io's mean-element orientation did. */
|
|
54
55
|
const ORIENTATION_STEP_S = 1800;
|
|
56
|
+
/** Reads a `file:` address with Node's own module (found at run time, so a browser bundle never resolves it); Node's `fetch` does not serve `file:`. */
|
|
57
|
+
async function readFileUrl(url) {
|
|
58
|
+
const nodeFs = globalThis.process?.getBuiltinModule?.("node:fs/promises");
|
|
59
|
+
if (nodeFs === undefined)
|
|
60
|
+
throw new Error(`moon fit chunk ${url}: this runtime cannot read a file: address`);
|
|
61
|
+
return new Uint8Array(await nodeFs.readFile(new URL(url)));
|
|
62
|
+
}
|
|
55
63
|
const fetchBytesOf = async (url) => {
|
|
64
|
+
if (url.startsWith("file:"))
|
|
65
|
+
return readFileUrl(url);
|
|
56
66
|
const response = await fetch(url);
|
|
57
67
|
if (!response.ok)
|
|
58
68
|
throw new Error(`moon fit chunk ${url}: HTTP ${response.status}`);
|
|
@@ -61,11 +71,16 @@ const fetchBytesOf = async (url) => {
|
|
|
61
71
|
export function createMoonSystem(config) {
|
|
62
72
|
let installed = null;
|
|
63
73
|
let loadIndex = config.loadIndex;
|
|
64
|
-
|
|
74
|
+
/** The set built from the index, shared by every request (the index is read once); `held` is true when a set was handed in whole by `install`. */
|
|
75
|
+
let building = null;
|
|
76
|
+
let held = false;
|
|
77
|
+
/** Chunk paths already decoded into the set, and those being fetched now (shared by every request, so a path is fetched once). */
|
|
78
|
+
let added = new Set();
|
|
79
|
+
let fetching = new Map();
|
|
65
80
|
const tidalLockNote = `The orientation is an approximate tidal lock keeping the near side towards ${config.centreLabel}, with no libration.`;
|
|
66
81
|
const ephemeris = () => {
|
|
67
82
|
if (installed === null)
|
|
68
|
-
throw new
|
|
83
|
+
throw new NotLoadedError(`${config.centreLabel}'s moon fits are not loaded: await the system's load before mounting a scene with its moons`);
|
|
69
84
|
return installed;
|
|
70
85
|
};
|
|
71
86
|
const decodeInto = async (target, items, bytes) => {
|
|
@@ -78,6 +93,88 @@ export function createMoonSystem(config) {
|
|
|
78
93
|
}
|
|
79
94
|
}
|
|
80
95
|
};
|
|
96
|
+
const reset = () => { building = null; added = new Set(); fetching = new Map(); };
|
|
97
|
+
const indexSet = () => {
|
|
98
|
+
building ??= (async () => {
|
|
99
|
+
if (loadIndex === undefined)
|
|
100
|
+
throw new Error(`${config.centreLabel}'s moon positions are not provided: pass the astraeus-data-${config.centre} package to mount (data: [...]), or call provideIndex`);
|
|
101
|
+
return new ChebyshevEphemeris(parseEphemerisIndex(await loadIndex()));
|
|
102
|
+
})();
|
|
103
|
+
const own = building;
|
|
104
|
+
own.catch(() => { if (building === own)
|
|
105
|
+
building = null; });
|
|
106
|
+
return own;
|
|
107
|
+
};
|
|
108
|
+
/** Fetches and decodes the chunks of `items` the set does not hold and no request is already fetching; resolves when all of them are in. */
|
|
109
|
+
const ensureChunks = async (set, items, request) => {
|
|
110
|
+
const fetchBytes = request.fetchBytes ?? fetchBytesOf;
|
|
111
|
+
const waiting = [];
|
|
112
|
+
const mine = [];
|
|
113
|
+
for (const item of items) {
|
|
114
|
+
const inFlight = fetching.get(item.path);
|
|
115
|
+
if (inFlight !== undefined)
|
|
116
|
+
waiting.push(inFlight);
|
|
117
|
+
else if (!added.has(item.path) && !mine.some(({ path }) => path === item.path))
|
|
118
|
+
mine.push(item);
|
|
119
|
+
}
|
|
120
|
+
if (mine.length > 0) {
|
|
121
|
+
const batch = (async () => {
|
|
122
|
+
await decodeInto(set, mine, await Promise.all(mine.map(({ path }) => fetchBytes(request.chunkUrls[path]))));
|
|
123
|
+
for (const { path } of mine)
|
|
124
|
+
added.add(path);
|
|
125
|
+
})();
|
|
126
|
+
for (const { path } of mine)
|
|
127
|
+
fetching.set(path, batch);
|
|
128
|
+
const done = () => { for (const { path } of mine)
|
|
129
|
+
if (fetching.get(path) === batch)
|
|
130
|
+
fetching.delete(path); };
|
|
131
|
+
batch.then(done, done);
|
|
132
|
+
waiting.push(batch);
|
|
133
|
+
}
|
|
134
|
+
await Promise.all(waiting);
|
|
135
|
+
};
|
|
136
|
+
/** The chunks before the window the bodies' orbit lines need (about one period back, shipped ones only). */
|
|
137
|
+
const historyChunks = (set, request, history) => {
|
|
138
|
+
const start = request.window.startUtcMs;
|
|
139
|
+
const out = [];
|
|
140
|
+
for (const body of history.bodies) {
|
|
141
|
+
const lookback = Math.min(history.maxMs, HISTORY_MARGIN * osculatingPeriodMs(set, body, start));
|
|
142
|
+
const from = Math.floor(Math.max(start - lookback, set.boundsOf(body).startUtcMs));
|
|
143
|
+
for (const chunk of set.chunksFor([body], from, start))
|
|
144
|
+
if (request.chunkUrls[chunk.path] !== undefined)
|
|
145
|
+
out.push(chunk);
|
|
146
|
+
}
|
|
147
|
+
return out;
|
|
148
|
+
};
|
|
149
|
+
/** A moon's orbit ring is centred on the clock, so at the window's last instant it reads ahead of it: the year after the window, where the build ships it (never required). */
|
|
150
|
+
const afterChunks = (set, request) => {
|
|
151
|
+
const end = request.window.endUtcMs;
|
|
152
|
+
const out = [];
|
|
153
|
+
for (const body of request.bodies) {
|
|
154
|
+
const limit = set.boundsOf(body).endUtcMs;
|
|
155
|
+
if (limit <= end)
|
|
156
|
+
continue;
|
|
157
|
+
for (const chunk of set.chunksFor([body], end, Math.min(limit, end + AFTER_WINDOW_MS)))
|
|
158
|
+
if (request.chunkUrls[chunk.path] !== undefined)
|
|
159
|
+
out.push(chunk);
|
|
160
|
+
}
|
|
161
|
+
return out;
|
|
162
|
+
};
|
|
163
|
+
const loadRequest = async (request) => {
|
|
164
|
+
if (held) {
|
|
165
|
+
assertWithinSpan(installed, request);
|
|
166
|
+
return installed;
|
|
167
|
+
}
|
|
168
|
+
const set = await indexSet();
|
|
169
|
+
assertWithinSpan(set, request);
|
|
170
|
+
await ensureChunks(set, chunksNeeded(set, request), request);
|
|
171
|
+
if (request.history !== undefined)
|
|
172
|
+
await ensureChunks(set, historyChunks(set, request, request.history), request);
|
|
173
|
+
await ensureChunks(set, afterChunks(set, request), request);
|
|
174
|
+
if (!held)
|
|
175
|
+
installed = set;
|
|
176
|
+
return set;
|
|
177
|
+
};
|
|
81
178
|
const osculatingPeriodMs = (set, body, timeUtcMs) => {
|
|
82
179
|
const state = set.stateOf(body, timeUtcMs);
|
|
83
180
|
const partner = config.balancePoint === undefined ? state : set.stateOf(config.balancePoint.body, timeUtcMs);
|
|
@@ -118,60 +215,10 @@ export function createMoonSystem(config) {
|
|
|
118
215
|
},
|
|
119
216
|
install(set) {
|
|
120
217
|
installed = set;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
load(request) {
|
|
124
|
-
if (installed !== null) {
|
|
125
|
-
try {
|
|
126
|
-
assertWithinSpan(installed, request);
|
|
127
|
-
}
|
|
128
|
-
catch (error) {
|
|
129
|
-
return Promise.reject(error);
|
|
130
|
-
}
|
|
131
|
-
return Promise.resolve(installed);
|
|
132
|
-
}
|
|
133
|
-
loading ??= (async () => {
|
|
134
|
-
if (loadIndex === undefined)
|
|
135
|
-
throw new Error(`${config.centreLabel}'s moon positions are not provided: pass the astraeus-data-${config.centre} package to mount (data: [...]), or call provideIndex`);
|
|
136
|
-
const set = new ChebyshevEphemeris(parseEphemerisIndex(await loadIndex()));
|
|
137
|
-
assertWithinSpan(set, request);
|
|
138
|
-
const needed = chunksNeeded(set, request);
|
|
139
|
-
const fetchBytes = request.fetchBytes ?? fetchBytesOf;
|
|
140
|
-
await decodeInto(set, needed, await Promise.all(needed.map(({ path }) => fetchBytes(request.chunkUrls[path]))));
|
|
141
|
-
if (request.history !== undefined) {
|
|
142
|
-
const loaded = new Set(needed.map(({ path }) => path));
|
|
143
|
-
const start = request.window.startUtcMs;
|
|
144
|
-
const extra = [];
|
|
145
|
-
for (const body of request.history.bodies) {
|
|
146
|
-
const lookback = Math.min(request.history.maxMs, HISTORY_MARGIN * osculatingPeriodMs(set, body, start));
|
|
147
|
-
const from = Math.floor(Math.max(start - lookback, set.boundsOf(body).startUtcMs));
|
|
148
|
-
for (const chunk of set.chunksFor([body], from, start)) {
|
|
149
|
-
if (loaded.has(chunk.path) || request.chunkUrls[chunk.path] === undefined)
|
|
150
|
-
continue;
|
|
151
|
-
loaded.add(chunk.path);
|
|
152
|
-
extra.push(chunk);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
await decodeInto(set, extra, await Promise.all(extra.map(({ path }) => fetchBytes(request.chunkUrls[path]))));
|
|
156
|
-
}
|
|
157
|
-
// A moon's orbit ring is centred on the clock, so at the window's last instant it reads ahead of it: also load the year after the window where the build ships it (never required).
|
|
158
|
-
const end = request.window.endUtcMs;
|
|
159
|
-
const after = [];
|
|
160
|
-
for (const body of request.bodies) {
|
|
161
|
-
const limit = set.boundsOf(body).endUtcMs;
|
|
162
|
-
if (limit <= end)
|
|
163
|
-
continue;
|
|
164
|
-
for (const chunk of set.chunksFor([body], end, Math.min(limit, end + AFTER_WINDOW_MS))) {
|
|
165
|
-
if (!needed.some(({ path }) => path === chunk.path) && request.chunkUrls[chunk.path] !== undefined && !after.some(({ path }) => path === chunk.path))
|
|
166
|
-
after.push(chunk);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
await decodeInto(set, after, await Promise.all(after.map(({ path }) => fetchBytes(request.chunkUrls[path]))));
|
|
170
|
-
installed = set;
|
|
171
|
-
return set;
|
|
172
|
-
})();
|
|
173
|
-
return loading;
|
|
218
|
+
held = set !== null;
|
|
219
|
+
reset();
|
|
174
220
|
},
|
|
221
|
+
load: (request) => loadRequest(request),
|
|
175
222
|
osculatingPeriodMs,
|
|
176
223
|
trajectory,
|
|
177
224
|
binding: (body, rotation) => Object.freeze({ body, create: (adapter) => trajectory(body, adapter, rotation) }),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Saturn's, Uranus's and Neptune's ring bands as they are read (data/rings/<planet>.json, O-033 T-118). Raw JSON in its own file,
|
|
3
|
-
*
|
|
2
|
+
* Saturn's, Uranus's and Neptune's ring bands as they are read (data/rings/<planet>.json, O-033 T-118). Raw JSON in its own file, so a planet that carries its rings in the catalogue (O-048 T-205) reads
|
|
3
|
+
* only its rings (the moon lists live in the planets' data packages, O-059 T-270).
|
|
4
4
|
*/
|
|
5
5
|
import neptuneRings from "../../../data/rings/neptune.json" with { type: "json" };
|
|
6
6
|
import saturnRings from "../../../data/rings/saturn.json" with { type: "json" };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Saturn, Uranus, Neptune and Pluto (O-033 T-116): defined once here, placed Sun-centred from the planet curve fits (`data/ephemerides/planets/`,
|
|
3
|
-
*
|
|
3
|
+
* each the system barycentre as JPL Horizons reports the planet, O-063 T-290), turned by the IAU pole and prime meridian. Their radii and
|
|
4
4
|
* gravitational parameters are the Horizons physical-data headers saved in each system's moon index (`data/ephemerides/<planet>-moons/index.json`).
|
|
5
|
-
*
|
|
5
|
+
* Each is placed at the system barycentre plus its own offset when its moon system is loaded: that binding is `planetBinding` in `planetTrajectory.ts`.
|
|
6
6
|
*/
|
|
7
7
|
import type { CelestialBodyDefinition, EphemerisRecord } from "../body.js";
|
|
8
8
|
import type { IauRotationElements } from "../iauRotation.js";
|
|
@@ -14,7 +14,6 @@ export declare const PLUTO_ROTATION: IauRotationElements;
|
|
|
14
14
|
export declare const SATURN_EPHEMERIS: EphemerisRecord;
|
|
15
15
|
export declare const URANUS_EPHEMERIS: EphemerisRecord;
|
|
16
16
|
export declare const NEPTUNE_EPHEMERIS: EphemerisRecord;
|
|
17
|
-
/** Pluto has no VSOP87 series: its barycentre is a curve fit of Horizons states (T-114, T-116), and its own wobble about it comes from its system's fits. */
|
|
18
17
|
export declare const PLUTO_EPHEMERIS: EphemerisRecord;
|
|
19
18
|
export declare const SATURN: CelestialBodyDefinition;
|
|
20
19
|
export declare const URANUS: CelestialBodyDefinition;
|
|
@@ -30,19 +30,10 @@ export const SATURN_ROTATION = Object.freeze({ poleRaDeg: [40.589, -0.036], pole
|
|
|
30
30
|
export const URANUS_ROTATION = Object.freeze({ poleRaDeg: [257.311, 0], poleDecDeg: [-15.175, 0], primeMeridianDeg: [203.81, -501.1600928], citation: IAU_REPORT });
|
|
31
31
|
export const NEPTUNE_ROTATION = Object.freeze({ poleRaDeg: [299.36, 0], poleDecDeg: [43.46, 0], primeMeridianDeg: [249.978, 541.1397757], citation: IAU_REPORT });
|
|
32
32
|
export const PLUTO_ROTATION = Object.freeze({ poleRaDeg: [132.993, 0], poleDecDeg: [-6.163, 0], primeMeridianDeg: [302.695, 56.3625225], citation: IAU_REPORT });
|
|
33
|
-
export const SATURN_EPHEMERIS = planetEphemeris("Saturn", "
|
|
34
|
-
export const URANUS_EPHEMERIS = planetEphemeris("Uranus", "
|
|
35
|
-
export const NEPTUNE_EPHEMERIS = planetEphemeris("Neptune", "
|
|
36
|
-
|
|
37
|
-
export const PLUTO_EPHEMERIS = {
|
|
38
|
-
provenance: createProvenance({
|
|
39
|
-
sourceType: "ephemeris",
|
|
40
|
-
sources: ["JPL Horizons API 1.2 (https://ssd.jpl.nasa.gov/api/horizons.api), COMMAND=9 (Pluto system barycentre) CENTER=500@10, VECTORS geometric ICRF km TDB, fetched 2026-10-20, fitted as piecewise Chebyshev series (tools/import/planet-fits.mjs); US Government work, credit NASA/JPL-Caltech Solar System Dynamics"],
|
|
41
|
-
accuracy: "The system barycentre reproduces Horizons within 1 km at independent dates 1950 to 2045. Pluto's centre is that point plus its own offset from the system's fits (within a metre 2010 to 2030); with the system not loaded Pluto is drawn at the barycentre, up to about 2,100 km from its centre.",
|
|
42
|
-
notes: "Geometric position about the Sun's centre; no light-time or aberration.",
|
|
43
|
-
}),
|
|
44
|
-
knownLimitations: ["No velocity is modelled for planets, so they have no speed readout.", "Until Pluto's system fits are loaded Pluto sits at the system barycentre, up to about 2,100 km from its centre."],
|
|
45
|
-
};
|
|
33
|
+
export const SATURN_EPHEMERIS = planetEphemeris("Saturn", "699", "DE441 with the Saturn satellite ephemeris sat441l", "With the Saturn moon package loaded (it covers 1950 to 2029), within 0.5 km of Horizons' Saturn on 2 January of each year 1972 to 2029 and 0.11 to 0.31 km at the Voyager 1 and 2 closest approaches (O-063 T-290).", "Until the Saturn moon package is loaded for the date Saturn sits at its system barycentre, up to 304 km from its centre (measured 1972 to 2044).");
|
|
34
|
+
export const URANUS_EPHEMERIS = planetEphemeris("Uranus", "799", "DE441 with the Uranus satellite ephemeris ura184_merged, whose system barycentre differs from DE441's barycentre body 7 by up to about 3,400 km away from the 1986 Voyager 2 encounter; the series follows Horizons' Uranus", "With the Uranus moon package loaded (it covers 1950 to 2029), within 0.6 km of Horizons' Uranus on 2 January of each year 1972 to 2029 and 0.20 km at Voyager 2's closest approach (O-063 T-290).", "Until the Uranus moon package is loaded for the date Uranus sits at its system barycentre, up to 45 km from its centre (measured 1972 to 2044).");
|
|
35
|
+
export const NEPTUNE_EPHEMERIS = planetEphemeris("Neptune", "899", "DE441 with the Neptune satellite ephemeris nep098_merged, whose system barycentre differs from DE441's barycentre body 8 by up to about 740 km away from the 1989 Voyager 2 encounter; the series follows Horizons' Neptune", "With the Neptune moon package loaded (it covers 1950 to 2029), within 0.5 km of Horizons' Neptune on 2 January of each year 1972 to 2029 and 0.27 km at Voyager 2's closest approach (O-063 T-290).", "Until the Neptune moon package is loaded for the date Neptune sits at its system barycentre, up to 74 km from its centre (measured 1972 to 2044).");
|
|
36
|
+
export const PLUTO_EPHEMERIS = planetEphemeris("Pluto", "999", "DE441 with the Pluto satellite ephemeris plu060_merged (whose barycentre agrees with DE441's body 9: the fit's bytes are the same as T-116's fit of body 9)", "With the Pluto moon package loaded (it covers 2010 to 2029), within 1.5 km of Horizons' Pluto at the archived dates 2010 to 2030 (tests/planetMoonSystems.test.ts); the barycentre fit is within 0.79 km of Horizons at independent dates 1950 to 2045.", "Until Pluto's moon package is loaded for the date Pluto sits at its system barycentre, up to about 2,100 km from its centre.");
|
|
46
37
|
export const SATURN = giantPlanet("saturn", "Saturn", { mean: 58232, equatorial: 60268, polar: 54364 }, 37_931_206.234, { radius: "Equat. radius (1 bar) = 60268+-4 km, Polar radius (km) = 54364+-10, Vol. Mean Radius (km) = 58232+-6", gm: "GM (km^3/s^2) = 37931206.234" }, SATURN_EPHEMERIS, [GAS_BAND("Saturn")]);
|
|
47
38
|
export const URANUS = giantPlanet("uranus", "Uranus", { mean: 25362, equatorial: 25559, polar: 24973 }, 5_793_950.6103, { radius: "Equat. radius (1 bar) = 25559+-4 km, Polar radius (km) = 24973+-20, Vol. Mean Radius (km) = 25362+-12", gm: "GM (km^3/s^2) = 5793950.6103" }, URANUS_EPHEMERIS, [GAS_BAND("Uranus")]);
|
|
48
39
|
export const NEPTUNE = giantPlanet("neptune", "Neptune", { mean: 24624, equatorial: 24766, polar: 24342 }, 6_835_099.97, { radius: "Equat. radius (1 bar) = 24766+-15 km, Polar radius (km) = 24342+-30, Vol. mean radius (km) = 24624+-21", gm: "GM (km^3/s^2) = 6835099.97" }, NEPTUNE_EPHEMERIS, [GAS_BAND("Neptune")]);
|
|
@@ -24,5 +24,3 @@ export declare const CHARON: import("../body.js").CelestialBodyDefinition;
|
|
|
24
24
|
/** The mapped moons by system, in the order the moon lists give them. */
|
|
25
25
|
export declare const PLANET_MOON_DEFINITIONS: readonly import("../body.js").CelestialBodyDefinition[];
|
|
26
26
|
export declare const PLANET_MOON_BINDINGS: readonly StateSourceBinding[];
|
|
27
|
-
/** Pluto: the planet fits give the system barycentre; its own offset is added once its system's fits are loaded. */
|
|
28
|
-
export declare const PLUTO_BINDING: StateSourceBinding;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { iauElementsFromRecord } from "../iauRotation.js";
|
|
2
2
|
import { recordPeriodDays } from "../siderealPeriod.js";
|
|
3
|
-
import { createPlanetSunTrajectory } from "./planetTrajectory.js";
|
|
4
3
|
import { MARS } from "./mars.js";
|
|
5
4
|
import { createMoonSystem, HISTORICAL_MOON_FIT_SPAN, moonFitSource } from "./moonSystem.js";
|
|
6
|
-
import { NEPTUNE, PLUTO,
|
|
5
|
+
import { NEPTUNE, PLUTO, SATURN, URANUS } from "./outerPlanets.js";
|
|
7
6
|
import charonOrbit from "../../../data/orbits/charon.json" with { type: "json" };
|
|
8
7
|
import dioneOrbit from "../../../data/orbits/dione.json" with { type: "json" };
|
|
9
8
|
import enceladusOrbit from "../../../data/orbits/enceladus.json" with { type: "json" };
|
|
@@ -60,19 +59,3 @@ export const PLANET_MOON_BINDINGS = Object.freeze([
|
|
|
60
59
|
NEPTUNE_MOON_SYSTEM.binding(TRITON.id, iauElementsFromRecord(tritonOrbit.rotation)),
|
|
61
60
|
PLUTO_MOON_SYSTEM.binding(CHARON.id, iauElementsFromRecord(charonOrbit.rotation)),
|
|
62
61
|
]);
|
|
63
|
-
/**
|
|
64
|
-
* Pluto's own offset from the system barycentre at `timeUtcMs`, from its system's centre series, or null while the system is not loaded or the
|
|
65
|
-
* time lies outside the loaded chunks (Pluto then stays at the barycentre, which its position record says).
|
|
66
|
-
*/
|
|
67
|
-
function plutoOffsetKm(timeUtcMs) {
|
|
68
|
-
if (!PLUTO_MOON_SYSTEM.isLoaded())
|
|
69
|
-
return null;
|
|
70
|
-
try {
|
|
71
|
-
return PLUTO_MOON_SYSTEM.ephemeris().centreOffsetKm(timeUtcMs);
|
|
72
|
-
}
|
|
73
|
-
catch {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
/** Pluto: the planet fits give the system barycentre; its own offset is added once its system's fits are loaded. */
|
|
78
|
-
export const PLUTO_BINDING = Object.freeze({ body: PLUTO.id, create: (adapter) => createPlanetSunTrajectory("pluto", PLUTO_ROTATION, adapter, plutoOffsetKm) });
|
|
@@ -4,5 +4,11 @@ import type { TimeBounds } from "../trajectory.js";
|
|
|
4
4
|
export declare const PLANET_VALIDATED_UTC: TimeBounds;
|
|
5
5
|
export declare const IAU_REPORT = "Archinal et al., Report of the IAU Working Group on Cartographic Coordinates and Rotational Elements: 2015, Celestial Mechanics and Dynamical Astronomy 130, article 22 (2018), as transcribed in NAIF pck00011.tpc (2022-12-27)";
|
|
6
6
|
export declare const ROTATION_LIMITATION = "Orientation is the IAU pole direction (linear in time) and prime meridian (linear in time) only; the report's periodic nutation and libration terms are left out, and TT stands in for TDB.";
|
|
7
|
-
/**
|
|
8
|
-
export declare
|
|
7
|
+
/** The date the Horizons states behind the planet series were retrieved (O-063 T-290). */
|
|
8
|
+
export declare const PLANET_SERIES_RETRIEVED = "2026-11-10";
|
|
9
|
+
/**
|
|
10
|
+
* Position provenance shared by the planets (O-063 T-290): the series is the planet's system barycentre as JPL Horizons reports the planet, and a
|
|
11
|
+
* planet with a moon system adds its own offset from that barycentre from its moon package when that is loaded. `body` names the Horizons
|
|
12
|
+
* target, `centreSource` how Horizons places it, `measured` the figures against Horizons, `withoutPackage` what changes without the package.
|
|
13
|
+
*/
|
|
14
|
+
export declare function planetEphemeris(label: string, body: string, centreSource: string, measured: string, withoutPackage?: string): EphemerisRecord;
|
|
@@ -3,17 +3,25 @@ import { createProvenance } from "../provenance.js";
|
|
|
3
3
|
export const PLANET_VALIDATED_UTC = Object.freeze({ startUtcMs: Date.UTC(1969, 6, 21), endUtcMs: Date.UTC(2030, 5, 1) });
|
|
4
4
|
export const IAU_REPORT = "Archinal et al., Report of the IAU Working Group on Cartographic Coordinates and Rotational Elements: 2015, Celestial Mechanics and Dynamical Astronomy 130, article 22 (2018), as transcribed in NAIF pck00011.tpc (2022-12-27)";
|
|
5
5
|
export const ROTATION_LIMITATION = "Orientation is the IAU pole direction (linear in time) and prime meridian (linear in time) only; the report's periodic nutation and libration terms are left out, and TT stands in for TDB.";
|
|
6
|
-
/**
|
|
7
|
-
export
|
|
6
|
+
/** The date the Horizons states behind the planet series were retrieved (O-063 T-290). */
|
|
7
|
+
export const PLANET_SERIES_RETRIEVED = "2026-11-10";
|
|
8
|
+
/** Before 1972 the engine and Horizons label the same instant differently; measured 1950 to 1971 against Horizons (tests/planetAccuracyFlybys.test.ts). */
|
|
9
|
+
const PRE_1972_LIMITATION = "Before 1972 a date is read on the engine's smooth TT - UTC, while Horizons labels times in UT1 (to 1962) and in UTC's rubber seconds (to 1972): the same label can be up to 0.7 s apart, so a planet can sit up to that much travel away from Horizons' position for that label (measured 1950 to 1971: Mercury 34.5 km, Venus 24.3, Mars 16.8, Jupiter 8.5, Saturn 6.2, Uranus 4.7, Neptune 3.5).";
|
|
10
|
+
/**
|
|
11
|
+
* Position provenance shared by the planets (O-063 T-290): the series is the planet's system barycentre as JPL Horizons reports the planet, and a
|
|
12
|
+
* planet with a moon system adds its own offset from that barycentre from its moon package when that is loaded. `body` names the Horizons
|
|
13
|
+
* target, `centreSource` how Horizons places it, `measured` the figures against Horizons, `withoutPackage` what changes without the package.
|
|
14
|
+
*/
|
|
15
|
+
export function planetEphemeris(label, body, centreSource, measured, withoutPackage) {
|
|
8
16
|
return {
|
|
9
17
|
provenance: createProvenance({
|
|
10
18
|
sourceType: "ephemeris",
|
|
11
19
|
sources: [
|
|
12
|
-
|
|
20
|
+
`JPL Horizons API 1.2 (https://ssd.jpl.nasa.gov/api/horizons.api), ${label} (${body}) about the Sun's centre (CENTER=500@10)${withoutPackage === undefined ? "" : " and about its system barycentre"}, VECTORS geometric ICRF km TDB, 6-hourly 1950 to 2046, retrieved ${PLANET_SERIES_RETRIEVED}: ${centreSource}; the system barycentre fitted as piecewise Chebyshev series within 1 km (tools/import/planet-fits.mjs). US Government work, credit NASA/JPL-Caltech Solar System Dynamics`,
|
|
13
21
|
],
|
|
14
|
-
accuracy:
|
|
22
|
+
accuracy: measured,
|
|
15
23
|
notes: "Geometric position about the Sun's centre; no light-time or aberration.",
|
|
16
24
|
}),
|
|
17
|
-
knownLimitations: ["No velocity is modelled for planets, so they have no speed readout.", ...
|
|
25
|
+
knownLimitations: ["No velocity is modelled for planets, so they have no speed readout.", ...(withoutPackage === undefined ? [] : [withoutPackage]), PRE_1972_LIMITATION],
|
|
18
26
|
};
|
|
19
27
|
}
|
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
import type { AstronomyAdapter, PlanetId } from "../astronomyAdapter.js";
|
|
2
|
+
import type { StateSourceBinding } from "../body.js";
|
|
3
|
+
import type { ChebyshevEphemeris } from "../chebyshevEphemeris.js";
|
|
2
4
|
import { type IauRotationElements } from "../iauRotation.js";
|
|
3
5
|
import type { Trajectory } from "../trajectory.js";
|
|
4
6
|
/**
|
|
5
|
-
* A planet in its one native centre, the Sun:
|
|
6
|
-
* No velocity is modelled (a State carries none from this source), so a planet has no speed readout.
|
|
7
|
-
* `offsetKm`, when given and not null at a time, is added to the series position:
|
|
8
|
-
*
|
|
7
|
+
* A planet in its one native centre, the Sun: the planet series position (the system barycentre, from JPL Horizons) and IAU-rotation orientation
|
|
8
|
+
* from the adapter's time scale. No velocity is modelled (a State carries none from this source), so a planet has no speed readout.
|
|
9
|
+
* `offsetKm`, when given and not null at a time, is added to the series position: the planet's own offset from its system's barycentre,
|
|
10
|
+
* available only once its moon system's fits are loaded.
|
|
9
11
|
*/
|
|
10
12
|
export declare function createPlanetSunTrajectory(planet: PlanetId, rotation: IauRotationElements, adapter: AstronomyAdapter, offsetKm?: (timeUtcMs: number) => ArrayLike<number> | null): Trajectory;
|
|
13
|
+
/** The part of a moon system the planet binding reads: whether a set is installed, and the set. */
|
|
14
|
+
export interface BarycentreOffsetSource {
|
|
15
|
+
isLoaded(): boolean;
|
|
16
|
+
ephemeris(): ChebyshevEphemeris;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The planet's own offset from its system barycentre at `timeUtcMs`, from its moon system's centre series, or null while the system is not loaded
|
|
20
|
+
* or the time lies outside the loaded chunks (the planet then stays at the barycentre, which its position record says).
|
|
21
|
+
*/
|
|
22
|
+
export declare function barycentreOffsetKm(system: BarycentreOffsetSource): (timeUtcMs: number) => ArrayLike<number> | null;
|
|
23
|
+
/**
|
|
24
|
+
* The one planet binding (O-063 T-290; Pluto's since O-033 T-116): the planet series gives the system barycentre, and a planet with a moon system
|
|
25
|
+
* adds its own offset from that barycentre once the system's fits are loaded. Mercury and Venus have no moon system: barycentre and centre agree.
|
|
26
|
+
*/
|
|
27
|
+
export declare function planetBinding(planet: PlanetId, rotation: IauRotationElements, system?: BarycentreOffsetSource): StateSourceBinding;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { iauOrientation } from "../iauRotation.js";
|
|
2
2
|
import { assertUtcUnixMs, createState, EQJ } from "../state.js";
|
|
3
3
|
/**
|
|
4
|
-
* A planet in its one native centre, the Sun:
|
|
5
|
-
* No velocity is modelled (a State carries none from this source), so a planet has no speed readout.
|
|
6
|
-
* `offsetKm`, when given and not null at a time, is added to the series position:
|
|
7
|
-
*
|
|
4
|
+
* A planet in its one native centre, the Sun: the planet series position (the system barycentre, from JPL Horizons) and IAU-rotation orientation
|
|
5
|
+
* from the adapter's time scale. No velocity is modelled (a State carries none from this source), so a planet has no speed readout.
|
|
6
|
+
* `offsetKm`, when given and not null at a time, is added to the series position: the planet's own offset from its system's barycentre,
|
|
7
|
+
* available only once its moon system's fits are loaded.
|
|
8
8
|
*/
|
|
9
9
|
export function createPlanetSunTrajectory(planet, rotation, adapter, offsetKm) {
|
|
10
10
|
return Object.freeze({
|
|
@@ -22,10 +22,34 @@ export function createPlanetSunTrajectory(planet, rotation, adapter, offsetKm) {
|
|
|
22
22
|
body: planet,
|
|
23
23
|
center: "sun",
|
|
24
24
|
timeUtcMs,
|
|
25
|
-
|
|
25
|
+
plane: EQJ,
|
|
26
26
|
positionKm: position,
|
|
27
27
|
orientation: iauOrientation(rotation, adapter.daysSinceJ2000Tt(timeUtcMs)),
|
|
28
28
|
});
|
|
29
29
|
},
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* The planet's own offset from its system barycentre at `timeUtcMs`, from its moon system's centre series, or null while the system is not loaded
|
|
34
|
+
* or the time lies outside the loaded chunks (the planet then stays at the barycentre, which its position record says).
|
|
35
|
+
*/
|
|
36
|
+
export function barycentreOffsetKm(system) {
|
|
37
|
+
return (timeUtcMs) => {
|
|
38
|
+
if (!system.isLoaded())
|
|
39
|
+
return null;
|
|
40
|
+
try {
|
|
41
|
+
return system.ephemeris().centreOffsetKm(timeUtcMs);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The one planet binding (O-063 T-290; Pluto's since O-033 T-116): the planet series gives the system barycentre, and a planet with a moon system
|
|
50
|
+
* adds its own offset from that barycentre once the system's fits are loaded. Mercury and Venus have no moon system: barycentre and centre agree.
|
|
51
|
+
*/
|
|
52
|
+
export function planetBinding(planet, rotation, system) {
|
|
53
|
+
const offsetKm = system === undefined ? undefined : barycentreOffsetKm(system);
|
|
54
|
+
return Object.freeze({ body: planet, create: (adapter) => createPlanetSunTrajectory(planet, rotation, adapter, offsetKm) });
|
|
55
|
+
}
|
package/src/core/bodies/venus.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createProvenance } from "../provenance.js";
|
|
2
2
|
import { IAU_REPORT, PLANET_VALIDATED_UTC, planetEphemeris, ROTATION_LIMITATION } from "./planetRecords.js";
|
|
3
|
-
export const VENUS_EPHEMERIS = planetEphemeris("Venus", "
|
|
3
|
+
export const VENUS_EPHEMERIS = planetEphemeris("Venus", "299", "DE441 (Venus has no moons: its barycentre, 2, is the planet)", "Within 0.6 km of Horizons' Venus on 2 January of each year 1972 to 2044 (O-063 T-290); the fit is within 0.75 km of Horizons at independent dates 1950 to 2045.");
|
|
4
4
|
/** Venus pole and prime meridian from the IAU 2015 report: degrees, pole per Julian century, W per day, from J2000 TDB. */
|
|
5
5
|
export const VENUS_ROTATION = Object.freeze({
|
|
6
6
|
poleRaDeg: [272.76, 0],
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Shader uniform arrays hold at most this many families. */
|
|
2
|
+
export declare const MAX_BODY_SET_FAMILIES = 16;
|
|
3
|
+
export interface BodySetFamily {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly label: string;
|
|
6
|
+
/** Default orbit colour, #rrggbb; the live settings may change it. */
|
|
7
|
+
readonly color: string;
|
|
8
|
+
/** Orbit brightness multiplier of the family before the live look changes it; absent: 1. */
|
|
9
|
+
readonly brightness?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Default orbit colours, in family order: the Okabe and Ito colour-blind-safe set (Okabe and Ito 2008, "Color Universal Design"), without
|
|
13
|
+
* its black and its dark blue (both vanish on the night sky), preceded by the cream of the existing orbit lines and followed by a neutral grey.
|
|
14
|
+
*/
|
|
15
|
+
export declare const DEFAULT_FAMILY_PALETTE: readonly string[];
|
|
16
|
+
/** Families in data order with the default palette's colours, cycling past its end. */
|
|
17
|
+
export declare function familiesWithPalette(families: readonly {
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly label: string;
|
|
20
|
+
}[], palette?: readonly string[]): readonly BodySetFamily[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// The families of a body set and the colours they take: pure data and one helper, shared by the viewer's body sets and the scene builder.
|
|
2
|
+
/** Shader uniform arrays hold at most this many families. */
|
|
3
|
+
export const MAX_BODY_SET_FAMILIES = 16;
|
|
4
|
+
/**
|
|
5
|
+
* Default orbit colours, in family order: the Okabe and Ito colour-blind-safe set (Okabe and Ito 2008, "Color Universal Design"), without
|
|
6
|
+
* its black and its dark blue (both vanish on the night sky), preceded by the cream of the existing orbit lines and followed by a neutral grey.
|
|
7
|
+
*/
|
|
8
|
+
export const DEFAULT_FAMILY_PALETTE = Object.freeze(["#f0e6da", "#f0e442", "#e69f00", "#56b4e9", "#cc79a7", "#009e73", "#d55e00", "#bbbbbb"]);
|
|
9
|
+
/** Families in data order with the default palette's colours, cycling past its end. */
|
|
10
|
+
export function familiesWithPalette(families, palette = DEFAULT_FAMILY_PALETTE) {
|
|
11
|
+
if (families.length > MAX_BODY_SET_FAMILIES)
|
|
12
|
+
throw new RangeError(`a body set holds at most ${MAX_BODY_SET_FAMILIES} families, got ${families.length}`);
|
|
13
|
+
return Object.freeze(families.map((family, index) => Object.freeze({ id: family.id, label: family.label, color: palette[index % palette.length] })));
|
|
14
|
+
}
|
|
@@ -333,7 +333,7 @@ export class ChebyshevEphemeris {
|
|
|
333
333
|
velocity[axis] -= centreVelocity[axis];
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
|
-
return createState({ body: bodyId, center: this.index.centre, timeUtcMs,
|
|
336
|
+
return createState({ body: bodyId, center: this.index.centre, timeUtcMs, plane: EQJ, positionKm: position, velocityKmS: velocity, orientation: null });
|
|
337
337
|
}
|
|
338
338
|
/** The ordinary Trajectory for one body, valid inside `boundsOf(body)`, in the set's one centre. */
|
|
339
339
|
trajectory(bodyId) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BodyId, CelestialBodyDefinition, StateSourceBinding } from "./body.js";
|
|
2
|
+
import type { TimeInput } from "./timeInput.js";
|
|
2
3
|
import { type EccentricSampling } from "./sunCentredSources.js";
|
|
3
4
|
import type { Trajectory } from "./trajectory.js";
|
|
4
5
|
/** Default look of the marker that stands for a body on a published orbit; a record's own `marker` replaces either value. */
|
|
@@ -13,6 +14,7 @@ export declare const APPROXIMATE_LIMIT_FRACTION = 0.01;
|
|
|
13
14
|
export declare const INDICATIVE_LIMIT_FRACTION = 0.05;
|
|
14
15
|
/** The classification a largest error fraction earns, or null when it earns neither (the body should not be drawn from its elements alone). */
|
|
15
16
|
export declare function classifyPositionError(maxFraction: number): AccuracyClassification | null;
|
|
17
|
+
/** The time scale an elements solution is expressed in: "TDB", "TT" or "UTC". */
|
|
16
18
|
export type ElementsTimeScale = "TDB" | "TT" | "UTC";
|
|
17
19
|
/** The class a position comparison earns: `"approximate"` or `"indicative"` (see `classifyPositionError`). */
|
|
18
20
|
export type AccuracyClassification = "approximate" | "indicative";
|
|
@@ -47,7 +49,7 @@ export interface ElementsBodyRecord {
|
|
|
47
49
|
readonly ttMinusUtcSeconds?: number;
|
|
48
50
|
};
|
|
49
51
|
/** The plane the elements are given in. */
|
|
50
|
-
readonly
|
|
52
|
+
readonly plane: "ecliptic-j2000";
|
|
51
53
|
readonly source: ElementsSource;
|
|
52
54
|
readonly radius?: {
|
|
53
55
|
readonly km: number;
|
|
@@ -56,9 +58,11 @@ export interface ElementsBodyRecord {
|
|
|
56
58
|
readonly accuracy: {
|
|
57
59
|
readonly classification: AccuracyClassification;
|
|
58
60
|
readonly statement: string;
|
|
59
|
-
/** The dates the position was compared with an independent ephemeris: what the claim covers. */
|
|
60
|
-
readonly
|
|
61
|
-
|
|
61
|
+
/** The dates the position was compared with an independent ephemeris: what the claim covers. A record is usually JSON, so ISO text such as `2030-01-01T00:00:00Z` is the usual form; a Date or Unix milliseconds also read. */
|
|
62
|
+
readonly valid: {
|
|
63
|
+
readonly start: TimeInput;
|
|
64
|
+
readonly end: TimeInput;
|
|
65
|
+
};
|
|
62
66
|
/** Further limits to show beside the generic two-body ones. */
|
|
63
67
|
readonly limitations: readonly string[];
|
|
64
68
|
};
|