hydromt.io.open_raster#

hydromt.io.open_raster(filename, mask_nodata=False, chunks=None, nodata=None, logger=<Logger hydromt.io (WARNING)>, **kwargs)[source]#

Open a gdal-readable file with rasterio based on.

rioxarray.open_rasterio(), but return squeezed DataArray.

Parameters:
  • filename (str, path, file-like, rasterio.DatasetReader, or rasterio.WarpedVRT) – Path to the file to open. Or already open rasterio dataset.

  • mask_nodata (bool, optional) – set nodata values to np.nan (xarray default nodata value)

  • nodata (int, float, optional) – Set nodata value if missing

  • chunks (int, tuple or dict, 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.

  • **kwargs – key-word arguments are passed to xarray.open_dataset() with “rasterio” engine.

  • logger (logger object, optional) – The logger object used for logging messages. If not provided, the default logger will be used.

Returns:

data – DataArray

Return type:

DataArray