xrspatial.geotiff.open_geotiff#

xrspatial.geotiff.open_geotiff(source: str, *, dtype=None, window=None, overview_level: int | None = None, band: int | None = None, name: str | None = None, chunks: int | tuple | None = None, gpu: bool = False, max_pixels: int | None = None) DataArray[source]#

Read a GeoTIFF, COG, or VRT file into an xarray.DataArray.

Automatically dispatches to the best backend: - gpu=True: GPU-accelerated read via nvCOMP (returns CuPy) - chunks=N: Dask lazy read via windowed chunks - gpu=True, chunks=N: Dask+CuPy for out-of-core GPU pipelines - Default: NumPy eager read

VRT files are auto-detected by extension.

Parameters:
  • source (str) – File path, HTTP URL, or cloud URI (s3://, gs://, az://).

  • dtype (str, numpy.dtype, or None) – Cast the result to this dtype after reading. None keeps the file’s native dtype. Float-to-int casts raise ValueError to prevent accidental data loss.

  • window (tuple or None) – (row_start, col_start, row_stop, col_stop) for windowed reading.

  • overview_level (int or None) – Overview level (0 = full resolution).

  • band (int or None) – Band index (0-based). None returns all bands.

  • name (str or None) – Name for the DataArray.

  • chunks (int, tuple, or None) – Chunk size for Dask lazy reading.

  • gpu (bool) – Use GPU-accelerated decompression (requires cupy + nvCOMP).

  • max_pixels (int or None) – Maximum allowed pixel count (width * height * samples). None uses the default (~1 billion). Raise to read legitimately large files.

Returns:

NumPy, Dask, CuPy, or Dask+CuPy backed depending on options.

Return type:

xr.DataArray