Neaps
View on GitHubMany agencies like NOAA provide high-quality tide data and prediction services. But these services require online access, and are not available for every country. Neaps uses standard algorithms to predict tide heights anywhere that has well-defined harmonic constituents.
Neaps is the foundation of all tide predictions on OpenWaters.io.
Key Features
Harmonic Analysis
Uses harmonic constituents to predict tides with high accuracy, matching or exceeding commercial tide prediction software.
Fast Performance
Written in modern JavaScript/TypeScript with performance optimizations for both server and client-side predictions.
Flexible Datum Support
Calculate tides relative to different vertical datums including MLLW, MSL, MLW, and more.
Developer Friendly
Simple, well-documented API that's easy to integrate into your applications. Available as an npm package.
How It Works
Harmonic Constituents
Tides are the result of gravitational forces from the moon, sun, and other celestial bodies. These forces create predictable oscillations in water levels that can be modeled as a sum of sinusoidal waves called harmonic constituents.
Prediction Calculation
For each constituent, Neaps calculates its contribution to the tide height at a given time using the constituent's:
- Amplitude: The strength of this constituent's effect
- Phase: The timing offset relative to an astronomical reference
- Speed: How quickly this constituent oscillates
Summing It Up
The predicted tide height is the sum of all constituent contributions. By combining dozens of constituents, Neaps can accurately predict the complex patterns of real-world tides.
Using Neaps
Installation
npm install @neaps/neaps Example Usage
import { TideStation } from '@neaps/neaps';
// Load station data
const station = new TideStation({
id: '9414290',
name: 'San Francisco',
constituents: { /* harmonic constituents */ }
});
// Get predictions for today
const predictions = station.getPredictions({
start: new Date(),
end: new Date(Date.now() + 24 * 60 * 60 * 1000)
});
// Find high and low tides
const extrema = station.getExtrema({
start: new Date(),
end: new Date(Date.now() + 24 * 60 * 60 * 1000)
}); Open Source & Free
Neaps is open source software, available under the MIT license. Use it freely in your projects, contribute improvements, or fork it for your own needs.