raster_collection¶
raster_collection
¶
Classes¶
RasterCollection
¶
Wrapper that validates and normalizes raster inputs by return period.
The expected canonical form is a mapping
return_period (int) -> { "depth": AbstractRasterReader, # required "uncertainty": AbstractRasterReader|float|None, # optional (depth uncertainty) "velocity": AbstractRasterReader|None, # optional "duration": AbstractRasterReader|None, # optional }
To avoid ambiguity this class prefers labeled inputs. A bare AbstractRasterReader may be provided and will be treated as the depth raster for that return period. Tuples/lists are intentionally rejected to avoid order-dependent semantics.
Source code in src/inland_consequences/raster_collection.py
Functions¶
sample_for_rp
¶
Sample depth/depth uncertainty/velocity/duration for a single return period.
Returns a dict of pandas.Series with keys: 'depth', 'uncertainty', 'velocity', 'duration'. The 'uncertainty' key contains depth uncertainty values. If an optional raster (velocity/duration) is not provided for the rp, the corresponding Series will be filled with NaN values of the appropriate length.
Parameters: - rp: return period to sample - geometries: iterable of geometries to pass to raster.get_value_vectorized (cannot be None)