Add test coverage for overview_resampling min/max/median modes#1639
Merged
brendancol merged 2 commits intoMay 12, 2026
Merged
Conversation
The to_geotiff and write_geotiff_gpu overview_resampling parameter accepts six modes (mean, nearest, mode, cubic, min, max, median) but the last three had no test coverage on either the CPU block reducer (_block_reduce_2d) or the GPU block reducer (_block_reduce_2d_gpu). A regression in any of those branches would ship undetected. This commit closes a Cat 4 HIGH parameter-coverage gap with 26 new tests: * CPU and GPU unit tests for the block reducer on finite input. * CPU and GPU unit tests for partial-NaN input verifying the nan-aware reductions skip NaN cells. * End-to-end COG writes for to_geotiff(cog=True) and write_geotiff_gpu(cog=True) for each of the three modes. * CPU/GPU parity check for to_geotiff(gpu=True) overview output. * CPU nodata-sentinel regression (issue 1613 path, here extended to the min/max/median branches that 1613 did not test). * Error path: ValueError on an unknown method name for both backends. All 26 tests pass on a GPU-enabled host. Pass 6 of the test-coverage sweep on the geotiff module. State CSV notes column updated.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds new test coverage for overview_resampling modes min, max, and median across CPU and GPU GeoTIFF COG overview generation, focusing on both unit-level block reducers and end-to-end writer/reader round-trips.
Changes:
- Add CPU/GPU unit tests for
_block_reduce_2d/_block_reduce_2d_gpuformin/max/medianon finite and partial-NaN inputs. - Add end-to-end COG overview round-trip tests for
to_geotiff(..., cog=True)andwrite_geotiff_gpu(..., cog=True)for those modes, plus CPU/GPU parity coverage. - Update the internal
.claudesweep state tracking entry for the geotiff module.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
xrspatial/geotiff/tests/test_overview_resampling_min_max_median_2026_05_11.py |
New tests covering min/max/median overview resampling for CPU and GPU paths, including unit + end-to-end coverage. |
.claude/sweep-test-coverage-state.csv |
Updates test-coverage sweep tracking notes for the geotiff module. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| The CPU writer (``xrspatial.geotiff._writer._block_reduce_2d``) and the | ||
| GPU writer (``xrspatial.geotiff._gpu_decode._block_reduce_2d_gpu``) both | ||
| implement six resampling reductions for COG overview generation: |
Comment on lines
+13
to
+15
| * ``min`` -- NO coverage prior to this file. | ||
| * ``max`` -- NO coverage prior to this file. | ||
| * ``median`` -- NO coverage prior to this file. |
| @@ -1,3 +1,3 @@ | |||
| module,last_inspected,issue,severity_max,categories_found,notes | |||
| geotiff,2026-05-11,,HIGH,2;3,"Pass 5 (2026-05-11): added test_degenerate_shapes_backends_2026_05_11.py covering Cat 3 HIGH geometric gaps (1x1 / 1xN / Nx1 reads on dask+numpy, GPU, dask+cupy backends; 1x1 / 1xN / Nx1 writes through write_geotiff_gpu) and Cat 2 MEDIUM NaN/Inf gaps (all-NaN read on GPU + dask+cupy, Inf / -Inf reads on all non-eager backends, NaN sentinel mask on dask read path including sentinel block split across chunk boundary). 23 tests, all passing on GPU host. Prior passes still hold: pass 4 (r4) closed read_geotiff_gpu/dask name= + max_pixels= kwargs (Cat 4), pass 3 (r3) closed read_vrt GPU/dask+GPU backend dispatch (Cat 1) and dtype/name kwargs (Cat 4)." | |||
| geotiff,2026-05-11,,HIGH,2;3;4,"Pass 6 (2026-05-11): added test_overview_resampling_min_max_median_2026_05_11.py covering Cat 4 HIGH parameter-coverage gap on overview_resampling=min/max/median. Both CPU (_block_reduce_2d) and GPU (_block_reduce_2d_gpu) reductions had branches with zero test coverage; an unnoticed regression in any of the three modes would ship undetected. 26 tests, all passing on GPU host: block-reducer unit tests (finite + partial-NaN), end-to-end COG writes for both to_geotiff and write_geotiff_gpu, CPU/GPU parity for to_geotiff(gpu=True), CPU nodata-sentinel regression check, and ValueError error-path tests for unknown method names on both backends. Pass 5 (2026-05-11): added test_degenerate_shapes_backends_2026_05_11.py covering Cat 3 HIGH geometric gaps (1x1 / 1xN / Nx1 reads on dask+numpy, GPU, dask+cupy backends; 1x1 / 1xN / Nx1 writes through write_geotiff_gpu) and Cat 2 MEDIUM NaN/Inf gaps (all-NaN read on GPU + dask+cupy, Inf / -Inf reads on all non-eager backends, NaN sentinel mask on dask read path including sentinel block split across chunk boundary). 23 tests, all passing on GPU host. Prior passes still hold: pass 4 (r4) closed read_geotiff_gpu/dask name= + max_pixels= kwargs (Cat 4), pass 3 (r3) closed read_vrt GPU/dask+GPU backend dispatch (Cat 1) and dtype/name kwargs (Cat 4)." | |||
- Fix "six" -> "seven" reductions count (mean, nearest, min, max, median, mode, cubic). - Reword module docstring: CPU end-to-end paths for min/max/median were already covered by test_cog_overview_nodata_1613; the gap this file closes is GPU end-to-end + direct CPU/GPU block-reducer branches. - Mirror the clarification in the sweep-test-coverage state CSV row.
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.
Summary
The
to_geotiffandwrite_geotiff_gpuoverview_resamplingparameter accepts six documented modes (mean,nearest,mode,cubic,min,max,median). The last three had no tests on either the CPU block reducer (_block_reduce_2d) or the GPU block reducer (_block_reduce_2d_gpu). A regression in any of those branches would ship undetected.This PR closes a Cat 4 HIGH parameter-coverage gap surfaced by pass 6 of the test-coverage sweep on the geotiff module.
What is added
26 new tests in
xrspatial/geotiff/tests/test_overview_resampling_min_max_median_2026_05_11.py:to_geotiff(cog=True)andwrite_geotiff_gpu(cog=True)for each of the three modes.to_geotiff(gpu=True)overview output.ValueErroron an unknown method name for both backends.No source changes. All 26 tests pass locally on a GPU-enabled host.
Test plan
pytest xrspatial/geotiff/tests/test_overview_resampling_min_max_median_2026_05_11.py -v-> 26 passed