salem.DataArrayAccessor.roi

DataArrayAccessor.roi(self, shape=None, geometry=None, grid=None, corners=None, crs=wgs84, roi=None, all_touched=False, other=None)

Make a region of interest (ROI) for the dataset.

All grid points outside the ROI will be masked out.

Parameters:
dsDataset or DataArray

form the ROI from the extent of the Dataset or DataArray

shapestr

path to a shapefile

geometrygeometry

a shapely geometry (don’t forget the crs keyword)

gridGrid

a Grid object which extent will form the ROI

cornerstuple

a ((x0, y0), (x1, y1)) tuple of the corners of the square to subset the dataset to (don’t forget the crs keyword)

crscrs, default wgs84

coordinate reference system of the geometry and corners

roindarray

if you have a mask ready, you can give it here

all_touchedboolean

pass-through argument for rasterio.features.rasterize, indicating that all grid cells which are clipped by the shapefile defining the region of interest should be included (default=False)

otherscalar, DataArray or Dataset, optional

Value to use for locations in this object where cond is False. By default, these locations filled with NA. As in http://xarray.pydata.org/en/stable/generated/xarray.DataArray.where.html