Skip to content

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

Merged
brendancol merged 2 commits into
xarray-contrib:mainfrom
brendancol:deep-sweep-test-coverage-proximity-2026-05-29
Jun 1, 2026
Merged

test(proximity): cover degenerate shapes, non-default metrics, attrs#2712
brendancol merged 2 commits 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
@brendancol brendancol merged commit 2c2bda6 into xarray-contrib:main Jun 1, 2026
6 of 7 checks passed
brendancol added a commit that referenced this pull request Jun 1, 2026
PR #2712's squash merge ran the merge=union driver against a branch
based on the older multi-line CSV format. The union duplicated the
header three times, duplicated several module rows, and split
multi-line notes fields across physical lines.

Restore the file to one header plus one single-line row per module
(adds the proximity row #2712 intended to add). No data lost: the
retained rows are the compacted versions already on main before the
merge. The merge=union root cause is tracked separately.
brendancol added a commit that referenced this pull request Jun 1, 2026
…9-01

Resolve test_proximity.py conflict (both-sides-added test blocks); keep
both this PR's tests and the #2712 coverage block.
brendancol added a commit that referenced this pull request Jun 1, 2026
Resolve test_proximity.py conflict (both-sides-added test blocks); keep
both this PR's tests and the #2712 coverage block.
brendancol added a commit that referenced this pull request Jun 1, 2026
Resolve test_proximity.py conflict (both-sides-added test blocks); keep
both this PR's tests and the #2712 coverage block.
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