hydromt.MeshModel.setup_mesh_from_rasterdataset#

MeshModel.setup_mesh_from_rasterdataset(raster_fn: str | Path | DataArray | Dataset, variables: list | None = None, fill_method: str | None = None, resampling_method: str | None = 'mean', all_touched: bool | None = True, rename: Dict | None = {}) List[str]#

HYDROMT CORE METHOD: Add data variable(s) from raster_fn to mesh object.

Raster data is interpolated to the mesh grid using the resampling_method. If raster is a dataset, all variables will be added unless variables list is specified.

Adds model layers:

  • raster.name mesh: data from raster_fn

Parameters:
  • raster_fn (str, Path, xr.DataArray, xr.Dataset) – Data catalog key, path to raster file or raster xarray data object.

  • variables (list, optional) – List of variables to add to mesh from raster_fn. By default all.

  • 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 {‘count’, ‘min’, ‘max’, ‘sum’, ‘mean’, ‘std’, ‘median’, ‘q##’}.

  • all_touched (bool, optional) – If True, all pixels touched by geometries will used to define the sample. If False, only pixels whose center is within the geometry or that are selected by Bresenham’s line algorithm will be used. By default True.

  • rename (dict, optional) – Dictionary to rename variable names in raster_fn before adding to mesh {‘name_in_raster_fn’: ‘name_in_mesh’}. By default empty.

Returns:

List of variables added to mesh.

Return type:

list