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.

Three of Seattle's tidal waves, M2, K1 and O1, drawn to scale above the tide they add up to, with mean sea level, a start time, and the next high of 1.20 m and next low of 0.40 m after it
  • 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

OperationGives
height The predicted height at an instantIn: constituents, instantUtc
Out: heightInMeters
nextExtremes The next high and the next low after an instantIn: constituents, startUtc
Out: highUtc, highHeightInMeters, lowUtc, lowHeightInMeters

Fields

FieldMeaning
constituentsA 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.
nameIn 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.
amplitudeInMetersIn each constituent: its mean amplitude H, 0 or more. NOAA gives the millimetre.
phaseInDegreesIn each constituent: its Greenwich phase lag κ′ (NOAA's phase_GMT), 0 to 360. NOAA gives a tenth of a degree.
instantUtcAn instant, ISO 8601 with Z
startUtcThe instant to search from, ISO 8601 with Z
heightInMetersThe 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.
highUtcThe first high water after startUtc: the first local maximum of the predicted height. NOAA gives the minute.
highHeightInMetersThe predicted height at highUtc, as heightInMeters
lowUtcThe first low water after startUtc: the first local minimum. A low that comes before the high is still the first low.
lowHeightInMetersThe predicted height at lowUtc, as heightInMeters

Edge cases

CaseWhat it tests
noaa-height-seattle-2026-12-31-2354heightThe last 2026 prediction: still under 2026's V0+u and node factors.
noaa-height-seattle-2027-01-01-0000heightThe 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-2354heightA large tide in Cook Inlet, the last 2026 prediction.
noaa-height-nikiski-2027-01-01-0000heightThe first 2027 prediction at Nikiski: the curve steps about 6 cm here.
noaa-next-extremes-seattle-2026-12-31-2000nextExtremesStarts in 2026; the low and the high come in 2027, under 2027's values.
invalid-height-unknown-constituentheightA name NOAA doesn't use.
invalid-height-duplicate-constituentheightM2 twice would double its height: invalidInput.
invalid-next-extremes-unknown-constituentnextExtremesA 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.

OperationCases
height 10194 published · 4 edge · 7 invalid
nextExtremes 4746 published · 1 edge · 1 invalid

Tags say where each value came from: what they mean.

FieldTolerance
heightInMeters± 0.005
highUtc± 120 s
highHeightInMeters± 0.005
lowUtc± 120 s
lowHeightInMeters± 0.005

Every other field is compared exactly.

Implementations

ImplementationStatus
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

HeightsCO-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 lowsCO-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
ConstituentsCO-OPS Metadata API: harmonic constituents (harcon.json), metricNOAA CO-OPS. Amplitude in metres, phase_GMT as phaseInDegrees · Public domain
CheckXTide 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
MethodManual 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 practiceTidal 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