read

Contents

read#

read(raster_path: str | CloudPath | Path, pixel_size: tuple | list | float | None = None, size: list | tuple | None = None, resampling: Resampling = Resampling.nearest, masked: bool = True, indexes: int | list | None = None, **kwargs) DataArray[source]#

Overload of sertit.rasters.read() managing DASK in EOReader’s way.

>>> raster_path = "path/to/raster.tif"
>>> xds1 = read(raster_path)
>>> # or
>>> with rasterio.open(raster_path) as dst:
>>>    xds2 = read(dst)
>>> xds1 == xds2
True
Parameters:
  • raster_path (AnyPathStrType) – Path to the raster

  • pixel_size (Union[tuple, list, float]) – Size of the pixels of the wanted band, in dataset unit (X, Y)

  • size (Union[tuple, list]) – Size of the array (width, height). Not used if pixel_size is provided.

  • resampling (Resampling) – Resampling method

  • masked (bool) – Get a masked array

  • indexes (Union[int, list]) – Indexes to load. Load the whole array if None.

  • **kwargs – Optional keyword arguments to pass into rioxarray.open_rasterio().

Returns:

Masked xarray corresponding to the raster data and its metadata

Return type:

xr.DataArray