Skip to content

Commit 66fc110

Browse files
committed
Simplify public API to 3 functions
The public API is now: read_geotiff(source, ...) # read anything: file, URL, cloud, VRT write_geotiff(data, path, ...) # write any backend write_vrt(path, sources) # generate VRT mosaic XML read_geotiff auto-detects: - .vrt extension -> VRT reader - http:// / https:// -> COG range-request reader - s3:// / gs:// / az:// -> cloud via fsspec - gpu=True -> nvCOMP GPU decompression - chunks=N -> Dask lazy windowed reads Removed from __all__: open_cog (deprecated wrapper), read_vrt (called internally), read_geotiff_dask (use chunks=), read_geotiff_gpu / write_geotiff_gpu (use gpu=True). All these functions still exist for backwards compatibility but are no longer the recommended entry points.
1 parent 3ffd82a commit 66fc110

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,22 @@ Native GeoTIFF and Cloud Optimized GeoTIFF reader/writer. No GDAL required.
141141
|:-----|:------------|:-----:|:----:|:--------:|:-------------:|:-----:|
142142
| [read_geotiff](xrspatial/geotiff/__init__.py) | Read GeoTIFF / COG / VRT | ✅️ | ✅️ | ✅️ | ✅️ | ✅️ |
143143
| [write_geotiff](xrspatial/geotiff/__init__.py) | Write DataArray as GeoTIFF / COG | ✅️ | ✅️ | ✅️ | ✅️ | ✅️ |
144-
| [read_vrt / write_vrt](xrspatial/geotiff/__init__.py) | Virtual Raster Table mosaic | ✅️ | ✅️ | ✅️ | ✅️ | |
144+
| [write_vrt](xrspatial/geotiff/__init__.py) | Generate VRT mosaic from GeoTIFFs | ✅️ | | | | |
145145

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

148148
```python
149-
read_geotiff('dem.tif') # NumPy
150-
read_geotiff('dem.tif', chunks=512) # Dask
151-
read_geotiff('dem.tif', gpu=True) # CuPy (nvCOMP + GDS)
152-
read_geotiff('dem.tif', gpu=True, chunks=512) # Dask + CuPy
153-
154-
write_geotiff(cupy_array, 'out.tif') # auto-detects GPU
155-
write_geotiff(data, 'out.tif', gpu=True) # force GPU compress
149+
read_geotiff('dem.tif') # NumPy
150+
read_geotiff('dem.tif', chunks=512) # Dask
151+
read_geotiff('dem.tif', gpu=True) # CuPy (nvCOMP + GDS)
152+
read_geotiff('dem.tif', gpu=True, chunks=512) # Dask + CuPy
153+
read_geotiff('https://example.com/cog.tif') # HTTP COG
154+
read_geotiff('s3://bucket/dem.tif') # Cloud (S3/GCS/Azure)
155+
read_geotiff('mosaic.vrt') # VRT mosaic (auto-detected)
156+
157+
write_geotiff(cupy_array, 'out.tif') # auto-detects GPU
158+
write_geotiff(data, 'out.tif', gpu=True) # force GPU compress
159+
write_vrt('mosaic.vrt', ['tile1.tif', 'tile2.tif']) # generate VRT
156160
```
157161

158162
**Compression codecs:** Deflate, LZW (Numba JIT), ZSTD, PackBits, JPEG (Pillow), uncompressed

xrspatial/geotiff/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
from ._reader import read_to_array
2121
from ._writer import write
2222

23-
__all__ = ['read_geotiff', 'write_geotiff', 'open_cog', 'read_geotiff_dask',
24-
'read_vrt', 'write_vrt', 'read_geotiff_gpu', 'write_geotiff_gpu']
23+
__all__ = ['read_geotiff', 'write_geotiff', 'write_vrt']
2524

2625

2726
def _wkt_to_epsg(wkt_or_proj: str) -> int | None:

0 commit comments

Comments
 (0)