hydromt.GridModel.setup_grid_from_rasterdataset#
- GridModel.setup_grid_from_rasterdataset(raster_fn: str | Path | DataArray | Dataset, variables: List | None = None, fill_method: str | None = None, reproject_method: List | str | None = 'nearest', mask_name: str | None = 'mask', rename: Dict | None = None) List[str] #
HYDROMT CORE METHOD: Add data variable(s) from
raster_fn
to grid object.If raster is a dataset, all variables will be added unless
variables
list is specified.Adds model layers:
raster.name grid: data from raster_fn
- Parameters:
raster_fn (
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_fn. 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_fn. By default ‘mask’. Use None to disable masking.rename (
dict
, optional) – Dictionary to rename variable names in raster_fn before adding to grid {‘name_in_raster_fn’: ‘name_in_grid’}. By default empty.
- Returns:
Names of added model map layers
- Return type: