Add Inf/-Inf regression tests for fire module#3500
Merged
Conversation
The fire kernels guard only against NaN (v != v), so +Inf and -Inf inputs flow through the per-pixel arithmetic. The resulting outputs are well defined and match across numpy, cupy, dask+numpy, and dask+cupy, but no test covered them. Lock that contract with 28 tests: a per-function numpy contract check plus four-backend parity for dnbr, rdnbr, burn_severity_class, fireline_intensity, flame_length, rate_of_spread, and kbdi. Test-only change; no source behavior is modified. Update the test-coverage sweep state row for fire.
Address review nit on PR #3500: the kbdi numpy Inf contract pinned a bare 43.95906. Add a comment explaining it is the post-clamp drought- factor re-accumulation at temp=30, annual_precip=1500. Comment-only.
Contributor
Author
Review: Inf/-Inf regression tests for fireReviewed on a CUDA host. Test-only change: 28 new tests plus a state-CSV row. No source files touched. I re-ran the file (101 passed) and checked each locked contract value against the kernels. BlockersNone. SuggestionsNone in the added code. I hand-checked every expected value in
Nits
What looks good
Checklist
|
…age-fire-2026-06-25 # Conflicts: # .claude/sweep-test-coverage-state.csv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds 28 tests covering +Inf / -Inf inputs for every public function in
xrspatial.fire:dnbr,rdnbr,burn_severity_class,fireline_intensity,flame_length,rate_of_spread, andkbdi.Why
The fire kernels skip cells only on NaN (
v != v), so non-finite-but-not-NaN values flow straight through the arithmetic. That path had no test. Probing all four backends shows the behavior is consistent and well defined, for example:dnbr:inf - inf -> nan,inf - finite -> infburn_severity_class:+inf -> class 7,-inf -> class 1kbdi:prev = infclamps to 800rate_of_spread:slope = inf -> nanThe new tests lock this contract so a later change to the finite-value guard cannot alter behavior unnoticed.
Coverage
Each function gets a numpy contract test (exact expected values) plus four-backend parity (numpy / cupy / dask+numpy / dask+cupy). All 28 ran and passed on a CUDA host. Full
test_fire.pyis green (101 passed).Test-only change. No source behavior is modified.
From the test-coverage deep sweep (Cat 2: NaN/Inf edge cases).