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

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

  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

  To build a wflow model based on basin ID
  hydromt build wflow /path/to/model_root "{'basin': 230001006}"

  To build a sfincs model based on a bbox (for Texel)
  hydromt build sfincs /path/to/model_root "{'bbox': [4.6891,52.9750,4.9576,53.1994]}"

Options:
  -r, --res FLOAT             Model resolution in model src.
  --build-base / --build-all  Deprecated!
  --opt TEXT                  Component specific keyword arguments, see the
                              setup_<component> method 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 PATH             File path to yml data sources file. See
                              documentation for required yml file format.

  --dd, --deltares-data       Parse default deltares data yml from
                              https://github.com/DirkEilander/hydromt-
                              artifacts/releases

  -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
2021-10-04 11:18:54,513 - build - log - INFO - HydroMT version: 0.4.4.dev
2021-10-04 11:18:54,514 - build - main - INFO - Building instance of wflow model at /home/runner/work/hydromt_wflow/hydromt_wflow/docs/examples/examples/wflow_test_base.
2021-10-04 11:18:54,514 - build - main - INFO - User settings:
2021-10-04 11:18:54,549 - build - model_api - INFO - Initializing wflow model from hydromt_wflow (v0.1.3).
2021-10-04 11:18:54,550 - build - model_api - INFO - setup_basemaps.region: {'subbasin': [12.2051, 45.8331], 'strord': 4, 'bounds': [11.7, 45.35, 12.95, 46.7]}
2021-10-04 11:18:54,550 - build - model_api - INFO - setup_basemaps.res: 0.00833
2021-10-04 11:18:54,550 - build - model_api - INFO - setup_basemaps.hydrography_fn: merit_hydro
2021-10-04 11:18:54,550 - build - model_api - INFO - setup_basemaps.basin_index_fn: merit_hydro_index
2021-10-04 11:18:54,550 - build - model_api - INFO - setup_basemaps.upscale_method: ihu
2021-10-04 11:18:54,550 - build - wflow - INFO - Preparing base hydrography basemaps.
2021-10-04 11:18:54,913 - build - data_adapter - INFO - Downloading file to /home/runner/.hydromt_data/data/v0.0.5/data.tar.gz
2021-10-04 11:18:57,229 - build - data_adapter - INFO - Adding sample data v0.0.5 from artifacts
2021-10-04 11:18:57,297 - build - data_adapter - INFO - DataCatalog: Getting merit_hydro RasterDataset raster data from /home/runner/.hydromt_data/data/v0.0.5/merit_hydro/{variable}.tif
2021-10-04 11:19:01,165 - build - basin_mask - INFO - basin bbox: [11.7750, 45.8042, 12.7450, 46.6900] / size: 664756
2021-10-04 11:19:01,398 - build - basemaps - INFO - Upscale flow direction data: 10x, ihu method.
2021-10-04 11:19:17,337 - build - wflow - INFO - Write model data to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/examples/examples/wflow_test_base
2021-10-04 11:19:17,341 - build - model_api - INFO - Writing model config to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/examples/examples/wflow_test_base/wflow_sbm.toml
2021-10-04 11:19:17,342 - build - wflow - INFO - Write staticmaps to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/examples/examples/wflow_test_base/staticmaps.nc
2021-10-04 11:19:17,448 - build - wflow - INFO - Writing model staticgeom to file.

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 components are build and in which order and optionally sets non-default arguments for each component. 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(build_configuration).

Each header as shown between [...] (e.g. [setup_basemaps]) corresponds to a model component. All model components 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 match basemaps source
river_upa       = 30            # minimum upstream area threshold for the river map [km2]
slope_len       = 2000          # length over which tp calculate river slope [m]

[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_riverwidth]
precip_fn       = chelsa        # source for precip climatology used to estimate discharge: {chelsa}
climate_fn      = koppen_geiger # source for climate classification used to estimate discharge: {koppen_geiger}
predictor       = discharge     # predictor used in power-law w=a*predictor^b {'discharge'; 'uparea', other staticmaps}; a and b can also be set here.
fill            = False         # if False all river width values are set based on predictor, if True only data gaps and lakes/reservoirs in observed width are filled (works only with MERIT hydro)
min_wth         = 1             # global minimum width

