Fix float32 dtype leak in flood_depth/curve_number_runoff dask backends#3509
Merged
Conversation
…ds (#3499) numpy and cupy cast the input to float64, but _flood_depth_dask and _cn_runoff_dask operated on the input array without a cast, so a float32 input returned float32 on the dask and dask+cupy backends. Both functions document a float64 output. Cast hand/p to float64 at the top of the dask helpers so all four backends agree. Adds float32-input dtype tests across numpy, dask, cupy, and dask+cupy. Updates the sweep-accuracy state CSV. Closes #3499
…lood-2026-06-25 # Conflicts: # xrspatial/flood.py # xrspatial/tests/test_flood.py
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 #3499
flood_depthandcurve_number_runoffdocument a float64 output. The numpy and cupy helpers cast the input to float64, but_flood_depth_daskand_cn_runoff_daskoperated on the input array with no cast, so a float32 input returned float32 on the dask and dask+cupy backends.Change
handto float64 at the top of_flood_depth_dask.pto float64 at the top of_cn_runoff_dask.The dask+cupy wrappers reuse the dask helpers, so all four backends now return float64. The other flood functions already returned float64 on every backend (the float64
_TAN_MINclamp, the1.0/0.0literals ininundation, andnp.interpinvegetation_roughness).Backend coverage
numpy, cupy, dask+numpy, dask+cupy. Added 8 dtype tests (one per function per backend) that feed a float32 input and assert a float64 result. Verified locally on a CUDA host (96 flood tests pass).
Test plan
pytest xrspatial/tests/test_flood.py(96 passed, includes cupy and dask+cupy)