hydromt.DataArray.raster.geometry_mask#

DataArray.raster.geometry_mask(gdf, all_touched=False, invert=False, **kwargs)#

Return a grid with True values where shapes overlap pixels.

Parameters:
  • gdf (geopandas.GeoDataFrame) – GeoDataFrame of shapes and values to burn.

  • all_touched (bool, optional) – If True, all pixels touched by geometries will masked. If false, only pixels whose center is within the polygon or that are selected by Bresenham’s line algorithm will be burned in. By default False.

  • invert (bool, optional) – If True, the mask will be False where shapes overlap pixels, by default False

  • kwargs (optional) – Additional keyword arguments to pass to features.rasterize.

Returns:

Geometry mask

Return type:

xarray.DataArray