Rivers¶
glofas_ewds.rivers ¶
The river nearest a place, on a grid where a cell is not a river.
Pure: nothing here does I/O.
A town is a point; its river is somewhere in the 0.05° cells around it, and
the cell under the town hall is usually not it. On the Toce near Candoglia the
cell under the point carries 16 m³/s and the next one 147. :func:nearest_river
takes the size of every cell around a place (the 2-year flow of the official
thresholds, :func:~glofas_ewds.thresholds.threshold_window, or your own
reference per cell) and says which cell holds the river, how far it is and how
it compares with the cell of the place itself.
It finds the largest river within the radius, at its nearest cell. A town
on a tributary five kilometres from the Po gets the Po: read distance_km
and own_size before you trust the choice, and pass a smaller radius when
you know better.
River
dataclass
¶
The cell that holds the river of a place.
nearest_river ¶
nearest_river(sizes: Mapping[Node, float], longitude: float, latitude: float, *, radius_km: float = RIVER_RADIUS_KM, share: float = RIVER_SHARE) -> River | None
The nearest cell of the largest river within radius_km of a place.
sizes is {cell centre: m³/s} for the cells around the place.
None when no cell in the radius has a positive size: there is no river
here that GloFAS models, which is not "the river is low".