Tide prediction
Harmonic method, Schureman's SP 98 as NOAA runs it · checked against NOAA CO-OPS's predictions
What it is
The tide at a place is the sum of a few dozen steady waves, each driven by the moon or the sun. Harmonic constants give each wave’s size (amplitude) and timing (phase) at one station, measured from a year or more of water levels. To predict, each wave is started from where the moon and sun are at the time, adjusted for the 18.6-year wobble of the moon’s orbit, and the waves are added up. NOAA predicts every US tide this way, with the method in Schureman’s manual from 1940.
- The constants are the station. Two stations a few kilometres apart can have very different tides; nothing here works from a latitude and longitude.
- Heights are above mean sea level, not the chart datum a tide table uses. Add the station’s datum offset to get a tide table’s numbers.
- Seattle and San Francisco are mixed, Boston and Eastport semidiurnal, Pensacola diurnal. Honolulu’s range is about half a metre; Nikiski’s, in Cook Inlet, about six.
- NOAA leaves out a high and a low less than about 2 hours apart, like a brief stand at Galveston. No case here depends on one.
Operations
| Operation | Gives |
|---|---|
height |
The predicted height at an instantIn: constituents, instantUtcOut: heightInMeters |
nextExtremes |
The next high and the next low after an instantIn: constituents, startUtcOut: highUtc, highHeightInMeters, lowUtc, lowHeightInMeters |
Fields
| Field | Meaning |
|---|---|
constituents | A station's harmonic constants: a list of objects, each with name, amplitudeInMeters and phaseInDegrees. The cases give NOAA's published set for a station in NOAA's order, leaving out those with zero amplitude. A name given twice is invalidInput. |
name | In each constituent: its name as NOAA spells it, one of NOAA's 37: M2, S2, N2, K1, M4, O1, M6, MK3, S4, MN4, NU2, S6, MU2, 2N2, OO1, LAM2, S1, M1, J1, MM, SSA, SA, MSF, MF, RHO, Q1, T2, R2, 2Q1, P1, 2SM2, M3, L2, 2MK3, K2, M8, MS4. Any other name is invalidInput. |
amplitudeInMeters | In each constituent: its mean amplitude H, 0 or more. NOAA gives the millimetre. |
phaseInDegrees | In each constituent: its Greenwich phase lag κ′ (NOAA's phase_GMT), 0 to 360. NOAA gives a tenth of a degree. |
instantUtc | An instant, ISO 8601 with Z |
startUtc | The instant to search from, ISO 8601 with Z |
heightInMeters | The height above the constituents' mean, which for NOAA's sets is mean sea level: the sum of the constituents, with no constant term. NOAA gives the millimetre. |
highUtc | The first high water after startUtc: the first local maximum of the predicted height. NOAA gives the minute. |
highHeightInMeters | The predicted height at highUtc, as heightInMeters |
lowUtc | The first low water after startUtc: the first local minimum. A low that comes before the high is still the first low. |
lowHeightInMeters | The predicted height at lowUtc, as heightInMeters |
Edge cases
| Case | What it tests |
|---|---|
noaa-height-seattle-2026-12-31-2354height | The last 2026 prediction: still under 2026's V0+u and node factors. |
noaa-height-seattle-2027-01-01-0000height | The first 2027 prediction: NOAA switches to 2027's V0+u and node factors at 00:00 UTC, and Seattle's curve jumps about 8 cm. |
noaa-height-nikiski-2026-12-31-2354height | A large tide in Cook Inlet, the last 2026 prediction. |
noaa-height-nikiski-2027-01-01-0000height | The first 2027 prediction at Nikiski: the curve steps about 6 cm here. |
noaa-next-extremes-seattle-2026-12-31-2000nextExtremes | Starts in 2026; the low and the high come in 2027, under 2027's values. |
invalid-height-unknown-constituentheight | A name NOAA doesn't use. |
invalid-height-duplicate-constituentheight | M2 twice would double its height: invalidInput. |
invalid-next-extremes-unknown-constituentnextExtremes | A name NOAA doesn't use. |
Their inputs and expected values are in vectors.json; search for the case's id.
For agents
Follow Schureman, Manual of Harmonic Analysis and Prediction of Tides (SP 98, 1958 reprint), the way NOAA runs it. The height is h = Σ f·H·cos(a·t + (V₀+u) − κ′) over the constituents given, with no constant term. H is amplitudeInMeters and κ′ is phaseInDegrees, already referred to Greenwich and GMT, so no longitude or time zone correction. a is the constituent’s speed from SP 98 tables 2 and 2a.
Take one set of V₀+u and f per year, for the UTC year of the instant. t is hours since 00:00 UTC on 1 January of that year, and V₀ is for that moment. u and f are for the middle of the year: 2 July 12:00 UTC, or 2 July 00:00 in a leap year (SP 98 p. 157, on tables 14 and 15). NOAA switches years at 00:00 UTC whatever the station’s time zone, and its curve steps there; the cases either side of 1 January 2027 test it. Computing u and f at the instant instead misses NOAA by up to about 4 cm, so it fails.
The traps are in NOAA’s 37 constituents. M1 is SP 98’s second form: V = T − s + h − 90°, u = ξ − ν + Q with tan Q = 0.483 tan P (formulas 201 and 203), f = f(O1)/Qa (197, 206, 207), where Qa is 1/√(2.310 + 1.435 cos 2P), so f is f(O1)·√(2.310 + 1.435 cos 2P), and speed 14.4966939° an hour. 2MK3 is 2M2 − K1 (table 2a), not M2 + O1. MSF is S2 − M2 (p. 48), so its u isn’t zero. L2 needs R and Ra (212 to 215), K1 ν′ (224, 227) and K2 2ν″ (232, 235). A compound’s u is the sum of its parts’ and its f their product. NOAA spells λ2 LAM2 and ρ1 RHO.
For nextExtremes, find the first local maximum and the first local minimum of h after startUtc to well under a minute, by stepping a few minutes and refining. The first low may come before the first high. Pass every case in vectors.json within its tolerance.
To check your V₀+u and f by hand, SP 98 tables 14 and 15 give them to 1999 and 2000. XTide’s congen_output.txt (flaterco.com) gives them for every year from 1700 to 2100, computed from SP 98.
Test data
vectors.json holds 148 cases, published 2026-11-04. Earth model: None: a station's harmonic constants stand for its place. How to read it: Test data format.
| Operation | Cases |
|---|---|
height |
10194 published · 4 edge · 7 invalid |
nextExtremes |
4746 published · 1 edge · 1 invalid |
Tags say where each value came from: what they mean.
| Field | Tolerance |
|---|---|
heightInMeters | ± 0.005 |
highUtc | ± 120 s |
highHeightInMeters | ± 0.005 |
lowUtc | ± 120 s |
lowHeightInMeters | ± 0.005 |
Every other field is compared exactly.
Implementations
| Implementation | Status |
|---|---|
| gshaw/algorithms-swiftSwift | Passes |
| gshaw/algorithms-typescriptTypeScript | Passes |
Each implementation's CI grades it against this page's test data on every push, and again when the data changes. The code isn't public yet. See how implementations work.
Source
| Heights | CO-OPS Data API: tide predictions every 6 minutes, on mean sea level, in GMTNOAA Center for Operational Oceanographic Products and Services. Every request and response is in /tides/sources/noaa.jsonl · Public domain |
| Highs and lows | CO-OPS Data API: high and low tide predictions (interval=hilo)NOAA CO-OPS. Leaves out a high and a low less than about 2 hours apart; no case depends on one · Public domain |
| Constituents | CO-OPS Metadata API: harmonic constituents (harcon.json), metricNOAA CO-OPS. Amplitude in metres, phase_GMT as phaseInDegrees · Public domain |
| Check | XTide 2.16 on the same constantsDavid Flater. Its equilibrium arguments and node factors are congen's, from SP 98. Within 0.004 m and 60 s of every case it checks; it blends one year into the next over the hour either side of 1 January, so it doesn't check those. Every call is in /tides/sources/xtide.txt · GPL 3 |
| Method | Manual of Harmonic Analysis and Prediction of Tides, Special Publication 98, 1958 reprint: tables 2, 2a, 14 and 15Paul Schureman, US Coast and Geodetic Survey. The method to follow; no value in the file comes from it · Public domain |
| NOAA's practice | Tidal Analysis and Prediction, NOAA Special Publication NOS CO-OPS 3, 2007, section 2.2.4Bernard D. Parker. One node factor and one u per year, both for the middle of the year · Public domain |