Skip to content

oceanmodeling/coops-simple-metadata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

coops_md

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).

Features

  • 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.

Functions

fetch_station_datums(nos_id)

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.

fetch_station_floodlevels(nos_id)

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.

fetch_and_check_station_levels(nos_id)

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.

python walk_dir_save_metadata <dir>

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.

Usage Example

from fetch_coops_metadata import fetch_and_check_station_levels

nos_id = "8724580"
series = fetch_and_check_station_levels(nos_id)
print(series)

Requirements

  • Python 3.x
  • numpy
  • requests

Install dependencies with:

pip install numpy requests

About

Fetch and process tidal datum and flood level metadata from the NOAA CO-OPS Metadata API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages