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.Datasetorxarray.DataArraypixels outside the rasterized polygon toNaN.- Parameters:
xx (
TypeVar(XrT,DataArray,Dataset)) –DatasetorDataArray.poly (
Geometry) – Aodc.geo.geom.Geometrypolygon used to maskxx.invert (
bool) – Whether to invert the mask before applying it toxx. IfTrue, only pixels inside ofpolywill 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