Skip to content

A spy satellite simulator in your browser, except the data is real. Live open source spatial intelligence on a photorealistic 3D globe.

docs(cyclones): document the early-advisory window and pin its bounds

Mazeyar Moeini Feizabadi6d6ce364c684
diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md
index e5b3d2ace..0af075a6d 100644
--- a/docs/CURRENT-STATE.md
+++ b/docs/CURRENT-STATE.md
@@ -339,7 +339,12 @@ Cyclones combine fixed NHC/CPHC status and summary GIS endpoints through a bound
same-origin provider. The status endpoint lacks browser CORS; each installation
fetches keyless public sources at runtime, with no centralized ingestion service.
The five-minute snapshot covers Atlantic and eastern/central North Pacific only.
-Current positions, advisory issue time and position time stay distinct. Tracks,
+Current positions, advisory issue time and position time stay distinct. NHC may
+release an advisory before its nominal time (routinely up to about 30 minutes,
+rarely about an hour), so advisory issue and position times up to and including
+90 minutes ahead of the server clock are accepted; 90 minutes is this app's
+tolerance, not an NHC limit. Later, non-canonical, or more than 12-hour-old
+times still reject the status snapshot. Tracks,
forecast lead-hour points and cones render only when all source parts match the
status advisory; a newer status shows its position with geometry pending rather
than relabeling older geometry. The cone represents forecast center uncertainty,
diff --git a/src/data/cyclonesProxy.test.mjs b/src/data/cyclonesProxy.test.mjs
index 31433b326..23e84826c 100644
--- a/src/data/cyclonesProxy.test.mjs
+++ b/src/data/cyclonesProxy.test.mjs
@@ -166,11 +166,40 @@ test('advisories published before their nominal time are accepted, far-future on
// NHC wrote the 03:00Z advisory at 02:34Z.
const early = Date.UTC(2026, 8, 16, 2, 34);
assert.equal(parseCycloneStatus(status(), early)[0].issuedAt, TIME);
- assert.throws(() =>
- parseCycloneStatus(status(), Date.UTC(2026, 8, 16, 1, 25)),
+ assert.throws(
+ () => parseCycloneStatus(status(), Date.UTC(2026, 8, 16, 1, 25)),
+ /invalid_cyclone_data/,
);
});
+test('advisory and position times are bounded at 90 minutes ahead and 12 hours old', () => {
+ const MINUTE = 60_000;
+ const at = (offsetMs) => new Date(NOW + offsetMs).toISOString();
+ const fields = {
+ issuedAt: (value) =>
+ status({
+ forecastAdvisory: {
+ advNum: '010',
+ issuance: value,
+ url: 'https://www.nhc.noaa.gov/text/MIATCMEP5.shtml',
+ },
+ }),
+ positionAt: (value) => status({ lastUpdate: value }),
+ };
+ for (const [field, payload] of Object.entries(fields)) {
+ for (const offset of [90 * MINUTE, -12 * 60 * MINUTE]) {
+ const [storm] = parseCycloneStatus(payload(at(offset)), NOW);
+ assert.equal(storm[field], at(offset), `${field} ${offset}`);
+ }
+ for (const offset of [90 * MINUTE + 1, -12 * 60 * MINUTE - 1])
+ assert.throws(
+ () => parseCycloneStatus(payload(at(offset)), NOW),
+ /invalid_cyclone_data/,
+ `${field} ${offset}`,
+ );
+ }
+});
+
test('coherent geometry is retained with holes/dateline while older advisory geometry is omitted', () => {
const storms = parseCycloneStatus(status(), NOW);
const parts = collections();