Skip to content

test(proximity): cover degenerate shapes, non-default metrics, attrs#2712

Open
brendancol wants to merge 1 commit into
xarray-contrib:mainfrom
brendancol:deep-sweep-test-coverage-proximity-2026-05-29
Open

test(proximity): cover degenerate shapes, non-default metrics, attrs#2712
brendancol wants to merge 1 commit into
xarray-contrib:mainfrom
brendancol:deep-sweep-test-coverage-proximity-2026-05-29

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Closes #2692. Test-only; no source changes.

Adds 65 tests to test_proximity.py. All run and pass on a CUDA host across numpy, cupy, dask+numpy, and dask+cupy. None of these pins a bug; the current behavior is correct everywhere. They lock the behavior so a regression shows up in CI.

What's covered:

  • Degenerate raster shapes (1x1 single pixel, Nx1 column strip, 1xN row strip) for proximity, allocation, and direction on all four backends. These shapes are where the line-sweep kernel boundaries (_process_proximity_line) and the GPU brute-force kernel grid sizing (_proximity_cuda_kernel) tend to break. Expected values are hand-checked; a mutation of one pinned direction expectation confirms the tests have teeth.
  • MANHATTAN and GREAT_CIRCLE on allocation and direction across all four backends. Before this, only proximity exercised non-default metrics cross-backend. Both metrics match the numpy baseline.
  • Attrs preservation with non-empty res/crs attrs (the shared test_raster fixture carries no attrs, so the existing attrs check compares two empty dicts). Includes a bounded-dask test that exercises the res-attr-driven padding path, since proximity reads attrs['res'] via get_dataarray_resolution to size map_overlap depth.

Full test_proximity.py suite: 134 passed (was 69).

Note for a future accuracy pass: a res attr that disagrees with the actual coordinate spacing mis-sizes the bounded-dask map_overlap depth (raises or produces wrong boundary results). That's a source fragility, out of scope for this test-only PR.

…array-contrib#2692)

Adds 65 tests to test_proximity.py. Test-only; no source changes.

- Cat 3: 1x1 / Nx1 / 1xN degenerate rasters for proximity, allocation,
  and direction on numpy, cupy, dask+numpy, dask+cupy.
- Cat 1/4: MANHATTAN and GREAT_CIRCLE on allocation and direction across
  all four backends (previously only proximity tested non-default
  metrics cross-backend).
- Cat 5: attrs preservation with non-empty res/crs, plus a bounded-dask
  test exercising the res-attr-driven padding path.

All new tests run and pass on a CUDA host.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 29, 2026
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.

proximity: add missing backend and edge-case test coverage

1 participant