hydromt.readers.open_raster#
- hydromt.readers.open_raster(uri: str | Path, *, mask_nodata: bool = False, chunks: int | tuple[int, ...] | dict[str, int] | None = None, nodata: int | float | None = None, filesystem: AbstractFileSystem | None = None, **kwargs) DataArray[source]#
Open a gdal-readable file with rasterio based on.
rioxarray.open_rasterio(), but return squeezed DataArray.- Parameters:
uri (
str,Path) – Path or URI of the file to open.Pathis only valid for local files.mask_nodata (
bool, optional) – set nodata values to np.nan (xarray default nodata value)chunks (
int,tupleordict, optional) – Chunk sizes along each dimension, e.g.,5,(5, 5)or{'x': 5, 'y': 5}. If chunks is provided, it used to load the new DataArray into a dask array.filesystem (
AbstractFileSystem | None, optional) – fsspec filesystem to read the file from. None (default) means the local filesystem, in which case the path is handed to GDAL as-is so that its own drivers and fast paths keep working.**kwargs – key-word arguments are passed to
xarray.open_dataset()with “rasterio” engine.
- Returns:
data – DataArray
- Return type:
DataArray
Notes
Remote files are read lazily through a file handle. The handle is closed when the returned DataArray is closed, so the data stays readable for as long as the DataArray lives.