Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds prominence-based filtering to the extremes prediction algorithm to eliminate spurious mathematical extremes from low-amplitude tidal stations. The issue was particularly apparent in micro-tidal locations like Vahemadal, Estonia, where tiny oscillations (1-4mm) caused by numerical computation were incorrectly reported as tidal extremes alongside the real tidal signal.
Changes:
- Implements post-processing prominence filter that iteratively removes extremes with level differences below 2% of total constituent amplitude
- Adds unit tests for prominence filtering behavior on both low-amplitude and normal tidal stations
- Adds comprehensive snapshot tests covering 20 representative stations worldwide to catch regressions from future algorithm changes
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/tide-predictor/src/harmonics/prediction.ts | Adds prominence filtering algorithm after extremes detection |
| packages/tide-predictor/test/harmonics/prediction.test.ts | Adds unit tests for prominence filtering on low-amplitude and normal stations |
| packages/neaps/test/snapshots.test.ts | New snapshot test suite covering 20 diverse tidal stations |
| packages/neaps/test/snapshots/snapshots.test.ts.snap | Generated snapshot data showing filtered extremes for all test stations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
0af2499 to
2b90420
Compare
829e55b to
d338dfa
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
884f4c0 to
065c691
Compare
d94fb9a to
bb60461
Compare
0088c81 to
f0d8636
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
#219 reports bad data for stations like Vahemadal (Estonia), where tidal amplitudes are negligible. The derivative-based root-finding algorithm introduced in #213 correctly finds mathematical zeros of h'(t), but reports tiny oscillations (1-4mm) as tidal extremes (previous code may have produced those oscillations too, depending on their timing). For example, Vahemadal returns 6 extremes in 1 day with a total range of only 3.6cm, where physically there's just one slow rise/fall dominated by seasonal constituents (SSA: 0.158m, SA: 0.059m, vs M2: 0.006m).
This PR filters spurious extremes from tide predictions using prominence threshold and minimum temporal gap criteria.
This PR also adds a snapshot test with extremes from a selection of representative stations to make it more obvious how model changes affect real world predictions.