geotiff: guard streaming writer against MinIsWhite extra_tags override#2080
Merged
Conversation
…erride (#2073) The eager writer rejects extra_tags overrides that would require writer-side pixel inversion for single-band MinIsWhite. The streaming dask path lacked the same guard, so an override silently bypassed the inversion and the file round-tripped with inverted pixel values.
…2073) Address PR #2080 review: * Factor the duplicated TAG_PHOTOMETRIC-override guard out of the eager and streaming writers into ``_reject_disagreeing_photometric_override``. Both writers now call the helper, so the message text, the gating condition, and the single-band scope live in one place. * Add ``test_streaming_extra_tags_miniswhite_override_multiband_not_rejected_2073`` to pin the ``samples == 1`` gate. A regression that dropped or flipped the gate (so the guard fired for multi-band rasters too) would otherwise surface only by accident. * Move the regression test from ``xrspatial/tests/`` to ``xrspatial/geotiff/tests/`` to match every other geotiff regression test's location. Filename also shortened: the ``geotiff_`` prefix was redundant inside the geotiff subtree. The third dismissed nit (``_extra_tags_photo_ds`` naming) goes away with the refactor because the helper takes its own local variable name.
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 #2073
Summary
write_streamingso a dask write withextra_tags=[(262, SHORT, 1, 0)]on a single-band raster raisesValueErrorinstead of writing inverted bytes.extra_tagsandphotometric; a non-MinIsWhite-crossing override (photometric=1) still round-trips.Backend coverage
xrspatial/geotiff/_writer.py::write_streaming). The eager path already had the guard at_writer.py:1600-1617; no change there.Test plan
pytest xrspatial/tests/test_geotiff_streaming_photometric_override_2073.py -x -q(2 passed)pytest xrspatial/tests/test_geotiff*.py -x -q(12 passed)pytest xrspatial/geotiff/ xrspatial/tests/ -k "geotiff or photometric or extra_tags"-- only failures are pre-existing GPU tests (test_predictor2_big_endian_gpu_1517,test_size_param_validation_gpu_vrt_1776::test_tile_size_positive_works) unrelated to the photometric path.