Skip to main content

Python wrapper for NOAA Tides & Currents Data and Metadata

Project description

noaa_coops

Build Status PyPI PyPI - Python Version

noaa_coops is a Python wrapper for the NOAA CO-OPS Tides & Currents Data and Metadata APIs.

This package is an evolution of py_noaa, the main addition being the creation of a Station class that is central to noaa_coops and provides distinct advantages over py_noaa.

Use


All data and metadata is handled using a Station class with methods and attributes for retrieving metadata, observed data, and predicted data.

Getting Metadata

All available metadata for a desired station (identifed by unique stationid) is automagically generated when a Station object is initialzed. Station IDs can be found using the mapping interface at https://tidesandcurrents.noaa.gov/. All metadata is stored as a dictionary in the .metadata attribute of a Station object for easy exploration (e.g. seattle.metadata). Additionally, the keys of the metadata attribute dictionary are also assigned as attributes of the station object itself (easily explored using tab-completion in your IDE). For example:

>>> from pprint import pprint  # For pretty printing
>>> import noaa_coops as nc
>>> seattle = nc.Station(9447130)
>>> pprint(seattle.lat_lon['lat'])
47.601944
>>> pprint(seattle.lat_lon['lon'])
-122.339167

Getting Observed or Predicted Data

Station data can be retrieved using the .get_data method on a Station class object. Data is returned as a Pandas DataFrame for easy use and analysis. Data types are listed on the NOAA CO-OPS Data API. The data types currently supported for retrieval with noaa_coops are:

- Currents
- Observed water levels
- Observered daily high and low water levels (use `product="high_low"`)
- Predicted water levels
- Predicted high and low water levels
- Winds
- Air pressure
- Air temperature
- Water temperature

Compatibility with other data products may exist, but is not guaranteed at this time. Feel free to submit a pull request if you would like to add addtional functionality.

In the example below, water level data is retrieved for the Seattle station (stationid=9447130) for a 3 month period.

>>> import noaa_coops as nc
>>> seattle = nc.Station(9447130)
>>> df_water_levels = seattle.get_data(
...     begin_date="20150101",
...     end_date="20150331",
...     product="water_level",
...     datum="MLLW",
...     units="metric",
...     time_zone="gmt")
>>> df_water_levels.head()  # doctest: +NORMALIZE_WHITESPACE
                       flags QC  sigma  water_level
date_time
2015-01-01 00:00:00  0,0,0,0  v  0.023        1.799
2015-01-01 00:06:00  0,0,0,0  v  0.018        1.718
2015-01-01 00:12:00  0,0,0,0  v  0.013        1.639
2015-01-01 00:18:00  0,0,0,0  v  0.012        1.557
2015-01-01 00:24:00  0,0,0,0  v  0.014        1.473

Requirements

For use:

  • requests
  • numpy
  • pandas

For development/contributions:

  • pytest
  • pytest-cov

TODO

See issues for a list of issues and to add issues of your own.

Contribution

All contributions are welcome, feel free to submit a pull request if you have a valuable addition to the package or constructive feedback.

Many thanks to the following contributors!

Project details


Download files

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

Source Distribution

noaa_coops-0.1.2.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

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

noaa_coops-0.1.2-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file noaa_coops-0.1.2.tar.gz.

File metadata

  • Download URL: noaa_coops-0.1.2.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.8

File hashes

Hashes for noaa_coops-0.1.2.tar.gz
Algorithm Hash digest
SHA256 55f8a4b01c69bccc6308b3c04543eac3b386af6760efe458cc33ecc471934d80
MD5 b973952ba7ff861339e154a634012338
BLAKE2b-256 cd14a76092d5bcffc822bd515603da264fb7e7edac1c59400bbafaa556044e09

See more details on using hashes here.

File details

Details for the file noaa_coops-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: noaa_coops-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.8

File hashes

Hashes for noaa_coops-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 686bcf85b63a7a78102c39d9e6e62fe20df6d5d84fc68054710db8daa41e5f27
MD5 ba6e80fc2c6860721ebff5eb8f4f024f
BLAKE2b-256 f32e52908edd16b9552a063ce693478d5e4825eade5b41de52749974eba14363

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