Skip to content

Add rasterize all_touched-line and non-iterable-input coverage tests#3120

Merged
brendancol merged 3 commits into
mainfrom
deep-sweep-test-coverage-rasterize-2026-06-09
Jun 10, 2026
Merged

Add rasterize all_touched-line and non-iterable-input coverage tests#3120
brendancol merged 3 commits into
mainfrom
deep-sweep-test-coverage-rasterize-2026-06-09

Conversation

@brendancol

@brendancol brendancol commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Test-only PR from the test-coverage sweep (pass 5 over xrspatial/rasterize.py).

Proposed Changes

  • Pins all_touched=True as a no-op for LineString input on numpy, cupy, dask+numpy, and dask+cupy, parametrized over a corner-crossing diagonal and a shallow interior-crossing line, plus equality with rasterio's default-mode burn. A strict xfail asserts rasterio all_touched parity and flips when rasterize(all_touched=True) has no effect on LineString geometries #3102 (lines skip the supercover burn) is fixed, so the behavior change cannot land silently.
  • Pins the non-iterable geometries TypeError in _parse_input over int / float / None / object inputs.
  • Merged latest main (rasterize source fixes, reproject improvements, geotiff updates); resolved conflict in .claude/sweep-test-coverage-state.csv by keeping the PR's rasterize Pass 5 row and taking main's updated reproject row.

No source changes beyond the merge. The line/all_touched divergence itself is tracked in #3102.

Backend coverage: the no-op pin runs on all four backends; cupy and dask+cupy executed on a CUDA host (not skipped). Tests: 10 passed, 6 skipped.

…3105)

Pins all_touched=True as a no-op for LineString input on all four
backends (strict xfail tracks the rasterio divergence, #3102) and the
non-iterable geometries TypeError path. Updates the test-coverage
sweep state CSV for the rasterize module.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label Jun 9, 2026

@brendancol brendancol left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review: Add rasterize all_touched-line and non-iterable-input coverage tests

Test-only PR; reviewed the new file in full plus the surrounding rasterize source and the four prior coverage files.

Blockers (must fix before merge)

None.

Suggestions (should fix, not blocking)

  • test_rasterize_coverage_2026_06_09.py:96-99: _DIAG crosses pixel corners, which is exactly where rasterization tie-breaking lives. The pins hold today, but a second line geometry that crosses cell interiors (not corners) would make the no-op pin less sensitive to tie-break changes that are unrelated to #3102. Cheap to add if a follow-up touches this file; not worth a new commit on its own.

Nits (optional improvements)

  • test_rasterize_coverage_2026_06_09.py:185: a string input is iterable, so rasterize("abc") takes a different failure path (item[0] on a 1-char string). The new tests cover the documented non-iterable guard only; if anyone wants the string case pinned it belongs with #3105's LOW leftovers, not this PR.

What looks good

  • The no-op pin runs on all four backends with ragged dask chunks ((3,2),(3,2) over 5x5), so the tile path crosses the diagonal.
  • The strict xfail referencing #3102 plus the equality pins mean the eventual fix cannot land without touching this file, which is the point of a pin.
  • Bresenham expectation is a hand-checkable known value (anti-diagonal), not a snapshot.
  • rasterio gating matches the convention in test_rasterize_all_touched_supercover_2169.py.
  • State CSV row is a single physical line, last-write-wins, prior pass notes preserved.

Checklist

  • Algorithm matches reference (rasterio default mode verified directly)
  • All implemented backends produce consistent results (cupy and dask+cupy executed on a CUDA host)
  • NaN handling: n/a for these paths
  • Edge cases covered (corner-crossing diagonal, MultiLineString explode, ragged chunks)
  • Dask chunk boundaries handled correctly
  • No premature materialization (single compute per assertion)
  • Benchmark not needed (test-only)
  • README feature matrix: n/a
  • Docstrings present on every test class and the module header

@brendancol brendancol left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up review (after 96d0b65)

Disposition of the first-pass findings:

  • Suggestion (interior-crossing line): fixed. The no-op pin is now parametrized over a corner-crossing diagonal and a shallow interior-crossing line on all four backends (16 cells total; 15 passed + 1 strict xfail on a CUDA host).
  • Nit (string input): dismissed. A string is iterable, so it takes the pair-unpacking path and dies with an incidental IndexError. Pinning that would lock in accidental behavior for garbage input rather than a contract; left with the LOW leftovers on #3105.

No new findings. The diff since the first review is the parametrize change plus the _INTERIOR constant and comment.

@brendancol

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

…age-rasterize-2026-06-09

# Conflicts:
#	.claude/sweep-test-coverage-state.csv

Copilot AI commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Merge conflicts resolved in 62c4fb5. The only conflict was in .claude/sweep-test-coverage-state.csv: kept the PR's rasterize row (Pass 5, 2026-06-09) and took main's updated reproject row. Tests pass: 10 passed, 6 skipped.

@brendancol brendancol merged commit bf99500 into main Jun 10, 2026
1 check was pending
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.

2 participants