Skip to content

Refactor GeoTIFF Phase 4: complete metadata finalization centralization (PR-D of #2211) #2227

@brendancol

Description

@brendancol

Summary

Part of epic #2211. Phase 4 deliverable: finish the work started in #2162 — move every remaining attrs-population call into GeoTIFFMetadata / the finalization helpers, so every read backend stamps the same canonical keys for equivalent inputs.

Scope

Refactor + table-driven attrs parity test. No public API change.

Files

  • Modify: xrspatial/geotiff/_attrs.py — make GeoTIFFMetadata.finalize() (and its lazy variant) the single attrs entry point. Absorb any per-backend attrs population still living in _reader.py, _vrt.py, _backends/*.
  • Modify: each backend module to call finalize() (or the lazy variant) rather than building attrs inline.
  • Create: xrspatial/geotiff/tests/test_attrs_finalization_parity_2211.py — table-driven comparison across backends, excluding documented backend-specific keys.

Acceptance

  • Every attrs key defined in _attrs.py's canonical schema is stamped by finalize() / the lazy helper, not by ad-hoc da.attrs[k] = v in backends.
  • Table-driven parity test asserts identical attrs across eager / Dask / GPU (when available) / VRT for the same input fixture.
  • test_attrs_contract_*.py and test_attrs_parity_1548.py still pass.
  • No public API change.

Prior art

PRs #2200, #2205, #2207, #2209 from epic #2162 established the shared finalization helpers for eager + dask + VRT. This PR finishes the migration so no backend writes attrs directly.

Closes part of #2211.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions