odc.geo.xr.mask
- odc.geo.xr.mask(xx, poly, invert=False, all_touched=True)[source]
Apply a polygon geometry as a mask, setting all
xarray.Dataset
orxarray.DataArray
pixels outside the rasterized polygon toNaN
.- Parameters:
xx (
TypeVar
(XrT
,DataArray
,Dataset
)) –Dataset
orDataArray
.poly (
Geometry
) – Aodc.geo.geom.Geometry
polygon used to maskxx
.invert (
bool
) – Whether to invert the mask before applying it toxx
. IfTrue
, only pixels inside ofpoly
will be masked.all_touched (
bool
) – IfTrue
, 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:
See also