Skip to content

Commit 25b355b

Browse files
committed
Add fire module: burn severity, fire behavior, and KBDI (#922)
Seven per-cell raster functions with numpy/cupy/dask/dask+cupy backends: Burn severity: dnbr, rdnbr, burn_severity_class (USGS 7-class) Fire behavior: fireline_intensity (Byram), flame_length, rate_of_spread (simplified Rothermel with Anderson 13 fuel model lookup) Fire danger: kbdi (single time-step Keetch-Byram Drought Index) Includes 54 tests covering known values, NaN propagation, edge cases, input validation, cross-backend parity, Dataset support, and accessor smoke tests. Adds .xrs accessor methods for both DataArray and Dataset.
1 parent 9931145 commit 25b355b

File tree

5 files changed

+1697
-0
lines changed

5 files changed

+1697
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ connected-component labelling; and broad dask+cupy backend coverage across the
1010
library.
1111

1212
#### New Features
13+
- Add fire module: dNBR, RdNBR, burn severity class, fireline intensity, flame length, rate of spread (Rothermel), and KBDI (#922)
1314
- Add 3D multi-band support to focal functions (#924)
1415
- Add foundational hydrology tools (#921)
1516
- Add terrain metrics module: TRI, TPI, and Roughness (#920)

xrspatial/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
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.fire import burn_severity_class # noqa
19+
from xrspatial.fire import dnbr # noqa
20+
from xrspatial.fire import fireline_intensity # noqa
21+
from xrspatial.fire import flame_length # noqa
22+
from xrspatial.fire import kbdi # noqa
23+
from xrspatial.fire import rate_of_spread # noqa
24+
from xrspatial.fire import rdnbr # noqa
1825
from xrspatial.flood import curve_number_runoff # noqa
1926
from xrspatial.flood import flood_depth # noqa
2027
from xrspatial.flood import inundation # noqa

xrspatial/accessor.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,36 @@ def polygonize(self, **kwargs):
257257
from .polygonize import polygonize
258258
return polygonize(self._obj, **kwargs)
259259

260+
# ---- Fire ----
261+
262+
def dnbr(self, post_nbr_agg, **kwargs):
263+
from .fire import dnbr
264+
return dnbr(self._obj, post_nbr_agg, **kwargs)
265+
266+
def rdnbr(self, pre_nbr_agg, **kwargs):
267+
from .fire import rdnbr
268+
return rdnbr(self._obj, pre_nbr_agg, **kwargs)
269+
270+
def burn_severity_class(self, **kwargs):
271+
from .fire import burn_severity_class
272+
return burn_severity_class(self._obj, **kwargs)
273+
274+
def fireline_intensity(self, spread_rate_agg, **kwargs):
275+
from .fire import fireline_intensity
276+
return fireline_intensity(self._obj, spread_rate_agg, **kwargs)
277+
278+
def flame_length(self, **kwargs):
279+
from .fire import flame_length
280+
return flame_length(self._obj, **kwargs)
281+
282+
def rate_of_spread(self, wind_speed_agg, fuel_moisture_agg, **kwargs):
283+
from .fire import rate_of_spread
284+
return rate_of_spread(self._obj, wind_speed_agg, fuel_moisture_agg, **kwargs)
285+
286+
def kbdi(self, max_temp_agg, precip_agg, annual_precip, **kwargs):
287+
from .fire import kbdi
288+
return kbdi(self._obj, max_temp_agg, precip_agg, annual_precip, **kwargs)
289+
260290
# ---- Multispectral (self = NIR band) ----
261291

262292
def ndvi(self, red_agg, **kwargs):
@@ -471,6 +501,16 @@ def surface_direction(self, elevation, **kwargs):
471501
from .surface_distance import surface_direction
472502
return surface_direction(self._obj, elevation, **kwargs)
473503

504+
# ---- Fire ----
505+
506+
def burn_severity_class(self, **kwargs):
507+
from .fire import burn_severity_class
508+
return burn_severity_class(self._obj, **kwargs)
509+
510+
def flame_length(self, **kwargs):
511+
from .fire import flame_length
512+
return flame_length(self._obj, **kwargs)
513+
474514
# ---- Multispectral (band mapping via kwargs) ----
475515

476516
def ndvi(self, nir, red, **kwargs):

0 commit comments

Comments
 (0)