Skip to content

polygonize: close test-coverage gaps for backends, edge cases, params#2156

Open
brendancol wants to merge 1 commit into
mainfrom
deep-sweep-test-coverage-polygonize-2026-05-19
Open

polygonize: close test-coverage gaps for backends, edge cases, params#2156
brendancol wants to merge 1 commit into
mainfrom
deep-sweep-test-coverage-polygonize-2026-05-19

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Summary

Deep-sweep test-coverage pass against xrspatial/polygonize.py on 2026-05-19. Adds xrspatial/tests/test_polygonize_coverage_2026_05_19.py with 58 tests, all passing on a CUDA host.

Gaps closed

Cat 1 (backend coverage)

  • simplify_tolerance= and mask= parity on the dask+cupy backend. numpy / cupy / dask were already covered.

Cat 2 (NaN / Inf / nodata)

  • NaN parity for cupy and dask+cupy backends.
  • all-NaN raster on every backend.
  • +/-Inf pins on every backend. The numpy / dask / dask+cupy backends silently absorb Inf cells into adjacent finite polygons (issue polygonize numpy/dask backends silently absorb +Inf/-Inf cells #2155); cupy emits them correctly. The pins lock the current asymmetric behaviour so the fix is visible as a test diff.

Cat 3 (geometric edge cases)

  • 1x1 single-pixel raster on all four backends + geopandas.
  • Nx1 single-column raster on all four backends. Exercises the nx==1 padding path at polygonize.py:565 and the cupy nx==1 numpy-fallback at polygonize.py:671. Neither code path had direct test coverage before.
  • 1xN single-row raster on all four backends.
  • All-equal-value raster on all four backends.

Cat 4 (parameter coverage)

  • column_name= non-default value across geopandas / spatialpandas / geojson return types.
  • Error paths: bad connectivity, bad transform length, mask shape mismatch, mask underlying-type mismatch.

Cat 5 not applicable: polygonize returns lists / dataframes, not a DataArray with attrs to propagate.

Source-bug surfaced

Filed #2155 for a real bug surfaced by the +/-Inf tests: numpy / dask / dask+cupy backends silently absorb Inf cells. Per sweep rules the source fix is NOT bundled with this test-only PR.

Test plan

  • python -m pytest xrspatial/tests/test_polygonize_coverage_2026_05_19.py -> 58 passed.
  • python -m pytest xrspatial/tests/test_polygonize.py xrspatial/tests/test_polygonize_coverage_2026_05_19.py -> 172 passed, 13 skipped (pre-existing skips for optional deps).
  • CUDA host: cupy and dask+cupy tests executed locally.

Deep-sweep test-coverage pass 1 (2026-05-19): adds
test_polygonize_coverage_2026_05_19.py with 58 tests, all passing on
a CUDA host.

Closes the following audit-flagged gaps:

Cat 1 (backend coverage)
  - simplify_tolerance + mask= parity on the dask+cupy backend
    (numpy / cupy / dask were already covered).

Cat 2 (NaN / Inf / nodata)
  - NaN parity for cupy and dask+cupy.
  - all-NaN raster on every backend.
  - +/-Inf pins on every backend.  numpy / dask / dask+cupy currently
    silently absorb Inf cells into adjacent finite polygons (issue
    #2155); cupy emits them correctly.  Pins lock the asymmetric
    behaviour so the fix is visible.

Cat 3 (geometric)
  - 1x1 single-pixel raster on all four backends + geopandas.
  - Nx1 single-column raster exercises the nx==1 padding path
    (polygonize.py:565) and the cupy nx==1 numpy-fallback
    (polygonize.py:671).
  - 1xN single-row and all-equal-value rasters on all four backends.

Cat 4 (parameter coverage)
  - column_name non-default value across geopandas / spatialpandas /
    geojson return types.
  - Validation error paths: bad connectivity, bad transform length,
    mask shape mismatch, mask underlying-type mismatch.

Cat 5 N/A: polygonize returns lists / dataframes, not a DataArray
with attrs to propagate.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 19, 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.

1 participant