odc.geo.xr.crop
- odc.geo.xr.crop(xx, poly, apply_mask=True, all_touched=True)[source]
Crops and optionally mask an
xarray.Dataset
orxarray.DataArray
to the spatial extent of a geometry.- Parameters:
xx (
TypeVar
(XrT
,DataArray
,Dataset
)) –Dataset
orDataArray
.poly (
Geometry
) – Aodc.geo.geom.Geometry
polygon used to cropxx
.apply_mask (
bool
) – Whether to mask out pixels outside of the rasterized extent ofpoly
by setting them toNaN
.all_touched (
bool
) – IfTrue
andapply_mask=True
, the rasterize step will burn in all pixels touched bypoly
. IfFalse
, only pixels whose centers are within the polygon or that are selected by Bresenham’s line algorithm will be burned in.
- Return type:
- Returns:
A
Dataset
orDataArray
cropped and optionally masked to the spatial extent ofpoly
.
See also