lair.synoptic.timeseries#

lair.synoptic.timeseries(start, end, token=None, timeout=300, units='metric', **query)[source]#

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

Parameters:
  • start – Window, anything pd.Timestamp parses; naive times follow the UTC rule.

  • end – Window, anything pd.Timestamp parses; naive times follow the UTC rule.

  • token (str, optional) – API token; defaults to $SYNOPTIC_TOKEN.

  • timeout (float) – Seconds to wait for the response.

  • units (str) – API units ("metric": m/s, deg C).

  • **query – API query, e.g. stid="TRJO" or bbox=..., and vars="wind_speed,wind_direction".

Returns:

pd.DataFrame – Columns stid, Time (UTC, tz-aware) and one column per returned variable in the API’s naming (wind_speed_set_1, …). Stations with no observations in the window are omitted.

Return type:

DataFrame

See also

metadata

Which stations exist for a query.

hourly_mean

Averages the frame by hour, with the wind as a vector.

Examples

Needs a token and the internet:

>>> from lair.synoptic import hourly_mean, timeseries
>>> obs = timeseries(
...     "2024-01-15 12:00",
...     "2024-01-15 18:00",
...     stid="TRJO",
...     vars="wind_speed,wind_direction",
... )
>>> hourly = hourly_mean(obs)