hydromt.model.components.GridComponent.add_data_from_rasterdataset#
- GridComponent.add_data_from_rasterdataset(raster_data: str | Path | DataArray | Dataset, variables: List[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) List[str] [source]#
HYDROMT CORE METHOD: Add data variable(s) from
raster_data
to grid component.If raster is a dataset, all variables will be added unless
variables
list is specified.Adds model layers:
raster.name grid: data from raster_data
- Parameters:
raster_data (
str
,Path
,xr.DataArray
,xr.Dataset
) – Data catalog key, path to raster file or raster xarray data object. If a path to a raster file is provided it will be added to the data_catalog with its name based on the file basename without extension.variables (
list
, optional) – List of variables to add to grid from raster_data. By default all.fill_method (
str
, optional) – If specified, fills nodata values using fill_nodata method. Available methods are {‘linear’, ‘nearest’, ‘cubic’, ‘rio_idw’}.reproject_method (
list
,str
, optional) – See rasterio.warp.reproject for existing methods, by default ‘nearest’. Can provide a list corresponding tovariables
.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 raster_data before adding to grid {‘name_in_raster_data’: ‘name_in_grid’}. By default empty.
- Returns:
Names of added model map layers
- Return type: