lair.geo.BaseGrid.clip#
- BaseGrid.clip(bbox=None, extent=None, geom=None, crs=None, inplace=False, **kwargs)[source]#
Clip the data to the given bounds.
Note
A cell is kept when its center is inside the bounds or on them, with a
bbox, anextentor ageom, whichever way the coordinates run. With ageomthe cells outside it stay in the grid as NaN; seelair.geo.clip().- Parameters:
bbox (tuple[minx, miny, maxx, maxy]) – The bounding box to clip the data to.
extent (tuple[minx, maxx, miny, maxy]) – The extent to clip the data to.
geom (shapely.Polygon) – The geometry to clip the data to.
crs (Any) – The CRS of the input geometries. If not provided, the CRS of the data is used.
inplace (bool, optional) – Whether to modify the data in place. Default is False (returns a new copy with the clipped data).
kwargs (Any) – Additional keyword arguments for
bboxandextent, passed to the rioxarrayclip_boxmethod; none are taken withgeom.
- Returns:
BaseGrid – The clipped grid
- Return type:
Self
See also
clipThe same for xarray data.