Skip to main content

Tide prediction library

Project description

tide-prediction

Tidal prediction library for French Atlantic and English Channel ports. Computes high/low water times, heights, tidal coefficients, and full height curves — all from a fast Rust core exposed via Python bindings.

Disclaimer

This library is provided AS IS, without warranty of any kind. It is not intended for navigation, maritime safety, or any use where inaccurate predictions could cause harm to persons, property, or the environment. Predictions are produced from a simplified 13-constituent harmonic model and do not account for meteorological effects (storm surge, wind, barometric pressure) or exceptional astronomical events. Typical residual RMSE is 0.10–0.25 m; local error may be larger.

For official tidal predictions in France, refer to the SHOM. The author disclaims all liability arising from the use of this software. By using this library you do so at your own risk and sole responsibility.

Installation

pip install tide-prediction

The package is imported as import tide (not tide_prediction).

Quick start

import tide

# Predict a full day
pred = tide.predict_day("FR-BREST", "2024-06-15")

from datetime import datetime, timezone

for e in pred.extremes:
    kind = "HW" if e.is_high_water else "LW"
    coef = f"  coef={e.coefficient}" if e.coefficient else ""
    dt = datetime.fromtimestamp(e.time, tz=timezone.utc).strftime("%H:%M")
    print(f"{kind}  {dt}  {e.height:.2f} m{coef}")

# HW  00:26  4.83 m  coef=39
# LW  06:41  2.40 m
# HW  13:07  4.80 m  coef=42
# LW  19:07  2.61 m

API

tide.predict_day(port_id, date) → DayPrediction

Returns high/low water extremes and a 10-minute height curve for a single day.

  • port_id — port identifier (e.g. "FR-BREST")
  • date — date string "YYYY-MM-DD" (UTC)

tide.predict_range(port_id, from_date, to_date) → list[DayPrediction]

Same as predict_day over a date range (inclusive).

tide.height_at(port_id, timestamp) → float

Instantaneous water height in metres at a given Unix UTC timestamp.

from datetime import datetime, timezone

ts = int(datetime(2024, 6, 15, 12, 0, tzinfo=timezone.utc).timestamp())
h = tide.height_at("FR-BREST", ts)
print(f"{h:.3f} m")  # 4.607 m

Port discovery

# List all available ports
ports = tide.list_ports()

# Search by name
results = tide.search_ports("saint")

# Get a specific port
port = tide.get_port("FR-BREST")
print(port.name, port.latitude, port.longitude)

Data model

DayPrediction
├── port_id        str
├── date           str          "YYYY-MM-DD"
├── extremes       list[TidalExtreme]
│   ├── time           int      Unix timestamp UTC
│   ├── height         float    metres
│   ├── is_high_water  bool
│   └── coefficient    int|None 20–120, Atlantic/Channel HW only
└── heights        list[HeightPoint]
    ├── timestamp   int          every 10 minutes
    └── height      float        metres

Available ports

ID Port Calibration
FR-BREST Brest (coefficient reference) REFMAR
FR-PORT-TUDY Port Tudy (Île de Groix) REFMAR
FR-CONCARNEAU Concarneau REFMAR
FR-SAINT-NAZAIRE Saint-Nazaire REFMAR
FR-LA-ROCHELLE La Rochelle — La Pallice REFMAR
FR-ROSCOFF Roscoff REFMAR
FR-SAINT-MALO Saint-Malo REFMAR
FR-CHERBOURG Cherbourg REFMAR
FR-LE-HAVRE Le Havre REFMAR
FR-DIEPPE Dieppe REFMAR
FR-DUNKERQUE Dunkerque REFMAR
FR-BAYONNE Boucau-Bayonne REFMAR
FR-ARCACHON Arcachon REFMAR
FR-PORT-NAVALO Port-Navalo (Golfe du Morbihan) SHOM SPM
FR-ARRADON Arradon (Golfe du Morbihan) SHOM SPM
FR-AURAY Auray — Saint-Goustan SHOM SPM
FR-ETEL Entrée rivière d'Étel SHOM SPM

Tidal coefficients

Coefficients (20–120) are computed for Atlantic and English Channel high waters relative to the Brest reference tidal range, following the French SHOM convention. They are only available for high water (is_high_water = True) at ports on the Atlantic/Channel coast.

Requirements

  • Python ≥ 3.8
  • Currently tested on Linux x86-64 (manylinux). macOS and Windows wheels may be added in future releases.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tide_prediction-1.0.1-py3-none-musllinux_1_2_aarch64.whl (312.7 kB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

tide_prediction-1.0.1-py3-none-manylinux_2_34_x86_64.whl (354.9 kB view details)

Uploaded Python 3manylinux: glibc 2.34+ x86-64

tide_prediction-1.0.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (314.2 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

File details

Details for the file tide_prediction-1.0.1-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for tide_prediction-1.0.1-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 56e13e4e1efcb1c7299312de9a320ecee0767a28f97f81f0bb6e6a41a273e6dc
MD5 0bb2c6f4b664654c5e5ed9a6c7d93856
BLAKE2b-256 d559d9d44f3dbcb0d6d6edba1fc86bf67989ad3c3ff7c1a2c619f4cb62c634cc

See more details on using hashes here.

File details

Details for the file tide_prediction-1.0.1-py3-none-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for tide_prediction-1.0.1-py3-none-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 387b5ef396ab1d9d1526c239a82bbdc9e44f7dc6107bce82048b7167bc1d1a1e
MD5 3a9561330aa3edc876d5fe8b0cb6951e
BLAKE2b-256 ba5af91e9ad9e0781da50c528c7bd03edaa3a8f306c4a6b86443304fa7d77e21

See more details on using hashes here.

File details

Details for the file tide_prediction-1.0.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for tide_prediction-1.0.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 79c31c05bfd675ac4f9981e755d2a9ab835d4205c3e2dc43b5ad9cc43d0ce1b8
MD5 92ae355ace221dc1039812c4637d9f23
BLAKE2b-256 53e3ab7d46f28d7fb0015aa3078adda8054ebf2b8f254cb2778f7197f6e9c699

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page