refactor(geotiff): extract GeoTIFF fixture builder#2912
Open
Melissari1997 wants to merge 1 commit into
Open
Conversation
Consolidate duplicated hand-built TIFF helper functions into a single parameterised `write_minimal_tiff` utility in `_geotiff_fixtures.py`. This replaces the redundant implementations in `test_geotags.py` and `test_metadata.py`, reducing code duplication and improving maintainability of the GeoTIFF test suite.
Contributor
Author
PR Review: Extract shared hand-built TIFF helper to tests/_geotiff_fixtures.pyBlockers (must fix before merge)None. Suggestions (should fix, not blocking)None. Nits (optional improvements)None. What looks good
Checklist
|
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
Closes #2423.
Extracts the duplicated hand-built TIFF helper logic that existed in two test modules into a single shared
xrspatial/geotiff/tests/_geotiff_fixtures.pymodule.Changes
xrspatial/geotiff/tests/_geotiff_fixtures.py— exposeswrite_minimal_tiff(path, *, geokeys=None, geo_ascii=None)that builds a 4x4 float32 TIFF with optional GeoKeyDirectory (tag 34735) and/or GeoAsciiParams (tag 34737) payloads.unit/test_geotags.py::_write_tiff_with_geokeys— now delegates towrite_minimal_tiff; the wrapper still builds the GeoKeyDirectory values from themodel_type/projected_cs_type/geographic_typeparameters so callers are unchanged.unit/test_metadata.py::_write_minimal_tiff_with_wkt— now delegates towrite_minimal_tiff; the wrapper remains for the GTCitationGeoKey construction.from pathlib import Pathfromtest_geotags.py.Scope notes
The grep for
"II.*42.*ifd_start"across the geotiff test suite found other inline TIFF builders, but all of them differ in dimensions, dtype, tag set, or structure (e.g. palette TIFFs, sub-byte bit depths, multi-band planar layouts, transformation-matrix geo models). None shared the 4x4/float32/GeoKey pattern, so they are left in place.