geotiff: drop decorative post-write header check in writer#1848
Merged
Conversation
Both `write_geotiff` and the streaming writer reparsed the first 16 bytes after the file (or temp file) was already written and emitted a "Written file may be corrupt" warning on failure. The check only covered the TIFF/BigTIFF header that our own builder produced, so it proved almost nothing about IFDs, tile or strip offsets, geotags, or COG layout, and the warning fired after the bytes hit disk anyway. Drop both blocks. Callers who want a real round-trip integrity check can call `read_geotiff(path)` themselves.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the “post-write validation” blocks in the GeoTIFF writers that reparsed the first 16 bytes (TIFF/BigTIFF header) after the file had already been written, and emitted a potentially misleading Written file may be corrupt warning.
Changes:
- Removed the post-write header parse/warn block from the eager
write()path. - Removed the equivalent post-write header parse/warn block from
write_streaming()(temp-file path beforeos.replace).
💡 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.
Closes #1844.
Summary
write_geotiffand the streaming writer inxrspatial/geotiff/_writer.py.Written file may be corruptwarning on failure.Why
_write_bytes(or after the temp file was fully written), so even a real failure would have left a bad file on disk; the warning misled callers into thinking the file had been verified.read_geotiff(path).What callers gain or lose
Test plan
pytest xrspatial/geotiff/tests/test_writer.py xrspatial/geotiff/tests/test_writer_matrix.py xrspatial/geotiff/tests/test_streaming_write.py xrspatial/geotiff/tests/test_parallel_writer_1800.py-- 145 passed.pytest xrspatial/geotiff/tests/matchesmain: the remaining failures (test_features.py::TestPalette,test_predictor2_big_endian_gpu_1517.py,test_size_param_validation_gpu_vrt_1776.py) reproduce onmainand are unrelated to this change.