@johnmorrisdotca/chikyu-earth 0.57.0 → 0.59.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/CHANGELOG.md +20 -1
- package/README.md +2 -2
- package/dist/flat/element.d.ts +1 -1
- package/dist/flat/element.js +4 -3
- package/dist/realistic/element-base.d.ts +3 -2
- package/dist/realistic/element-base.js +8 -2
- package/dist/satellites/history.d.ts +237 -0
- package/dist/satellites/history.js +441 -0
- package/dist/satellites/index.d.ts +1 -0
- package/dist/satellites/index.js +1 -0
- package/dist/satellites/track.d.ts +4 -1
- package/dist/satellites/track.js +132 -24
- package/dist/satellites/types.d.ts +7 -4
- package/dist/space/element-base.d.ts +54 -2
- package/dist/space/element-base.js +92 -3
- package/dist/space/index.d.ts +1 -0
- package/dist/space/index.js +1 -0
- package/dist/space/path-ribbons.d.ts +2 -0
- package/dist/space/path-ribbons.js +2 -2
- package/dist/space/satellite-layer.d.ts +9 -0
- package/dist/space/satellite-layer.js +70 -2
- package/dist/space/trail.d.ts +117 -0
- package/dist/space/trail.js +152 -0
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 0.59.0 - 2026-11-18
|
|
4
4
|
|
|
5
|
+
- **A survey of where the finer ground has a picture, and the guide corrected** (MODULES-1367). `scripts/finer-coverage.py` (`pnpm coverage`) reads the Landsat layer's tiles at a grid of places and writes the maps and tables in `docs/coverage/` (level 5 and level 11). On 2026-11-17 the finer picture covered 89 per cent of the land, and every band of latitude from 60 degrees south to 80 degrees north at 96 per cent or more; what is missing is all of Antarctica, part of the land north of 80 degrees and the water of large lakes. The earth-tiles guide, in English and Japanese, says that instead of "the far north". `pnpm test:tiles` runs the script's selftest on a tiny made-up map (it needs Pillow: `python3 -m venv .cache/venv && .cache/venv/bin/pip install pillow`), and CI runs it too.
|
|
6
|
+
- **The Landsat scene edge west of Tokyo is named in the guide** (MODULES-1314). With `tiles-finer="gibs"` the 2000 mosaic shows a straight edge about 40 km west of Tokyo (tile level 9, row 96, column 568) where two Landsat scenes meet. It is in NASA's picture. No general fix was found (the tiles do not say where a scene ends, and a colour gain scales both sides alike), so the guide, in English and Japanese, now names it and says to pick another year (`tiles-finer-date`) or layer (`tiles-finer-layer`). No code changes.
|
|
7
|
+
|
|
8
|
+
## 0.58.0 - 2026-11-17
|
|
9
|
+
|
|
10
|
+
- **A fast clock's streaks turn about the plane of the moment shown** (MODULES-1476). Above 60 times real time `arc()` turned each pinned place about a normal worked out once from the element set's own `RA_OF_ASC_NODE` and `INCLINATION`, so days from the elements (a low orbit's plane turns about 5 degrees a day) the dot left its orbit between two pins: 600 s after its pin the ISS's place was 3,049 km from `exact()`'s at 20 days from its elements and 5,970 km at 400. The axis is now the pinned place crossed with SGP4's velocity there, worked out once for each pin and not in `arc()`, with no allocation in the frame: the same ISS is 13.6 km off at 20 days and 5.4 km at 400 (what is left is the mean motion standing in for the true rate along the orbit). At the page's own pin rate (about once a second) the worst place of the recorded stations is 0.4 km off. Tests: `arc` within 1 km of `exact` at the pin rate and within 20 km 600 s after a pin, 20 and 400 days from the elements, and no SGP4 call or heap growth in a frame between pins. No change to the API.
|
|
11
|
+
- **A satellite's history, and the Observe view** (MODULES-1118). Data only: the page brings the element sets, chikyu fetches nothing.
|
|
12
|
+
- **History.** `createSatelliteHistory(sets, { launch, decay, uncertainty })` (in `/satellites`) places one satellite at any moment from the set nearest that moment (SGP4). `describe(ms)` says which of `before-launch`, `backcast`, `tracked`, `predicted`, `decayed` or `unplaceable` the moment is, with the set used, its distance in days, the launch and the decay (from the options, else `LAUNCH_DATE` and `DECAY_DATE` of the sets, else the launch year of `OBJECT_ID`); `exact(ms, out)`, `trailInto` and `trail` give the place and the last orbits; `group` is the `Satellites` the view draws, not drawn before the launch or after the decay and shaded after the newest set.
|
|
13
|
+
- **Uncertainty.** After (and before) the nearest set a place carries `uncertaintyKm` = 1 km + 3 km/day + 1.5 km/day squared of the distance (`DEFAULT_UNCERTAINTY`, `predictionUncertaintyKm`, the `uncertainty` option). Measured against NASA/JPL Horizons (ISS, `-125544`, right ascension, declination and range from the Earth's centre, read 2026-11-17): the ISS placed from the one recorded set of 2 November is 25, 59, 108 and 168 km out at 5.6, 7.6, 9.6 and 11.6 days; each is inside the stated figure (margin 1.4 to 2.5). A figure for a low orbit with much drag: a ceiling for a higher one.
|
|
14
|
+
- **`altitudeSeries(sets)`** is the mean height over one revolution at each set's epoch (`{ epochMs, altitudeKm, noradId }`, oldest first), for a chart.
|
|
15
|
+
- **Element.** `<chikyu-space>` gets `setSatelliteHistory(id, history)` (the group `history:<id>`; takes what `createSatelliteHistory` made, because the element does not import satellite.js), `satelliteHistory(id)`, `observe(target, { orbits, colour, distanceKm, smooth })` and `observing`. The Observe view is the follow view outside the satellite, the Earth turning beneath, and a trail of its last 0.25 to 20 orbits (3 by default) as one line in one draw call, from points kept on a grid of 96 to an orbit: a frame costs one SGP4 call and the points that came into the window; nothing is drawn at rest, out of sight or once it is off. `stats.satellites` has `trailPoints` and `trailBuilds`. New pure `createTrailBuilder`, `trailOrbits` and the `TRAIL_*` constants in `/space`.
|
|
16
|
+
- **Tests and docs.** Placement against Horizons on four dates, before launch, after decay, the nearest set, the shading, the trail (unit tests, each shown to fail when the code is broken) and `e2e/history.gl.ts` (a real browser, five repeats under a CPU slowed to a quarter); the guide "A satellite's history, and the Observe view" in English and Japanese and two examples (`examples/node/history.mjs`, `examples/history/`).
|
|
5
17
|
- **A published accuracy table, and a test that holds it** (MODULES-523). The new guide "How accurate it is" (English and Japanese) gives the measured error of the Sun's overhead point and of the line between day and night against NASA/JPL Horizons (eight moments from 1950 to 2075; worst 0.0074 degree, 0.8 km on the ground), and of the SGP4 places that `createSatellites` gives against Vallado's published verification set ("Revisiting Spacetrack Report #3", AIAA 2006-6753; four element sets, near Earth, strong drag and deep space; worst 0.000000007 km, agreement to every published digit). Each reference value is copied into `test/accuracy/references.ts` with its source and the date it was read. `test/accuracy.test.ts` holds the errors under stated limits (0.010 degree for the Sun and the line, 1 millimetre for SGP4), each the worst measured plus a margin, and each shown to fail when the code or the limit is broken. Not covered, and said so in the guide: NOAA's calculator (a page to operate, no file of values), the paper's printed tables and `tcppver.out` (only in a zip), the sunrise line with refraction, and the Earth-fixed step. No code of the package changed.
|
|
18
|
+
- **A satellite far from its elements keeps its usual orbit: `estimate-far="steady"`** (MODULES-1366). With `estimate-far`, a satellite more than 30 days from its elements is carried on by SGP4 with the elements' air drag left in. With nobody to boost it the model's copy sinks, and it is left out once it is under 120 km or SGP4 gives up: of the 16,596 active satellites of 10 November 2026 still placed 30 days from their elements, 1,921 were gone a year on and 6,398 five years on, and a ride on one of them ended there.
|
|
19
|
+
- **The choice.** `estimate-far="steady"` on `<chikyu-space>`, `<chikyu-earth-realistic>` and `<chikyu-flat>` (the property `estimateFar = "steady"`), or `createSatellites(sets, { estimateFar: "steady" })`. Beyond `maxAgeDays` the drag is switched off: the satellite keeps the height and shape its orbit had on that day, and the plane and the low point go on turning as the Earth's flattening turns them. On the same list none is lost one or two years on, 1 at five years and 5 at ten (stretched high orbits that the Sun and Moon pull out of shape in the model). It is the usual orbit, not a prediction, and is still `estimated: true`.
|
|
20
|
+
- **Nothing else changes.** `estimate-far` with no value, and `estimateFar: true`, are as before, drag and all, and off is still the default. `estimateFar` on a group and on the elements is now `boolean | "steady"`. Up to `maxAgeDays` the two choices give the same place to the last digit.
|
|
21
|
+
- **No jump at the hand-over.** The steady orbit is a second SGP4 record with no drag term, started at `maxAgeDays` from the mean elements SGP4 itself has reached there (its mean motion turned back into the one an element set states), so the two records give the same place at that moment. Measured on the 16,599 satellites of the list that are placed there: a microsecond past the hand-over the two are at most 0.08 mm apart for a low orbit and 0.005 mm for a high one. A high orbit that carries a drag term starts its Sun and Moon terms again, which leaves a few kilometres (2 satellites of the list, 2.5 and 11.5 km); that gap is faded out over the first day and is never jumped. Elements with no drag term are already steady and are used as they are.
|
|
22
|
+
- **Still left out.** A satellite its own elements have brought down by `maxAgeDays` (304 of the list), and one whose drag term has run away by then (a mean motion more than a quarter off the elements' own: a drag term of 0.17 puts one recorded Starlink 530,000 km up at 30 days). Never before launch or after decay, as before.
|
|
23
|
+
- **Cost.** A second record a satellite, made the first time it is placed beyond `maxAgeDays`: 0.1 s once for 16,903 satellites, and about 2.3 KB each (40 MB for that many). The SGP4 calls a frame do not change.
|
|
24
|
+
- **Tests and docs.** `test/steady.test.ts` on the recorded stations and Starlink satellites and two made-up high orbits: the hand-over forward and back (3,977 of them, within a millimetre a microsecond on), every satellite placed past 30 days still placed all round its orbit at 1, 2, 5 and 10 years, the ISS at the same height for 10 years and its plane still turning 5 degrees a day, the old behaviour to the last digit when the choice is not made, launch and decay dates, and the group's clock and fast-clock streaks. Breaking the code six ways (no fade, no runaway rule, started from the epoch, the mean motion not turned back, the drag left in, the choice ignored) fails them each time. A browser test in `e2e/estimate.gl.ts`. English and Japanese guides.
|
|
6
25
|
|
|
7
26
|
## 0.57.0 - 2026-11-17
|
|
8
27
|
|
package/README.md
CHANGED
|
@@ -311,7 +311,7 @@ console.log(`${book.mapSources("day").length} day maps with the source off`);
|
|
|
311
311
|
|
|
312
312
|
## Satellites
|
|
313
313
|
|
|
314
|
-
The ISS, a space station or thousands of Starlink satellites at the places SGP4 puts them for the date and time shown, on `<chikyu-space>`: a group is one draw call however many it holds, press one to get its name, height and speed, and its orbit is drawn. Chikyu fetches nothing: your page passes in orbital elements (CelesTrak's JSON, within its usage policy), and satellite.js (MIT, an optional peer) does the maths about once a second, with every frame between interpolated. `fetchElements(url)` reads OMM JSON, CSV or TLE from an address you choose, politely (https, not again within two hours, stop on any answer that is not 200). A satellite whose elements are more than 14 days from the time shown is drawn dimmer, and one more than 30 days away is left out. A group is hidden while the clock runs faster than 60 times real time. `nearest` and `within` say which satellites are closest to a place, a direction in the sky or another satellite, and `closeApproach` the next time two of them pass; each call places every satellite once and does not run again by itself. `ringSatellites` rings the ones you name. A small catalogue (`SATELLITE_GROUPS`, `CATALOGUE`, `findInCatalogue`) names fourteen groups (stations, weather, GPS, Galileo, OneWeb and more) and about forty satellites worth following, with no elements in it. The guide has the rules for getting elements and the budget, each line tested: [satellites guide](docs/guides/satellites.md), [docs/satellites.md](docs/satellites.md).
|
|
314
|
+
The ISS, a space station or thousands of Starlink satellites at the places SGP4 puts them for the date and time shown, on `<chikyu-space>`: a group is one draw call however many it holds, press one to get its name, height and speed, and its orbit is drawn. Chikyu fetches nothing: your page passes in orbital elements (CelesTrak's JSON, within its usage policy), and satellite.js (MIT, an optional peer) does the maths about once a second, with every frame between interpolated. `fetchElements(url)` reads OMM JSON, CSV or TLE from an address you choose, politely (https, not again within two hours, stop on any answer that is not 200). A satellite whose elements are more than 14 days from the time shown is drawn dimmer, and one more than 30 days away is left out. A group is hidden while the clock runs faster than 60 times real time. `nearest` and `within` say which satellites are closest to a place, a direction in the sky or another satellite, and `closeApproach` the next time two of them pass; each call places every satellite once and does not run again by itself. `ringSatellites` rings the ones you name. `createSatelliteHistory(sets, { launch, decay })` gives one satellite a history: it is placed at any moment from the element set nearest that moment, not before its launch or after it has come down (`describe(ms)` says when), and after the newest set as a shaded prediction with its uncertainty stated and growing (`uncertaintyKm`, checked against NASA/JPL Horizons); `altitudeSeries(sets)` is the mean height at each set's epoch for a chart; on `<chikyu-space>`, `setSatelliteHistory(id, history)` draws it and `observe(id, { orbits })` is the Observe view, outside the satellite with the Earth turning and its trail over its last orbits ([guide](docs/guides/satellite-history.md)). A small catalogue (`SATELLITE_GROUPS`, `CATALOGUE`, `findInCatalogue`) names fourteen groups (stations, weather, GPS, Galileo, OneWeb and more) and about forty satellites worth following, with no elements in it. The guide has the rules for getting elements and the budget, each line tested: [satellites guide](docs/guides/satellites.md), [docs/satellites.md](docs/satellites.md).
|
|
315
315
|
|
|
316
316
|
<p align="center"><img alt="The ISS, ringed, over South Africa on 3 November 2026, with its orbit and the stations' orbits" src="docs/images/space-sat-iss.png" width="420"></p>
|
|
317
317
|
|
|
@@ -615,7 +615,7 @@ console.log(countryList().filter((country) => country.alpha2 === null).map((coun
|
|
|
615
615
|
|
|
616
616
|
## How to cite
|
|
617
617
|
|
|
618
|
-
> Morris, J. (2026). *Chikyu Earth* (version 0.
|
|
618
|
+
> Morris, J. (2026). *Chikyu Earth* (version 0.59.0) [Computer software]. https://github.com/johnmorrisdotca/chikyu-earth
|
|
619
619
|
|
|
620
620
|
GitHub's "Cite this repository" button reads [CITATION.cff](CITATION.cff) and gives BibTeX and APA. Cite the version you used (`npm ls @johnmorrisdotca/chikyu-earth`), and credit the sources behind the numbers and pictures: [NOTICE.md](NOTICE.md) says who made each one and under what terms.
|
|
621
621
|
|
package/dist/flat/element.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ export interface GroupStyle {
|
|
|
69
69
|
* The page gives it orbital elements: `setGroup(id, sets)` for each group (the ids of `SATELLITE_GROUPS` are known by name and colour), or the `elements` property for one, or `elements-src` (an address, read once, through `fetchElements`' rules). The package fetches nothing of its own.
|
|
70
70
|
* Attributes: `center` (the longitude in the middle, degrees; 0, Greenwich, by default; the map wraps round the date line), `home-lon` and `home-lat` (the reader's place: a marker, and the "My place" button, which appear only when given; the element never asks the browser for a place),
|
|
71
71
|
* `group` (which groups to show: `all`, one id, or several with commas), `off` (groups that are loaded but start off when `group` names none, such as `starlink`: the filter chip turns one on), `colour-by` (`group`, or `plane` to colour by orbital plane), `plane` (a plane letter: show that plane only), `footprint` and `track` (draw the coverage circle and the ground track, which is amber in sunlight and blue in the Earth's shadow, a cylinder, with a key: `--chikyu-flat-track-sun` and `--chikyu-flat-track-shadow` change the colours; the footprint is of the chosen satellite, or of every one shown when there are 80 or fewer),
|
|
72
|
-
* `paused` (hold the clock and keep the speed; nothing is drawn while it is held), `trails` (`off` for no streaks at a fast clock), `footprint-elevation` (degrees above the horizon the circle is drawn for; 25 like the 3D beam), `selected` (a NORAD number: the chosen satellite), `time` (`now` or an ISO date; live when absent), `speed` (1 is real time, 0 holds, 86400 is a day a second, negative runs backwards), `estimate-far
|
|
72
|
+
* `paused` (hold the clock and keep the speed; nothing is drawn while it is held), `trails` (`off` for no streaks at a fast clock), `footprint-elevation` (degrees above the horizon the circle is drawn for; 25 like the 3D beam), `selected` (a NORAD number: the chosen satellite), `time` (`now` or an ISO date; live when absent), `speed` (1 is real time, 0 holds, 86400 is a day a second, negative runs backwards), `estimate-far` (`steady` keeps each satellite's usual orbit beyond 30 days from its elements), `shade` (`off` for no night),
|
|
73
73
|
* `dot-size` (pixels), `controls` (`none`, or any of `centre zoom footprint track chips`: the built-in buttons and filter chips shown; all by default) and `lang` (`en` or `ja`; the page's language by default).
|
|
74
74
|
*
|
|
75
75
|
* Events: `chikyu-flat-pick` (a satellite under the pointer, tapped, or reached by the keyboard: a `FlatPick`; `detail.id` is null when a tap lands on nothing and clears the choice), `chikyu-flat-filter` (a chip changed which groups or plane are shown: `{ groups, plane }`),
|
package/dist/flat/element.js
CHANGED
|
@@ -48,6 +48,7 @@ const trackRuns = (points) => {
|
|
|
48
48
|
const sameRef = (a, b) => a === b || (a !== null && b !== null && a.g === b.g && a.i === b.i);
|
|
49
49
|
const escape = (text) => text.replace(/[&<>"]/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[c]);
|
|
50
50
|
const flag = (value) => value !== null && !/^(off|false|no|0)$/i.test(value.trim());
|
|
51
|
+
const estimateFarOf = (value) => (value !== null && value.trim().toLowerCase() === "steady" ? "steady" : flag(value));
|
|
51
52
|
const finite = (value, fallback) => (value === null || value.trim() === "" || !Number.isFinite(Number(value)) ? fallback : Number(value));
|
|
52
53
|
const readTime = (value) => {
|
|
53
54
|
if (value === null || value.trim() === "" || value.trim().toLowerCase() === "now")
|
|
@@ -100,7 +101,7 @@ canvas{position:absolute;inset:0;width:100%;height:100%;display:block}
|
|
|
100
101
|
* The page gives it orbital elements: `setGroup(id, sets)` for each group (the ids of `SATELLITE_GROUPS` are known by name and colour), or the `elements` property for one, or `elements-src` (an address, read once, through `fetchElements`' rules). The package fetches nothing of its own.
|
|
101
102
|
* Attributes: `center` (the longitude in the middle, degrees; 0, Greenwich, by default; the map wraps round the date line), `home-lon` and `home-lat` (the reader's place: a marker, and the "My place" button, which appear only when given; the element never asks the browser for a place),
|
|
102
103
|
* `group` (which groups to show: `all`, one id, or several with commas), `off` (groups that are loaded but start off when `group` names none, such as `starlink`: the filter chip turns one on), `colour-by` (`group`, or `plane` to colour by orbital plane), `plane` (a plane letter: show that plane only), `footprint` and `track` (draw the coverage circle and the ground track, which is amber in sunlight and blue in the Earth's shadow, a cylinder, with a key: `--chikyu-flat-track-sun` and `--chikyu-flat-track-shadow` change the colours; the footprint is of the chosen satellite, or of every one shown when there are 80 or fewer),
|
|
103
|
-
* `paused` (hold the clock and keep the speed; nothing is drawn while it is held), `trails` (`off` for no streaks at a fast clock), `footprint-elevation` (degrees above the horizon the circle is drawn for; 25 like the 3D beam), `selected` (a NORAD number: the chosen satellite), `time` (`now` or an ISO date; live when absent), `speed` (1 is real time, 0 holds, 86400 is a day a second, negative runs backwards), `estimate-far
|
|
104
|
+
* `paused` (hold the clock and keep the speed; nothing is drawn while it is held), `trails` (`off` for no streaks at a fast clock), `footprint-elevation` (degrees above the horizon the circle is drawn for; 25 like the 3D beam), `selected` (a NORAD number: the chosen satellite), `time` (`now` or an ISO date; live when absent), `speed` (1 is real time, 0 holds, 86400 is a day a second, negative runs backwards), `estimate-far` (`steady` keeps each satellite's usual orbit beyond 30 days from its elements), `shade` (`off` for no night),
|
|
104
105
|
* `dot-size` (pixels), `controls` (`none`, or any of `centre zoom footprint track chips`: the built-in buttons and filter chips shown; all by default) and `lang` (`en` or `ja`; the page's language by default).
|
|
105
106
|
*
|
|
106
107
|
* Events: `chikyu-flat-pick` (a satellite under the pointer, tapped, or reached by the keyboard: a `FlatPick`; `detail.id` is null when a tap lands on nothing and clears the choice), `chikyu-flat-filter` (a chip changed which groups or plane are shown: `{ groups, plane }`),
|
|
@@ -202,7 +203,7 @@ export class ChikyuFlat extends HTMLElement {
|
|
|
202
203
|
}
|
|
203
204
|
if (sets !== null) {
|
|
204
205
|
const sats = createSatellites(sets);
|
|
205
|
-
sats.estimateFar =
|
|
206
|
+
sats.estimateFar = estimateFarOf(this.getAttribute("estimate-far"));
|
|
206
207
|
const known = SATELLITE_GROUPS.find((one) => one.id === id);
|
|
207
208
|
const n = sats.count;
|
|
208
209
|
const clusters = clusterPlanes(sats.sets);
|
|
@@ -470,7 +471,7 @@ export class ChikyuFlat extends HTMLElement {
|
|
|
470
471
|
this.#readClock();
|
|
471
472
|
else if (name === "estimate-far")
|
|
472
473
|
for (const g of this.#groups.values())
|
|
473
|
-
g.sats.estimateFar =
|
|
474
|
+
g.sats.estimateFar = estimateFarOf(value);
|
|
474
475
|
else if (name === "elements-src")
|
|
475
476
|
this.#load();
|
|
476
477
|
else if (name === "shade" || name === "dot-size")
|
|
@@ -596,6 +596,7 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
|
|
|
596
596
|
* Keep placing satellites that are far from their element sets, as an estimate (the attribute `estimate-far`, off unless set; `estimate-far="off"` is off). A satellite is left out when the moment shown is more than `maxAgeDays` (30) from its elements; on, it is carried forward or back by the same SGP4 code
|
|
597
597
|
* instead, and drawn lighter than a dimmed one. **An estimate is where the satellite would be if its orbit had not changed since the elements were taken.** It is worst for low orbits (drag changes them within days, and a manoeuvre moves the satellite along its path, so after weeks the estimate can be far along the orbit from the truth, and a satellite that has re-entered is not there at all) and for a long time away; a high orbit changes slowly and is close for months. Never before a satellite's launch or after its decay when its elements carry `LAUNCH_DATE` and `DECAY_DATE` (else the year of its `OBJECT_ID` is the earliest);
|
|
598
598
|
* one SGP4 cannot carry that far, or brings down below about 120 km, is left out and is not counted as placed. Each estimated satellite is `estimated: true`, with `estimatedDays`, in `placeSatellite`, `satelliteInfo`, `chikyu-satellite-visibility` and `chikyu-satellite-click`, and `stats.satellites.estimated` counts them.
|
|
599
|
+
* **`estimate-far="steady"`** (the property set to `"steady"`) switches the air drag off beyond `maxAgeDays`, so a satellite keeps its usual orbit for as long as the clock runs instead of sinking in the model and being left out; the place does not jump where the drag is switched off.
|
|
599
600
|
* It applies to every group, those the page made with `createSatellites(sets, { estimateFar: true })` too.
|
|
600
601
|
*
|
|
601
602
|
* @example
|
|
@@ -609,8 +610,8 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
|
|
|
609
610
|
* console.log(typeof farFromToday);
|
|
610
611
|
* ```
|
|
611
612
|
*/
|
|
612
|
-
get estimateFar(): boolean;
|
|
613
|
-
set estimateFar(value: boolean);
|
|
613
|
+
get estimateFar(): boolean | "steady";
|
|
614
|
+
set estimateFar(value: boolean | "steady");
|
|
614
615
|
/** The satellite marked by `selectSatellite` or by a press on it, if any. */
|
|
615
616
|
get selectedSatellite(): SatelliteRef | null;
|
|
616
617
|
/**
|
|
@@ -1489,6 +1489,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
1489
1489
|
* Keep placing satellites that are far from their element sets, as an estimate (the attribute `estimate-far`, off unless set; `estimate-far="off"` is off). A satellite is left out when the moment shown is more than `maxAgeDays` (30) from its elements; on, it is carried forward or back by the same SGP4 code
|
|
1490
1490
|
* instead, and drawn lighter than a dimmed one. **An estimate is where the satellite would be if its orbit had not changed since the elements were taken.** It is worst for low orbits (drag changes them within days, and a manoeuvre moves the satellite along its path, so after weeks the estimate can be far along the orbit from the truth, and a satellite that has re-entered is not there at all) and for a long time away; a high orbit changes slowly and is close for months. Never before a satellite's launch or after its decay when its elements carry `LAUNCH_DATE` and `DECAY_DATE` (else the year of its `OBJECT_ID` is the earliest);
|
|
1491
1491
|
* one SGP4 cannot carry that far, or brings down below about 120 km, is left out and is not counted as placed. Each estimated satellite is `estimated: true`, with `estimatedDays`, in `placeSatellite`, `satelliteInfo`, `chikyu-satellite-visibility` and `chikyu-satellite-click`, and `stats.satellites.estimated` counts them.
|
|
1492
|
+
* **`estimate-far="steady"`** (the property set to `"steady"`) switches the air drag off beyond `maxAgeDays`, so a satellite keeps its usual orbit for as long as the clock runs instead of sinking in the model and being left out; the place does not jump where the drag is switched off.
|
|
1492
1493
|
* It applies to every group, those the page made with `createSatellites(sets, { estimateFar: true })` too.
|
|
1493
1494
|
*
|
|
1494
1495
|
* @example
|
|
@@ -1503,10 +1504,15 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
1503
1504
|
* ```
|
|
1504
1505
|
*/
|
|
1505
1506
|
get estimateFar() {
|
|
1506
|
-
|
|
1507
|
+
const value = this.getAttribute("estimate-far");
|
|
1508
|
+
if (value === null || value === "off")
|
|
1509
|
+
return false;
|
|
1510
|
+
return value.trim().toLowerCase() === "steady" ? "steady" : true;
|
|
1507
1511
|
}
|
|
1508
1512
|
set estimateFar(value) {
|
|
1509
|
-
if (value)
|
|
1513
|
+
if (value === "steady")
|
|
1514
|
+
this.setAttribute("estimate-far", "steady");
|
|
1515
|
+
else if (value)
|
|
1510
1516
|
this.setAttribute("estimate-far", "");
|
|
1511
1517
|
else
|
|
1512
1518
|
this.removeAttribute("estimate-far");
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import type { ElementSet, Satellites } from "./types.ts";
|
|
2
|
+
/**
|
|
3
|
+
* What a moment is, for a satellite with a history.
|
|
4
|
+
*
|
|
5
|
+
* - `before-launch`: the moment is before its launch; it is not drawn.
|
|
6
|
+
* - `backcast`: after the launch but before its oldest element set; placed from that set, carried back.
|
|
7
|
+
* - `tracked`: between its oldest and its newest element set; placed from the set nearest the moment.
|
|
8
|
+
* - `predicted`: after its newest element set; a prediction, drawn shaded, with an uncertainty that grows.
|
|
9
|
+
* - `decayed`: after its decay date; it has come down and is not drawn.
|
|
10
|
+
* - `unplaceable`: SGP4 could not place it (bad numbers, or it fell below the air from its own elements).
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* import type { HistoryStatus } from "@johnmorrisdotca/chikyu-earth/satellites";
|
|
15
|
+
*
|
|
16
|
+
* const drawn = (status: HistoryStatus): boolean => status === "tracked" || status === "backcast" || status === "predicted";
|
|
17
|
+
* console.log(drawn("predicted"));
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export type HistoryStatus = "before-launch" | "backcast" | "tracked" | "predicted" | "decayed" | "unplaceable";
|
|
21
|
+
/**
|
|
22
|
+
* How fast the stated uncertainty of a place grows with its distance in time from the nearest element set: `baseKm + kmPerDay * d + kmPerDaySquared * d * d`, `d` in days.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* import type { UncertaintyModel } from "@johnmorrisdotca/chikyu-earth/satellites";
|
|
27
|
+
*
|
|
28
|
+
* const calm: UncertaintyModel = { baseKm: 1, kmPerDay: 1, kmPerDaySquared: 0.2 };
|
|
29
|
+
* console.log(calm.kmPerDay);
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export interface UncertaintyModel {
|
|
33
|
+
baseKm: number;
|
|
34
|
+
kmPerDay: number;
|
|
35
|
+
kmPerDaySquared: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The package's stated uncertainty for a low orbit: 1 km, 3 km a day and 1.5 km a day squared from the nearest element set. It was set from what was measured against NASA/JPL Horizons
|
|
39
|
+
* (the ISS from one element set: 25, 59, 108 and 168 km at 5.6, 7.6, 9.6 and 11.6 days) with a margin; a higher orbit, with less drag, is better than this, so it is a ceiling, not a forecast.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* import { DEFAULT_UNCERTAINTY } from "@johnmorrisdotca/chikyu-earth/satellites";
|
|
44
|
+
*
|
|
45
|
+
* console.log(DEFAULT_UNCERTAINTY.kmPerDay);
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare const DEFAULT_UNCERTAINTY: Readonly<UncertaintyModel>;
|
|
49
|
+
/**
|
|
50
|
+
* The stated uncertainty, in kilometres, of a satellite's place `days` from its nearest element set (either side).
|
|
51
|
+
*
|
|
52
|
+
* @param days - The distance in days from the nearest set's epoch (the sign is ignored).
|
|
53
|
+
* @param model - The growth to state (`DEFAULT_UNCERTAINTY` when left out).
|
|
54
|
+
* @returns Kilometres, never less than `model.baseKm`.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* import { predictionUncertaintyKm } from "@johnmorrisdotca/chikyu-earth/satellites";
|
|
59
|
+
*
|
|
60
|
+
* console.log(predictionUncertaintyKm(0).toFixed(0), predictionUncertaintyKm(10).toFixed(0)); // 1 181
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare function predictionUncertaintyKm(days: number, model?: Readonly<UncertaintyModel>): number;
|
|
64
|
+
/**
|
|
65
|
+
* What can be told to `createSatelliteHistory`.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* import type { HistoryOptions } from "@johnmorrisdotca/chikyu-earth/satellites";
|
|
70
|
+
*
|
|
71
|
+
* const options: HistoryOptions = { launch: "1998-11-20", decay: "2031-01-01" };
|
|
72
|
+
* console.log(options.launch);
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export interface HistoryOptions {
|
|
76
|
+
/** The launch: a date (`2026-11-02`, the start of that day UTC), a date and time, or milliseconds. Left out, `LAUNCH_DATE` of the sets, else the start of the launch year in `OBJECT_ID`, else no limit. */
|
|
77
|
+
launch?: string | number;
|
|
78
|
+
/** The decay: as `launch` (a bare date is the end of that day). Left out, `DECAY_DATE` of the sets, else none. */
|
|
79
|
+
decay?: string | number;
|
|
80
|
+
/** How the stated uncertainty grows (`DEFAULT_UNCERTAINTY` when left out). */
|
|
81
|
+
uncertainty?: UncertaintyModel;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Where a satellite stands in its history at one moment: what to tell a reader.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* import type { HistoryMoment } from "@johnmorrisdotca/chikyu-earth/satellites";
|
|
89
|
+
*
|
|
90
|
+
* const say = (m: HistoryMoment): string => (m.status === "decayed" ? `came down ${new Date(m.decayedMs!).toISOString().slice(0, 10)}` : m.status);
|
|
91
|
+
* console.log(typeof say);
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export interface HistoryMoment {
|
|
95
|
+
status: HistoryStatus;
|
|
96
|
+
/** The set used, as its place in `history.sets` (sorted by epoch); -1 when there are none. */
|
|
97
|
+
setIndex: number;
|
|
98
|
+
/** The epoch of that set, ms. */
|
|
99
|
+
epochMs: number;
|
|
100
|
+
/** The distance in days from that set's epoch, whichever way (0 or more). */
|
|
101
|
+
distanceDays: number;
|
|
102
|
+
/** The stated uncertainty of the place, kilometres (`predictionUncertaintyKm` of `distanceDays`); 0 when it is not placed. */
|
|
103
|
+
uncertaintyKm: number;
|
|
104
|
+
/** The launch, ms, or null when it is not known. */
|
|
105
|
+
launchedMs: number | null;
|
|
106
|
+
/** True when `launchedMs` is a date the sets or the options give, not just the start of the launch year. */
|
|
107
|
+
launchExact: boolean;
|
|
108
|
+
/** The decay, ms (the end of the day when a bare date was given), or null when it has not come down. */
|
|
109
|
+
decayedMs: number | null;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* One point of `altitudeSeries`: the mean height of a satellite at the epoch of one element set.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* import type { AltitudePoint } from "@johnmorrisdotca/chikyu-earth/satellites";
|
|
117
|
+
*
|
|
118
|
+
* const label = (p: AltitudePoint): string => `${new Date(p.epochMs).toISOString().slice(0, 10)}: ${p.altitudeKm.toFixed(1)} km`;
|
|
119
|
+
* console.log(typeof label);
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export interface AltitudePoint {
|
|
123
|
+
/** The epoch of the set, ms. */
|
|
124
|
+
epochMs: number;
|
|
125
|
+
/** The mean height over one revolution about that moment, kilometres above the mean Earth radius (6371 km). */
|
|
126
|
+
altitudeKm: number;
|
|
127
|
+
/** The NORAD catalogue number. */
|
|
128
|
+
noradId: number;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* A satellite with a history: its element sets in order, its launch and decay, and where it was at any moment.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```ts
|
|
135
|
+
* import type { SatelliteHistory } from "@johnmorrisdotca/chikyu-earth/satellites";
|
|
136
|
+
*
|
|
137
|
+
* const first = (h: SatelliteHistory): number => h.sets[0]?.NORAD_CAT_ID ?? 0;
|
|
138
|
+
* console.log(typeof first);
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
export interface SatelliteHistory {
|
|
142
|
+
/** The NORAD catalogue number. */
|
|
143
|
+
readonly noradId: number;
|
|
144
|
+
/** The name, from the newest set. */
|
|
145
|
+
readonly name: string;
|
|
146
|
+
/** The sets SGP4 could start from, oldest epoch first. */
|
|
147
|
+
readonly sets: readonly ElementSet[];
|
|
148
|
+
/** Their epochs, ms, in the same order. */
|
|
149
|
+
readonly epochs: readonly number[];
|
|
150
|
+
/** The sets that were left out, with the reason. */
|
|
151
|
+
readonly refused: readonly {
|
|
152
|
+
noradId: number;
|
|
153
|
+
epoch: string;
|
|
154
|
+
reason: string;
|
|
155
|
+
}[];
|
|
156
|
+
/** The newest set's epoch, ms, or 0 when there are none: after it a place is a prediction. */
|
|
157
|
+
readonly newestEpochMs: number;
|
|
158
|
+
/** Where it stands at `ms`: no SGP4 call. */
|
|
159
|
+
describe(ms: number): HistoryMoment;
|
|
160
|
+
/**
|
|
161
|
+
* The place and velocity at `ms` from the set nearest it (Earth radii in the space view's axes, km/s), into `out` (6 numbers). Returns the status: only `backcast`, `tracked` and `predicted` write `out`.
|
|
162
|
+
*/
|
|
163
|
+
exact(ms: number, out: Float64Array): HistoryStatus;
|
|
164
|
+
/**
|
|
165
|
+
* The last `orbits` revolutions of its path before `ms`, oldest first, into `out` (3 numbers a point, as many points as fit, at least 2), each point placed from the set nearest its own moment.
|
|
166
|
+
* No allocation. Returns how many points are valid: points before its launch or after its decay are left out of the front and the back, and 0 when it is not placed at `ms`.
|
|
167
|
+
*/
|
|
168
|
+
trailInto(ms: number, orbits: number, out: Float32Array): number;
|
|
169
|
+
/** The same, in a new array of `points` points (`trailInto` for a frame). */
|
|
170
|
+
trail(ms: number, orbits: number, points?: number): Float32Array;
|
|
171
|
+
/** The group the space view draws: one satellite, placed from the nearest set at each moment, shaded while predicted. */
|
|
172
|
+
readonly group: Satellites;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Make the history of one satellite from its element sets (any number, any order, all of one satellite). A set that SGP4 cannot start from is listed in `refused` and left out.
|
|
176
|
+
* It needs satellite.js and imports in a browser or on a server. The sets are the page's: nothing is fetched.
|
|
177
|
+
*
|
|
178
|
+
* @param sets - Element sets in CelesTrak's JSON format, one satellite, as many epochs as the page has.
|
|
179
|
+
* @param options - `launch`, `decay` (else the sets' own `LAUNCH_DATE`, `DECAY_DATE`) and `uncertainty`.
|
|
180
|
+
* @returns The history: `describe(ms)`, `exact(ms, out)`, `trail`, and `group` for the space view.
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```ts
|
|
184
|
+
* import { createSatelliteHistory, type ElementSet } from "@johnmorrisdotca/chikyu-earth/satellites";
|
|
185
|
+
*
|
|
186
|
+
* const set = (epoch: string, meanAnomaly: number): ElementSet => ({
|
|
187
|
+
* OBJECT_NAME: "ISS (ZARYA)",
|
|
188
|
+
* OBJECT_ID: "1998-067A",
|
|
189
|
+
* EPOCH: epoch,
|
|
190
|
+
* MEAN_MOTION: 15.49150046,
|
|
191
|
+
* ECCENTRICITY: 0.0007139,
|
|
192
|
+
* INCLINATION: 51.6332,
|
|
193
|
+
* RA_OF_ASC_NODE: 335.9757,
|
|
194
|
+
* ARG_OF_PERICENTER: 339.3739,
|
|
195
|
+
* MEAN_ANOMALY: meanAnomaly,
|
|
196
|
+
* NORAD_CAT_ID: 25544,
|
|
197
|
+
* BSTAR: 0.00012,
|
|
198
|
+
* MEAN_MOTION_DOT: 0.0001,
|
|
199
|
+
* MEAN_MOTION_DDOT: 0,
|
|
200
|
+
* LAUNCH_DATE: "1998-11-20",
|
|
201
|
+
* });
|
|
202
|
+
* const history = createSatelliteHistory([set("2026-11-02T10:25:21.580320", 20.6961)]);
|
|
203
|
+
* console.log(history.describe(Date.UTC(1990, 0, 1)).status, history.describe(Date.UTC(2026, 10, 3)).status, history.describe(Date.UTC(2026, 10, 20)).status);
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
export declare function createSatelliteHistory(sets: readonly ElementSet[], options?: HistoryOptions): SatelliteHistory;
|
|
207
|
+
/**
|
|
208
|
+
* The mean height of a satellite at the epoch of each of its element sets, for a chart of how its orbit rose and fell (a station reboosted, a satellite coming down).
|
|
209
|
+
* The height is averaged over one revolution about the epoch (SGP4 at 24 moments), above the mean Earth radius (6371 km); a set SGP4 cannot start from is left out. Oldest epoch first.
|
|
210
|
+
*
|
|
211
|
+
* @param sets - Element sets of one satellite (or several: each is a point, with its `noradId`).
|
|
212
|
+
* @returns One point for each usable set, sorted by epoch.
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* ```ts
|
|
216
|
+
* import { altitudeSeries, type ElementSet } from "@johnmorrisdotca/chikyu-earth/satellites";
|
|
217
|
+
*
|
|
218
|
+
* const set = (epoch: string, motion: number): ElementSet => ({
|
|
219
|
+
* OBJECT_NAME: "ISS (ZARYA)",
|
|
220
|
+
* OBJECT_ID: "1998-067A",
|
|
221
|
+
* EPOCH: epoch,
|
|
222
|
+
* MEAN_MOTION: motion,
|
|
223
|
+
* ECCENTRICITY: 0.0007139,
|
|
224
|
+
* INCLINATION: 51.6332,
|
|
225
|
+
* RA_OF_ASC_NODE: 335.9757,
|
|
226
|
+
* ARG_OF_PERICENTER: 339.3739,
|
|
227
|
+
* MEAN_ANOMALY: 20.6961,
|
|
228
|
+
* NORAD_CAT_ID: 25544,
|
|
229
|
+
* BSTAR: 0.00012,
|
|
230
|
+
* MEAN_MOTION_DOT: 0.0001,
|
|
231
|
+
* MEAN_MOTION_DDOT: 0,
|
|
232
|
+
* });
|
|
233
|
+
* const series = altitudeSeries([set("2026-11-02T10:25:21", 15.49), set("2026-10-02T10:25:21", 15.52)]);
|
|
234
|
+
* console.log(series.map((p) => p.altitudeKm.toFixed(0)));
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
export declare function altitudeSeries(sets: readonly ElementSet[]): AltitudePoint[];
|