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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file tidetable-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: tidetable-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbbeac466fea409e77cbaea09d86282d6baad36ffb9523a03cef5e58fb35bee3 |
|
MD5 | 129ca905237b6565df8353ec5da89939 |
|
BLAKE2b-256 | e2f913fa7aceda2eaecfd99b232cbf51cf415285e7a785862bba6b6077afd492 |
File details
Details for the file tidetable-0.1.1-py2-none-any.whl
.
File metadata
- Download URL: tidetable-0.1.1-py2-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6936c1df9bcef9c8caab6fc3d921faecdd2460d6f699a91b83f308ba7e4fadf4 |
|
MD5 | f0b12c03d82a5713df82559e9d20927c |
|
BLAKE2b-256 | 8905a63e16ae1ee9b29b430daaa292e3a97235a87b01e72dae312ae715107d76 |