Skip to content

Add GPU COG overview support (#1150)#1174

Merged
brendancol merged 5 commits intomasterfrom
issue-1150
Apr 8, 2026
Merged

Add GPU COG overview support (#1150)#1174
brendancol merged 5 commits intomasterfrom
issue-1150

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Summary

  • write_geotiff_gpu() now accepts cog, overview_levels, and overview_resampling. Overviews are block-reduced and compressed on GPU, then written in COG layout (IFDs first, pixel data after).
  • to_geotiff() passes overview params through to the GPU path, so CuPy arrays get COG output without CPU fallback.
  • 16 new tests: resampling methods, multi-level overviews, auto-generation, round-trip, GPU/CPU parity.

Test plan

  • pytest xrspatial/geotiff/tests/test_cog.py -- 25 tests (9 existing + 16 new), all pass
  • GPU tests need CuPy+CUDA, skip otherwise
  • COG structure verified: IFDs before pixel data, correct overview dimensions
  • Full-res values unchanged after COG write with overviews

Closes #1150

write_geotiff_gpu now accepts cog, overview_levels, and overview_resampling.
Overviews are block-reduced and compressed on GPU, then assembled into COG
layout. to_geotiff() passes the new params through to the GPU path.
Tests cover resampling methods (mean, nearest, mode, min, max, median),
multi-level overviews, auto-generation, round-trip value preservation,
public API dispatch, and GPU/CPU parity for block-reduce.
New docs/source/reference/geotiff.rst covers the public I/O functions.
README feature matrix now lists write_geotiff_gpu and shows COG
overview usage examples.
Covers automatic and explicit overview levels, resampling methods,
and round-trip verification. Self-contained with synthetic data.
@github-actions github-actions bot added the performance PR touches performance-sensitive code label Apr 7, 2026
GDAL and rasterio use TIFF tag 254 (NewSubfileType = 1) to identify
overview sub-IFDs. Without it, overviews are written correctly but
invisible to GDAL-based tools. Verified: rasterio and gdalinfo now
see both overview levels, and pixel values match GDAL's own COG
output to within float32 rounding (max relative error < 0.0001%).
@brendancol brendancol merged commit cdf8cce into master Apr 8, 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.

Add overview (pyramid) generation for Cloud-Optimized GeoTIFF output

1 participant