[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
2021-10-04 11:19:20,611 - build - log - DEBUG - Writing log messages to new file /home/runner/work/hydromt_wflow/hydromt_wflow/docs/examples/examples/wflow_test_full/hydromt.log.
2021-10-04 11:19:20,611 - build - log - INFO - HydroMT version: 0.4.4.dev
2021-10-04 11:19:20,611 - build - main - INFO - Building instance of wflow model at /home/runner/work/hydromt_wflow/hydromt_wflow/docs/examples/examples/wflow_test_full.
2021-10-04 11:19:20,611 - build - main - INFO - User settings:
2021-10-04 11:19:20,650 - build - model_plugins - DEBUG - Loaded model plugin 'wflow = hydromt_wflow.wflow.WflowModel' (0.1.3)
2021-10-04 11:19:20,650 - build - model_api - INFO - Initializing wflow model from hydromt_wflow (v0.1.3).
2021-10-04 11:19:20,651 - build - model_api - DEBUG - Setting model config options.
2021-10-04 11:19:20,653 - 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
2021-10-04 11:19:20,653 - build - model_api - INFO - setup_basemaps.region: {'subbasin': [12.2051, 45.8331], 'strord': 4, 'bounds': [11.7, 45.35, 12.95, 46.7]}
2021-10-04 11:19:20,653 - build - model_api - INFO - setup_basemaps.res: 0.00833
2021-10-04 11:19:20,653 - build - model_api - INFO - setup_basemaps.hydrography_fn: merit_hydro
2021-10-04 11:19:20,653 - build - model_api - INFO - setup_basemaps.basin_index_fn: merit_hydro_index
2021-10-04 11:19:20,653 - build - model_api - INFO - setup_basemaps.upscale_method: ihu
2021-10-04 11:19:20,653 - build - wflow - INFO - Preparing base hydrography basemaps.
2021-10-04 11:19:20,653 - build - data_adapter - INFO - Adding sample data v0.0.5 from artifacts
2021-10-04 11:19:20,721 - build - data_adapter - INFO - DataCatalog: Getting merit_hydro RasterDataset raster data from /home/runner/.hydromt_data/data/v0.0.5/merit_hydro/{variable}.tif
2021-10-04 11:19:20,798 - build - basin_mask - DEBUG - Parsed region (kind=subbasin): {'strord': 4, 'bounds': [11.7, 45.35, 12.95, 46.7], 'xy': [12.2051, 45.8331]}
2021-10-04 11:19:24,552 - build - basin_mask - INFO - basin bbox: [11.7750, 45.8042, 12.7450, 46.6900] / size: 664756
2021-10-04 11:19:24,631 - build - wflow - DEBUG - Adding basins vector to staticgeoms.
2021-10-04 11:19:24,631 - build - basemaps - DEBUG - Mask in dataset assumed to represent subbasins.
2021-10-04 11:19:24,632 - build - basemaps - DEBUG - (Sub)basin at original resolution has 664756 cells.
2021-10-04 11:19:24,774 - build - basemaps - DEBUG - Burn subbasin outlet in upstream area data.
2021-10-04 11:19:24,785 - build - basemaps - INFO - Upscale flow direction data: 10x, ihu method.
2021-10-04 11:19:40,406 - build - basemaps - DEBUG - Derive stream order.
2021-10-04 11:19:40,649 - build - basemaps - DEBUG - Map shape: (106, 116); active cells: 6637.
2021-10-04 11:19:40,649 - build - basemaps - DEBUG - Outlet coordinates (1/1): (12.20750,45.83583).
2021-10-04 11:19:40,713 - build - wflow - DEBUG - Adding region vector to staticgeoms.
2021-10-04 11:19:40,717 - build - model_api - INFO - setup_rivers.hydrography_fn: merit_hydro
2021-10-04 11:19:40,717 - build - model_api - INFO - setup_rivers.river_upa: 30
2021-10-04 11:19:40,717 - build - model_api - INFO - setup_rivers.slope_len: 2000
2021-10-04 11:19:40,717 - build - model_api - INFO - setup_rivers.n_river_mapping: None
2021-10-04 11:19:40,717 - build - model_api - INFO - setup_rivers.min_rivlen_ratio: 0.1
2021-10-04 11:19:40,717 - build - wflow - INFO - Preparing river maps.
2021-10-04 11:19:40,717 - build - data_adapter - INFO - DataCatalog: Getting merit_hydro RasterDataset raster data from /home/runner/.hydromt_data/data/v0.0.5/merit_hydro/{variable}.tif
2021-10-04 11:19:40,781 - build - data_adapter - DEBUG - RasterDataset: Clip with geom - [11.778, 45.807, 12.745, 46.690]
2021-10-04 11:19:40,796 - build - river - DEBUG - Set river mask with upstream area threshold: 30 km2.
2021-10-04 11:19:40,806 - build - river - DEBUG - Derive river length.
2021-10-04 11:19:51,777 - build - river - DEBUG - Derive river slope.
2021-10-04 11:19:52,516 - build - landuse - INFO - Deriving N_River using average resampling (nodata=-999.0).
2021-10-04 11:19:52,528 - build - wflow - DEBUG - Adding rivers vector to staticgeoms.
2021-10-04 11:19:53,549 - build - model_api - INFO - setup_reservoirs.reservoirs_fn: hydro_reservoirs
2021-10-04 11:19:53,549 - build - model_api - INFO - setup_reservoirs.min_area: 1.0
2021-10-04 11:19:53,550 - build - model_api - INFO - setup_reservoirs.priority_jrc: True
2021-10-04 11:19:53,550 - build - wflow - INFO - Preparing reservoir maps.
2021-10-04 11:19:53,550 - build - data_adapter - INFO - DataCatalog: Getting hydro_reservoirs GeoDataFrame vector data from /home/runner/.hydromt_data/data/v0.0.5/hydro_reservoirs.gpkg
2021-10-04 11:19:53,554 - build - data_adapter - INFO - GeoDataFrame: Read vector data and clip to geom (epsg:4326) [11.775, 45.804, 12.745, 46.690].
2021-10-04 11:19:53,584 - build - data_adapter - DEBUG - GeoDataFrame: Convert units for 5 columns.
2021-10-04 11:19:53,587 - build - wflow - WARNING - No reservoirs of sufficient size found within region! Skipping reservoir procedures!
2021-10-04 11:19:53,587 - build - model_api - INFO - setup_lakes.lakes_fn: hydro_lakes
2021-10-04 11:19:53,587 - build - model_api - INFO - setup_lakes.min_area: 10.0
2021-10-04 11:19:53,587 - build - wflow - INFO - Preparing lake maps.
2021-10-04 11:19:53,587 - build - data_adapter - INFO - DataCatalog: Getting hydro_lakes GeoDataFrame vector data from /home/runner/.hydromt_data/data/v0.0.5/hydro_lakes.gpkg
2021-10-04 11:19:53,592 - build - data_adapter - INFO - GeoDataFrame: Read vector data and clip to geom (epsg:4326) [11.775, 45.804, 12.745, 46.690].
2021-10-04 11:19:53,615 - build - data_adapter - DEBUG - GeoDataFrame: Convert units for 1 columns.
2021-10-04 11:19:53,616 - build - wflow - WARNING - No lakes of sufficient size found within region! Skipping lake procedures!
2021-10-04 11:19:53,617 - build - model_api - INFO - setup_glaciers.glaciers_fn: rgi
2021-10-04 11:19:53,617 - build - model_api - INFO - setup_glaciers.min_area: 1.0
2021-10-04 11:19:53,617 - build - wflow - INFO - Preparing glacier maps.
2021-10-04 11:19:53,617 - build - data_adapter - INFO - DataCatalog: Getting rgi GeoDataFrame vector data from /home/runner/.hydromt_data/data/v0.0.5/rgi.gpkg
2021-10-04 11:19:53,621 - build - data_adapter - INFO - GeoDataFrame: Read vector data and clip to geom (epsg:4326) [11.775, 45.804, 12.745, 46.690].
2021-10-04 11:19:53,652 - build - wflow - INFO - 1 glaciers of sufficient size found within region.
2021-10-04 11:19:53,666 - build - glaciers - DEBUG - Creating vector grid for calculating glacier fraction and storage per grid cell
2021-10-04 11:19:53,842 - build - glaciers - DEBUG - Setting glacierfrac and store values per glacier.
2021-10-04 11:19:55,502 - build - model_api - INFO - setup_riverwidth.predictor: discharge
2021-10-04 11:19:55,502 - build - model_api - INFO - setup_riverwidth.fill: False
2021-10-04 11:19:55,502 - build - model_api - INFO - setup_riverwidth.fit: False
2021-10-04 11:19:55,502 - build - model_api - INFO - setup_riverwidth.min_wth: 1
2021-10-04 11:19:55,502 - build - model_api - INFO - setup_riverwidth.precip_fn: chelsa
2021-10-04 11:19:55,502 - build - model_api - INFO - setup_riverwidth.climate_fn: koppen_geiger
2021-10-04 11:19:55,502 - build - data_adapter - INFO - DataCatalog: Getting chelsa RasterDataset raster data from /home/runner/.hydromt_data/data/v0.0.5/chelsa.tif
2021-10-04 11:19:55,513 - build - data_adapter - DEBUG - RasterDataset: Clip with geom - [11.778, 45.807, 12.745, 46.690]
2021-10-04 11:19:55,523 - build - data_adapter - INFO - DataCatalog: Getting koppen_geiger RasterDataset raster data from /home/runner/.hydromt_data/data/v0.0.5/koppen_geiger.tif
2021-10-04 11:19:55,533 - build - data_adapter - DEBUG - RasterDataset: Clip with geom - [11.778, 45.807, 12.745, 46.690]
2021-10-04 11:19:55,544 - build - river - DEBUG - Deriving predictor "discharge" values
2021-10-04 11:19:55,549 - build - river - DEBUG - Basin base climate classification: 3 (Cfb)
2021-10-04 11:19:55,591 - build - river - WARNING - mask variable "lakeareas" not found in maps.
2021-10-04 11:19:55,591 - build - river - WARNING - mask variable "resareas" not found in maps.
2021-10-04 11:19:55,591 - build - river - DEBUG - glacareas masked out in rivwth data.
2021-10-04 11:19:55,591 - build - river - INFO - Using "width = a*discharge^b"; where a=6.33, b=0.55 (nse=-0.447; outliers=6.09%)
2021-10-04 11:19:55,592 - build - river - INFO - rivwth set globally based on width-discharge relationship.
2021-10-04 11:19:55,594 - build - model_api - INFO - setup_lulcmaps.lulc_fn: globcover
2021-10-04 11:19:55,594 - build - model_api - INFO - setup_lulcmaps.lulc_mapping_fn: None
2021-10-04 11:19:55,594 - build - model_api - INFO - setup_lulcmaps.lulc_vars: ['landuse', 'Kext', 'N', 'PathFrac', 'RootingDepth', 'Sl', 'Swood', 'WaterFrac']
2021-10-04 11:19:55,594 - build - wflow - INFO - Preparing LULC parameter maps.
2021-10-04 11:19:55,594 - build - data_adapter - INFO - DataCatalog: Getting globcover RasterDataset raster data from /home/runner/.hydromt_data/data/v0.0.5/globcover.tif
2021-10-04 11:19:55,605 - build - data_adapter - DEBUG - RasterDataset: Clip with geom - [11.778, 45.807, 12.745, 46.690]
2021-10-04 11:19:55,624 - build - landuse - INFO - Deriving landuse using nearest resampling (nodata=230).
2021-10-04 11:19:55,667 - build - landuse - INFO - Deriving Kext using average resampling (nodata=-999.0).
2021-10-04 11:19:55,712 - build - landuse - INFO - Deriving N using average resampling (nodata=-999.0).
2021-10-04 11:19:55,754 - build - landuse - INFO - Deriving PathFrac using average resampling (nodata=-999.0).
2021-10-04 11:19:55,799 - build - landuse - INFO - Deriving RootingDepth using average resampling (nodata=-999).
2021-10-04 11:19:55,844 - build - landuse - INFO - Deriving Sl using average resampling (nodata=-999.0).
2021-10-04 11:19:55,888 - build - landuse - INFO - Deriving Swood using average resampling (nodata=-999.0).
2021-10-04 11:19:55,933 - build - landuse - INFO - Deriving WaterFrac using average resampling (nodata=-999).
2021-10-04 11:19:55,986 - build - model_api - INFO - setup_laimaps.lai_fn: modis_lai
2021-10-04 11:19:55,986 - build - wflow - INFO - Preparing LAI maps.
2021-10-04 11:19:55,986 - build - data_adapter - INFO - DataCatalog: Getting modis_lai RasterDataset netcdf data from /home/runner/.hydromt_data/data/v0.0.5/modis_lai.nc
2021-10-04 11:19:55,999 - build - data_adapter - DEBUG - RasterDataset: Clip with geom - [11.778, 45.807, 12.745, 46.690]
2021-10-04 11:19:56,010 - build - data_adapter - DEBUG - RasterDataset: Convert units for 1 variables.
2021-10-04 11:19:56,018 - build - landuse - INFO - Deriving LAI using average resampling (nodata=None).
2021-10-04 11:19:56,084 - build - model_api - INFO - setup_soilmaps.soil_fn: soilgrids
2021-10-04 11:19:56,084 - build - model_api - INFO - setup_soilmaps.ptf_ksatver: brakensiek
2021-10-04 11:19:56,084 - build - wflow - INFO - Preparing soil parameter maps.
2021-10-04 11:19:56,085 - build - data_adapter - INFO - DataCatalog: Getting soilgrids RasterDataset raster data from /home/runner/.hydromt_data/data/v0.0.5/soilgrids/{variable}.tif
2021-10-04 11:19:56,413 - build - data_adapter - DEBUG - RasterDataset: Clip with geom - [11.778, 45.807, 12.745, 46.690]
2021-10-04 11:19:56,436 - build - data_adapter - DEBUG - RasterDataset: Convert units for 21 variables.
2021-10-04 11:19:56,826 - build - soilgrids - INFO - calculate and resample thetaS
2021-10-04 11:19:57,363 - build - soilgrids - INFO - calculate and resample thetaR
2021-10-04 11:19:58,110 - build - soilgrids - INFO - calculate and resample KsatVer
2021-10-04 11:19:59,975 - build - soilgrids - INFO - calculate and resample pore size distribution index
2021-10-04 11:20:01,870 - build - soilgrids - INFO - fit z - log(KsatVer) with numpy linalg regression (y = b*x) -> M_
2021-10-04 11:20:02,239 - build - soilgrids - INFO - fit zi - Ksat with curve_fit (scipy.optimize) -> M
2021-10-04 11:20:05,940 - build - model_api - INFO - setup_gauges.gauges_fn: grdc
2021-10-04 11:20:05,941 - build - model_api - INFO - setup_gauges.source_gdf: None
2021-10-04 11:20:05,941 - build - model_api - INFO - setup_gauges.snap_to_river: True
2021-10-04 11:20:05,941 - build - model_api - INFO - setup_gauges.mask: None
2021-10-04 11:20:05,941 - build - model_api - INFO - setup_gauges.derive_subcatch: False
2021-10-04 11:20:05,941 - build - model_api - INFO - setup_gauges.derive_outlet: True
2021-10-04 11:20:05,941 - build - model_api - INFO - setup_gauges.basename: None
2021-10-04 11:20:05,941 - build - model_api - INFO - setup_gauges.update_toml: True
2021-10-04 11:20:05,941 - build - model_api - INFO - setup_gauges.gauge_toml_header: None
2021-10-04 11:20:05,941 - build - model_api - INFO - setup_gauges.gauge_toml_param: None
2021-10-04 11:20:05,941 - build - wflow - INFO - Gauges locations set based on river outlets.
2021-10-04 11:20:05,949 - build - wflow - INFO - Gauges map based on catchment river outlets added.
2021-10-04 11:20:05,949 - build - data_adapter - INFO - DataCatalog: Getting grdc GeoDataFrame csv data from /home/runner/.hydromt_data/data/v0.0.5/grdc.csv
2021-10-04 11:20:05,953 - build - data_adapter - INFO - GeoDataFrame: Read csv data and clip to geom (epsg:4326) [11.775, 45.804, 12.745, 46.690].
2021-10-04 11:20:05,971 - build - wflow - INFO - 3 grdc gauge locations found within domain
2021-10-04 11:20:05,979 - build - wflow - INFO - Gauges map from grdc added.
2021-10-04 11:20:05,980 - build - model_api - INFO - setup_precip_forcing.precip_fn: era5
2021-10-04 11:20:05,980 - build - model_api - INFO - setup_precip_forcing.precip_clim_fn: None
2021-10-04 11:20:05,980 - build - model_api - INFO - setup_precip_forcing.chunksize: None
2021-10-04 11:20:05,980 - build - data_adapter - INFO - DataCatalog: Getting era5 RasterDataset netcdf data from /home/runner/.hydromt_data/data/v0.0.5/era5.nc
2021-10-04 11:20:05,993 - build - data_adapter - DEBUG - RasterDataset: Shifting time labels with 86400 sec.
2021-10-04 11:20:05,994 - build - data_adapter - DEBUG - RasterDataset: Slicing time dim ('2010-01-01T00:00:00', '2010-03-31T00:00:00')
2021-10-04 11:20:06,004 - build - data_adapter - DEBUG - RasterDataset: Clip with geom - [11.778, 45.807, 12.745, 46.690]
2021-10-04 11:20:06,014 - build - data_adapter - DEBUG - RasterDataset: Convert units for 1 variables.
2021-10-04 11:20:06,064 - build - model_api - INFO - setup_temp_pet_forcing.temp_pet_fn: era5
2021-10-04 11:20:06,064 - build - model_api - INFO - setup_temp_pet_forcing.pet_method: debruin
2021-10-04 11:20:06,064 - build - model_api - INFO - setup_temp_pet_forcing.press_correction: True
2021-10-04 11:20:06,064 - build - model_api - INFO - setup_temp_pet_forcing.temp_correction: True
2021-10-04 11:20:06,064 - build - model_api - INFO - setup_temp_pet_forcing.dem_forcing_fn: era5_orography
2021-10-04 11:20:06,064 - build - model_api - INFO - setup_temp_pet_forcing.skip_pet: False
2021-10-04 11:20:06,064 - build - model_api - INFO - setup_temp_pet_forcing.chunksize: None
2021-10-04 11:20:06,065 - build - data_adapter - INFO - DataCatalog: Getting era5 RasterDataset netcdf data from /home/runner/.hydromt_data/data/v0.0.5/era5.nc
2021-10-04 11:20:06,074 - build - data_adapter - DEBUG - RasterDataset: Shifting time labels with 86400 sec.
2021-10-04 11:20:06,075 - build - data_adapter - DEBUG - RasterDataset: Slicing time dim ('2010-01-01T00:00:00', '2010-03-31T00:00:00')
2021-10-04 11:20:06,083 - build - data_adapter - DEBUG - RasterDataset: Clip with geom - [11.778, 45.807, 12.745, 46.690]
2021-10-04 11:20:06,095 - build - data_adapter - DEBUG - RasterDataset: Convert units for 4 variables.
2021-10-04 11:20:06,125 - build - data_adapter - INFO - DataCatalog: Getting era5_orography RasterDataset netcdf data from /home/runner/.hydromt_data/data/v0.0.5/era5_orography.nc
2021-10-04 11:20:06,137 - build - data_adapter - DEBUG - RasterDataset: Clip with geom - [11.625, 45.625, 12.875, 46.875]
2021-10-04 11:20:06,149 - build - data_adapter - DEBUG - RasterDataset: Convert units for 1 variables.
2021-10-04 11:20:06,469 - build - wflow - INFO - Write model data to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/examples/examples/wflow_test_full
2021-10-04 11:20:06,482 - build - model_api - INFO - Writing model config to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/examples/examples/wflow_test_full/wflow_sbm.toml
2021-10-04 11:20:06,482 - build - wflow - INFO - Write staticmaps to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/examples/examples/wflow_test_full/staticmaps.nc
2021-10-04 11:20:06,923 - build - wflow - INFO - Writing model staticgeom to file.
2021-10-04 11:20:07,043 - build - wflow - INFO - Write forcing file
2021-10-04 11:20:07,049 - build - wflow - INFO - Process forcing; saving to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/examples/examples/wflow_test_full/inmaps-era5-2010.nc
[########################################] | 100% Completed |  0.1s

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