Skip to content

Commit 041d025

Browse files
committed
Document dtype/max_pixels and clean stale read_geotiff references (#1637)
read_geotiff_gpu and read_vrt accepted dtype/max_pixels in their signatures but omitted them from the Parameters docstring block. Sibling read functions (open_geotiff, read_geotiff_dask) document both. Adds the missing entries. Also fixes two stale references to the long-removed read_geotiff function: a comment in read_geotiff_dask that should say open_geotiff, and an import in bench_reproject_vs_rioxarray.py.
1 parent 595ece8 commit 041d025

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

xrspatial/geotiff/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,7 @@ def read_geotiff_dask(source: str, *, dtype=None, chunks: int | tuple = 512,
15911591

15921592
source = _coerce_path(source)
15931593

1594-
# ``read_geotiff`` already routes ``.vrt`` to ``read_vrt`` before
1594+
# ``open_geotiff`` already routes ``.vrt`` to ``read_vrt`` before
15951595
# reaching here, so this branch is only hit when ``read_geotiff_dask``
15961596
# is called directly with a VRT path. Keep it as a defensive fallback
15971597
# rather than letting the windowed-read path try to parse VRT XML as
@@ -2161,6 +2161,10 @@ def read_geotiff_gpu(source: str, *,
21612161
----------
21622162
source : str
21632163
File path.
2164+
dtype : str, numpy.dtype, or None
2165+
Cast the result to this dtype after reading. None keeps the
2166+
file's native dtype. Float-to-int casts raise ValueError, mirroring
2167+
``open_geotiff`` / ``read_geotiff_dask``.
21642168
overview_level : int or None
21652169
Overview level (0 = full resolution).
21662170
window : tuple or None
@@ -3009,6 +3013,11 @@ def read_vrt(source: str, *, dtype=None, window=None,
30093013
(row, col) tuple for rectangular.
30103014
gpu : bool
30113015
If True, return a CuPy-backed DataArray on GPU.
3016+
max_pixels : int or None
3017+
Maximum allowed pixel count (width * height * samples) for the
3018+
assembled VRT region. None uses the reader default (~1 billion).
3019+
Matches ``open_geotiff`` / ``read_geotiff_dask`` /
3020+
``read_geotiff_gpu``.
30123021
30133022
Returns
30143023
-------

xrspatial/tests/bench_reproject_vs_rioxarray.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,8 @@ def _load_for_both(path):
324324
import os
325325
path = os.path.expanduser(path)
326326

327-
from xrspatial.geotiff import read_geotiff
328-
da_xrs = read_geotiff(path)
327+
from xrspatial.geotiff import open_geotiff
328+
da_xrs = open_geotiff(path)
329329

330330
da_rio = rioxarray.open_rasterio(path).squeeze(drop=True)
331331
return da_xrs, da_rio

0 commit comments

Comments
 (0)