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:

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

Note

From HydroMT version 0.7.0 onwards the region argument is optional and should be preceded by a -r or --region flag. The resolution (previously -r) argument has been moved to the setup_basemaps section in the .yml configuration file.

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

  • basin

  • subbasin

The coordinate reference system (CRS) of the model will be the same as the one of the input hydrography data. If the region is specified using point coordinates or a bounding box, the coordinates used should match the CRS of the hydrography data. If the user wants to use a different CRS, we advise to reproject the hydrography data to the desired CRS before building the model. You can find some examples on how to do this in the example notebook.

Configuration file#

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

Note that the order in which the components are listed in the configuration 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)

Below is an example configuration file that can be used to build a complete Wflow model .yml file. Each section corresponds to a model component with the same name.

setup_config:                 # options parsed to wflow toml 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'
  res: 0.00833           # build the model at a 30 arc sec (~1km) resolution

setup_rivers:
  hydrography_fn: merit_hydro      # source hydrography data, should correspond to hydrography_fn in setup_basemaps
  river_geom_fn: hydro_rivers_lin # 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]
  river_routing: kinematic-wave   # {'kinematic-wave', 'local-inertial'}

# setup_floodplains: # if 2D floodplains are required
#   hydrography_fn: merit_hydro      # source hydrography data, should correspond to hydrography_fn in setup_basemaps
#   floodplain_type: 2d #  # If two-dimensional floodplains are required
#   elevtn_map: wflow_dem  # {'wflow_dem', 'dem_subgrid'}

# setup_floodplains: # if 1D floodplains are required
#   hydrography_fn: merit_hydro      # source hydrography data, should correspond to hydrography_fn in setup_basemaps
#   floodplain_type: 1d    # If one-dimensional floodplains are required
#   flood_depths: # flood depths at which a volume is derived
#     - 0.5
#     - 1.0
#     - 1.5
#     - 2.0
#     - 2.5
#     - 3.0
#     - 4.0
#     - 5.0

setup_reservoirs:
  reservoirs_fn: hydro_reservoirs  # source for reservoirs shape and attributes
  timeseries_fn: gww           # additionnal source for reservoir are timeseries to compute reservoirs, Either 'gww' using gwwapi or 'jrc' using hydroengine.
  min_area: 1.0           # minimum lake area to consider [km2]

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

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

setup_lulcmaps:
  lulc_fn : globcover_2009     # source for lulc maps: {globcover, vito, corine}
  lulc_mapping_fn: globcover_mapping_default  # default mapping for lulc classes

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_outlets:
  river_only: True

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:          # source for high resolution climatology to correct precipitation if any.

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:

  • For testing and examples purposes, HydroMT can 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. to use this predefined catalog, the user can add -d artifact_data to the build / update command line.

  • 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 -d deltares_data predefined catalog to the build / update command line.

  • Finally, the user can prepare its own yaml catalog (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.