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"
!hydromt --models
hydroMT model plugins: wflow (v0.2.1.dev0), wflow_sediment (v0.2.1.dev0)

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 REGION

  Build models from scratch.

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

  To build a wflow model for a subbasin using and point coordinates snapped to cells with stream order >= 4
  hydromt build wflow /path/to/model_root "{'subbasin': [-7.24, 62.09], 'strord': 4}" -i /path/to/wflow_config.ini -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 "{'bbox': [4.6891,52.9750,4.9576,53.1994]}" -i /path/to/sfincs_config.ini -d /path/to/data_catalog.yml -v

Options:
  -r, --res FLOAT             Model resolution in model src.
  --build-base / --build-all  Deprecated!
  --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.
  -d, --data TEXT             Path to local yaml data catalog file OR name of
                              predefined data catalog.
  --dd, --deltares-data       Shortcut to add the "deltares_data" catalog
  -q, --quiet                 Decrease verbosity.
  -v, --verbose               Increase verbosity.
  --help                      Show this message and exit.

Setup Wflow model base layers#

[3]:
# NOTE: copy this line (without !) to your shell for more direct feedback
!hydromt build wflow "./wflow_test_base" "{'subbasin': [12.2051, 45.8331], 'strord': 4, 'bounds': [11.70, 45.35, 12.95, 46.70]}" -r 0.00833 -v
2022-08-10 11:47:03,160 - build - log - INFO - HydroMT version: 0.5.1.dev
2022-08-10 11:47:03,160 - build - main - INFO - Building instance of wflow model at /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_base.
2022-08-10 11:47:03,160 - build - main - INFO - User settings:
2022-08-10 11:47:03,166 - build - model_api - INFO - Initializing wflow model from hydromt_wflow (v0.2.1.dev0).
2022-08-10 11:47:03,166 - build - model_api - INFO - setup_basemaps.region: {'subbasin': [12.2051, 45.8331], 'strord': 4, 'bounds': [11.7, 45.35, 12.95, 46.7]}
2022-08-10 11:47:03,166 - build - model_api - INFO - setup_basemaps.res: 0.00833
2022-08-10 11:47:03,166 - build - model_api - INFO - setup_basemaps.hydrography_fn: merit_hydro
2022-08-10 11:47:03,166 - build - model_api - INFO - setup_basemaps.basin_index_fn: merit_hydro_index
2022-08-10 11:47:03,166 - build - model_api - INFO - setup_basemaps.upscale_method: ihu
2022-08-10 11:47:03,166 - build - wflow - INFO - Preparing base hydrography basemaps.
2022-08-10 11:47:03,356 - build - data_catalog - INFO - Reading data catalog artifact_data v0.0.6 from archive
2022-08-10 11:47:03,573 - build - data_catalog - INFO - Downloading data archive file to /home/runner/.hydromt_data/artifact_data/v0.0.6/data.tar.gz
2022-08-10 11:47:04,802 - build - data_catalog - INFO - Parsing data catalog from /home/runner/.hydromt_data/artifact_data/v0.0.6/data_catalog.yml
2022-08-10 11:47:04,858 - build - data_catalog - INFO - DataCatalog: Getting merit_hydro RasterDataset raster data from /home/runner/.hydromt_data/artifact_data/v0.0.6/merit_hydro/{variable}.tif
2022-08-10 11:47:08,076 - build - basin_mask - INFO - subbasin bbox: [11.7750, 45.8042, 12.7450, 46.6900]
2022-08-10 11:47:08,298 - build - basemaps - INFO - Upscale flow direction data: 10x, ihu method.
2022-08-10 11:47:21,677 - build - wflow - INFO - Write model data to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_base
2022-08-10 11:47:21,680 - build - model_api - INFO - Writing model config to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_base/wflow_sbm.toml
2022-08-10 11:47:21,692 - build - wflow - INFO - Write staticmaps to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_base/staticmaps.nc
2022-08-10 11:47:21,819 - build - wflow - INFO - Writing model staticgeom to file.
malloc(): unsorted double linked list corrupted
Aborted (core dumped)

The example above means the following: run hydromt build with:

  • wflow : i.e. build a Wflow model

  • ./wflow_test_base : output model folder

  • "{'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

  • -r 0.0083333 : build the model at a 30 arc sec (~1km) resolution

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

