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.
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:
none,deflate,lzw,zstd,packbits(skip if not currently interop-validated).uint16) and one float dtype (e.g.float32).For each row, assertions:
rasterio.opensucceeds.validate_cloud_optimized_geotiffcheck thatpytest.skips cleanly when the dependency is missing.Out of scope
Acceptance
xrspatial/geotiff/tests/.