hydromt.model.components.GridComponent.add_data_from_raster_reclass#
- GridComponent.add_data_from_raster_reclass(raster_data: str | Path | DataArray, reclass_table_data: str | Path | DataFrame, reclass_variables: List[str], variable: str | None = None, fill_method: str | None = None, reproject_method: str | List[str] | None = 'nearest', mask_name: str | None = 'mask', rename: Dict[str, str] | None = None, **kwargs) List[str] [source]#
HYDROMT CORE METHOD: Add data variable(s) to grid component by reclassifying the data in
raster_data
based onreclass_table_data
.Adds model layers:
reclass_variables grid: reclassified raster data
- Parameters:
raster_data (
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_data (
str
,Path
,pd.DataFrame
) – Data catalog key, path to tabular data file or tabular pandas dataframe object for the reclassification table of raster_data.reclass_variables (
list
) – List of reclass_variables from reclass_table_data table to add to maps. Index column should match values in raster_data.variable (
str
, optional) – Name of raster_data 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_data 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 toreclass_variables
.mask_name (
str
, optional) – Name of mask in self.grid to use for masking raster_data. 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: