hydromt_wflow.WflowSbmModel.setup_grid_from_geodataset#
- WflowSbmModel.setup_grid_from_geodataset(geodataset_fn: str | DataFrame | Dataset, locations_fn: str | GeoDataFrame | None = None, index_col: str | None = None, variable: str | None = None, fill_value: float | int | None = None, nodata_value: float | int = -9999, mask: str | None = None, output_names: dict = {}, resample_time_kwargs: dict | None = None) None#
Add data variable from
geodataset_fnto grid object.Prepares a static/cyclic/forcing grid layer at specificied point locations. A GeoDataset including the locations and the variable to rasterize can be used. Alternatively, locations can be provided as a separate geodataframe or as a layer already present in the staticmaps (e.g. gauges locations or reservoir outlets).
Locations will be used as is. If snapping is required, users can first snap using the
setup_gaugesmethod.The config toml can also be updated to include the new map using
wflow_variable.Adds model layers:
variable grid: data from geodataset_fn
- Parameters:
geodataset_fn (str, pd.DataFrame, xr.Dataset) –
Geodataset source as DataFrame or GeoDataset.
DataFrame: the index column should contain time and the other columns should correspond to the name or ID values of the stations in locations_fn.
GeoDataset: the dataset should contain the variable specified by variable and the dimensions ‘time’ and ‘index’.
Required variable: ‘time’, ‘variable’
locations_fn (str, gpd.GeoDataFrame, optional) – Source for the locations of the stations as points: (x, y) or (lat, lon). Only required if geodataset_fn is of type DataFrame. Can be provided as a layer already present in the staticmaps.
index_col (str, optional) – Column in locations_fn to use for station ID values, by default None.
variable (str, optional) – Name of the variable in geodataset_fn to add to the grid. Only required if geodataset_fn is a GeoDataset with multiple variables.
fill_value (float | int, optional) – Fill value for the other grid cells. If not provided, the same value as the nodata value is used. By default None.
nodata_value (float | int, optional) – No data value for the grid cells if not defined in the geodataset.
mask (str, optional) – Name of the mask to apply on the grid. Should be a layer already present in the staticmaps. If None, the basin mask will be used.
output_names (dict, optional) – Dictionary with output name that will be used in the model netcdf input files. Users should provide the Wflow.jl variable name followed by the name in the netcdf file.
resample_time_kwargs (dict, optional) – If time resampling is required in case of forcing data, the kwargs to pass to the hydromt.model.processes.meteo.resample_time method can be specified here. For example
upsampling(bfill),downsampling(mean) orconserve_mass(True).