Skip to content

Commit 8d6a707

Browse files
committed
Add flood prediction tools: flood_depth, inundation, curve_number_runoff, travel_time (#923)
New xrspatial.flood module with four per-cell flood analysis functions that build on the existing hydrology toolkit (HAND, flow_length, etc.): - flood_depth: water depth from HAND raster and water level - inundation: binary flood/no-flood mask - curve_number_runoff: SCS/NRCS curve number runoff estimation - travel_time: overland flow travel time via simplified Manning's equation All four support numpy, cupy, dask, and dask+cupy backends. Includes 45 tests covering known values, NaN propagation, edge cases, input validation, and cross-backend equivalence.
1 parent b734348 commit 8d6a707

File tree

4 files changed

+995
-0
lines changed

4 files changed

+995
-0
lines changed

xrspatial/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
from xrspatial.curvature import curvature # noqa
1616
from xrspatial.emerging_hotspots import emerging_hotspots # noqa
1717
from xrspatial.fill import fill # noqa
18+
from xrspatial.flood import curve_number_runoff # noqa
19+
from xrspatial.flood import flood_depth # noqa
20+
from xrspatial.flood import inundation # noqa
21+
from xrspatial.flood import travel_time # noqa
1822
from xrspatial.flow_accumulation import flow_accumulation # noqa
1923
from xrspatial.flow_direction import flow_direction # noqa
2024
from xrspatial.flow_direction_dinf import flow_direction_dinf # noqa

xrspatial/accessor.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,24 @@ def hand(self, flow_accum, elevation, **kwargs):
115115
from .hand import hand
116116
return hand(self._obj, flow_accum, elevation, **kwargs)
117117

118+
# ---- Flood ----
119+
120+
def flood_depth(self, water_level, **kwargs):
121+
from .flood import flood_depth
122+
return flood_depth(self._obj, water_level, **kwargs)
123+
124+
def inundation(self, water_level, **kwargs):
125+
from .flood import inundation
126+
return inundation(self._obj, water_level, **kwargs)
127+
128+
def curve_number_runoff(self, curve_number, **kwargs):
129+
from .flood import curve_number_runoff
130+
return curve_number_runoff(self._obj, curve_number, **kwargs)
131+
132+
def travel_time(self, slope_agg, mannings_n, **kwargs):
133+
from .flood import travel_time
134+
return travel_time(self._obj, slope_agg, mannings_n, **kwargs)
135+
118136
def viewshed(self, x, y, **kwargs):
119137
from .viewshed import viewshed
120138
return viewshed(self._obj, x, y, **kwargs)
@@ -373,6 +391,24 @@ def hand(self, flow_accum, elevation, **kwargs):
373391
from .hand import hand
374392
return hand(self._obj, flow_accum, elevation, **kwargs)
375393

394+
# ---- Flood ----
395+
396+
def flood_depth(self, water_level, **kwargs):
397+
from .flood import flood_depth
398+
return flood_depth(self._obj, water_level, **kwargs)
399+
400+
def inundation(self, water_level, **kwargs):
401+
from .flood import inundation
402+
return inundation(self._obj, water_level, **kwargs)
403+
404+
def curve_number_runoff(self, curve_number, **kwargs):
405+
from .flood import curve_number_runoff
406+
return curve_number_runoff(self._obj, curve_number, **kwargs)
407+
408+
def travel_time(self, slope_agg, mannings_n, **kwargs):
409+
from .flood import travel_time
410+
return travel_time(self._obj, slope_agg, mannings_n, **kwargs)
411+
376412
# ---- Classification ----
377413

378414
def natural_breaks(self, **kwargs):

0 commit comments

Comments
 (0)