Add dask+numpy nodata-masking value-parity tests for resample - #3074
Merged
Conversation
brendancol
commented
Jun 9, 2026
brendancol
left a comment
Contributor
Author
There was a problem hiding this comment.
PR Review: Add dask+numpy nodata-masking value-parity tests for resample
Blockers
None.
Suggestions
None.
Nits
None.
What looks good
- The
isnan(out[0,0])assertions carry their weight. Without masking the top-left 2x2 sentinel block would average or select to a finite -9999 / -1.0, so the test fails loudly if masking ever silently becomes a no-op. - Branch coverage of
_apply_nodata_maskis good: the float -1.0 sentinel takes the float-input path (no cast), the int -9999 sentinel takes the integer->float32 cast path. - Parity is checked against the numpy backend with equal_nan=True, which is exactly the gap this closes.
- The cupy exclusion is written into the module docstring with the concrete xarray/cupy error, so a future reader on a fixed environment knows what to re-enable.
- Filename carries the issue token 3073, so no temp/file collision with parallel runs.
Checklist
- Backends: numpy + dask+numpy covered; cupy/dask+cupy excluded with a documented reason.
- NaN handling: masked cells assert NaN; parity uses equal_nan.
- Edge cases: all-sentinel block (all-NaN window) is exercised on the average path.
- Source untouched; test-only.
- No benchmark or README change needed.
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 #3073
What this does
xrspatial/tests/test_resample_nodata_dask_parity_3073.pycovering the dask+numpy nodata-masking value path, which had no value-level test (existing dask+numpy nodata tests only hit the error paths and identity-attr refresh).nearest,average) and sentinel source (explicitnodata=arg,_FillValueattr,nodataattr; integer-9999and float-1.0).Backend coverage
numpy and dask+numpy. cupy / dask+cupy nodata tests are left out on purpose: on xarray 2025.12 + cupy 13.6,
DataArray.where()on a cupy array raisesAttributeError: module 'cupy' has no attribute 'astype', an xarray/cupy Array-API mismatch (~221.wheresites across xrspatial), not a resample bug.Scope
Test-only.
resample.pyis unchanged.Test plan
test_resample.py+ coverage suite still green (309 passed)