hydromt.model.components.SpatialDatasetsComponent.add_raster_data_from_raster_reclass#
- SpatialDatasetsComponent.add_raster_data_from_raster_reclass(raster_filename: str | Path | DataArray, reclass_table_filename: 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 = True, rename: Dict | None = None, **kwargs) List[str] [source]#
HYDROMT CORE METHOD: Add data variable(s) to datasets component by reclassifying the data in
raster_filename
based onreclass_table_filename
.This is done by reclassifying the data in
raster_filename
based onreclass_table_filename
.Adds model layers:
reclass_variables: reclassified raster data
- Parameters:
raster_filename (
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_filename (
str
,Path
,pd.DataFrame
) – Data catalog key, path to tabular data file or tabular pandas dataframe object for the reclassification table of raster_filename.reclass_variables (
list
) – List of reclass_variables from reclass_table_filename table to add to the datasets. Index column should match values in raster_filename.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_filename 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 dataset 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: