Skip to content

Add geotiff writer test matrix (#1483)#1490

Merged
brendancol merged 1 commit intomainfrom
issue-1483
May 5, 2026
Merged

Add geotiff writer test matrix (#1483)#1490
brendancol merged 1 commit intomainfrom
issue-1483

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Summary

Test-only coverage for geotiff write findings T-5, T-6, T-7, T-9 from a recent audit. No source changes. New file xrspatial/geotiff/tests/test_writer_matrix.py adds 85 tests.

  • T-5: dtype x compression matrix. 8 dtypes (uint8/16/32, int16/32/64, float32/64) x 5 codecs (none, deflate, lzw, zstd, lz4) round-tripped through stripped and tiled layouts on 32x32 rasters.
  • T-6: NaN-vs-sentinel nodata semantics. Float NaN nodata, float sentinel (-9999), uint8 sentinel (255). Verifies on-disk sentinel and read-back NaN behaviour through both read_to_array and open_geotiff.
  • T-7: COG validity. Uses rasterio (skipped if missing) to confirm tiled layout, presence and monotonicity of overviews, and pixel round-trip. If rio-cogeo is installed, also runs cog_validate. Note: xrspatial does not currently emit GDAL's LAYOUT=COG IMAGE_STRUCTURE tag, so that specific marker is not asserted.
  • T-9: write-to-readonly directory. Chmod 0o555 a temp dir, expect OSError/PermissionError, restore mode in finally. Skipped on Windows and when running as root.
  • T-10: planar config 2 round-trip was dropped because the writer does not emit PlanarConfiguration=2.

Issue: #1483

Test plan

  • pytest xrspatial/geotiff/tests/test_writer_matrix.py (85 passed locally with rasterio installed)
  • Existing test_writer.py still passes
  • CI run (rasterio-dependent COG test will skip if rasterio not in CI env)

Adds xrspatial/geotiff/tests/test_writer_matrix.py covering:
- T-5: dtype x compression round-trip (8 dtypes x 5 codecs, stripped and tiled)
- T-6: NaN vs sentinel nodata semantics (float NaN, float sentinel, uint8 sentinel)
- T-7: COG output validity via rasterio (tiled, overviews, optional rio-cogeo
  validator); skipped if rasterio is missing
- T-9: writing to a chmod 0o555 directory raises OSError/PermissionError;
  skipped on Windows and root

T-10 (PlanarConfiguration=2 round-trip) was dropped. The writer doesn't emit
planar=2 output. Only the reader supports it.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 5, 2026
@brendancol brendancol merged commit e253900 into main May 5, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant