Cover compression_level= for compression='lz4'#1650
Merged
brendancol merged 1 commit intoMay 12, 2026
Merged
Conversation
The compression-level validator in xrspatial.geotiff.__init__ advertises a (0, 16) valid range for lz4 alongside deflate (1, 9) and zstd (1, 22), but only the deflate and zstd ranges had round-trip + boundary-reject tests. The lz4 path goes through the same validator at three call sites (eager numpy, dask streaming, and _write_vrt_tiled), so a regression that dropped 'lz4' from _LEVEL_RANGES would have silently accepted any int level -- lz4_compress itself does not validate. Adds 18 tests: round-trip at 0/1/9/16 (lossless), default no-arg path, higher-level not larger on compressible input, eager out-of-range reject at -1/-10/17/100, valid-range message format pin, dask streaming round-trip at 0/1/8/16, and dask streaming out-of-range reject at -1/17/50. Closes the Cat 4 MEDIUM parameter-coverage gap left after pass 7.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds targeted test coverage for compression='lz4' when using the compression_level= parameter in the GeoTIFF writer, ensuring the documented (0, 16) level range is enforced and that both eager and dask-streaming call sites are covered.
Changes:
- Add a new test module covering LZ4 round-trip correctness at boundary and representative levels, default
compression_level=Nonebehavior, out-of-range rejection, and dask-streaming validation. - Update the internal sweep state CSV to record the added coverage work.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
xrspatial/geotiff/tests/test_lz4_compression_level_2026_05_11.py |
New tests for LZ4 compression_level range enforcement, error messaging, and eager + dask streaming round-trips. |
.claude/sweep-test-coverage-state.csv |
Records the new “Pass 8” test-coverage sweep status entry for geotiff. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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 compression-level validator in
xrspatial.geotiff.__init__advertises a(0, 16)valid range forlz4alongsidedeflate(1, 9)andzstd(1, 22), but only the deflate and zstd ranges had round-trip + boundary-reject tests.The
lz4path goes through the same_LEVEL_RANGESvalidator at three call sites (eager numpy, dask streaming, and_write_vrt_tiled). A regression that dropped'lz4'from_LEVEL_RANGESwould have silently accepted any int level:lz4_compressitself does not validate the level argument.This adds 18 tests in
xrspatial/geotiff/tests/test_lz4_compression_level_2026_05_11.py:0/1/9/16(lossless: assert_array_equal).compression_level=Nonefalls through to the codec default).-1/-10/17/100.lz4 ... valid: 0-16).0/1/8/16(separate validation call site).-1/17/50.Closes the Cat 4 MEDIUM parameter-coverage gap left after pass 7 of the test-coverage sweep on
geotiff. No source changes.Test plan
test_compression_level.py(14 tests) ortest_lz4.py(13 tests)'lz4'from_LEVEL_RANGESmakes the out-of-range tests fail (silent acceptance)