Skip to content

Release-gate: stable-codec read/write/read round-trip (PR 4 of 5 of epic #2341) #2360

@brendancol

Description

@brendancol

Reason or Problem

Epic #2341 calls for read/write/read round-trip tests for stable codecs as part of the release gate. The existing test_compression.py and test_supported_features_tiers_2137.py cover codec behaviour in pieces, but no single test pins the joint contract "on stable codecs, a round-trip preserves both bit-exact pixels AND every release-attr key" across the full set of stable codecs and the dtypes that matter.

Proposal

Add xrspatial/geotiff/tests/test_release_gate_codec_round_trip_2341.py.

Parametrize over the cartesian product of:

  • Stable codecs from SUPPORTED_FEATURES: none, deflate, lzw, zstd, packbits.
  • Dtypes: int16, int32, float32, float64.

For each combination:

  • Construct a small DataArray in memory with a known transform, CRS, and nodata value (NaN for float, sentinel for int).
  • Write it via to_geotiff(path, compress=codec).
  • Read it back via open_geotiff(path).
  • Assert .values byte-exact (NaN-aware for float).
  • Assert attrs['transform'], attrs['crs'], attrs['crs_wkt'], attrs['nodata'], attrs['masked_nodata'], attrs['georef_status'], attrs['raster_type'] match the originals.
  • Assert attrs['compression'] (or whatever the canonical attr key is) reflects the requested codec.

Assertions inlined per-file. Add a row to docs/source/reference/release_gate_geotiff.rst under "Local GeoTIFF read and write" citing the new file.

Stakeholders and Impacts

Touches one new test file. No production code change unless the round-trip surfaces a real bug.

Out of scope: experimental codecs (LERC, JPEG2000, J2K, LZ4) — already gated and tested by test_supported_features_tiers_2137.py. Internal-only JPEG — same.

Drawbacks

Marginal test runtime increase (5 codecs * 4 dtypes = 20 round-trips). Each round-trip uses a small (e.g. 128x128) raster, so the absolute cost is small.

Alternatives

  • Reuse test_compression.py instead of adding a new file. Rejected for the same reason as PR 1: the release-gate doc row needs a stable test path to cite.

Additional Notes or Context

Parent epic: #2341. PR 4 of 5.

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