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:

clients

Pure access, moved here verbatim with its history: one client per network (AWDB, CDEC, DataBC, NVE, Yukon), each answering get_all_stations / get_data / get_metadata with 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() and load(), which put those records into the package’s own return types and take aoi and time like every other loader.

archive

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

inventory

Snow stations as a GeoDataFrame, indexed by their global station code.

load

Station observations as a (station, time) Dataset.

metadata

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

Every 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.xz

One date,wteq_cm,snwd_cm CSV 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.

csv_url

URL of one station's archive CSV.

inventory

The published station inventory as a GeoDataFrame indexed by code.

load

Daily SWE and snow depth for many stations, from the published archive.

network_of

{code: network} from the inventory, for codes whose shape is ambiguous.

easysnowdata.stations.clients#

AWDBClient

Client for the USDA NRCS AWDB REST API v1.

AWDBError

Raised when the AWDB API returns an error or a request fails.

CDECClient

Client for CDEC (California Data Exchange Center).

CDECError

Raised when the CDEC API returns an error or a request fails.

DataBCClient

Client for BC snow survey data via BC Data Catalogue.

DataBCError

Raised when a DataBC request fails.

NVEClient

Client for the NVE HydAPI (Norwegian hydrological data service).

NVEError

Raised when the NVE HydAPI returns an error or a request fails.

YukonClient

Client for the Yukon Water Data (AquaCache) API.

YukonError

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:

code

The globally unique code the inventory and the archive use, e.g. "679_WA_SNTL". Unique across all five networks.

station_id

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

Network

One snow-station network and the client that reads it.

canonical_units

The unit easysnowdata.stations.load() emits for type_name.

get

Return the Network called network.

split_by_network

Group stations by network, as {network_id: [station_id, …]}.

to_code

The globally unique code of station_id in network.

to_station_id

The native station id of station in network.