hydromt_delwaq.workflows.forcing.hydrology_forcing#
- hydromt_delwaq.workflows.forcing.hydrology_forcing(ds: ~xarray.core.dataset.Dataset, ds_model: ~xarray.core.dataset.Dataset, time_tuple: tuple, timestepsecs: int, fluxes: ~typing.List, surface_water: str = 'sfw', add_volume_offset: bool = True, min_volume: float = 0.1, override: ~typing.List = [], logger: ~logging.Logger = <Logger hydromt_delwaq.workflows.forcing (WARNING)>)[source]#
Calculate hydrology forcing data.
As the fluxes order should precisely macth the pointer defined in setup_basemaps, the variables names in
hydro_forcing_fn
should match names defined in thefluxes
argument of setup_basemaps. These names should also have been saved in the file config/B7_flow.inc.If several sub-variables in
hydro_forcing_fn
need to be summed up to get the expected flux in pointer, they can be named {flux_name_in_pointer}_{number} (eg “sfw>sfw_1” and “sfw>sfw_2” to get “sfw>sfw”) and the function will sum them on the fly. To remove (- instead of +) use unit_mult attribute of the data catalog with -1 for the sub-variables of interest. To override rather than sum fluxes, use theoverride
argument and name of the concerned flux (eg “sfw>sfw”). The flux are overwritten (excluding nodata) in the order of the list, so the last one will be the one used.Unit conversions are possible from mm/area to m3/s for fluxes, volumes should be provided directly in m3. For conversion from mm to m3/s, it is possible to specify over wich surface area the mm are calculated. If ‘mm’ (default), the cellarea is assumed. Else, you can use ‘mm/{surfacearea}’ where {surfacearea} should be a map available in hydromaps (rivarea, lakearea, resarea).
- Parameters:
ds (xr.Dataset) – Dataset containing the input data
ds_model (xr.Dataset) –
Dataset containing the model grid
Required variables: [mask]
Optional variables for unit conversion: [rivarea, lakearea, resarea]
time_tuple (tuple) – Tuple containing the start and end time of the simulation
timestepsecs (int) – Timestep of the simulation in seconds
fluxes (list) – List of fluxes to be calculated
surface_water (str, optional) – Name of the surface water layer to calculate volume. By default “sfw”.
add_volume_offset (bool, optional) – Add time offset of one timestepsecs to the volumes, by default True.
min_volume (float, optional) – Minimum volume to be considered, by default 0.1 to avoid zero volumes.
override (list, optional) – List of fluxes to be overriden if several fluxes varibales are found, by default [].
logger (logging.Logger, optional) – Logger object, by default logger
- Returns:
ds_out – Dataset containing the input data
- Return type:
xr.Dataset