hydromt.model.processes.mesh.mesh2d_from_rasterdataset#

hydromt.model.processes.mesh.mesh2d_from_rasterdataset(ds: DataArray | Dataset, mesh2d: UgridDataArray | Ugrid2d, variables: List[str] | None = None, fill_method: str | None = None, resampling_method: str | List[str] | None = 'centroid', rename: Dict[str, str] | None = None) UgridDataset[source]#

Resamples data in ds to mesh2d.

Raster data is interpolated to the mesh using the resampling_method.

Parameters:
  • ds (xr.DataArray, xr.Dataset) – Raster xarray data object.

  • mesh2d (xu.UgridDataArray, xu.Ugrid2d) – Mesh2d grid to resample to.

  • variables (list, optional) – List of variables to resample. By default all variables in ds.

  • fill_method (str, optional) – If specified, fills no data values using fill_nodata method. Available methods are {‘linear’, ‘nearest’, ‘cubic’, ‘rio_idw’}.

  • resampling_method (str, optional) – Method to sample from raster data to mesh. By default mean. Options include {“centroid”, “barycentric”, “mean”, “harmonic_mean”, “geometric_mean”, “sum”, “minimum”, “maximum”, “mode”, “median”, “max_overlap”}. If centroid, will use xugrid.CentroidLocatorRegridder() method. If barycentric, will use xugrid.BarycentricInterpolator() method. If any other, will use xugrid.OverlapRegridder() method. Can provide a list corresponding to variables.

  • rename (dict, optional) – Dictionary to rename variable names in ds {‘name_ds’: ‘name_in_uds_out’}. By default empty.

Returns:

uds_out – Resampled data on mesh2d.

Return type:

xu.UgridDataset