NOTE: As we did not specify a model configuration, only the base maps (topography and hydrography) have been setup using default parameters. To build a complete model we need the use a configuraton ini-file.

Model setup configuration#

The ini-file 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_ini_file>. We have prepared several example ini-files which are available in the model repository examples folder and from the docs (building a model).

Each header as shown between [...] (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 ini file for inspection:

[4]:
fn_ini = "wflow_build.ini"
with open(fn_ini, "r") as f:
    txt = f.read()
print(txt)
[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

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 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 available from the Deltares p-drive. If you have acces to this drive, a pre-configured catalog file can be loaded using the --dd flag.

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

Setup complete Wflow model#

[5]:
# NOTE: copy this line (without !) to your shell for more direct feedback
!hydromt build wflow "./wflow_test_full" "{'subbasin': [12.2051, 45.8331], 'strord': 4, 'bounds': [11.70, 45.35, 12.95, 46.70]}" -r 0.00833 -i wflow_build.ini -vv
2022-08-10 11:47:38,032 - build - log - DEBUG - Writing log messages to new file /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_full/hydromt.log.
2022-08-10 11:47:38,032 - build - log - INFO - HydroMT version: 0.5.1.dev
2022-08-10 11:47:38,032 - build - main - INFO - Building instance of wflow model at /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_full.
2022-08-10 11:47:38,032 - build - main - INFO - User settings:
2022-08-10 11:47:38,040 - build - model_plugins - DEBUG - Loaded model plugin 'wflow = hydromt_wflow.wflow.WflowModel' (0.2.1.dev0)
2022-08-10 11:47:38,040 - build - model_api - INFO - Initializing wflow model from hydromt_wflow (v0.2.1.dev0).
2022-08-10 11:47:38,040 - build - model_api - ERROR - missing required argument cfdict for setup_config
2022-08-10 11:47:38,040 - build - model_api - DEBUG - Setting model config options.
2022-08-10 11:47:38,042 - build - model_api - DEBUG - Default config read from /usr/share/miniconda/envs/hydromt-wflow/lib/python3.9/site-packages/hydromt_wflow/data/wflow/wflow_sbm.toml
2022-08-10 11:47:38,042 - build - model_api - INFO - setup_basemaps.region: {'subbasin': [12.2051, 45.8331], 'strord': 4, 'bounds': [11.7, 45.35, 12.95, 46.7]}
2022-08-10 11:47:38,043 - build - model_api - INFO - setup_basemaps.res: 0.00833
2022-08-10 11:47:38,043 - build - model_api - INFO - setup_basemaps.hydrography_fn: merit_hydro
2022-08-10 11:47:38,043 - build - model_api - INFO - setup_basemaps.basin_index_fn: merit_hydro_index
2022-08-10 11:47:38,043 - build - model_api - INFO - setup_basemaps.upscale_method: ihu
2022-08-10 11:47:38,043 - build - wflow - INFO - Preparing base hydrography basemaps.
2022-08-10 11:47:38,059 - build - data_catalog - INFO - Reading data catalog artifact_data v0.0.6 from archive
2022-08-10 11:47:38,059 - build - data_catalog - INFO - Parsing data catalog from /home/runner/.hydromt_data/artifact_data/v0.0.6/data_catalog.yml
2022-08-10 11:47:38,199 - build - data_catalog - INFO - DataCatalog: Getting merit_hydro RasterDataset raster data from /home/runner/.hydromt_data/artifact_data/v0.0.6/merit_hydro/{variable}.tif
2022-08-10 11:47:38,309 - build - basin_mask - DEBUG - Parsed region (kind=subbasin): {'strord': 4, 'bounds': [11.7, 45.35, 12.95, 46.7], 'xy': [12.2051, 45.8331]}
2022-08-10 11:47:41,378 - build - basin_mask - INFO - subbasin bbox: [11.7750, 45.8042, 12.7450, 46.6900]
2022-08-10 11:47:41,440 - build - wflow - DEBUG - Adding basins vector to staticgeoms.
2022-08-10 11:47:41,440 - build - basemaps - DEBUG - Mask in dataset assumed to represent subbasins.
2022-08-10 11:47:41,441 - build - basemaps - DEBUG - (Sub)basin at original resolution has 664756 cells.
2022-08-10 11:47:41,560 - build - basemaps - DEBUG - Burn subbasin outlet in upstream area data.
2022-08-10 11:47:41,598 - build - basemaps - INFO - Upscale flow direction data: 10x, ihu method.
2022-08-10 11:47:56,305 - build - basemaps - DEBUG - Derive stream order.
2022-08-10 11:47:56,546 - build - basemaps - DEBUG - Map shape: (106, 116); active cells: 6637.
2022-08-10 11:47:56,546 - build - basemaps - DEBUG - Outlet coordinates (1/1): (12.20750,45.83583).
2022-08-10 11:47:56,623 - build - wflow - DEBUG - Adding region vector to staticgeoms.
2022-08-10 11:47:56,627 - build - model_api - INFO - setup_rivers.hydrography_fn: merit_hydro
2022-08-10 11:47:56,627 - build - model_api - INFO - setup_rivers.river_geom_fn: rivers_lin2019_v1
2022-08-10 11:47:56,627 - build - model_api - INFO - setup_rivers.river_upa: 30
2022-08-10 11:47:56,627 - build - model_api - INFO - setup_rivers.rivdph_method: powlaw
2022-08-10 11:47:56,627 - build - model_api - INFO - setup_rivers.slope_len: 2000
2022-08-10 11:47:56,627 - build - model_api - INFO - setup_rivers.min_rivlen_ratio: 0.1
2022-08-10 11:47:56,627 - build - model_api - INFO - setup_rivers.min_rivdph: 1
2022-08-10 11:47:56,627 - build - model_api - INFO - setup_rivers.min_rivwth: 30
2022-08-10 11:47:56,627 - build - model_api - INFO - setup_rivers.smooth_len: 5000
2022-08-10 11:47:56,627 - build - model_api - INFO - setup_rivers.rivman_mapping_fn: /usr/share/miniconda/envs/hydromt-wflow/lib/python3.9/site-packages/hydromt_wflow/data/wflow/N_river_mapping.csv
2022-08-10 11:47:56,627 - build - wflow - INFO - Preparing river maps.
2022-08-10 11:47:56,627 - build - data_catalog - INFO - DataCatalog: Getting merit_hydro RasterDataset raster data from /home/runner/.hydromt_data/artifact_data/v0.0.6/merit_hydro/{variable}.tif
2022-08-10 11:47:56,723 - build - rasterdataset - DEBUG - RasterDataset: Clip with geom - [11.778, 45.807, 12.745, 46.690]
2022-08-10 11:47:56,738 - build - river - DEBUG - Set river mask (min uparea: 30 km2) and prepare flow dirs.
2022-08-10 11:47:56,910 - build - river - DEBUG - Derive river length.
2022-08-10 11:48:02,826 - build - river - DEBUG - Derive river slope.
2022-08-10 11:48:03,612 - build - river - DEBUG - Derive rivwth from hydrography dataset.
2022-08-10 11:48:03,650 - build - landuse - INFO - Deriving N_River using average resampling (nodata=-999.0).
2022-08-10 11:48:03,661 - build - data_catalog - INFO - DataCatalog: Getting rivers_lin2019_v1 GeoDataFrame vector data from /home/runner/.hydromt_data/artifact_data/v0.0.6/rivers_lin2019_v1.gpkg
2022-08-10 11:48:03,662 - build - geodataframe - INFO - GeoDataFrame: Read vector data and clip to geom (epsg:4326) [11.778, 45.807, 12.745, 46.690].
2022-08-10 11:48:03,879 - build - river - DEBUG - Derive ['rivwth', 'qbankfull'] from shapefile.
2022-08-10 11:48:03,969 - build - river - DEBUG - Valid for 381/655 river cells (max dist: 392 m).
2022-08-10 11:48:05,861 - build - wflow - DEBUG - Adding rivers vector to staticgeoms.
2022-08-10 11:48:06,560 - build - model_api - INFO - setup_reservoirs.reservoirs_fn: hydro_reservoirs
2022-08-10 11:48:06,560 - build - model_api - INFO - setup_reservoirs.min_area: 1.0
2022-08-10 11:48:06,560 - build - model_api - INFO - setup_reservoirs.priority_jrc: True
2022-08-10 11:48:06,560 - build - wflow - INFO - Preparing reservoir maps.
2022-08-10 11:48:06,560 - build - data_catalog - INFO - DataCatalog: Getting hydro_reservoirs GeoDataFrame vector data from /home/runner/.hydromt_data/artifact_data/v0.0.6/hydro_reservoirs.gpkg
2022-08-10 11:48:06,563 - build - geodataframe - INFO - GeoDataFrame: Read vector data and clip to geom (epsg:4326) [11.775, 45.804, 12.745, 46.690].
2022-08-10 11:48:06,589 - build - geodataframe - DEBUG - GeoDataFrame: Convert units for 5 columns.
2022-08-10 11:48:06,592 - build - wflow - WARNING - No reservoirs of sufficient size found within region! Skipping reservoir procedures!
2022-08-10 11:48:06,592 - build - model_api - INFO - setup_lakes.lakes_fn: hydro_lakes
2022-08-10 11:48:06,593 - build - model_api - INFO - setup_lakes.min_area: 10.0
2022-08-10 11:48:06,593 - build - wflow - INFO - Preparing lake maps.
2022-08-10 11:48:06,593 - build - data_catalog - INFO - DataCatalog: Getting hydro_lakes GeoDataFrame vector data from /home/runner/.hydromt_data/artifact_data/v0.0.6/hydro_lakes.gpkg
2022-08-10 11:48:06,595 - build - geodataframe - INFO - GeoDataFrame: Read vector data and clip to geom (epsg:4326) [11.775, 45.804, 12.745, 46.690].
2022-08-10 11:48:06,614 - build - geodataframe - DEBUG - GeoDataFrame: Convert units for 1 columns.
2022-08-10 11:48:06,616 - build - wflow - WARNING - No lakes of sufficient size found within region! Skipping lake procedures!
2022-08-10 11:48:06,616 - build - model_api - INFO - setup_glaciers.glaciers_fn: rgi
2022-08-10 11:48:06,616 - build - model_api - INFO - setup_glaciers.min_area: 1.0
2022-08-10 11:48:06,616 - build - wflow - INFO - Preparing glacier maps.
2022-08-10 11:48:06,616 - build - data_catalog - INFO - DataCatalog: Getting rgi GeoDataFrame vector data from /home/runner/.hydromt_data/artifact_data/v0.0.6/rgi.gpkg
2022-08-10 11:48:06,619 - build - geodataframe - INFO - GeoDataFrame: Read vector data and clip to geom (epsg:4326) [11.775, 45.804, 12.745, 46.690].
2022-08-10 11:48:06,639 - build - wflow - INFO - 1 glaciers of sufficient size found within region.
2022-08-10 11:48:06,651 - build - glaciers - DEBUG - Creating vector grid for calculating glacier fraction and storage per grid cell
2022-08-10 11:48:06,847 - build - glaciers - DEBUG - Setting glacierfrac and store values per glacier.
2022-08-10 11:48:09,654 - build - model_api - INFO - setup_lulcmaps.lulc_fn: globcover
2022-08-10 11:48:09,655 - build - model_api - INFO - setup_lulcmaps.lulc_mapping_fn: None
2022-08-10 11:48:09,655 - build - model_api - INFO - setup_lulcmaps.lulc_vars: ['landuse', 'Kext', 'N', 'PathFrac', 'RootingDepth', 'Sl', 'Swood', 'WaterFrac']
2022-08-10 11:48:09,655 - build - wflow - INFO - Preparing LULC parameter maps.
2022-08-10 11:48:09,655 - build - data_catalog - INFO - DataCatalog: Getting globcover RasterDataset raster data from /home/runner/.hydromt_data/artifact_data/v0.0.6/globcover.tif
2022-08-10 11:48:09,671 - build - rasterdataset - DEBUG - RasterDataset: Clip with geom - [11.778, 45.807, 12.745, 46.690]
2022-08-10 11:48:09,691 - build - landuse - INFO - Deriving landuse using nearest resampling (nodata=230).
2022-08-10 11:48:09,733 - build - landuse - INFO - Deriving Kext using average resampling (nodata=-999.0).
2022-08-10 11:48:09,773 - build - landuse - INFO - Deriving N using average resampling (nodata=-999.0).
2022-08-10 11:48:09,813 - build - landuse - INFO - Deriving PathFrac using average resampling (nodata=-999.0).
2022-08-10 11:48:09,853 - build - landuse - INFO - Deriving RootingDepth using average resampling (nodata=-999.0).
2022-08-10 11:48:09,891 - build - landuse - INFO - Deriving Sl using average resampling (nodata=-999.0).
2022-08-10 11:48:09,930 - build - landuse - INFO - Deriving Swood using average resampling (nodata=-999.0).
2022-08-10 11:48:09,970 - build - landuse - INFO - Deriving WaterFrac using average resampling (nodata=-999.0).
2022-08-10 11:48:10,018 - build - model_api - INFO - setup_laimaps.lai_fn: modis_lai
2022-08-10 11:48:10,018 - build - wflow - INFO - Preparing LAI maps.
2022-08-10 11:48:10,018 - build - data_catalog - INFO - DataCatalog: Getting modis_lai RasterDataset netcdf data from /home/runner/.hydromt_data/artifact_data/v0.0.6/modis_lai.nc
2022-08-10 11:48:10,027 - build - rasterdataset - DEBUG - RasterDataset: Clip with geom - [11.778, 45.807, 12.745, 46.690]
2022-08-10 11:48:10,038 - build - rasterdataset - DEBUG - RasterDataset: Convert units for 1 variables.
2022-08-10 11:48:10,045 - build - landuse - INFO - Deriving LAI using average resampling (nodata=nan).
2022-08-10 11:48:10,090 - build - model_api - INFO - setup_soilmaps.soil_fn: soilgrids
2022-08-10 11:48:10,090 - build - model_api - INFO - setup_soilmaps.ptf_ksatver: brakensiek
2022-08-10 11:48:10,090 - build - wflow - INFO - Preparing soil parameter maps.
2022-08-10 11:48:10,090 - build - data_catalog - INFO - DataCatalog: Getting soilgrids RasterDataset raster data from /home/runner/.hydromt_data/artifact_data/v0.0.6/soilgrids/{variable}.tif
2022-08-10 11:48:10,510 - build - rasterdataset - DEBUG - RasterDataset: Clip with geom - [11.778, 45.807, 12.745, 46.690]
2022-08-10 11:48:10,530 - build - rasterdataset - DEBUG - RasterDataset: Convert units for 21 variables.
2022-08-10 11:48:10,876 - build - soilgrids - INFO - calculate and resample thetaS
2022-08-10 11:48:11,020 - build - soilgrids - INFO - calculate and resample thetaR
2022-08-10 11:48:11,194 - build - soilgrids - INFO - calculate and resample KsatVer
2022-08-10 11:48:11,228 - build - soilgrids - INFO - calculate and resample pore size distribution index
2022-08-10 11:48:11,298 - build - soilgrids - INFO - fit z - log(KsatVer) with numpy linalg regression (y = b*x) -> M_
2022-08-10 11:48:11,894 - build - soilgrids - INFO - fit zi - Ksat with curve_fit (scipy.optimize) -> M
2022-08-10 11:48:15,194 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for thetaS
2022-08-10 11:48:15,365 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for thetaR
2022-08-10 11:48:15,505 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for SoilThickness
2022-08-10 11:48:15,524 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for SoilMinThickness
2022-08-10 11:48:15,542 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for c
2022-08-10 11:48:15,736 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer
2022-08-10 11:48:15,789 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_0.0cm
2022-08-10 11:48:15,841 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_5.0cm
2022-08-10 11:48:15,891 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_15.0cm
2022-08-10 11:48:15,941 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_30.0cm
2022-08-10 11:48:15,991 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_60.0cm
2022-08-10 11:48:16,043 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_100.0cm
2022-08-10 11:48:16,095 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_200.0cm
2022-08-10 11:48:16,147 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for M_original_
2022-08-10 11:48:16,344 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for M_
2022-08-10 11:48:16,553 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for f_
2022-08-10 11:48:16,769 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for M_original
2022-08-10 11:48:16,977 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for M
2022-08-10 11:48:17,183 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for f
2022-08-10 11:48:17,386 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for wflow_soil
2022-08-10 11:48:17,545 - build - model_api - INFO - setup_gauges.gauges_fn: grdc
2022-08-10 11:48:17,545 - build - model_api - INFO - setup_gauges.source_gdf: None
2022-08-10 11:48:17,545 - build - model_api - INFO - setup_gauges.index_col: None
2022-08-10 11:48:17,545 - build - model_api - INFO - setup_gauges.snap_to_river: True
2022-08-10 11:48:17,545 - build - model_api - INFO - setup_gauges.mask: None
2022-08-10 11:48:17,545 - build - model_api - INFO - setup_gauges.derive_subcatch: False
2022-08-10 11:48:17,545 - build - model_api - INFO - setup_gauges.derive_outlet: True
2022-08-10 11:48:17,545 - build - model_api - INFO - setup_gauges.basename: None
2022-08-10 11:48:17,545 - build - model_api - INFO - setup_gauges.update_toml: True
2022-08-10 11:48:17,545 - build - model_api - INFO - setup_gauges.gauge_toml_header: None
2022-08-10 11:48:17,545 - build - model_api - INFO - setup_gauges.gauge_toml_param: None
2022-08-10 11:48:17,545 - build - wflow - INFO - Gauges locations set based on river outlets.
2022-08-10 11:48:17,553 - build - wflow - INFO - Gauges map based on catchment river outlets added.
2022-08-10 11:48:17,553 - build - data_catalog - INFO - DataCatalog: Getting grdc GeoDataFrame csv data from /home/runner/.hydromt_data/artifact_data/v0.0.6/grdc.csv
2022-08-10 11:48:17,556 - build - geodataframe - INFO - GeoDataFrame: Read csv data and clip to geom (epsg:4326) [11.775, 45.804, 12.745, 46.690].
2022-08-10 11:48:17,571 - build - wflow - INFO - 3 grdc gauge locations found within domain
2022-08-10 11:48:17,988 - build - wflow - INFO - Gauges map from grdc added.
2022-08-10 11:48:17,989 - build - model_api - INFO - setup_precip_forcing.precip_fn: era5
2022-08-10 11:48:17,989 - build - model_api - INFO - setup_precip_forcing.precip_clim_fn: None
2022-08-10 11:48:17,989 - build - model_api - INFO - setup_precip_forcing.chunksize: None
2022-08-10 11:48:17,989 - build - data_catalog - INFO - DataCatalog: Getting era5 RasterDataset netcdf data from /home/runner/.hydromt_data/artifact_data/v0.0.6/era5.nc
2022-08-10 11:48:18,003 - build - rasterdataset - DEBUG - RasterDataset: Shifting time labels with 86400 sec.
2022-08-10 11:48:18,004 - build - rasterdataset - DEBUG - RasterDataset: Slicing time dim ('2010-01-01T00:00:00', '2010-03-31T00:00:00')
2022-08-10 11:48:18,012 - build - rasterdataset - DEBUG - RasterDataset: Clip with geom - [11.778, 45.807, 12.745, 46.690]
2022-08-10 11:48:18,024 - build - rasterdataset - DEBUG - RasterDataset: Convert units for 1 variables.
2022-08-10 11:48:18,075 - build - model_api - INFO - setup_temp_pet_forcing.temp_pet_fn: era5
2022-08-10 11:48:18,076 - build - model_api - INFO - setup_temp_pet_forcing.pet_method: debruin
2022-08-10 11:48:18,076 - build - model_api - INFO - setup_temp_pet_forcing.press_correction: True
2022-08-10 11:48:18,076 - build - model_api - INFO - setup_temp_pet_forcing.temp_correction: True
2022-08-10 11:48:18,076 - build - model_api - INFO - setup_temp_pet_forcing.dem_forcing_fn: era5_orography
2022-08-10 11:48:18,076 - build - model_api - INFO - setup_temp_pet_forcing.skip_pet: False
2022-08-10 11:48:18,076 - build - model_api - INFO - setup_temp_pet_forcing.chunksize: None
2022-08-10 11:48:18,076 - build - data_catalog - INFO - DataCatalog: Getting era5 RasterDataset netcdf data from /home/runner/.hydromt_data/artifact_data/v0.0.6/era5.nc
2022-08-10 11:48:18,087 - build - rasterdataset - DEBUG - RasterDataset: Shifting time labels with 86400 sec.
2022-08-10 11:48:18,088 - build - rasterdataset - DEBUG - RasterDataset: Slicing time dim ('2010-01-01T00:00:00', '2010-03-31T00:00:00')
2022-08-10 11:48:18,094 - build - rasterdataset - DEBUG - RasterDataset: Clip with geom - [11.778, 45.807, 12.745, 46.690]
2022-08-10 11:48:18,108 - build - rasterdataset - DEBUG - RasterDataset: Convert units for 4 variables.
2022-08-10 11:48:18,136 - build - data_catalog - INFO - DataCatalog: Getting era5_orography RasterDataset netcdf data from /home/runner/.hydromt_data/artifact_data/v0.0.6/era5_orography.nc
2022-08-10 11:48:18,148 - build - rasterdataset - DEBUG - RasterDataset: Clip with geom - [11.625, 45.625, 12.875, 46.875]
2022-08-10 11:48:18,160 - build - rasterdataset - DEBUG - RasterDataset: Convert units for 1 variables.
2022-08-10 11:48:18,440 - build - model_api - INFO - setup_constant_pars.dtype: float32
2022-08-10 11:48:18,440 - build - model_api - INFO - setup_constant_pars.nodata: -999
2022-08-10 11:48:18,440 - build - model_api - INFO - setup_constant_pars.KsatHorFrac: 100
2022-08-10 11:48:18,440 - build - model_api - INFO - setup_constant_pars.Cfmax: 3.75653
2022-08-10 11:48:18,440 - build - model_api - INFO - setup_constant_pars.cf_soil: 0.038
2022-08-10 11:48:18,440 - build - model_api - INFO - setup_constant_pars.EoverR: 0.11
2022-08-10 11:48:18,440 - build - model_api - INFO - setup_constant_pars.InfiltCapPath: 5
2022-08-10 11:48:18,440 - build - model_api - INFO - setup_constant_pars.InfiltCapSoil: 600
2022-08-10 11:48:18,440 - build - model_api - INFO - setup_constant_pars.MaxLeakage: 0
2022-08-10 11:48:18,440 - build - model_api - INFO - setup_constant_pars.rootdistpar: -500
2022-08-10 11:48:18,440 - build - model_api - INFO - setup_constant_pars.TT: 0
2022-08-10 11:48:18,440 - build - model_api - INFO - setup_constant_pars.TTI: 2
2022-08-10 11:48:18,440 - build - model_api - INFO - setup_constant_pars.TTM: 0
2022-08-10 11:48:18,441 - build - model_api - INFO - setup_constant_pars.WHC: 0.1
2022-08-10 11:48:18,441 - build - model_api - INFO - setup_constant_pars.G_Cfmax: 5.3
2022-08-10 11:48:18,441 - build - model_api - INFO - setup_constant_pars.G_SIfrac: 0.002
2022-08-10 11:48:18,441 - build - model_api - INFO - setup_constant_pars.G_TT: 1.3
2022-08-10 11:48:18,491 - build - wflow - INFO - Write model data to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_full
2022-08-10 11:48:18,501 - build - model_api - INFO - Writing model config to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_full/wflow_sbm.toml
2022-08-10 11:48:18,555 - build - wflow - INFO - Write staticmaps to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_full/staticmaps.nc
2022-08-10 11:48:18,915 - build - wflow - INFO - Writing model staticgeom to file.
2022-08-10 11:48:19,037 - build - wflow - INFO - Write forcing file
2022-08-10 11:48:19,044 - 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.
2022-08-10 11:48:19,044 - build - model_api - INFO - Writing model config to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_full/wflow_sbm.toml
2022-08-10 11:48:19,057 - 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 | 102.45 ms

With this example we build a complete Wflow model including forcing. Compared to the previous hydromt build we have added: * -i wflow_build.ini : setup configuration file including all components to build and their arguments

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 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.

[6]:
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
 - hydromt.log
 - staticmaps.nc
 - hydromt_data.yml
 - wflow_sbm.toml
 - inmaps-era5-2010.nc
wflow_test_full/run_default
wflow_test_full/instate
wflow_test_full/staticgeoms
 - gauges.geojson
 - basins.geojson
 - region.geojson
 - glaciers.geojson
 - rivers.geojson
 - gauges_grdc.geojson

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.