lair.synoptic#

Surface station observations from the Synoptic Data API (the MesoWest successor).

Three calls cover most uses:

  • metadata() – which stations exist for a query (stid, bbox, state, network, vars, …), with location and period of record.

  • timeseries() – the native observations (often 5-min) for a query and time window, one row per station and time.

  • hourly_mean() – hourly means of a timeseries() frame, with wind averaged as a vector (Uwind/Vwind) and the direction taken from the mean vector. Averaging wind direction in degrees is wrong whenever an hour straddles north (350 and 10 deg average to 180).

Query keywords are passed straight to the API, so anything the Synoptic docs list works (https://docs.synopticdata.com/services/). The token comes from token= or the SYNOPTIC_TOKEN environment variable, read at call time. Requires the requests extra. Long periods should be requested in chunks (e.g. a month at a time); the API caps the size of one response.

Functions

hourly_mean

Hourly means of a timeseries() frame, with wind averaged as a vector.

metadata

Stations matching a query, one row each.

timeseries

Native observations for every station matching a query, in one long frame.

Exceptions

SynopticError

The API answered, but with an error (bad token, no access, no stations...).