Tip

For an interactive online version click here: Binder badge

Build a Wflow model from scratch#

This notebook demonstrates how to prepare Wflow model from scratch using the command line interace (CLI).

All lines in this notebook which start with ! are executed from the command line. Within the notebook environment the logging messages are shown after completion. You can also copy these lines and paste these in your shell to get more direct feedback.

HydroMT CLI build interface#

Lets first check if the Wflow model is recognized by HydroMT

[1]:
# this should return "wflow, wflow_sediment"
# as well as the generic HydroMT models "grid_model, lumped_model, network_model, (mesh_model)"
!hydromt --models
model plugins:
 - wflow (hydromt_wflow 0.5.1.dev0)
 - wflow_sediment (hydromt_wflow 0.5.1.dev0)
generic models (hydromt 0.9.5.dev0):
 - grid_model
 - vector_model
 - network_model


Using the HydroMT build API we can setup a complete model from scratch. Let’s get an overview of all the available options:

[2]:
!hydromt build --help
Usage: hydromt build [OPTIONS] MODEL MODEL_ROOT

  Build models from scratch.

  Example usage: --------------

  To build a wflow model for a subbasin using a point coordinates snapped to
  cells with upstream area >= 50 km2 hydromt build wflow /path/to/model_root
  -i /path/to/wflow_config.yml  -r "{'subbasin': [-7.24, 62.09], 'uparea':
  50}" -d deltares_data -d /path/to/data_catalog.yml -v

  To build a sfincs model based on a bbox hydromt build sfincs
  /path/to/model_root  -i /path/to/sfincs_config.yml  -r "{'bbox':
  [4.6891,52.9750,4.9576,53.1994]}"  -d /path/to/data_catalog.yml -v

Options:
  --opt TEXT               Method specific keyword arguments, see the method
                           documentation of the specific model for more
                           information about the arguments.
  -i, --config PATH        Path to hydroMT configuration file, for the model
                           specific implementation.
  -r, --region TEXT        Set the region for which to build the model, e.g.
                           {'subbasin': [-7.24, 62.09]}
  -d, --data TEXT          Path to local yaml data catalog file OR name of
                           predefined data catalog.
  --dd, --deltares-data    Flag: Shortcut to add the "deltares_data" catalog
  --fo, --force-overwrite  Flag: If provided overwrite existing model files
  --cache                  Flag: If provided cache tiled rasterdatasets
  -v, --verbose            Increase verbosity.
  -q, --quiet              Decrease verbosity.
  --help                   Show this message and exit.

Model setup configuration#

The HydroMT configuration file (YAML) contains the model setup configuration and determines which methods are used to prepare the different components of a Wflow model and in which order and optionally sets non-default arguments for each method. This configuration is passed to HydroMT using -i <path_to_config_file>. We have prepared several example files which are available in the model repository examples folder and from the docs (building a model).

Each header (without indent) (e.g. setup_basemaps:) corresponds to a model method. All model methods are explained in the docs (model components).

We will load the default wflow build configuration yaml file for inspection:

[3]:
fn_config = "wflow_build.yml"
with open(fn_config, "r") as f:
    txt = f.read()
print(txt)
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: 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]
  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     # 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_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

Data for model setup#

The <...>_fn arguments correspond to a data source from the DataCatalog which is based on a yml-file with references to the data paths/urls and how the data should be read. This file can be provided to hydromt using -d <path_to_yml_file>.

By default, the pre-defined artifact_data catalog containing some example data for the Piave basin will be downloaded to ~/.hydromt_data/ which is also used for this example. An overview of the available example data is provided here This example data is a based on the data which is available from the Deltares p-drive. If you have acces to this drive, a pre-configured catalog file can be loaded using the -d deltares_data pre-defined catalog.

More background how to write a data catalog yml file can be found in the HydroMT core docs

Setup complete Wflow model#

Once we have prepared our data catalog and model build settings file, we are ready to ask HydroMT to build our Wflow model. Building the model can be done from the command line. Down below is an example for the Northern part of the Piave basin in Italy:

