hydromt.DataArray.raster.rasterize_geometry#
- DataArray.raster.rasterize_geometry(gdf: GeoDataFrame, method: str | None = 'fraction', mask_name: str | None = None, name: str | None = None, nodata: int | float | None = -1, keep_geom_type: bool | None = False) DataArray #
Return an object with the fraction of the grid cells covered by geometry.
- Parameters:
gdf (
geopandas.GeoDataFrame
) – GeoDataFrame of shapes to burn.method (
str
, optional) – Method to burn in the geometry, either ‘fraction’ (default) or ‘area’.mask_name (
str
, optional) – Name of the mask variable in self to use for calculating the fraction of area covered by the geometry. By default None for no masking.name (
str
, optional) – Name of the output DataArray. If None, the method name is used.nodata (
int
orfloat
, optional) – Used as fill value for all areas not covered by input geometries. By default -1.keep_geom_type (
bool
) – Only maintain geometries of the same type if true, otherwise keep geometries, regardless of their remaining type. False by default
- Returns:
da_out – DataArray with burned geometries
- Return type: