This Python module provides functions to fetch and process tidal datum and flood level metadata from the NOAA CO-OPS Metadata API for a given station (NOS_ID).
- Fetches tidal datums for a NOAA station as a pandas Series.
- Fetches flood levels for a NOAA station as a pandas Series.
- Combines and checks unit consistency between datums and flood levels.
- Command line tool to "walk" a directory, search for parquet files, fetch metadata for stations in those files, then save metadata in a JSON file.
Fetches tidal datums for the given NOS_ID from the NOAA API.
Returns a pandas Series with datum names as the index and values as the water level. The series name includes units if available.
Fetches flood levels for the given NOS_ID from the NOAA API.
Returns a pandas Series with flood level names as the index and values as the water level.
Fetches both datums and flood levels, checks for unit consistency (using the MHHW datum and minor flood level), and returns a combined pandas Series.
If units are inconsistent or cannot be determined, the series is named waterlevel_unknown_units.
Search the directory dir, and its subdirectories, for parquet files; attempt to extract an NOS ID from the parquet file names; fetch metadata for NOS ID; save in a JSON file. Note that this is a command line tool.
from fetch_coops_metadata import fetch_and_check_station_levels
nos_id = "8724580"
series = fetch_and_check_station_levels(nos_id)
print(series)- Python 3.x
- numpy
- requests
Install dependencies with:
pip install numpy requests