Cover write_geotiff_gpu CPU-fallback codecs (#1706)#1709
Merged
brendancol merged 1 commit intoMay 12, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds targeted regression tests to cover write_geotiff_gpu compression modes that route through CPU fallback branches (or CPU-only implementations), ensuring both round-trip pixel fidelity and correct on-disk TIFF Compression tag emission for interoperability.
Changes:
- Add a new GPU-gated test module covering
lzw,packbits,lz4,lerc, andjpeg2000/j2kthroughwrite_geotiff_gpu, including Compression-tag pinning via IFD parsing. - Add cross-backend decoded-pixel parity checks for lossless CPU-fallback codecs (
lzw,packbits) and dispatch coverage forto_geotiff(gpu=True, ...). - Update sweep test-coverage state metadata to record the newly closed coverage gap.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
xrspatial/geotiff/tests/test_gpu_writer_cpu_fallback_codecs_2026_05_12.py |
New GPU-gated tests for CPU-fallback codec routing + TIFF Compression tag pinning + limited CPU/GPU parity checks. |
.claude/sweep-test-coverage-state.csv |
Records sweep pass metadata indicating the new coverage for issue #1706. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The GPU writer documents nine compression= modes; only four (none, deflate, zstd, jpeg) had direct round-trip coverage. The remaining five (lzw, packbits, lz4, lerc, jpeg2000/j2k) route through dedicated branches in gpu_compress_tiles with CPU fallbacks that shipped without targeted tests. 17 new tests, all passing on a GPU host: * lzw, packbits, lz4: round-trip + TIFF Compression tag pin on uint16 input. * lerc: lossless round-trip on float32 and uint16 + tag pin. * jpeg2000: uint8 single-band + RGB multi-band lossless round-trip, j2k-alias parity, tag pin (skipif glymur missing). * GPU-vs-CPU writer pixel parity for lzw/packbits. * to_geotiff(gpu=True, compression=lzw/packbits) dispatcher thread-through. Mutation tests confirm sensitivity: swapping lzw bytes to zstd in cpu_compress and lerc bytes to deflate in lerc_compress both flip round-trip tests red. State CSV updated with pass-11 notes.
523c25e to
9adc39c
Compare
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 #1706.
Summary
The GPU writer documents nine
compression=modes; only four (none,deflate,zstd,jpeg) had direct round-trip tests. The remaining five (lzw,packbits,lz4,lerc,jpeg2000/j2k) route through dedicated branches ingpu_compress_tiles(_gpu_decode.py:2974-3019) with CPU fallbacks (lerc_compress,jpeg2000_compress,cpu_compress) and had zero direct tests viawrite_geotiff_gpu. A regression in routing, tag-wiring, or fallback dispatch would ship silently because the internal reader uses the same compression-tag table.Source unchanged; test-only addition.
Tests added
xrspatial/geotiff/tests/test_gpu_writer_cpu_fallback_codecs_2026_05_12.py-- 17 tests, all passing on a GPU host:lzw,packbits,lz4: round-trip + TIFF Compression tag pin onuint16input.lerc: lossless round-trip onfloat32anduint16+ tag pin (skipiflercmissing).jpeg2000:uint8single-band + RGB multi-band lossless round-trip,j2k-alias parity, tag pin (skipifglymurmissing).lzw/packbits.to_geotiff(gpu=True, compression='lzw'/'packbits')dispatcher thread-through.Test plan
test_gpu_writer_compression_modes_2026_05_11.pystill passes alongsidelzwbytes tozstdincpu_compress; swaplercbytes todeflateinlerc_compress; both flip round-trip tests red)Sweep metadata
Filed via the deep-sweep test-coverage workflow (pass 11). State CSV updated to reflect the new coverage.