hydromt.model.components.SpatialDatasetsComponent.add_raster_data_from_rasterdataset#
- SpatialDatasetsComponent.add_raster_data_from_rasterdataset(raster_filename: str | Path | Dataset, variables: List | None = None, fill_method: str | None = None, name: str | None = None, reproject_method: str | None = None, split_dataset: bool = True, rename: Dict[str, str] | None = None) List[str] [source]#
HYDROMT CORE METHOD: Add data variable(s) from
raster_filename
to datasets component.If raster is a xarray dataset, all variables will be added unless
variables
list is specified.Adds model layers: * raster.name: data from raster_filename
- Parameters:
raster_filename (
str
,Path
,xr.Dataset
) – Data catalog key, path to raster file or raster xarray data object.variables (
list
, optional) – List of variables to add to datasets from raster_filename. By default all.fill_method (
str
, optional) – If specified, fills nodata values using fill_nodata method. Available methods are {‘linear’, ‘nearest’, ‘cubic’, ‘rio_idw’}.name (
str
, optional) – Name of new dataset in self.data dictionary, only in case split_dataset=False.reproject_method (
str
, optional) – See rasterio.warp.reproject for existing methods, by default the data is not reprojected (None).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 raster_filename before adding to the datasets {‘name_in_raster_filename’: ‘name_in_dataset’}. By default empty.
- Returns:
Names of added model map layers
- Return type: