GloFAS readers¶
glofas_ewds.glofas ¶
GloFAS NetCDF files from the EWDS, read into numbers per node.
Needs the netcdf extra (netCDF4). No network.
Every reader takes your nodes (lon, lat points: river gauges, the centres
of a grid, your assets) and reads, for each, the cell
:func:~glofas_ewds.cells.open_meteo_cell chooses. What is not there stays
absent: a node outside the file or on a masked cell (sea, no river network)
gets no value, which is "no forecast here", never "the river is low".
Forecast files are read by the names of their dimensions (member, lead
time, run, latitude, longitude), not by their order, so the control run and
the ensemble share one reader. A file whose dimensions are not recognised
raises :class:~glofas_ewds.errors.GlofasEwdsError naming them.
discharge_series ¶
discharge_series(files: Iterable[Path], nodes: Sequence[Node], *, start: date, end: date) -> dict[Node, list[float]]
Daily discharge (m³/s) of each node's cell between start and end.
The EWDS valid_time is the end of the 24 hours averaged, so the
day after the one you asked for: the series is keyed by the day asked.
Masked values are dropped, not zeroed.
discharge_by_day ¶
discharge_by_day(files: Iterable[Path], nodes: Sequence[Node], *, start: date, end: date) -> dict[Node, dict[date, float]]
Like :func:discharge_series, with each value under its day.
What :func:~glofas_ewds.return_period.annual_maxima needs. A day in two
files (yesterday's partial month next to today's) is kept once.
forecast_peaks ¶
forecast_peaks(path: Path, nodes: Sequence[Node]) -> dict[Node, float]
The highest forecast discharge (m³/s) in each node's cell, over all lead times (and members, in an ensemble file).
Nodes outside the file or on a masked cell are left out.
ensemble_members ¶
ensemble_members(path: Path, nodes: Sequence[Node]) -> dict[Node, npt.NDArray[np.float64]]
Each node's forecast as a (member, lead time) array in m³/s, NaN where masked.
For a control file there is one member. Feed it to
:func:~glofas_ewds.ensemble.exceedance_probability.