salem.DataArrayAccessor.subset

DataArrayAccessor.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:
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

a mask for the region of interest to subset the dataset onto

marginint

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.