Skip to main content

Thin API for NOAA tide tables

Project description

Tidetable is a Python module for downloading annual tide prediction tables from the NOAA Tides & Currents site.

Basics

First, identify your tide station and it’s Station ID number.

Then, use the get method to download the table. This returns a TideTable object, which is just a list with a few additional metadata parameters.

>>> import tidetable
>>> table = tidetable.get(8416092)
>>> table
TideTable(stationid=8416092)
>>> table[0]
{'pred_cm': 149.0, 'datetime': datetime.datetime(2014, 12, 31, 3, 44), 'pred_ft': 4.9, 'high_low': 'H'}
>>> t.stationid, t.stationname
('8416092', 'Monhegan Island')
>>> table.datum
'MLLW'

Writing

The TideTable object has a write_csv method. It accepts either a file name or any file-like object.

import tidetable
table = tidetable.get(8416092)
table.write_csv('tide_table.csv')

Time zones

As you can see, TideTable is a list of dicts, each of which has a datetime, a prediction in feet and cm, and a high-or-low flag. The predictions are relative to the datum, which in this case is MLLW, or the mean lower low water level. Note that MLLW is different from sea level.

By default, the datetime is in the local time, which could be standard or daylight savings time. Use the time_zone keyword argument to fetch times in either GMT or the local standard time zone. TideTable always returns naive datetime objects.

Use these constants for specifying the time zone: tidetable.GMT, tidetable.LOCAL_STANDARD_TIME, tidetable.LOCAL_TIME.

>>> import tidetable
>>> table = tidetable.get(8416092, time_zone=tidetable.GMT)
>>> table[0]['datetime']
datetime.datetime(2014, 12, 31, 0, 15)

(Note the difference from the datetime in the first example, which is in Eastern Standard Time)

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

tidetable-0.1.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

tidetable-0.1.0-py2-none-any.whl (6.8 kB view details)

Uploaded Python 2

File details

Details for the file tidetable-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tidetable-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 725f03fd847869dadc51095964ea8113d64a6e39ffec33f50917dafd75dd6834
MD5 fb2bf1f62d5ce13a956ec138a16ce98e
BLAKE2b-256 6a85a3762407256744bc71da57b43e5778222eb0a7696e3fc30c12caa7c9a010

See more details on using hashes here.

File details

Details for the file tidetable-0.1.0-py2-none-any.whl.

File metadata

File hashes

Hashes for tidetable-0.1.0-py2-none-any.whl
Algorithm Hash digest
SHA256 10a29c25e2e4246679be367966aa5e3bd6f200d55cb220f79c21f07792fbec0b
MD5 e6c805d62c8248f021d466e4c9354304
BLAKE2b-256 05aa207282e3293035ebb730e5571772d47b7711ebe7ea2d103e7d4fdf6b2e6d

See more details on using hashes here.

Supported by

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