Repository navigation
Fix heights at NOAA stations: measure datum offsets against the table's own MSL - #12
Conversation
…'s own MSL Bay Area (and all NOAA-sourced) heights were off by the full MSL→MLLW conversion (~3.2 ft at Richmond Inner Harbor: app showed -1.2 ft when NOAA predicted +2.0 ft). Two related bugs: 1. datumOffset() assumed the station's datums table is MSL-relative (true for TICON, where MSL = 0) and returned -datums[target]. NOAA tables are station-datum-relative (STND = 0, MSL a few metres up), so the offset must be datums[MSL] - datums[target]. This affected 1,178 reference stations. 2. Subordinate-station ratios were applied to MSL-relative levels, but NOAA height ratios are defined on tide-table heights above the reference's chart datum. createModel now lifts reference levels into chart-datum space, warps there, and shifts back into the subordinate's model space (a no-op shift for the usual datum-less subordinate, whose display offset is also 0). This affected all 2,231 subordinates. Also fixes the Detail-page datum selector labels, which printed raw station-datum-relative values as "vs MSL". Verified against NOAA's published predictions for Richmond Inner Harbor (9414849, ratios on SF Golden Gate 9414290): highs/lows now match within 0.03 ft and 2 minutes; timing was already correct. Added a pinned regression test for that station pair plus STND-relative datum unit tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bsh1A5WLRb9xhiGNxUvs8p
The Settings-persisted datum key was a cross-station foot-gun: one global value applied to every station on Earth. Stations lacking the chosen key silently fell back to MSL-relative heights while the readout still wore the selected label, and datum-less subordinate stations mislabeled under any override. Users overwhelmingly want the numbers that match local published tide tables — the station's own chart datum — so that is now the only display reference. The Detail page's datum selector becomes a read-only table of the station's datums vs MSL (transparency kept, mutation removed), with the chart datum called out. The engine's predict-around-MSL / convert-at- display architecture is unchanged. A stale `datum` key persisted in existing users' localStorage is simply no longer read. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bsh1A5WLRb9xhiGNxUvs8p
The test clicked the recenter control and immediately asserted map.isMoving(). On a slow CI runner the click-resolution plus evaluate round-trip can outlast the 450 ms ease, so the animation is already finished and isMoving() is legitimately false — the CI failure was a race, not a product bug. Poll for either state instead: still animating, or camera already re-centred on the selection. The ease starts synchronously in the click handler, so one of the two always holds. Arrival alone can't be the sole predicate because environments that block tile/style requests never advance MapLibre's render loop, leaving the animation pending forever. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bsh1A5WLRb9xhiGNxUvs8p
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f939a642fd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| heightUnit: HeightUnit; | ||
| distanceUnit: DistanceUnit; | ||
| timeFormat: TimeFormat; | ||
| /** Chart datum key, or null to use each station's own chart_datum. */ | ||
| datum: string | null; | ||
| theme: 'dark' | 'light' | 'auto'; | ||
| showMarine: boolean; |
There was a problem hiding this comment.
Update the user documentation after removing datum selection
Removing datum from persisted settings and the Detail-page selector leaves the documented workflow inaccurate: README.md:26-27 still advertises chart datum as a preference, README.md:36-37 instructs users to switch it, and README.md:75-77 says it is stored locally. Users following those instructions will look for a control that no longer exists, so the README should describe the new station-chart-datum-only behavior.
Useful? React with 👍 / 👎.
* Update README for station-chart-datum-only heights The datum switcher was removed in #12 (a global override mislabeled stations lacking the chosen datum key), but the README still advertised chart datum as a switchable, persisted preference. Drop it from the preference lists, reword the Source & accuracy step, and document the new behavior: heights are always above the station's own chart datum, matching its published tide tables, with the reference levels listed read-only on the Source & accuracy page. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bsh1A5WLRb9xhiGNxUvs8p * Qualify reference-levels promise for datum-less stations Subordinate stations predicted by offsets (e.g. NOAA 9414849) ship no datums table, so the Source & accuracy page has no reference levels to list — don't promise them unconditionally. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bsh1A5WLRb9xhiGNxUvs8p --------- Co-authored-by: Claude <noreply@anthropic.com>
Bay Area (and all NOAA-sourced) heights were off by the full MSL→MLLW
conversion (~3.2 ft at Richmond Inner Harbor: app showed -1.2 ft when NOAA
predicted +2.0 ft). Two related bugs:
datumOffset() assumed the station's datums table is MSL-relative
(true for TICON, where MSL = 0) and returned -datums[target]. NOAA
tables are station-datum-relative (STND = 0, MSL a few metres up), so
the offset must be datums[MSL] - datums[target]. This affected 1,178
reference stations.
Subordinate-station ratios were applied to MSL-relative levels, but
NOAA height ratios are defined on tide-table heights above the
reference's chart datum. createModel now lifts reference levels into
chart-datum space, warps there, and shifts back into the subordinate's
model space (a no-op shift for the usual datum-less subordinate, whose
display offset is also 0). This affected all 2,231 subordinates.
Also fixes the Detail-page datum selector labels, which printed raw
station-datum-relative values as "vs MSL".
Verified against NOAA's published predictions for Richmond Inner Harbor
(9414849, ratios on SF Golden Gate 9414290): highs/lows now match within
0.03 ft and 2 minutes; timing was already correct. Added a pinned
regression test for that station pair plus STND-relative datum unit tests.
Co-Authored-By: Claude Fable 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01Bsh1A5WLRb9xhiGNxUvs8p