salem.DatasetAccessor.subset¶
-
DatasetAccessor.
subset
(self, margin=0, shape=None, geometry=None, grid=None, corners=None, crs=wgs84, roi=None)¶ Get a subset of the dataset.
Accepts all keywords of
roi()
Parameters: ds : Dataset or DataArray
form the ROI from the extent of the Dataset or DataArray
shape : str
path to a shapefile
geometry : geometry
a shapely geometry (don’t forget the crs keyword)
grid : Grid
a Grid object which extent will form the ROI
corners : tuple
a ((x0, y0), (x1, y1)) tuple of the corners of the square to subset the dataset to (don’t forget the crs keyword)
crs : crs, default wgs84
coordinate reference system of the geometry and corners
roi : ndarray
a mask for the region of interest to subset the dataset onto
margin : int
add a margin to the region to subset (can be negative!). Can be used a single keyword, too: set_subset(margin=-5) will remove five pixels from each boundary of the dataset.