Skip to content

resample: add dask+numpy nodata-masking value-parity tests #3073

Description

@brendancol

Coverage gap

resample masks nodata sentinels before resampling in _apply_nodata_mask, which goes through xarray's .where() / .astype(). Those dispatch per backend, but the dask+numpy masking path has no value-level test. The existing dask+numpy nodata tests only check the error paths (TestNodataOutOfRange) and the identity-attr refresh (TestIdentityNodataMetadata). Nothing checks that sentinel cells actually become NaN, with values matching the numpy backend, after a real (non-identity) resample.

Proposed tests

Add xrspatial/tests/test_resample_nodata_dask_parity_3073.py. For the dask+numpy backend it asserts that resample output matches the numpy backend (equal_nan=True) and that the expected masked cell is NaN. Parametrized over method (nearest, average) and sentinel source: explicit nodata= arg, _FillValue attr, an integer -9999 sentinel, and a float -1.0 sentinel. Guarded with the existing dask_array_available marker.

Scope

Test-only. No source changes.

Note on cupy

No cupy / dask+cupy nodata tests here. On this environment (xarray 2025.12 + cupy 13.6), DataArray.where() on a cupy backend raises AttributeError: module 'cupy' has no attribute 'astype'. That comes from an xarray/cupy Array-API mismatch hitting every .where call on a cupy array (~221 sites across xrspatial), not from resample, so it's out of scope for this coverage closure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend-coverageAdding missing dask/cupy/dask+cupy backend supporttestsTest coverage and parity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions