@neaps/tide-database 0.0.20251220

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ THE FOLLOWING LICENSE INFORMATION COVERS ONLY THE DOCUMENTATION AND ANY CODE
2
+ NOT WITHIN THE "data" DIRECTORY. EACH DATA FILE HAS ITS OWN LICENSE INFORMATION.
3
+
4
+ The MIT License (MIT)
5
+
6
+ Copyright (c) 2015 gatsbyjs
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in all
16
+ copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ SOFTWARE.
25
+
package/README.md ADDED
@@ -0,0 +1,79 @@
1
+ ## Tide harmonics database
2
+
3
+ The availability of good harmonic constituent data varies from country
4
+ to country, resulting in very different tide predeictions depending on
5
+ what products you use. Within the United States, NOAA provides excellent
6
+ harmonic constituents for free, but internationally it is a different
7
+ story.
8
+
9
+ We first observed these challenges in Gulfo Nuevo in Argentina. The gulf
10
+ is very deep, with a narrow mouth to the Atlantic and sloping benthic
11
+ profile. As a result, the difference between high and low tides is
12
+ consistently 5 meters or more. Various websites and products we used had
13
+ different levels of accuracy when predicting the tides. We found one
14
+ that was just predicting tides from a station over 200km away, outside
15
+ the gulf, and therefore completely different in terms of water level and
16
+ timing.
17
+
18
+ The various surf or weather report apps either use old data, or base
19
+ large areas of coastline on one station. Many people are still using
20
+ pre-2004 data published in Xtide's Harmbase. Harmbase is great, but it's
21
+ data is locked in binary files and SQL, and the maintainer [has given up on maintaining it outside the US](https://flaterco.com/xtide/faq.html#60)
22
+ .
23
+
24
+ **All** constituent data is delivered in Meters.
25
+
26
+ Much effort has been made to cover the [requirements from libTCD](https://flaterco.com/xtide/libtcd.html).
27
+
28
+ ## Submitting data
29
+
30
+ If you have **at least a year** of hourly water level observations, you can convert those to harmonic constituents and [submit them to this database online](https://neaps.js.org/harmonics) with a simple form.
31
+
32
+ Your submission will be automatically converted to a Pull Request to this repository.
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ npm install @neaps/tide-stations
38
+ ```
39
+
40
+ ## Usage
41
+
42
+ ```typescript
43
+ import { nearest, near, stations } from '@neaps/tide-stations';
44
+
45
+ // All stations
46
+ console.log('Total stations:', stations.length);
47
+
48
+ // Find the nearest station to a given lat/lon
49
+ console.log(`Nearest station:`, nearest({ lat: 26.722, lon: -80.031 }));
50
+
51
+ // Find the 10 nearest stations to a given lat/lon, in order of distance
52
+ console.log('5 nearest stations:', near({ lat: 26.722, lon: -80.031 }, 10));
53
+ ```
54
+
55
+ ## Maintenance
56
+
57
+ A GitHub Action runs monthly on the 1st of each month to automatically update NOAA tide station data. The workflow:
58
+ - Fetches the latest station list and harmonic constituents from NOAA's API
59
+ - Updates existing station files with new data
60
+ - Adds any newly discovered reference stations
61
+ - Creates a pull request if changes are detected
62
+
63
+ You can also manually trigger the workflow from the Actions tab in GitHub.
64
+
65
+ To manually update NOAA stations:
66
+
67
+ ```bash
68
+ $ tools/update-noaa-stations
69
+ ```
70
+
71
+ This will scan all existing NOAA station files, fetch any new stations from NOAA's API, and update harmonic constituents for all stations.
72
+
73
+ ## Versioning
74
+
75
+ Releases of this database use [Semantic Versioning](https://semver.org/), with these added semantics:
76
+
77
+ * 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.
78
+ * Minor version changes indicate backward-compatible additions to the data structure or APIs, such as new fields.
79
+ * Patch version changes indicate updates to station data, and will always be the current date. For example, "0.1.20260101".
@@ -0,0 +1,49 @@
1
+ type HarmonicConstituent = {
2
+ name: string;
3
+ description?: string;
4
+ amplitude: number;
5
+ phase_UTC: number;
6
+ phase_local: number;
7
+ speed?: number;
8
+ };
9
+ export interface Station {
10
+ id: string;
11
+ name: string;
12
+ continent: string;
13
+ country: string;
14
+ region: string;
15
+ timezone: string;
16
+ disclaimers: string;
17
+ type: 'reference' | 'subordinate';
18
+ latitude: number;
19
+ longitude: number;
20
+ source: {
21
+ name: string;
22
+ id: string;
23
+ published_harmonics: boolean;
24
+ url: string;
25
+ source_url: string;
26
+ };
27
+ license: {
28
+ type: string;
29
+ commercial_use: boolean;
30
+ url: string;
31
+ notes?: string;
32
+ };
33
+ harmonic_constituents: HarmonicConstituent[];
34
+ offsets?: {
35
+ reference: string;
36
+ height: {
37
+ high: number;
38
+ low: number;
39
+ type: 'ratio' | 'fixed';
40
+ };
41
+ time: {
42
+ high: number;
43
+ low: number;
44
+ };
45
+ };
46
+ datums: Record<string, number>;
47
+ }
48
+ declare const stations: Station[];
49
+ export default stations;