imod.util.mdal_compliant_ugrid2d#

imod.util.mdal_compliant_ugrid2d(dataset: Dataset, crs: Any | None = None) Dataset[source]#

Ensures the xarray Dataset will be written to a UGRID netCDF that will be accepted by MDAL.

  • Unstacks variables with a layer dimension into separate variables.

  • Removes absent entries from the mesh topology attributes.

  • Sets encoding to float for datetime variables.

Parameters:
  • dataset (xarray.Dataset) – Dataset to make compliant with MDAL

  • crs (Any, Optional) – Anything accepted by rasterio.crs.CRS.from_user_input Requires rioxarray installed.

Returns:

unstacked

Return type:

xr.Dataset