imod.prepare.rasterize#

imod.prepare.rasterize(geodataframe, like, column=None, fill=nan, **kwargs)[source]#

Rasterize a geopandas GeoDataFrame onto the given xarray coordinates.

Parameters:
  • geodataframe (geopandas.GeoDataFrame) –

  • column (str, int, float) – column name of geodataframe to burn into raster

  • like (xarray.DataArray) – Example DataArray. The rasterized result will match the shape and coordinates of this DataArray.

  • fill (float, int) – Fill value for nodata areas. Optional, default value is np.nan.

  • kwargs (additional keyword arguments for rasterio.features.rasterize.) – See: https://rasterio.readthedocs.io/en/stable/api/rasterio.features.html#rasterio.features.rasterize

Returns:

rasterized – Vector data rasterized. Matches shape and coordinates of like.

Return type:

xarray.DataArray