knmidata.edr.parsers module¶
Parsers converting OGC EDR payload responses into in-memory xarray.Dataset instances.
- knmidata.edr.parsers.parse_coverage(payload: dict[str, Any], shared_parameters: dict[str, Any] | None = None) Dataset¶
Parse a single OGC CoverageJSON coverage into an xarray.Dataset.
Dimension order follows the order of the axes in
domain.axes, matching the flattened order of the range values.- Parameters:
payload (dict[str, Any]) – A single CoverageJSON coverage object.
shared_parameters (dict[str, Any] | None, default=None) – Parameter metadata from the enclosing CoverageCollection, used when the coverage itself has no “parameters” member (KNMI puts them at the collection level and only “ranges” in each coverage).
- Returns:
Multidimensional dataset.
- Return type:
xr.Dataset
- knmidata.edr.parsers.parse_coveragejson(payload: dict[str, Any]) Dataset¶
Parse an OGC CoverageJSON payload into an xarray.Dataset.
Handles both single coverages and CoverageCollections (as returned by /area, /cube, or multi-location queries on station collections). Coverages are concatenated along the
stationdimension, labelled with the station id (WSI) when the response carries it, else the grid origin, else acoverageindex.- Parameters:
payload (dict[str, Any]) – Parsed JSON response from an EDR data query with f=CoverageJSON.
- Returns:
Multidimensional dataset.
- Return type:
xr.Dataset
- knmidata.edr.parsers.parse_geojson(payload: dict[str, Any]) Dataset¶
Parse a GeoJSON FeatureCollection into an xarray.Dataset.
Used for EDR responses with f=GeoJSON (e.g. /locations or point queries on station collections). The dataset gets a ‘feature’ dimension, lon/lat/time coordinates when present, and one data variable per numeric property.
- Parameters:
payload (dict[str, Any]) – Parsed JSON response from an EDR query with f=GeoJSON.
- Returns:
Dataset with one entry per feature.
- Return type:
xr.Dataset