hydromt.GridModel.setup_grid_from_raster_reclass#

GridModel.setup_grid_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: List | str | None = 'nearest', mask_name: str | None = 'mask', rename: Dict | None = None, **kwargs) List[str]#

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

Adds model layers:

  • reclass_variables grid: 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_fn 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 “nearest”. Can provide a list corresponding to reclass_variables.

  • mask_name (str, optional) – Name of mask in self.grid to use for masking raster_fn. By default ‘mask’. Use None to disable masking.

  • 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 (dict) – Additional keyword arguments to be passed to get_rasterdataset

Returns:

Names of added model grid layers

Return type:

list