Stations#
easysnowdata.stations#
Snow-station observations from five public networks (§9).
import easysnowdata as esd
aoi = (-121.94, 46.72, -121.54, 46.99) # Mount Rainier
inv = esd.stations.inventory(aoi, daily_only=True) # GeoDataFrame
obs = esd.stations.load(inv, variables=["swe", "snwd"],
time="2023-10/2024-06") # (station, time)
everything = esd.stations.archive.load() # every daily station
Three layers, as global_snow_networks’ DESIGN.md §2 lays them out:
clientsPure access, moved here verbatim with its history: one client per network (AWDB, CDEC, DataBC, NVE, Yukon), each answering
get_all_stations/get_data/get_metadatawith plain dict records in metric units. Use it directly when you want flags, a native variable name or an interval the adapter does not surface.- this module
inventory()andload(), which put those records into the package’s own return types and takeaoiandtimelike every other loader.archiveThe daily archive that repo publishes — a normalized station inventory and one pre-downloaded CSV per daily-verified station — for “everything daily since 1980” without hitting five APIs. SWE and snow depth only.
The station × time grid comes back dense with NaN where a station has
no observation. That is what xarray, Dask and groupby want, and a station
record is only sparse in the everyday sense — nothing here needs a sparse
array backend. Station positions are latitude and longitude
coordinates rather than an xvec geometry coordinate: the plan lists
xvec as optional, it would be a new dependency, and float coordinates
round-trip through Zarr and netCDF where a geometry object does not.
Station identity has two spellings, both accepted everywhere: the globally
unique code ("679_WA_SNTL") and the network’s own station id
("679:WA:SNTL"). See easysnowdata.stations.networks.
Snow stations as a GeoDataFrame, indexed by their global station code. |
|
Station observations as a |
|
Full per-station metadata from the owning network's API. |
easysnowdata.stations.archive#
The daily station archive: everything daily, without hitting five APIs.
global_snow_networks pre-downloads daily SWE and snow depth for every
station its probe has verified as daily-or-better, and publishes two
artefacts that this module reads (§9 step 3):
all_snow_stations.geojsonEvery station from all five networks, periodic sites included, with the 26 normalized properties of that repo’s DESIGN.md §6.1 — including
daily_or_better, which is the probe’s verdict rather than what a network advertises about itself.data/all_station_csvs.tar.xzOne
date,wteq_cm,snwd_cmCSV per daily-or-better station, bundled. About 28 MB, and the cheapest way by far to get every station’s whole record — which, for a few long snow courses, reaches back to 1896.
import easysnowdata as esd
inv = esd.stations.archive.inventory(daily_only=True) # one request
ds = esd.stations.archive.load(aoi=(-121.94, 46.72, -121.54, 46.99))
Both artefacts are refreshed daily by that repo’s CI, so the archive is at
most a day behind and covers only SWE and snow depth. For anything else — a
different variable, an interval other than daily, quality flags, or today’s
observation — use easysnowdata.stations.load(), which goes to the
networks themselves.
URL of one station's archive CSV. |
|
The published station inventory as a GeoDataFrame indexed by code. |
|
Daily SWE and snow depth for many stations, from the published archive. |
|
|
easysnowdata.stations.clients#
Client for the USDA NRCS AWDB REST API v1. |
|
Raised when the AWDB API returns an error or a request fails. |
|
Client for CDEC (California Data Exchange Center). |
|
Raised when the CDEC API returns an error or a request fails. |
|
Client for BC snow survey data via BC Data Catalogue. |
|
Raised when a DataBC request fails. |
|
Client for the NVE HydAPI (Norwegian hydrological data service). |
|
Raised when the NVE HydAPI returns an error or a request fails. |
|
Client for the Yukon Water Data (AquaCache) API. |
|
Raised when the Yukon AquaCache API returns an error or a request fails. |
easysnowdata.stations.networks#
The five snow-station networks, and how a station code maps to one of them.
Each Network ties a catalog source id to the vendored client that
speaks to it (easysnowdata.stations.clients) and to the spelling of a
station identifier in that network. Two spellings matter:
codeThe globally unique code the inventory and the archive use, e.g.
"679_WA_SNTL". Unique across all five networks.station_idWhat the network’s own API calls the station, e.g. the AWDB triplet
"679:WA:SNTL". Only AWDB’s two spellings differ; for the other four the code is the station id.
split_by_network() turns a mix of codes, station ids and inventory rows
into {network_id: [station_id, …]}, which is what easysnowdata.stations.load()
fans out over.
One snow-station network and the client that reads it. |
|
The unit |
|
Return the |
|
Group stations by network, as |
|
The globally unique code of station_id in network. |
|
The native station id of station in network. |