Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'weekly'
open-pull-requests-limit: 100
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'weekly'
open-pull-requests-limit: 100
37 changes: 37 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build and Publish

on:
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write

steps:
- uses: actions/checkout@v6

- uses: actions/setup-node@v5
with:
node-version: "24"

- run: npm ci

- name: Set version
run: |
CURRENT_VERSION=$(npm pkg get version | tr -d '"')
RELEASE_VERSION="${CURRENT_VERSION%.*}.$(date +%Y%m%d)"
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
npm version "$RELEASE_VERSION" --no-git-tag-version

- name: Publish to npm
run: npm publish

- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
tag: v${{ env.RELEASE_VERSION }}
generateReleaseNotes: true
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ console.log('5 nearest stations:', near({ lat: 26.722, lon: -80.031 }, 10));

## Maintenance

### Automated Updates

A GitHub Action runs monthly on the 1st of each month to automatically update NOAA tide station data. The workflow:
- Fetches the latest station list and harmonic constituents from NOAA's API
- Updates existing station files with new data
Expand All @@ -64,12 +62,18 @@ A GitHub Action runs monthly on the 1st of each month to automatically update NO

You can also manually trigger the workflow from the Actions tab in GitHub.

### Manual Updates

To manually update NOAA stations:

```bash
$ tools/update-noaa-stations
```

This will scan all existing NOAA station files, fetch any new stations from NOAA's API, and update harmonic constituents for all stations.

## Versioning

Releases of this database use [Semantic Versioning](https://semver.org/), with these added semantics:

* Major version changes indicate breaking changes to the data structure or APIs. However, as long as the version is "0.x", breaking changes may occur without a major version bump.
* Minor version changes indicate backward-compatible additions to the data structure or APIs, such as new fields.
* Patch version changes indicate updates to station data, and will always be the current date. For example, "0.1.20260101".
35 changes: 35 additions & 0 deletions docs/noaa.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## NOAA Tide Station Data Overview

This script fetches tide station metadata from NOAA CO-OPS and converts it into a local, normalized dataset. It classifies stations by prediction method, stores harmonic constituents or prediction offsets as appropriate, and records available tidal datums for reference.

The goal is to mirror how NOAA operationally produces tide predictions, not just what data exists in their metadata.

### Reference stations

Reference stations use **harmonic constituents** to generate tide predictions. These stations:

- Have a full harmonic solution derived from long water-level records
- Support predictions in multiple datums (MLLW, MSL, MTL, etc., when available)
- Can produce both continuous predictions and high/low events

For these stations, the script downloads harmonic constituents and datum values directly from NOAA.

### Subordinate stations

Subordinate stations do not use harmonics for predictions. Instead, their tides are derived from a nearby reference station using **prediction offsets**.

For subordinate stations:

- High and low tide times are shifted by a fixed number of minutes
- Tide heights are adjusted using either additive or ratio-based offsets
- Predictions are based on extreme events only, with linear interpolation between them
- NOAA serves predictions **only in MLLW** and **only as high/low events**

Some subordinate stations still list harmonic constituents in NOAA metadata; these are retained for historical and analytical purposes but are not used operationally.

### Datums

NOAA’s predictions are produced by offsetting tidal predictions from MSL (mean sea level), so that the requested datum corresponds to zero.

- Reference stations can return predictions in any supported datums
- Subordinate stations return predictions in **MLLW only**, even if other datums are listed
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@neaps/tide-stations",
"version": "1.0.0",
"name": "@neaps/tide-database",
"version": "0.0.0",
"description": "A public database of tide harmonics",
"keywords": [
"tides",
Expand Down Expand Up @@ -36,5 +36,9 @@
"vite": "^7.2.6",
"vite-plugin-dts": "^4.5.4",
"vitest": "^4.0.15"
}
},
"files": [
"dist",
"schemas"
]
}