Skip to main content

UKHO Tides

This package provides a client wrapper for the Admiralty Tidal API endpoints.

Installation

Install via pip.

pip install ukhotides

API Key

To call the API you will need an API key from the Admiralty Maritime Data Solutions developer portal. Follow their guide on how to do so and select one of the UK Tidal API products - the Discovery tier is free (the paid APIs have not been tested for this package).

Usage

from ukhotides import UkhoTides
from aiohttp import ClientSession

session = ClientSession()
client = UkhoTides(session, "<api_key>")

# Get all stations
stations = await client.async_get_stations()

# Get stations with name filter
stations = await client.async_get_stations("StationName")

# Get station by id
station = await client.async_get_station("0001")

# Get tidal events for station by id
events = await client.async_get_tidal_events("0001")

# Get 4 days of tidal events for station by id
events = await client.async_get_tidal_events("0001", 4)

There are also several premium endpoints exposed, however these are built based on the documentation and have not been tested.

### Premium API Endpoints ###
### UNTESTED ###
from ukhotides import UkhoTides, ApiLevel
from aiohttp import ClientSession
from datetime import datetime

session = ClientSession()
client = UkhoTides(session, "<api_key>", ApiLevel.Premium)

# Get tidal events for a station between a given date range
start_date = datetime(2020,1,1)
end_date = datetime(2020,1,30)
events = await client.async_get_tidal_events_for_date_range("0001", start_date, end_date)

# Get tide height for a station for a given datetime
date_time = datetime(2020,1,1)
height = await client.async_get_tidal_height("0001", date_time)

# Get tide heights for a station between a given date range and at a given interval
interval_in_minutes = 60
start_date = datetime(2020,1,1)
end_date = datetime(2020,1,1,2)
heights = await client.async_get_tidal_heights("0001", start_date, end_date, interval_in_minutes)

Publish to PyPi

Update the version number in pyproject.toml and then run:

poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build

TODO

  • Better docs (sorry)
  • Webhooks to automate distribution and versioning

Attribution

Contains ADMIRALTY® Tidal Data: © Crown copyright and database right

Release files for ukhotides 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ukhotides 1.1.2
File Size Uploaded
ukhotides-1.1.2.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ukhotides 1.1.2
File Interpreter ABI Platform
ukhotides-1.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 10.3 kB

Release files / ukhotides-1.1.2.tar.gz

Download URL ukhotides-1.1.2.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
15b1999c4530b659a2c0999da6e01a333adcb18d19034b700f37c719a78afc4d
BLAKE2b-256 checksum
How to use checksums
cdee647d8420fb8b15f47111d7bc910a2a5898ddd84e17f98c1aa61b9a61b0e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.10.15 Linux/5.15.153.1-microsoft-standard-WSL2

Release files / ukhotides-1.1.2-py3-none-any.whl

Download URL ukhotides-1.1.2-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6798c50e43743461613527a1424d0da0a3c4f8c6d6999002536c4dbc8a8af720
BLAKE2b-256 checksum
How to use checksums
36abcb01ddb656330d7dfad7ab6529b1efc2db1de4003fd490257ac8d813e280
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.10.15 Linux/5.15.153.1-microsoft-standard-WSL2

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

1 release file

0.1.1

1 release file

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page