fire: declare float32 dtype on dask+numpy backend (#3394)#3396
Merged
Conversation
The six dask+numpy map_blocks wrappers (_dnbr_dask, _rdnbr_dask, _fli_dask, _fl_dask, _ros_dask, _kbdi_dask) passed meta=np.array(()) with no dtype= argument, so the lazy dask DataArray reported float64 while the @ngjit kernels return float32. Pass dtype=np.float32 to match the kernels and the other three backends. _bsc_dask already set dtype=np.int8. Adds a parametrized regression test asserting the dask+numpy declared dtype matches the numpy backend for every fire function.
brendancol
commented
Jun 19, 2026
brendancol
left a comment
Contributor
Author
There was a problem hiding this comment.
PR Review: fire: declare float32 dtype on dask+numpy backend (#3394)
Blockers (must fix before merge)
None.
Suggestions (should fix, not blocking)
None.
Nits (optional improvements)
- Now that
dtype=np.float32is passed explicitly, the trailingmeta=np.array(())is redundant, since dask usesdtype=as the authoritative declared dtype. Keeping it matches the existing_bsc_daskstyle, so leaving it is fine. Dropping it would be marginally cleaner but not worth the churn.
What looks good
- The declared dtype now lines up with the kernels'
np.full(..., dtype=np.float32)allocation and with the other three backends. I confirmeddtype=drives the lazy declared dtype regardless of the float64 meta. - The regression test covers all seven fire functions and checks both the lazy declared dtype and the computed dtype against the numpy backend. I ran it with the source change reverted: the six affected cases fail and
_bsc_callpasses (it was already correct). - Small, repetitive change: six identical one-line kwarg additions, no algorithm or value change on any backend.
Checklist
- Algorithm matches reference (no algorithm change; metadata only)
- All implemented backends produce consistent results (dtype now uniform float32)
- NaN handling is correct (unchanged)
- Edge cases covered by tests (dtype parity parametrized over every function)
- Dask chunk boundaries handled correctly (element-wise, no overlap)
- No premature materialization or unnecessary copies
- Benchmark not needed (metadata fix)
- README feature matrix not applicable (no new function)
- Docstrings unchanged and still accurate
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.
Closes #3394.
The dask+numpy
map_blockswrappers for six fire functions declared the wrong output dtype: they passedmeta=np.array(())(float64) with nodtype=, so the lazy DataArray reported float64 while the@ngjitkernels return float32. numpy, cupy, and dask+cupy all reported float32, so dask+numpy was the odd one out.dtype=np.float32to_dnbr_dask,_rdnbr_dask,_fli_dask,_fl_dask,_ros_dask,_kbdi_dask._bsc_daskalready passeddtype=np.int8and is unchanged.Backends: only the dask+numpy declared-dtype metadata changes. Computed values are unaffected on all four backends. The fix matches the existing
_bsc_daskpattern.Test plan:
pytest xrspatial/tests/test_fire.py(61 passed, includes cupy + dask+cupy on a GPU host)