diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..98966d27 --- /dev/null +++ b/.github/dependabot.yml @@ -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 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..dfc9d1c1 --- /dev/null +++ b/.github/workflows/publish.yml @@ -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 diff --git a/README.md b/README.md index 1b1d3f46..cbbb1b32 100644 --- a/README.md +++ b/README.md @@ -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 @@ -64,8 +62,6 @@ 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 @@ -73,3 +69,11 @@ $ 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". diff --git a/docs/noaa.md b/docs/noaa.md new file mode 100644 index 00000000..f3768e11 --- /dev/null +++ b/docs/noaa.md @@ -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 diff --git a/package.json b/package.json index 72af843e..fc626cc0 100644 --- a/package.json +++ b/package.json @@ -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", @@ -36,5 +36,9 @@ "vite": "^7.2.6", "vite-plugin-dts": "^4.5.4", "vitest": "^4.0.15" - } + }, + "files": [ + "dist", + "schemas" + ] }