Wflow

With the hydromt_wflow plugin, you can easily work with wflow (SBM) models. This plugin helps you preparing or updating several components of a wflow model such as topography information, landuse, soil or forcing. The main interactions are available from the HydroMT Command Line Interface and allow you to configure HydroMT in order to build or update or clip wflow models.

When building or updating a model from command line a model region; a model setup configuration (.ini file) with model components and options and, optionally, a data sources (.yml) file should be prepared.

Note that the order in which the components are listed in the ini file is important:

  • setup_basemaps should always be run first to determine the model domain

  • setup_rivers should be run right after setup_basemaps as it influences several other setup components (lakes, reservoirs, riverwidth, gauges)

For python users all Wflow attributes and methods are available, see Wflow model class

Wflow model components

An overview of the available WflowModel setup components is provided in the table below. When using hydromt from the command line only the setup components are exposed. Click on a specific method see its documentation.

setup_config

Update config with a dictionary

setup_basemaps

This component sets the region of interest and res (resolution in degrees) of the model.

setup_rivers

This component sets the all river parameter maps.

setup_lakes

This component generates maps of lake areas and outlets as well as parameters with average lake area, depth a discharge values.

setup_reservoirs

This component generates maps of lake areas and outlets as well as parameters with average reservoir area, demand, min and max target storage capacities and discharge capacity values.

setup_glaciers

This component generates maps of glacier areas, area fraction and volume fraction, as well as tables with temperature threshold, melting factor and snow-to-ice convertion fraction.

setup_lulcmaps

This component derives several wflow maps are derived based on landuse- landcover (LULC) data.

setup_laimaps

This component sets leaf area index (LAI) climatology maps per month.

setup_soilmaps

This component derives several (layered) soil parameters based on a database with physical soil properties using available point-scale (pedo)transfer functions (PTFs) from literature with upscaling rules to ensure flux matching across scales.

setup_hydrodem

This component adds a hydrologically conditioned elevation (hydrodem) map for river and/or land local-inertial routing.

setup_gauges

This components sets the default gauge map based on basin outlets and additional gauge maps based on gauges_fn data.

setup_areamap

Setup area map from vector data to save wflow outputs for specific area.

Wflow datamodel

The following table provides an overview of which WflowModel attribute contains which Wflow in- and output files. The files are read and written with the associated read- and write- methods, i.e. read_config() and write_config() for the config attribute.

WflowModel data

WflowModel attribute

Wflow files

config

wflow_sbm.toml

staticmaps

staticmaps.nc

staticgeoms

geometries from the staticgeoms folder (basins.geojson, rivers.geojson etc.)

forcing

inmaps.nc

states

instates.nc

results

output.nc, output_scalar.nc, output.csv

Wflow configuration

This HydroMT plugin provides an implementation for the wflow model in order to build, update or clip from command line. Specific details on the HydroMT CLI methods can be found in https://deltares.github.io/hydromt/latest/user_guide/cli.html

Configuration file

Settings to build or update a wflow model are managed in a configuration file. In this file, every option from each model component can be changed by the user in its corresponding section.

Below is an example of ini file that can be used to build a complete wflow model .ini file. Each section corresponds to a model component with the same name.

[global]
data_libs       = []            # add optional paths to data yml files

[setup_config]                  # options parsed to wflow ini file <section>.<option>
starttime = 2010-01-01T00:00:00
endtime = 2010-03-31T00:00:00
timestepsecs = 86400
input.path_forcing = inmaps-era5-2010.nc

[setup_basemaps]
hydrography_fn     = merit_hydro   # source hydrography data {merit_hydro, merit_hydro_1k}
basin_index_fn  = merit_hydro_index # source of basin index corresponding to hydrography_fn
upscale_method  = ihu           # upscaling method for flow direction data, by default 'ihu'

[setup_rivers]
hydrography_fn   = merit_hydro      # source hydrography data, should correspond to hydrography_fn in setup_basemaps
river_geom_fn    = rivers_lin2019_v1 # river source data with river width and bankfull discharge
river_upa        = 30               # minimum upstream area threshold for the river map [km2]
rivdph_method    = powlaw           # method to estimate depth {'powlaw', 'manning', 'gvf'}
min_rivdph       = 1                # minimum river depth [m]
min_rivwth       = 30               # minimum river width [m]
slope_len        = 2000             # length over which tp calculate river slope [m]
smooth_len       = 5000             # length over which to smooth river depth and river width [m]

# [setup_hydrodem]                  # uncomment for river and/or land local-inertial routing.
# elevtn_map      = dem_subgrid     # {'dem_subgrid', 'wflow_dem'}
# river_routing   = local-inertial  # {'kinematic-wave', 'local-inertial'}
# land_routing    = kinematic-wave  # {'kinematic-wave', 'local-inertial'}

