Skip to content

Cover cupy median/mode, dask+cupy, integer input, target_resolution tuple in resample tests#1473

Merged
brendancol merged 1 commit intomainfrom
issue-1470
May 4, 2026
Merged

Cover cupy median/mode, dask+cupy, integer input, target_resolution tuple in resample tests#1473
brendancol merged 1 commit intomainfrom
issue-1470

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Closes #1470.

The recent resample audit flagged four corners of the test matrix that were never exercised. None of these are bug fixes — every path already worked, we just weren't testing it.

What's covered now

  • CuPy aggregate parity for median and mode. TestCuPyParity::test_aggregate_parity now runs all five aggregate methods. _run_cupy falls back to CPU for median / mode, but the cupy-in / cupy-out round-trip gets verified.
  • Dask+CuPy parity (new TestDaskCuPyParity class). Mirrors TestDaskParity: 3 interp methods × 3 scale factors plus 3 aggregate methods. Skips entirely when CUDA or dask is missing.
  • Integer input across all four backends (TestIntegerInput). An int32 8×8 raster goes through nearest and all five aggregate methods on numpy, cupy, dask+numpy, dask+cupy. Output is float, finite, and within the input range — no clipping, no overflow. Backends that aren't installed are skipped per-param.
  • target_resolution tuple (TestTargetResolutionTuple). A tuple of (2.0, 4.0) on an 8×8 raster with res=(1.0, 1.0) gives shape (4, 2) and attrs['res'] == (4.0, 2.0). Also asserts that the scalar form equals (s, s) and that the list form equals the tuple form.

Local results

  • 103 tests collected (was 62), all pass on a machine with CUDA+CuPy and dask installed
  • 0 skipped here; CI environments without CUDA will skip 18 cupy / dask+cupy tests via the existing cuda_and_cupy_available decorator

Test plan

  • pytest xrspatial/tests/test_resample.py passes locally
  • CI on a no-CUDA runner skips the cupy classes cleanly

…uple in resample tests (#1470)

Adds 41 tests to fill four gaps the resample audit found.
No source changes.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 4, 2026
@brendancol brendancol merged commit 43c3924 into main May 4, 2026
10 of 11 checks passed
@brendancol brendancol deleted the issue-1470 branch May 5, 2026 03:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tests: cover cupy median/mode, dask+cupy, integer input, target_resolution tuple in resample

1 participant