geotiff: document attrs tier classification in _attrs.py (#1984)#2000
Merged
Conversation
Extends the module docstring with the three-tier attrs contract from issue #1984: - Canonical keys (crs, crs_wkt, transform, nodata, raster_type, extra_tags, gdal_metadata, gdal_metadata_xml, x_resolution, y_resolution, resolution_unit, _xrspatial_geotiff_contract) are owned by xrspatial and survive round-trip. - Compatibility aliases (nodatavals, _FillValue) are read for ecosystem interop but writers never emit them when the canonical key is set. - Best-effort pass-through keys (GeoKey-derived fields, image_description, extra_samples, colormap variants) are preserved when the writer can reconstruct them from canonical state. Docstring-only change. The contract version key is mentioned for reference; it is populated by a later PR in the series.
Contributor
Author
PR Review: geotiff: document attrs tier classification in _attrs.pyBlockers (must fix before merge)
Suggestions (should fix, not blocking)
Nits (optional improvements)
What looks good
Checklist
|
3 tasks
- transform: corrected layout from (origin_x, origin_y, pixel_width, pixel_height) to the rasterio-style 6-tuple (pixel_width, 0.0, origin_x, 0.0, pixel_height, origin_y) that _transform_tuple_from_pixel_geometry actually emits, and noted that it is omitted on files with no GeoTIFF transform tags. - crs_wkt: replaced "Always emitted" (the reader only emits it when geo_info.crs_wkt is not None) with the more accurate "Present on read whenever any CRS information is available". Also dropped the unconfirmed "PROJ" qualifier on the WKT dialect. - gdal_metadata_xml: noted that writers prefer this over the parsed dict when both attrs are present. - extra_tags: noted that the attr is omitted when no out-of-band tags are present, matching the conditional emission in _populate_attrs_from_geo_info.
This was referenced May 18, 2026
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
PR 1 of 7 from the implementation plan on issue #1984.
Documents the three-tier attrs contract in the module docstring of
xrspatial/geotiff/_attrs.py. Docstring-only; no behaviour change.The three tiers are:
crs,crs_wkt,transform,nodata,raster_type,extra_tags,gdal_metadata,gdal_metadata_xml,x_resolution,y_resolution,resolution_unit,_xrspatial_geotiff_contract).nodatavalsfrom rioxarray,_FillValuefrom CF).image_description,extra_samples, colormap variants).The contract version key
_xrspatial_geotiff_contractis referenced in the docstring; population of that key lands in a later PR in the series.Note on nodata
Issue #1988 (declared-vs-masked nodata split) is a prerequisite for tightening the
nodatacanonical semantics. The docstring records the intended semantics post-#1988:nodatais the declared file sentinel as stored in the GDAL_NODATA tag.Test plan
pytest xrspatial/geotiff/tests/test_attrs_parity_1548.py -x -q(5 passed)