Skip to content

Commit fd22dc9

Browse files
committed
Pass chunks= and gpu= through open_cog to read_geotiff
1 parent 72b580a commit fd22dc9

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ Native GeoTIFF and Cloud Optimized GeoTIFF reader/writer. No GDAL required.
142142
| [read_geotiff](xrspatial/geotiff/__init__.py) | Read GeoTIFF / COG / VRT | ✅️ | ✅️ | ✅️ | ✅️ | ✅️ |
143143
| [write_geotiff](xrspatial/geotiff/__init__.py) | Write DataArray as GeoTIFF / COG | ✅️ | ✅️ | ✅️ | ✅️ | ✅️ |
144144
| [read_vrt / write_vrt](xrspatial/geotiff/__init__.py) | Virtual Raster Table mosaic | ✅️ | ✅️ | ✅️ | ✅️ | |
145-
| [open_cog](xrspatial/geotiff/__init__.py) | HTTP range-request COG reader | ✅️ | | | | ✅️ |
145+
| [open_cog](xrspatial/geotiff/__init__.py) | HTTP range-request COG reader | ✅️ | ✅️ | ✅️ | ✅️ | ✅️ |
146146

147147
`read_geotiff` and `write_geotiff` auto-dispatch to the correct backend:
148148

xrspatial/geotiff/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,9 @@ def write_geotiff(data: xr.DataArray | np.ndarray, path: str, *,
444444

445445

446446
def open_cog(url: str, *,
447-
overview_level: int | None = None) -> xr.DataArray:
447+
overview_level: int | None = None,
448+
chunks: int | tuple | None = None,
449+
gpu: bool = False) -> xr.DataArray:
448450
"""Read a Cloud Optimized GeoTIFF from an HTTP URL.
449451
450452
Uses range requests so only the needed tiles are fetched.
@@ -455,12 +457,18 @@ def open_cog(url: str, *,
455457
HTTP(S) URL to the COG.
456458
overview_level : int or None
457459
Overview level (0 = full resolution).
460+
chunks : int, tuple, or None
461+
Chunk size for Dask lazy reading.
462+
gpu : bool
463+
Use GPU-accelerated decompression.
458464
459465
Returns
460466
-------
461467
xr.DataArray
468+
NumPy, Dask, CuPy, or Dask+CuPy backed depending on options.
462469
"""
463-
return read_geotiff(url, overview_level=overview_level)
470+
return read_geotiff(url, overview_level=overview_level,
471+
chunks=chunks, gpu=gpu)
464472

465473

466474
def read_geotiff_dask(source: str, *, chunks: int | tuple = 512,

0 commit comments

Comments
 (0)