Add proximity coverage tests: int rasters, bounded GPU metrics, empty input (#3139)#3140
Open
brendancol wants to merge 3 commits into
Open
Add proximity coverage tests: int rasters, bounded GPU metrics, empty input (#3139)#3140brendancol wants to merge 3 commits into
brendancol wants to merge 3 commits into
Conversation
brendancol
commented
Jun 10, 2026
brendancol
left a comment
Contributor
Author
There was a problem hiding this comment.
PR Review: Add proximity coverage tests: int rasters, bounded GPU metrics, empty input (#3139)
Blockers
None.
Suggestions
- Int coverage was int32-only. uint8 is the usual land-cover dtype and exercises a different NaN-pad cast (lands on a non-target 0 instead of int32's phantom-target INT_MIN). Fixed in be721dd by parametrizing dtype.
test_integer_raster_explicit_target_valuesran proximity only; allocation and direction never saw integer pixels with explicittarget_values. Fixed in be721dd by parametrizing func.
Nits
- The empty-raster test is numpy-only. That's fine: the raise happens in
_processbefore backend dispatch (themax_possible_distanceendpoint lookup), so one backend covers all four. No change needed.
What looks good
- The spy on
_process_dask_cupymeans the bounded-GPU metric tests can't silently pass through a fallback path if dispatch thresholds drift. - The mutation check (zeroing the halo depth) flipped all 6 bounded tests red, and the source was restored byte-identical.
- The int tests hit both the unbounded dask KDTree path (max_distance=inf) and the bounded map_overlap halo path (max_distance=10), which is where the NaN-pad cast lives.
Checklist
- Algorithm reference: n/a, test-only
- Backend consistency: 72 new tests across numpy / cupy / dask+numpy / dask+cupy, executed on a CUDA host
- NaN handling: pinned via the int-pad tests
- Edge cases: empty-raster raise pinned
- Dask chunk boundaries: bounded halo path now exercised with non-default metrics
- Benchmark / README / docstrings: not applicable, test-only
…age-proximity-2026-06-09 # Conflicts: # xrspatial/tests/test_proximity.py
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 #3139
Test-only PR;
xrspatial/proximity.pyis untouched.boundary=np.nanon an int array casts the pad to INT_MIN, a finite non-zero "target" value, and the only thing neutralizing those phantom targets is that the coordinate-grid pads are real NaNs._process_dask_cupy) was only ever exercised with EUCLIDEAN. Added MANHATTAN and GREAT_CIRCLE x {proximity, allocation, direction} against the numpy baseline, with a spy asserting the bounded GPU path actually ran (6 tests). Mutation check: zeroing the halo depth flips all 6 red.Backend coverage: numpy / cupy / dask+numpy / dask+cupy all executed locally on a CUDA host.
Test plan:
test_proximity.pypasses (450 passed, 0 skipped)