hydromt_wflow.WflowSedimentModel.set_grid#
- WflowSedimentModel.set_grid(data: DataArray | Dataset | ndarray, name: str | None = None)#
Add data to grid.
All layers of grid must have identical spatial coordinates. This is an inherited method from HydroMT-core’s GridModel.set_grid with some fixes.
The first fix is when data with a time axis is being added. Since Wflow.jl v0.7.3, cyclic data at different lengths (12, 365, 366) is supported, as long as the dimension name starts with “time”. In this function, a check is done if a time axis with that exact shape is already present in the grid object, and will use that dimension (and its name) to set the data. If a time dimension does not yet exist with that shape, it is created following the format “time_{length_data}”.
The other fix is that when the model is updated with a different number of layers, this is not automatically updated correctly. With this fix, the old layer dimension is removed (including all associated data), and the new data is added with the correct “layer” dimension.
- Parameters:
data (xarray.DataArray or xarray.Dataset) – new map layer to add to grid
name (str, optional) – Name of new map layer, this is used to overwrite the name of a DataArray and ignored if data is a Dataset