[4]:
# NOTE: copy this line (without !) to your shell for more direct feedback
!hydromt build wflow "./wflow_test_full" -r "{'subbasin': [12.2051, 45.8331], 'strord': 4, 'bounds': [11.70, 45.35, 12.95, 46.70]}" -i wflow_build.yml -d artifact_data -vv
2024-04-23 07:04:54,207 - build - log - DEBUG - Writing log messages to new file /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_full/hydromt.log.
2024-04-23 07:04:54,207 - build - log - INFO - HydroMT version: 0.9.5.dev0
2024-04-23 07:04:54,207 - build - main - INFO - Building instance of wflow model at /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_full.
2024-04-23 07:04:54,207 - build - main - INFO - User settings:
2024-04-23 07:04:54,568 - build - data_catalog - INFO - Reading data catalog archive artifact_data v0.0.8
2024-04-23 07:04:54,568 - build - data_catalog - DEBUG - Caching data from https://github.com/DirkEilander/hydromt-artifacts/releases/download/v0.0.8/data.tar.gz
2024-04-23 07:04:55,299 - build - data_catalog - DEBUG - Unpacking data from https://github.com/DirkEilander/hydromt-artifacts/releases/download/v0.0.8/data.tar.gz
2024-04-23 07:04:56,040 - build - data_catalog - INFO - Parsing data catalog from /home/runner/.hydromt_data/artifact_data/v0.0.8/data_catalog.yml
2024-04-23 07:04:56,085 - build - model_api - INFO - Initializing wflow model from hydromt_wflow (v0.5.1.dev0).
2024-04-23 07:04:56,085 - build - data_catalog - INFO - Parsing data catalog from /home/runner/work/hydromt_wflow/hydromt_wflow/hydromt_wflow/data/parameters_data.yml
2024-04-23 07:04:56,093 - build - model_api - DEBUG - Setting model config options.
2024-04-23 07:04:56,094 - build - model_api - DEBUG - Default config read from /home/runner/work/hydromt_wflow/hydromt_wflow/hydromt_wflow/data/wflow/wflow_sbm.toml
2024-04-23 07:04:56,095 - build - model_api - INFO - setup_basemaps.region: {'subbasin': [12.2051, 45.8331], 'strord': 4, 'bounds': [11.7, 45.35, 12.95, 46.7]}
2024-04-23 07:04:56,095 - build - model_api - INFO - setup_basemaps.hydrography_fn: merit_hydro
2024-04-23 07:04:56,095 - build - model_api - INFO - setup_basemaps.basin_index_fn: merit_hydro_index
2024-04-23 07:04:56,095 - build - model_api - INFO - setup_basemaps.res: 0.00833
2024-04-23 07:04:56,095 - build - model_api - INFO - setup_basemaps.upscale_method: ihu
2024-04-23 07:04:56,095 - build - wflow - INFO - Preparing base hydrography basemaps.
2024-04-23 07:04:56,097 - build - rasterdataset - INFO - Reading merit_hydro raster data from /home/runner/.hydromt_data/artifact_data/v0.0.8/merit_hydro/{variable}.tif
2024-04-23 07:04:56,205 - build - basin_mask - DEBUG - Parsed region (kind=subbasin): {'strord': 4, 'bounds': [11.7, 45.35, 12.95, 46.7], 'xy': [12.2051, 45.8331]}
2024-04-23 07:04:59,754 - build - basin_mask - INFO - subbasin bbox: [11.7750, 45.8042, 12.7450, 46.6900]
2024-04-23 07:04:59,813 - build - wflow - DEBUG - Adding basins vector to geoms.
2024-04-23 07:04:59,813 - build - basemaps - DEBUG - Mask in dataset assumed to represent subbasins.
2024-04-23 07:04:59,814 - build - basemaps - DEBUG - (Sub)basin at original resolution has 664756 cells.
2024-04-23 07:04:59,874 - build - basemaps - DEBUG - Burn subbasin outlet in upstream area data.
2024-04-23 07:04:59,901 - build - basemaps - INFO - Upscale flow direction data: 10x, ihu method.
2024-04-23 07:05:14,436 - build - basemaps - DEBUG - Derive stream order.
2024-04-23 07:05:14,612 - build - basemaps - DEBUG - Map shape: (106, 116); active cells: 6637.
2024-04-23 07:05:14,613 - build - basemaps - DEBUG - Outlet coordinates (1/1): (12.20750,45.83583).
2024-04-23 07:05:14,749 - build - wflow - DEBUG - Adding region vector to geoms.
2024-04-23 07:05:14,754 - build - model_api - INFO - setup_rivers.hydrography_fn: merit_hydro
2024-04-23 07:05:14,754 - build - model_api - INFO - setup_rivers.river_geom_fn: rivers_lin2019_v1
2024-04-23 07:05:14,755 - build - model_api - INFO - setup_rivers.river_upa: 30
2024-04-23 07:05:14,755 - build - model_api - INFO - setup_rivers.rivdph_method: powlaw
2024-04-23 07:05:14,755 - build - model_api - INFO - setup_rivers.slope_len: 2000
2024-04-23 07:05:14,755 - build - model_api - INFO - setup_rivers.min_rivlen_ratio: 0.0
2024-04-23 07:05:14,755 - build - model_api - INFO - setup_rivers.min_rivdph: 1
2024-04-23 07:05:14,755 - build - model_api - INFO - setup_rivers.min_rivwth: 30
2024-04-23 07:05:14,755 - build - model_api - INFO - setup_rivers.smooth_len: 5000
2024-04-23 07:05:14,755 - build - model_api - INFO - setup_rivers.rivman_mapping_fn: roughness_river_mapping_default
2024-04-23 07:05:14,755 - build - model_api - INFO - setup_rivers.elevtn_map: wflow_dem
2024-04-23 07:05:14,755 - build - model_api - INFO - setup_rivers.river_routing: kinematic-wave
2024-04-23 07:05:14,755 - build - model_api - INFO - setup_rivers.connectivity: 8
2024-04-23 07:05:14,755 - build - wflow - INFO - Preparing river maps.
2024-04-23 07:05:14,756 - build - rasterdataset - INFO - Reading merit_hydro raster data from /home/runner/.hydromt_data/artifact_data/v0.0.8/merit_hydro/{variable}.tif
2024-04-23 07:05:14,845 - build - rasterdataset - DEBUG - Clip to [11.778, 45.807, 12.745, 46.690] (epsg:4326))
2024-04-23 07:05:14,852 - build - river - DEBUG - Set river mask (min uparea: 30 km2) and prepare flow dirs.
2024-04-23 07:05:14,952 - build - river - DEBUG - Derive river length.
2024-04-23 07:05:19,955 - build - river - DEBUG - Derive river slope.
2024-04-23 07:05:20,761 - build - river - DEBUG - Derive rivwth from hydrography dataset.
2024-04-23 07:05:20,769 - build - dataframe - INFO - Reading roughness_river_mapping_default csv data from /home/runner/work/hydromt_wflow/hydromt_wflow/hydromt_wflow/data/wflow/N_river_mapping.csv
2024-04-23 07:05:20,776 - build - landuse - INFO - Deriving N_River using average resampling (nodata=-999.0).
2024-04-23 07:05:20,782 - build - geodataframe - INFO - Reading rivers_lin2019_v1 vector data from /home/runner/.hydromt_data/artifact_data/v0.0.8/rivers_lin2019_v1.gpkg
2024-04-23 07:05:20,807 - build - geodataframe - DEBUG - Clip intersects [11.778, 45.807, 12.745, 46.690] (EPSG:4326)
2024-04-23 07:05:21,022 - build - river - DEBUG - Derive ['rivwth', 'qbankfull'] from shapefile.
2024-04-23 07:05:21,083 - build - river - DEBUG - Valid for 381/655 river cells (max dist: 392 m).
2024-04-23 07:05:25,216 - build - wflow - DEBUG - Adding rivers vector to geoms.
2024-04-23 07:05:26,050 - build - model_api - INFO - setup_reservoirs.reservoirs_fn: hydro_reservoirs
2024-04-23 07:05:26,050 - build - model_api - INFO - setup_reservoirs.timeseries_fn: gww
2024-04-23 07:05:26,050 - build - model_api - INFO - setup_reservoirs.min_area: 1.0
2024-04-23 07:05:26,050 - build - wflow - INFO - Preparing reservoir maps.
2024-04-23 07:05:26,050 - build - geodataframe - INFO - Reading hydro_reservoirs vector data from /home/runner/.hydromt_data/artifact_data/v0.0.8/hydro_reservoirs.gpkg
2024-04-23 07:05:26,071 - build - geodataframe - DEBUG - Clip contains [11.775, 45.804, 12.745, 46.690] (EPSG:4326)
2024-04-23 07:05:26,073 - build - geodataframe - DEBUG - Convert units for 5 columns.
2024-04-23 07:05:26,075 - build - wflow - WARNING - No reservoirs of sufficient size found within region! Skipping reservoir procedures!
2024-04-23 07:05:26,075 - build - wflow - INFO - Skipping method, as no data has been found
2024-04-23 07:05:26,075 - build - model_api - INFO - setup_lakes.lakes_fn: hydro_lakes
2024-04-23 07:05:26,075 - build - model_api - INFO - setup_lakes.rating_curve_fns: None
2024-04-23 07:05:26,076 - build - model_api - INFO - setup_lakes.min_area: 10.0
2024-04-23 07:05:26,076 - build - model_api - INFO - setup_lakes.add_maxstorage: False
2024-04-23 07:05:26,076 - build - wflow - INFO - Preparing lake maps.
2024-04-23 07:05:26,076 - build - geodataframe - INFO - Reading hydro_lakes vector data from /home/runner/.hydromt_data/artifact_data/v0.0.8/hydro_lakes.gpkg
2024-04-23 07:05:26,091 - build - geodataframe - DEBUG - Clip contains [11.775, 45.804, 12.745, 46.690] (EPSG:4326)
2024-04-23 07:05:26,092 - build - geodataframe - DEBUG - Convert units for 1 columns.
2024-04-23 07:05:26,093 - build - wflow - WARNING - No lakes of sufficient size found within region! Skipping lake procedures!
2024-04-23 07:05:26,093 - build - wflow - INFO - Skipping method, as no data has been found
2024-04-23 07:05:26,093 - build - model_api - INFO - setup_glaciers.glaciers_fn: rgi
2024-04-23 07:05:26,094 - build - model_api - INFO - setup_glaciers.min_area: 1.0
2024-04-23 07:05:26,094 - build - wflow - INFO - Preparing glacier maps.
2024-04-23 07:05:26,094 - build - geodataframe - INFO - Reading rgi vector data from /home/runner/.hydromt_data/artifact_data/v0.0.8/rgi.gpkg
2024-04-23 07:05:26,123 - build - geodataframe - DEBUG - Clip intersects [11.775, 45.804, 12.745, 46.690] (EPSG:4326)
2024-04-23 07:05:26,125 - build - wflow - INFO - 1 glaciers of sufficient size found within region.
2024-04-23 07:05:26,134 - build - glaciers - DEBUG - Creating vector grid for calculating glacier fraction and storage per grid cell
2024-04-23 07:05:26,198 - build - glaciers - DEBUG - Setting glacierfrac and store values per glacier.
2024-04-23 07:05:28,056 - build - model_api - INFO - setup_lulcmaps.lulc_fn: globcover
2024-04-23 07:05:28,056 - build - model_api - INFO - setup_lulcmaps.lulc_mapping_fn: None
2024-04-23 07:05:28,056 - build - model_api - INFO - setup_lulcmaps.lulc_vars: ['landuse', 'Kext', 'N', 'PathFrac', 'RootingDepth', 'Sl', 'Swood', 'WaterFrac']
2024-04-23 07:05:28,056 - build - wflow - INFO - Preparing LULC parameter maps.
2024-04-23 07:05:28,057 - build - rasterdataset - INFO - Reading globcover raster data from /home/runner/.hydromt_data/artifact_data/v0.0.8/globcover.tif
2024-04-23 07:05:28,073 - build - rasterdataset - DEBUG - Clip to [11.778, 45.807, 12.745, 46.690] (epsg:4326))
2024-04-23 07:05:28,074 - build - dataframe - INFO - Reading globcover_mapping_default csv data from /home/runner/work/hydromt_wflow/hydromt_wflow/hydromt_wflow/data/lulc/globcover_mapping.csv
2024-04-23 07:05:28,083 - build - landuse - INFO - Deriving landuse using nearest resampling (nodata=230).
2024-04-23 07:05:28,103 - build - landuse - INFO - Deriving Kext using average resampling (nodata=-999.0).
2024-04-23 07:05:28,125 - build - landuse - INFO - Deriving N using average resampling (nodata=-999.0).
2024-04-23 07:05:28,147 - build - landuse - INFO - Deriving PathFrac using average resampling (nodata=-999.0).
2024-04-23 07:05:28,169 - build - landuse - INFO - Deriving RootingDepth using average resampling (nodata=-999.0).
2024-04-23 07:05:28,191 - build - landuse - INFO - Deriving Sl using average resampling (nodata=-999.0).
2024-04-23 07:05:28,212 - build - landuse - INFO - Deriving Swood using average resampling (nodata=-999.0).
2024-04-23 07:05:28,232 - build - landuse - INFO - Deriving WaterFrac using average resampling (nodata=-999.0).
2024-04-23 07:05:28,258 - build - model_api - INFO - setup_laimaps.lai_fn: modis_lai
2024-04-23 07:05:28,258 - build - wflow - INFO - Preparing LAI maps.
2024-04-23 07:05:28,258 - build - rasterdataset - INFO - Reading modis_lai netcdf data from /home/runner/.hydromt_data/artifact_data/v0.0.8/modis_lai.nc
2024-04-23 07:05:28,290 - build - rasterdataset - DEBUG - Clip to [11.778, 45.807, 12.745, 46.690] (epsg:4326))
2024-04-23 07:05:28,291 - build - rasterdataset - DEBUG - Convert units for 1 variables.
2024-04-23 07:05:28,297 - build - landuse - INFO - Deriving LAI using average resampling (nodata=nan).
2024-04-23 07:05:28,371 - build - model_api - INFO - setup_soilmaps.soil_fn: soilgrids
2024-04-23 07:05:28,372 - build - model_api - INFO - setup_soilmaps.ptf_ksatver: brakensiek
2024-04-23 07:05:28,372 - build - model_api - INFO - setup_soilmaps.wflow_thicknesslayers: [100, 300, 800]
2024-04-23 07:05:28,372 - build - wflow - INFO - Preparing soil parameter maps.
2024-04-23 07:05:28,373 - build - rasterdataset - INFO - Reading soilgrids raster data from /home/runner/.hydromt_data/artifact_data/v0.0.8/soilgrids/{variable}.tif
2024-04-23 07:05:28,770 - build - rasterdataset - DEBUG - Clip to [11.778, 45.807, 12.745, 46.690] (epsg:4326))
2024-04-23 07:05:28,779 - build - rasterdataset - DEBUG - Convert units for 21 variables.
2024-04-23 07:05:28,991 - build - soilgrids - INFO - calculate and resample thetaS
2024-04-23 07:05:29,203 - build - soilgrids - INFO - calculate and resample thetaR
2024-04-23 07:05:29,415 - build - soilgrids - INFO - calculate and resample KsatVer
2024-04-23 07:05:29,465 - build - soilgrids - INFO - calculate and resample pore size distribution index
2024-04-23 07:05:29,896 - build - soilgrids - INFO - fit z - log(KsatVer) with numpy linalg regression (y = b*x) -> M_
2024-04-23 07:05:30,279 - build - soilgrids - INFO - fit zi - Ksat with curve_fit (scipy.optimize) -> M
2024-04-23 07:05:32,860 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for thetaS
2024-04-23 07:05:32,960 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for thetaR
2024-04-23 07:05:33,050 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for SoilThickness
No numerical nodata value found, skipping set_nodata
2024-04-23 07:05:33,067 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for SoilMinThickness
No numerical nodata value found, skipping set_nodata
2024-04-23 07:05:33,090 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for c
2024-04-23 07:05:33,098 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer
2024-04-23 07:05:33,138 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_0.0cm
2024-04-23 07:05:33,178 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_5.0cm
2024-04-23 07:05:33,219 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_15.0cm
2024-04-23 07:05:33,258 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_30.0cm
2024-04-23 07:05:33,297 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_60.0cm
2024-04-23 07:05:33,337 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_100.0cm
2024-04-23 07:05:33,376 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_200.0cm
2024-04-23 07:05:33,416 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for M_original_
No numerical nodata value found, skipping set_nodata
2024-04-23 07:05:33,531 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for M_
No numerical nodata value found, skipping set_nodata
2024-04-23 07:05:33,649 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for f_
No numerical nodata value found, skipping set_nodata
2024-04-23 07:05:33,772 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for M_original
No numerical nodata value found, skipping set_nodata
2024-04-23 07:05:33,893 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for M
No numerical nodata value found, skipping set_nodata
2024-04-23 07:05:34,016 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for f
No numerical nodata value found, skipping set_nodata
2024-04-23 07:05:34,136 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for wflow_soil
2024-04-23 07:05:34,227 - build - model_api - INFO - setup_outlets.river_only: True
2024-04-23 07:05:34,227 - build - model_api - INFO - setup_outlets.toml_output: csv
2024-04-23 07:05:34,227 - build - model_api - INFO - setup_outlets.gauge_toml_header: ['Q']
2024-04-23 07:05:34,227 - build - model_api - INFO - setup_outlets.gauge_toml_param: ['lateral.river.q_av']
2024-04-23 07:05:34,228 - build - wflow - INFO - Gauges locations set based on river outlets.
2024-04-23 07:05:34,234 - build - wflow - INFO - Gauges map based on catchment river outlets added.
2024-04-23 07:05:34,234 - build - wflow - INFO - Adding ['lateral.river.q_av'] to csv section of toml.
2024-04-23 07:05:34,235 - build - model_api - INFO - setup_gauges.gauges_fn: grdc
2024-04-23 07:05:34,235 - build - model_api - INFO - setup_gauges.index_col: None
2024-04-23 07:05:34,235 - build - model_api - INFO - setup_gauges.snap_to_river: True
2024-04-23 07:05:34,235 - build - model_api - INFO - setup_gauges.mask: None
2024-04-23 07:05:34,235 - build - model_api - INFO - setup_gauges.snap_uparea: False
2024-04-23 07:05:34,235 - build - model_api - INFO - setup_gauges.max_dist: 10000.0
2024-04-23 07:05:34,235 - build - model_api - INFO - setup_gauges.wdw: 3
2024-04-23 07:05:34,235 - build - model_api - INFO - setup_gauges.rel_error: 0.05
2024-04-23 07:05:34,235 - build - model_api - INFO - setup_gauges.abs_error: 50.0
2024-04-23 07:05:34,235 - build - model_api - INFO - setup_gauges.fillna: False
2024-04-23 07:05:34,235 - build - model_api - INFO - setup_gauges.derive_subcatch: False
2024-04-23 07:05:34,235 - build - model_api - INFO - setup_gauges.basename: None
2024-04-23 07:05:34,235 - build - model_api - INFO - setup_gauges.toml_output: csv
2024-04-23 07:05:34,235 - build - model_api - INFO - setup_gauges.gauge_toml_header: ['Q', 'P']
2024-04-23 07:05:34,235 - build - model_api - INFO - setup_gauges.gauge_toml_param: ['lateral.river.q_av', 'vertical.precipitation']
2024-04-23 07:05:34,235 - build - geodataframe - INFO - Reading grdc csv data from /home/runner/.hydromt_data/artifact_data/v0.0.8/grdc.csv
2024-04-23 07:05:34,241 - build - geodataframe - DEBUG - Clip intersects [11.775, 45.804, 12.745, 46.690] (EPSG:4326)
2024-04-23 07:05:34,242 - build - wflow - INFO - 3 grdc gauge locations found within domain
2024-04-23 07:05:34,605 - build - wflow - INFO - Adding ['lateral.river.q_av', 'vertical.precipitation'] to csv section of toml.
2024-04-23 07:05:34,605 - build - model_api - INFO - setup_precip_forcing.precip_fn: era5
2024-04-23 07:05:34,605 - build - model_api - INFO - setup_precip_forcing.precip_clim_fn: None
2024-04-23 07:05:34,605 - build - model_api - INFO - setup_precip_forcing.chunksize: None
2024-04-23 07:05:34,606 - build - rasterdataset - INFO - Reading era5 netcdf data from /home/runner/.hydromt_data/artifact_data/v0.0.8/era5.nc
2024-04-23 07:05:34,620 - build - rasterdataset - DEBUG - Shifting time labels with 86400 sec.
2024-04-23 07:05:34,621 - build - rasterdataset - DEBUG - Slicing time dim (datetime.datetime(2010, 1, 1, 0, 0), datetime.datetime(2010, 3, 31, 0, 0))
2024-04-23 07:05:34,628 - build - rasterdataset - DEBUG - Clip to [11.778, 45.807, 12.745, 46.690] (epsg:4326))
2024-04-23 07:05:34,630 - build - rasterdataset - DEBUG - Convert units for 1 variables.
2024-04-23 07:05:34,678 - build - model_api - INFO - setup_temp_pet_forcing.temp_pet_fn: era5
2024-04-23 07:05:34,678 - build - model_api - INFO - setup_temp_pet_forcing.pet_method: debruin
2024-04-23 07:05:34,678 - build - model_api - INFO - setup_temp_pet_forcing.press_correction: True
2024-04-23 07:05:34,679 - build - model_api - INFO - setup_temp_pet_forcing.temp_correction: True
2024-04-23 07:05:34,679 - build - model_api - INFO - setup_temp_pet_forcing.wind_correction: True
2024-04-23 07:05:34,679 - build - model_api - INFO - setup_temp_pet_forcing.wind_altitude: 10
2024-04-23 07:05:34,679 - build - model_api - INFO - setup_temp_pet_forcing.reproj_method: nearest_index
2024-04-23 07:05:34,679 - build - model_api - INFO - setup_temp_pet_forcing.dem_forcing_fn: era5_orography
2024-04-23 07:05:34,679 - build - model_api - INFO - setup_temp_pet_forcing.skip_pet: False
2024-04-23 07:05:34,679 - build - model_api - INFO - setup_temp_pet_forcing.chunksize: None
2024-04-23 07:05:34,679 - build - rasterdataset - INFO - Reading era5 netcdf data from /home/runner/.hydromt_data/artifact_data/v0.0.8/era5.nc
2024-04-23 07:05:34,693 - build - rasterdataset - DEBUG - Shifting time labels with 86400 sec.
2024-04-23 07:05:34,694 - build - rasterdataset - DEBUG - Slicing time dim (datetime.datetime(2010, 1, 1, 0, 0), datetime.datetime(2010, 3, 31, 0, 0))
2024-04-23 07:05:34,701 - build - rasterdataset - DEBUG - Clip to [11.778, 45.807, 12.745, 46.690] (epsg:4326))
2024-04-23 07:05:34,703 - build - rasterdataset - DEBUG - Convert units for 4 variables.
2024-04-23 07:05:34,725 - build - rasterdataset - INFO - Reading era5_orography netcdf data from /home/runner/.hydromt_data/artifact_data/v0.0.8/era5_orography.nc
2024-04-23 07:05:34,741 - build - rasterdataset - DEBUG - Clip to [11.625, 45.625, 12.875, 46.875] (epsg:4326))
2024-04-23 07:05:34,742 - build - rasterdataset - DEBUG - Convert units for 1 variables.
2024-04-23 07:05:34,929 - build - model_api - INFO - setup_constant_pars.dtype: float32
2024-04-23 07:05:34,929 - build - model_api - INFO - setup_constant_pars.nodata: -999
2024-04-23 07:05:34,929 - build - model_api - INFO - setup_constant_pars.KsatHorFrac: 100
2024-04-23 07:05:34,929 - build - model_api - INFO - setup_constant_pars.Cfmax: 3.75653
2024-04-23 07:05:34,929 - build - model_api - INFO - setup_constant_pars.cf_soil: 0.038
2024-04-23 07:05:34,929 - build - model_api - INFO - setup_constant_pars.EoverR: 0.11
2024-04-23 07:05:34,929 - build - model_api - INFO - setup_constant_pars.InfiltCapPath: 5
2024-04-23 07:05:34,929 - build - model_api - INFO - setup_constant_pars.InfiltCapSoil: 600
2024-04-23 07:05:34,929 - build - model_api - INFO - setup_constant_pars.MaxLeakage: 0
2024-04-23 07:05:34,929 - build - model_api - INFO - setup_constant_pars.rootdistpar: -500
2024-04-23 07:05:34,929 - build - model_api - INFO - setup_constant_pars.TT: 0
2024-04-23 07:05:34,929 - build - model_api - INFO - setup_constant_pars.TTI: 2
2024-04-23 07:05:34,929 - build - model_api - INFO - setup_constant_pars.TTM: 0
2024-04-23 07:05:34,930 - build - model_api - INFO - setup_constant_pars.WHC: 0.1
2024-04-23 07:05:34,930 - build - model_api - INFO - setup_constant_pars.G_Cfmax: 5.3
2024-04-23 07:05:34,930 - build - model_api - INFO - setup_constant_pars.G_SIfrac: 0.002
2024-04-23 07:05:34,930 - build - model_api - INFO - setup_constant_pars.G_TT: 1.3
2024-04-23 07:05:34,954 - build - wflow - INFO - Write model data to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_full
2024-04-23 07:05:34,962 - build - model_api - INFO - Writing model config to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_full/wflow_sbm.toml
2024-04-23 07:05:34,988 - build - wflow - INFO - Write grid to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_full/staticmaps.nc
2024-04-23 07:05:35,183 - build - wflow - INFO - Writing model staticgeom to file.
2024-04-23 07:05:35,248 - build - wflow - INFO - Write forcing file
2024-04-23 07:05:35,252 - build - wflow - WARNING - Not all dates found in precip_fn changing starttime to 2010-02-02 00:00:00 and endtime to 2010-02-15 00:00:00 in the toml.
2024-04-23 07:05:35,253 - build - model_api - INFO - Writing model config to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_full/wflow_sbm.toml
2024-04-23 07:05:35,258 - build - wflow - INFO - Process forcing; saving to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_full/inmaps-era5-2010.nc
[########################################] | 100% Completed | 101.79 ms

With this example we build a complete Wflow model including forcing. The example means the following: run hydromt build with:

  • wflow : i.e. build a Wflow model

  • ./wflow_test_full : output model folder

  • -r "{'subbasin': [12.2051, 45.8331], 'strord': 4, 'bounds': [11.70, 45.35, 12.95, 46.70]}" : derive a subbasin with its outlet at the given x,y coordinates and within the given bounds [xmin, ymin, xmax, ymax] (WGS84) snapped to a river with minimum stream order (strord) of 4. All REGION options are described in the docs

  • -i wflow_build.yml : setup configuration file including all components to build and their arguments

  • -d artifact_data: data catalog to use. Here artifact_data which contains a global data extract for Northern Italy for demo purposes.

  • -vv : give some extra verbosity (2 * v) to display feedback on screen. Now debug messages are provided.

Next we check which files have been created. The model root should contain two netcdf (.nc) files, one for the staticmaps and one for the forcing data, a wflow run configuration (.toml) file. These files are sufficient to run the wflow model. In addition several geometry (.geojson) files are saved in the staticgeoms folder. Finally, the setup process is logged in the hydromt.log file.

[5]:
import os

root = "wflow_test_full"
for path, _, files in os.walk(root):
    print(path)
    for name in files:
        if name.endswith(".xml"):
            continue
        print(f" - {name}")
wflow_test_full
 - staticmaps.nc
 - hydromt_data.yml
 - inmaps-era5-2010.nc
 - wflow_sbm.toml
 - hydromt.log
wflow_test_full/run_default
wflow_test_full/staticgeoms
 - gauges_grdc.geojson
 - gauges.geojson
 - rivers.geojson
 - region.geojson
 - basins.geojson
 - glaciers.geojson
wflow_test_full/instate

Visualize and/or inspect model schematization#

  • The wflow plot example notebook contains scripts to visualize your model

  • The wflow nc to raster files example notebook contains scripts to write the nc model files to a netcdf which can be used to inspect (and modify) the model layers in e.g. QGIS.