[setup_reservoirs]
reservoirs_fn   = hydro_reservoirs  # source for reservoirs based on GRAND: {hydro_reservoirs}; None to skip
min_area        = 1.0           # minimum lake area to consider [km2]
priority_jrc    = True          # if True then JRC data from hydroengine is used to calculate some reservoir attributes instead of the GRanD and HydroLAKES db.   

[setup_lakes]
lakes_fn        = hydro_lakes   # source for lakes based on hydroLAKES: {hydro_lakes}; None to skip
min_area        = 10.0          # minimum reservoir area to consider [km2]

[setup_glaciers]
glaciers_fn     = rgi           # source for glaciers based on Randolph Glacier Inventory {rgi}; None to skip
min_area        = 1.0           # minimum glacier area to consider [km2]

[setup_lulcmaps]
lulc_fn         = globcover     # source for lulc maps: {globcover, vito, corine}

[setup_laimaps]
lai_fn          = modis_lai     # source for LAI: {modis_lai}

[setup_soilmaps]
soil_fn         = soilgrids     # source for soilmaps: {soilgrids}
ptf_ksatver     = brakensiek    # pedotransfer function to calculate hydraulic conductivity: {brakensiek, cosby}

[setup_gauges]
gauges_fn       = grdc          # if not None add gaugemap. Either a path or known gauges_fn: {grdc}
snap_to_river   = True          # if True snaps gauges from source to river
derive_subcatch = False         # if True derive subcatch map based on gauges.

[setup_precip_forcing]
precip_fn       = era5          # source for precipitation.
precip_clim_fn  = None          # source for high resolution climatology to correct precipitation.

[setup_temp_pet_forcing]
temp_pet_fn     = era5          # source for temperature and potential evapotranspiration.
press_correction= True          # if True temperature is corrected with elevation lapse rate.
temp_correction = True          # if True pressure is corrected with elevation lapse rate.
dem_forcing_fn  = era5_orography # source of elevation grid corresponding to temp_pet_fn. Used for lapse rate correction.
pet_method      = debruin       # method to compute PET: {debruin, makkink}
skip_pet        = False         # if True, only temperature is prepared.

[setup_constant_pars]
KsatHorFrac=100
Cfmax = 3.75653
cf_soil = 0.038
EoverR = 0.11
InfiltCapPath = 5
InfiltCapSoil = 600 
MaxLeakage = 0
rootdistpar = -500
TT = 0
TTI = 2
TTM = 0
WHC = 0.1
G_Cfmax = 5.3
G_SIfrac = 0.002
G_TT = 1.3

Selecting data

Data sources in HydroMT are provided in one of several yaml libraries. These libraries contain required information on the different data sources so that HydroMT can process them for the different models. There are three ways for the user to select which data libraries to use:

  • If no yaml file is selected, HydroMT will use the data stored in the hydromt-artifacts which contains an extract of global data for a small region around the Piave river in Northern Italy.

  • Another options for Deltares users is to select the deltares-data library (requires access to the Deltares P-drive). In the command lines examples below, this is done by adding either -dd or –deltares-data to the build / update command line.

  • Finally, the user can prepare its own yaml libary (or libraries) (see HydroMT documentation to check the guidelines). These user libraries can be added either in the command line using the -d option and path/to/yaml or in the ini file with the data_libs option in the [global] sections.

Building a model

This plugin allows to build a complete model from available data. Once the configuration and data libraries are set, you can build a model by using:

activate hydromt-wflow
hydromt build wflow path/to/built_model "{'basin': [x, y]}" -i wflow_build.ini -d data_sources.yml -vvv

The recommended region options for a proper implementation of this model are:

  • basin

  • subbasin

Updating a model

This plugin allows to update any components from a wflow model. To do so, list the components to update in a configuration file, if needed edit your data library with new data sources required for the update and use the command:

activate hydromt-wflow
hydromt update wflow path/to/model_to_update -o path/to/updated_model -i wflow_update.ini -d data_sources.yml -vvv

Clipping a model

This plugin allows to clip the following parts of an existing model for a smaller region from command line:

  • staticmaps

  • forcing

To clip a smaller model from an existing one use:

activate hydromt-wflow
hydromt clip wflow path/to/model_to_clip path/to/clipped_model "{'basin' [1001]}" -vvv

As for building, the recommended region options for a proper implementation of the clipped model are:

  • basin

  • subbasin

    ~WflowModel.setup_precip_forcing ~WflowModel.setup_temp_pet_forcing ~WflowModel.setup_constant_pars