Skip to content

Add cost_distance tests for 1x1 raster, Inf friction, and metadata (#3341)#3347

Merged
brendancol merged 1 commit into
mainfrom
deep-sweep-test-coverage-cost_distance-2026-06-15-01
Jun 15, 2026
Merged

Add cost_distance tests for 1x1 raster, Inf friction, and metadata (#3341)#3347
brendancol merged 1 commit into
mainfrom
deep-sweep-test-coverage-cost_distance-2026-06-15-01

Conversation

@brendancol

Copy link
Copy Markdown
Contributor

Closes #3341.

Adds tests for three coverage gaps in cost_distance. Tests only, no source change.

What's new

  • 1x1 single-pixel raster. A source pixel with no neighbours returns cost 0; a 1x1 raster with no source returns all-NaN. Both across numpy, cupy, dask+numpy, dask+cupy.
  • Inf friction. An Inf-friction cell is impassable, same as NaN/zero. Paths route around it. All four backends.
  • Metadata preservation. Output keeps the input's attrs (res, crs), coords, and dim names. Includes a lat/lon case to catch any silent rename to y/x.

Verification

All 17 new cases ran and passed on a CUDA host (numpy, cupy, dask+numpy, dask+cupy). No GPU cases were skipped. The full test_cost_distance.py is green: 72 passed.

All three behaviors were already correct in the source. This just pins them so a future change can't break them quietly.

…3341)

Covers three gaps found by the test-coverage sweep:
- 1x1 single-pixel source and no-source rasters, all 4 backends
- Inf-friction barrier is impassable like NaN/zero, all 4 backends
- attrs/coords/dims preservation, plus lat/lon dim-name passthrough

Tests only; no source change. All ran and passed on a CUDA host
(numpy, cupy, dask+numpy, dask+cupy).
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label Jun 15, 2026
@brendancol brendancol merged commit 7a0863c into main Jun 15, 2026
9 checks passed
@brendancol brendancol deleted the deep-sweep-test-coverage-cost_distance-2026-06-15-01 branch June 25, 2026 12:57
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.

cost_distance: add tests for 1x1 raster and metadata preservation

1 participant