Skip to content

COG readiness: external compliance test suite for to_geotiff(cog=True) (#2286 PR 2/6) #2292

@brendancol

Description

@brendancol

Part of #2286 (COG readiness/stability rollout).

Scope

Add an external-interop compliance suite that exercises COGs written by to_geotiff(..., cog=True) and asserts they are readable and well-formed under rasterio. No production code changes — tests only.

Required changes

New file: xrspatial/geotiff/tests/test_cog_writer_compliance.py.

Test matrix:

  • Stable codecs only: none, deflate, lzw, zstd, packbits (skip if not currently interop-validated).
  • Dtypes: at least one integer dtype (e.g. uint16) and one float dtype (e.g. float32).
  • Band counts: single-band and multiband (3-band).
  • Nodata: sentinel value and NaN cases.
  • Georef: pixel-is-area and pixel-is-point.
  • Overviews: explicit level list and auto-generated levels.
  • Overview resampling modes that are intended to be stable.

For each row, assertions:

  • rasterio.open succeeds.
  • Base pixels equal expected (allclose with documented tolerance for lossy paths, byte-exact for lossless).
  • Overview count and dims match.
  • Overview pixels match expected within tolerance.
  • CRS, transform, nodata, dtype, band count, and dim names survive the round-trip.
  • TIFF layout is COG-like: tiled (not stripped), overview IFDs present, sane tile offsets, IFDs placed before image data.
  • Optional rio-cogeo / GDAL validate_cloud_optimized_geotiff check that pytest.skips cleanly when the dependency is missing.

Out of scope

  • Do not modify writer code. Failures should produce actionable test failures, not silently get patched over.
  • GPU writer paths.
  • Experimental codecs.
  • BigTIFF beyond what existing tests already cover.

Acceptance

  • New test file added under xrspatial/geotiff/tests/.
  • Suite green on CPU CI.
  • Any genuinely-broken row gets a targeted xfail with a linked issue rather than a silent skip.

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