Skip to content
laluka

Demo workspace Tidewatch is a made-up tide API. The lessons are real laluka lessons about it. Your own repos arrive with sign-in.

Heights are above chart datum, not mean sea level

Origin: baselineStatus: confirmedRepo: tidewatch-apiWritten: 19 Sept 2026

What

Every height the API returns is measured from chart datum. The harmonic model predicts around mean sea level, and heightAt adds the station's datum offset once, at the end.
Cites

How

The loop sums one cosine per constituent, then the offset is added and the result is rounded to two decimals.
Cites
Believed before
The API returns height above mean sea level, like most tide libraries.
True now
It returns height above chart datum. The offset is added in heightAt and nowhere else.

Cites

  1. [1]src/predict.ts:6-15matchSupports: what
    [lines 6-15 of a 15-line file]
    // Height above CHART DATUM, not mean sea level. Callers compare it with charted depths,
    // so the station's datum offset is added here and nowhere else.
    export function heightAt(station: Station, constituents: Constituent[], hoursSinceEpoch: number): number {
    let h = 0;
    for (const c of constituents) {
    const angle = ((c.speedDegPerHour * hoursSinceEpoch + c.phaseDeg) * Math.PI) / 180;
    h += c.amplitudeM * Math.cos(angle);
    }
    return Number((h + station.datumOffsetM).toFixed(2));
    }
  2. [2]src/stations.ts:3-3matchSupports: how
    [lines 3-3 of a 12-line file]
    export interface Station { id: string; name: string; lat: number; lon: number; datumOffsetM: number; }

Card

What is a Tidewatch height measured from?
junior
Show the answer
Chart datum. heightAt in src/predict.ts adds station.datumOffsetM to the harmonic sum, so callers can compare the number with charted depths.
Cites[1]