Skip to content

Add fire module (#922)#927

Merged
brendancol merged 4 commits intomasterfrom
fire-module
Mar 2, 2026
Merged

Add fire module (#922)#927
brendancol merged 4 commits intomasterfrom
fire-module

Conversation

@brendancol
Copy link
Contributor

@brendancol brendancol commented Mar 2, 2026

Summary

New xrspatial/fire.py module with 7 per-cell functions, all with numpy/cupy/dask/dask+cupy backends:

  • Burn severity: dnbr, rdnbr, burn_severity_class (USGS 7-class, int8)
  • Fire behavior: fireline_intensity (Byram), flame_length, rate_of_spread (simplified Rothermel, Anderson 13 fuel models)
  • Fire danger: kbdi (single time-step Keetch-Byram Drought Index)

burn_severity_class and flame_length accept Dataset inputs via @supports_dataset. Accessor methods on .xrs for all 7 (DataArray) and those 2 (Dataset). Top-level imports and changelog updated.

Test plan

54 tests in test_fire.py, all passing:

  • Known-value checks against hand-computed results
  • NaN propagation (NaN in any input -> NaN out)
  • Edge cases: zero/negative inputs, division guards, clamp bounds
  • Validation: non-DataArray raises TypeError, shape mismatch raises ValueError
  • Cross-backend parity: numpy vs dask, numpy vs cupy, numpy vs dask+cupy
  • Dataset pass-through for burn_severity_class and flame_length
  • rate_of_spread specifics: all 13 fuel models produce finite positive output; spread increases with slope and wind; high moisture suppresses spread; out-of-range fuel_model raises ValueError
  • Accessor smoke tests (DataArray and Dataset)

Closes #922

@github-actions github-actions bot added the performance PR touches performance-sensitive code label Mar 2, 2026
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.
Beginner-oriented walkthrough of all 7 fire module functions with
synthetic data: dNBR, RdNBR, burn severity classification, fireline
intensity, flame length, rate of spread (with fuel model comparison
and moisture sensitivity), and multi-day KBDI accumulation.
- API reference page (docs/source/reference/fire.rst) with autosummary
  directives for all 7 public functions
- User guide notebook (docs/source/user_guide/fire.ipynb) with synthetic
  data examples for burn severity, fire behavior, and KBDI
- Updated reference and user guide toctrees
@brendancol brendancol merged commit 0740651 into master Mar 2, 2026
10 of 11 checks passed
@brendancol brendancol deleted the fire-module branch March 5, 2026 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add fire module

1 participant