hydromt.GridModel.setup_maps_from_raster_reclass#

GridModel.setup_maps_from_raster_reclass(raster_fn: str | Path | DataArray, reclass_table_fn: str | Path | DataFrame, reclass_variables: List, variable: str | None = None, fill_method: str | None = None, reproject_method: str | None = None, name: str | None = None, split_dataset: bool | None = True, rename: Dict | None = None, **kwargs) List[str]#

HYDROMT CORE METHOD: Add data variable(s) to maps object by reclassifying the data in raster_fn based on reclass_table_fn.

This is done by reclassifying the data in raster_fn based on reclass_table_fn.

Adds model layers:

  • reclass_variables maps: reclassified raster data

Parameters:
  • raster_fn (str, Path, xr.DataArray) – Data catalog key, path to raster file or raster xarray data object. Should be a DataArray. Else use variable argument for selection.

  • reclass_table_fn (str, Path, pd.DataFrame) – Data catalog key, path to tabular data file or tabular pandas dataframe object for the reclassification table of raster_fn.

  • reclass_variables (list) – List of reclass_variables from reclass_table_fn table to add to maps. Index column should match values in raster_fn.

  • variable (str, optional) – Name of raster dataset variable to use. This is only required when reading datasets with multiple variables. By default None.

  • fill_method (str, optional) – If specified, fills nodata values in raster_fn using fill_nodata method before reclassifying. Available methods are {‘linear’, ‘nearest’, ‘cubic’, ‘rio_idw’}.

  • reproject_method (str, optional) – See rasterio.warp.reproject for existing methods, by default the data is not reprojected (None).

  • name (str, optional) – Name of new maps variable, only in case split_dataset=False.

  • split_dataset (bool, optional) – If data is a xarray.Dataset split it into several xarray.DataArrays.

  • rename (dict, optional) – Dictionary to rename variable names in reclass_variables before adding to grid {‘name_in_reclass_table’: ‘name_in_grid’}. By default empty.

  • **kwargs – Additional keyword arguments that are passed to the data_catalog.get_rasterdataset function.

Returns:

Names of added model map layers

Return type:

list