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.7.1.dev0)
- wflow_sediment (hydromt_wflow 0.7.1.dev0)
generic models (hydromt 0.10.0):
- 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: hydro_rivers_lin # river source data with river width and bankfull discharge
river_upa: 30 # minimum upstream area threshold for the river map [km2]
rivdph_method: powlaw # method to estimate depth {'powlaw', 'manning', 'gvf'}
min_rivdph: 1 # minimum river depth [m]
min_rivwth: 30 # minimum river width [m]
slope_len: 2000 # length over which tp calculate river slope [m]
smooth_len: 5000 # length over which to smooth river depth and river width [m]
river_routing: kinematic-wave # {'kinematic-wave', 'local-inertial'}
# setup_floodplains: # if 2D floodplains are required
# hydrography_fn: merit_hydro # source hydrography data, should correspond to hydrography_fn in setup_basemaps
# floodplain_type: 2d # # If two-dimensional floodplains are required
# elevtn_map: wflow_dem # {'wflow_dem', 'dem_subgrid'}
# setup_floodplains: # if 1D floodplains are required
# hydrography_fn: merit_hydro # source hydrography data, should correspond to hydrography_fn in setup_basemaps
# floodplain_type: 1d # If one-dimensional floodplains are required
# flood_depths: # flood depths at which a volume is derived
# - 0.5
# - 1.0
# - 1.5
# - 2.0
# - 2.5
# - 3.0
# - 4.0
# - 5.0
setup_reservoirs:
reservoirs_fn: hydro_reservoirs # source for reservoirs shape and attributes
timeseries_fn: gww # additionnal source for reservoir are timeseries to compute reservoirs, Either 'gww' using gwwapi or 'jrc' using hydroengine.
min_area: 1.0 # minimum lake area to consider [km2]
setup_lakes:
lakes_fn: hydro_lakes # source for lakes based on hydroLAKES: {hydro_lakes}
min_area: 10.0 # minimum reservoir area to consider [km2]
setup_glaciers:
glaciers_fn: rgi # source for glaciers based on Randolph Glacier Inventory {rgi}
min_area: 1.0 # minimum glacier area to consider [km2]
setup_lulcmaps:
lulc_fn : globcover_2009 # source for lulc maps: {globcover, vito, corine}
lulc_mapping_fn: globcover_mapping_default # default mapping for lulc classes
setup_laimaps:
lai_fn: modis_lai # source for LAI: {modis_lai}
setup_soilmaps:
soil_fn: soilgrids # source for soilmaps: {soilgrids}
ptf_ksatver: brakensiek # pedotransfer function to calculate hydraulic conductivity: {brakensiek, cosby}
setup_outlets:
river_only: True
setup_gauges:
gauges_fn: grdc # if not None add gaugemap. Either a path or known gauges_fn: {grdc}
snap_to_river: True # if True snaps gauges from source to river
derive_subcatch: False # if True derive subcatch map based on gauges.
setup_precip_forcing:
precip_fn: era5 # source for precipitation.
precip_clim_fn: # source for high resolution climatology to correct precipitation if any.
setup_temp_pet_forcing:
temp_pet_fn: era5 # source for temperature and potential evapotranspiration.
press_correction: True # if True temperature is corrected with elevation lapse rate.
temp_correction: True # if True pressure is corrected with elevation lapse rate.
dem_forcing_fn: era5_orography # source of elevation grid corresponding to temp_pet_fn. Used for lapse rate correction.
pet_method: debruin # method to compute PET: {debruin, makkink}
skip_pet: False # if True, only temperature is prepared.
setup_constant_pars:
KsatHorFrac: 100
Cfmax: 3.75653
cf_soil: 0.038
EoverR: 0.11
InfiltCapPath: 5
InfiltCapSoil: 600
MaxLeakage: 0
rootdistpar: -500
TT: 0
TTI: 2
TTM: 0
WHC: 0.1
G_Cfmax: 5.3
G_SIfrac: 0.002
G_TT: 1.3
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-12-18 18:35:57,725 - build - log - DEBUG - Writing log messages to new file /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_full/hydromt.log.
2024-12-18 18:35:57,725 - build - log - INFO - HydroMT version: 0.10.0
2024-12-18 18:35:57,725 - build - main - INFO - Building instance of wflow model at /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_full.
2024-12-18 18:35:57,725 - build - main - INFO - User settings:
Downloading file 'v0.0.9/data_catalog.yml' from 'https://raw.githubusercontent.com/Deltares/hydromt/main/data/catalogs/artifact_data/v0.0.9/data_catalog.yml' to '/home/runner/.hydromt_data/artifact_data'.
2024-12-18 18:35:58,213 - build - data_catalog - INFO - Reading data catalog artifact_data latest
2024-12-18 18:35:58,213 - build - data_catalog - INFO - Parsing data catalog from /home/runner/.hydromt_data/artifact_data/v0.0.9/data_catalog.yml
Downloading data from 'https://github.com/DirkEilander/hydromt-artifacts/releases/download/v0.0.9/data.tar.gz' to file '/home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar.gz'.
SHA256 hash of downloaded file: 32de5b95c171628547f303d7f65d53cbb1b9da9af4834717c8efff93fe55aad4
Use this value as the 'known_hash' argument of 'pooch.retrieve' to ensure that the file hasn't changed if it is downloaded again in the future.
Untarring contents of '/home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar.gz' to '/home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar'
2024-12-18 18:36:00,536 - build - model_api - INFO - Initializing wflow model from hydromt_wflow (v0.7.1.dev0).
2024-12-18 18:36:00,536 - build - data_catalog - INFO - Parsing data catalog from /home/runner/work/hydromt_wflow/hydromt_wflow/hydromt_wflow/data/parameters_data.yml
2024-12-18 18:36:00,548 - build - model_api - DEBUG - Setting model config options.
2024-12-18 18:36:00,549 - build - model_api - DEBUG - Default config read from /home/runner/work/hydromt_wflow/hydromt_wflow/hydromt_wflow/data/wflow/wflow_sbm.toml
2024-12-18 18:36:00,549 - build - model_api - INFO - setup_basemaps.region: {'subbasin': [12.2051, 45.8331], 'strord': 4, 'bounds': [11.7, 45.35, 12.95, 46.7]}
2024-12-18 18:36:00,550 - build - model_api - INFO - setup_basemaps.hydrography_fn: merit_hydro
2024-12-18 18:36:00,550 - build - model_api - INFO - setup_basemaps.basin_index_fn: merit_hydro_index
2024-12-18 18:36:00,550 - build - model_api - INFO - setup_basemaps.res: 0.00833
2024-12-18 18:36:00,550 - build - model_api - INFO - setup_basemaps.upscale_method: ihu
2024-12-18 18:36:00,550 - build - wflow - INFO - Preparing base hydrography basemaps.
2024-12-18 18:36:00,551 - build - rasterdataset - INFO - Reading merit_hydro raster data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/merit_hydro/{variable}.tif
2024-12-18 18:36:00,630 - 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-12-18 18:36:04,447 - build - basin_mask - INFO - subbasin bbox: [11.7750, 45.8042, 12.7450, 46.6900]
2024-12-18 18:36:04,651 - build - wflow - DEBUG - Adding basins vector to geoms.
2024-12-18 18:36:04,652 - build - basemaps - DEBUG - Mask in dataset assumed to represent subbasins.
2024-12-18 18:36:04,652 - build - basemaps - DEBUG - (Sub)basin at original resolution has 664756 cells.
2024-12-18 18:36:04,813 - build - basemaps - DEBUG - Burn subbasin outlet in upstream area data.
2024-12-18 18:36:04,861 - build - basemaps - INFO - Upscale flow direction data: 10x, ihu method.
2024-12-18 18:36:19,490 - build - basemaps - DEBUG - Derive stream order.
2024-12-18 18:36:19,649 - build - basemaps - DEBUG - Map shape: (106, 116); active cells: 6637.
2024-12-18 18:36:19,650 - build - basemaps - DEBUG - Outlet coordinates (1/1): (12.20750,45.83583).
2024-12-18 18:36:19,819 - build - wflow - DEBUG - Adding region vector to geoms.
2024-12-18 18:36:19,822 - build - model_api - INFO - setup_rivers.hydrography_fn: merit_hydro
2024-12-18 18:36:19,822 - build - model_api - INFO - setup_rivers.river_geom_fn: hydro_rivers_lin
2024-12-18 18:36:19,822 - build - model_api - INFO - setup_rivers.river_upa: 30
2024-12-18 18:36:19,822 - build - model_api - INFO - setup_rivers.rivdph_method: powlaw
2024-12-18 18:36:19,822 - build - model_api - INFO - setup_rivers.slope_len: 2000
2024-12-18 18:36:19,822 - build - model_api - INFO - setup_rivers.min_rivlen_ratio: 0.0
2024-12-18 18:36:19,822 - build - model_api - INFO - setup_rivers.min_rivdph: 1
2024-12-18 18:36:19,822 - build - model_api - INFO - setup_rivers.min_rivwth: 30
2024-12-18 18:36:19,822 - build - model_api - INFO - setup_rivers.smooth_len: 5000
2024-12-18 18:36:19,822 - build - model_api - INFO - setup_rivers.rivman_mapping_fn: roughness_river_mapping_default
2024-12-18 18:36:19,822 - build - model_api - INFO - setup_rivers.elevtn_map: wflow_dem
2024-12-18 18:36:19,822 - build - model_api - INFO - setup_rivers.river_routing: kinematic-wave
2024-12-18 18:36:19,822 - build - model_api - INFO - setup_rivers.connectivity: 8
2024-12-18 18:36:19,823 - build - wflow - INFO - Preparing river maps.
2024-12-18 18:36:19,824 - build - rasterdataset - INFO - Reading merit_hydro raster data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/merit_hydro/{variable}.tif
2024-12-18 18:36:19,884 - build - rasterdataset - DEBUG - Clip to [11.778, 45.807, 12.745, 46.690] (epsg:4326))
2024-12-18 18:36:19,891 - build - river - DEBUG - Set river mask (min uparea: 30 km2) and prepare flow dirs.
2024-12-18 18:36:20,004 - build - river - DEBUG - Derive river length.
2024-12-18 18:36:24,945 - build - river - DEBUG - Derive river slope.
2024-12-18 18:36:25,568 - build - river - DEBUG - Derive rivwth from hydrography dataset.
2024-12-18 18:36:25,583 - 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-12-18 18:36:25,588 - build - landuse - INFO - Deriving N_River using average resampling (nodata=-999.0).
2024-12-18 18:36:25,593 - build - geodataframe - INFO - Reading hydro_rivers_lin vector data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/rivers_lin2019_v1.gpkg
2024-12-18 18:36:25,602 - build - geodataframe - DEBUG - Clip intersects [11.778, 45.807, 12.745, 46.690] (EPSG:4326)
2024-12-18 18:36:25,804 - build - river - DEBUG - Derive ['rivwth', 'qbankfull'] from shapefile.
2024-12-18 18:36:26,031 - build - river - DEBUG - Valid for 381/655 river cells (max dist: 392 m).
2024-12-18 18:36:30,148 - build - wflow - DEBUG - Adding rivers vector to geoms.
2024-12-18 18:36:30,965 - build - model_api - INFO - setup_reservoirs.reservoirs_fn: hydro_reservoirs
2024-12-18 18:36:30,965 - build - model_api - INFO - setup_reservoirs.timeseries_fn: gww
2024-12-18 18:36:30,965 - build - model_api - INFO - setup_reservoirs.min_area: 1.0
2024-12-18 18:36:30,965 - build - wflow - INFO - Preparing reservoir maps.
2024-12-18 18:36:30,966 - build - geodataframe - INFO - Reading hydro_reservoirs vector data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/hydro_reservoirs.gpkg
2024-12-18 18:36:30,983 - build - geodataframe - DEBUG - Clip contains [11.775, 45.804, 12.745, 46.690] (EPSG:4326)
2024-12-18 18:36:30,984 - build - geodataframe - DEBUG - Convert units for 5 columns.
2024-12-18 18:36:30,986 - build - wflow - WARNING - No reservoirs of sufficient size found within region! Skipping reservoir procedures!
2024-12-18 18:36:30,986 - build - wflow - INFO - Skipping method, as no data has been found
2024-12-18 18:36:30,987 - build - model_api - INFO - setup_lakes.lakes_fn: hydro_lakes
2024-12-18 18:36:30,987 - build - model_api - INFO - setup_lakes.rating_curve_fns: None
2024-12-18 18:36:30,987 - build - model_api - INFO - setup_lakes.min_area: 10.0
2024-12-18 18:36:30,987 - build - model_api - INFO - setup_lakes.add_maxstorage: False
2024-12-18 18:36:30,987 - build - wflow - INFO - Preparing lake maps.
2024-12-18 18:36:30,987 - build - geodataframe - INFO - Reading hydro_lakes vector data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/hydro_lakes.gpkg
2024-12-18 18:36:30,997 - build - geodataframe - DEBUG - Clip contains [11.775, 45.804, 12.745, 46.690] (EPSG:4326)
2024-12-18 18:36:30,998 - build - geodataframe - DEBUG - Convert units for 1 columns.
2024-12-18 18:36:30,999 - build - wflow - WARNING - No lakes of sufficient size found within region! Skipping lake procedures!
2024-12-18 18:36:30,999 - build - wflow - INFO - Skipping method, as no data has been found
2024-12-18 18:36:30,999 - build - model_api - INFO - setup_glaciers.glaciers_fn: rgi
2024-12-18 18:36:30,999 - build - model_api - INFO - setup_glaciers.min_area: 1.0
2024-12-18 18:36:30,999 - build - wflow - INFO - Preparing glacier maps.
2024-12-18 18:36:31,000 - build - geodataframe - INFO - Reading rgi vector data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/rgi.gpkg
2024-12-18 18:36:31,011 - build - geodataframe - DEBUG - Clip intersects [11.775, 45.804, 12.745, 46.690] (EPSG:4326)
2024-12-18 18:36:31,013 - build - wflow - INFO - 1 glaciers of sufficient size found within region.
2024-12-18 18:36:31,023 - build - glaciers - DEBUG - Creating vector grid for calculating glacier fraction and storage per grid cell
2024-12-18 18:36:31,079 - build - glaciers - DEBUG - Setting glacierfrac and store values per glacier.
2024-12-18 18:36:32,932 - build - model_api - INFO - setup_lulcmaps.lulc_fn: globcover_2009
2024-12-18 18:36:32,932 - build - model_api - INFO - setup_lulcmaps.lulc_mapping_fn: globcover_mapping_default
2024-12-18 18:36:32,932 - build - model_api - INFO - setup_lulcmaps.lulc_vars: ['landuse', 'Kext', 'N', 'PathFrac', 'RootingDepth', 'Sl', 'Swood', 'WaterFrac', 'kc', 'alpha_h1', 'h1', 'h2', 'h3_high', 'h3_low', 'h4']
2024-12-18 18:36:32,932 - build - wflow - INFO - Preparing LULC parameter maps.
2024-12-18 18:36:32,933 - build - rasterdataset - INFO - Reading globcover_2009 raster data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/globcover.tif
2024-12-18 18:36:32,942 - build - rasterdataset - DEBUG - Clip to [11.778, 45.807, 12.745, 46.690] (epsg:4326))
2024-12-18 18:36:32,943 - 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-12-18 18:36:32,950 - build - landuse - INFO - Deriving landuse using nearest resampling (nodata=230).
2024-12-18 18:36:32,966 - build - landuse - INFO - Deriving Kext using average resampling (nodata=-999.0).
2024-12-18 18:36:32,983 - build - landuse - INFO - Deriving N using average resampling (nodata=-999.0).
2024-12-18 18:36:33,000 - build - landuse - INFO - Deriving PathFrac using average resampling (nodata=-999.0).
2024-12-18 18:36:33,017 - build - landuse - INFO - Deriving RootingDepth using average resampling (nodata=-999.0).
2024-12-18 18:36:33,034 - build - landuse - INFO - Deriving Sl using average resampling (nodata=-999.0).
2024-12-18 18:36:33,051 - build - landuse - INFO - Deriving Swood using average resampling (nodata=-999.0).
2024-12-18 18:36:33,068 - build - landuse - INFO - Deriving WaterFrac using average resampling (nodata=-999.0).
2024-12-18 18:36:33,085 - build - landuse - INFO - Deriving kc using average resampling (nodata=-999.0).
2024-12-18 18:36:33,102 - build - landuse - INFO - Deriving alpha_h1 using mode resampling (nodata=-999).
2024-12-18 18:36:33,157 - build - landuse - INFO - Deriving h1 using average resampling (nodata=-999).
2024-12-18 18:36:33,175 - build - landuse - INFO - Deriving h2 using average resampling (nodata=-999).
2024-12-18 18:36:33,192 - build - landuse - INFO - Deriving h3_high using average resampling (nodata=-999).
2024-12-18 18:36:33,209 - build - landuse - INFO - Deriving h3_low using average resampling (nodata=-999).
2024-12-18 18:36:33,226 - build - landuse - INFO - Deriving h4 using average resampling (nodata=-999).
2024-12-18 18:36:33,253 - build - model_api - INFO - setup_laimaps.lai_fn: modis_lai
2024-12-18 18:36:33,253 - build - model_api - INFO - setup_laimaps.lulc_fn: None
2024-12-18 18:36:33,253 - build - model_api - INFO - setup_laimaps.lulc_sampling_method: any
2024-12-18 18:36:33,253 - build - model_api - INFO - setup_laimaps.lulc_zero_classes: []
2024-12-18 18:36:33,253 - build - model_api - INFO - setup_laimaps.buffer: 2
2024-12-18 18:36:33,253 - build - wflow - INFO - Preparing LAI maps.
2024-12-18 18:36:33,254 - build - rasterdataset - INFO - Reading modis_lai netcdf data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/modis_lai.nc
2024-12-18 18:36:33,279 - build - rasterdataset - DEBUG - Clip to [11.778, 45.807, 12.745, 46.690] (epsg:4326))
2024-12-18 18:36:33,280 - build - rasterdataset - DEBUG - Convert units for 1 variables.
2024-12-18 18:36:33,285 - build - landuse - INFO - Deriving LAI using average resampling (nodata=nan).
2024-12-18 18:36:33,354 - build - model_api - INFO - setup_soilmaps.soil_fn: soilgrids
2024-12-18 18:36:33,354 - build - model_api - INFO - setup_soilmaps.ptf_ksatver: brakensiek
2024-12-18 18:36:33,354 - build - model_api - INFO - setup_soilmaps.wflow_thicknesslayers: [100, 300, 800]
2024-12-18 18:36:33,354 - build - wflow - INFO - Preparing soil parameter maps.
2024-12-18 18:36:33,355 - build - rasterdataset - INFO - Reading soilgrids raster data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/soilgrids/{variable}.tif
2024-12-18 18:36:33,632 - build - rasterdataset - DEBUG - Clip to [11.778, 45.807, 12.745, 46.690] (epsg:4326))
2024-12-18 18:36:33,642 - build - rasterdataset - DEBUG - Convert units for 21 variables.
2024-12-18 18:36:33,863 - build - soilgrids - INFO - calculate and resample thetaS
2024-12-18 18:36:34,083 - build - soilgrids - INFO - calculate and resample thetaR
2024-12-18 18:36:34,349 - build - soilgrids - INFO - calculate and resample KsatVer
2024-12-18 18:36:34,406 - build - soilgrids - INFO - calculate and resample pore size distribution index
2024-12-18 18:36:34,901 - build - soilgrids - INFO - fit z - log(KsatVer) with numpy linalg regression (y = b*x) -> M_
2024-12-18 18:36:35,300 - build - soilgrids - INFO - fit zi - Ksat with curve_fit (scipy.optimize) -> M
2024-12-18 18:36:38,061 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for thetaS
2024-12-18 18:36:38,181 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for thetaR
2024-12-18 18:36:38,320 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for SoilThickness
No numerical nodata value found, skipping set_nodata
2024-12-18 18:36:38,334 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for SoilMinThickness
No numerical nodata value found, skipping set_nodata
2024-12-18 18:36:38,349 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for c
2024-12-18 18:36:38,356 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer
2024-12-18 18:36:38,401 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_0.0cm
2024-12-18 18:36:38,446 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_5.0cm
2024-12-18 18:36:38,495 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_15.0cm
2024-12-18 18:36:38,540 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_30.0cm
2024-12-18 18:36:38,585 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_60.0cm
2024-12-18 18:36:38,630 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_100.0cm
2024-12-18 18:36:38,675 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_200.0cm
2024-12-18 18:36:38,721 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for M_original_
No numerical nodata value found, skipping set_nodata
2024-12-18 18:36:38,877 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for M_
No numerical nodata value found, skipping set_nodata
2024-12-18 18:36:39,034 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for f_
No numerical nodata value found, skipping set_nodata
2024-12-18 18:36:39,185 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for M_original
No numerical nodata value found, skipping set_nodata
2024-12-18 18:36:39,335 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for M
No numerical nodata value found, skipping set_nodata
2024-12-18 18:36:39,484 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for f
No numerical nodata value found, skipping set_nodata
2024-12-18 18:36:39,797 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for wflow_soil
2024-12-18 18:36:39,902 - build - model_api - INFO - setup_outlets.river_only: True
2024-12-18 18:36:39,902 - build - model_api - INFO - setup_outlets.toml_output: csv
2024-12-18 18:36:39,902 - build - model_api - INFO - setup_outlets.gauge_toml_header: ['Q']
2024-12-18 18:36:39,902 - build - model_api - INFO - setup_outlets.gauge_toml_param: ['lateral.river.q_av']
2024-12-18 18:36:39,902 - build - wflow - INFO - Gauges locations set based on river outlets.
2024-12-18 18:36:39,907 - build - wflow - INFO - Gauges map based on catchment river outlets added.
2024-12-18 18:36:39,907 - build - wflow - INFO - Adding ['lateral.river.q_av'] to csv section of toml.
2024-12-18 18:36:39,907 - build - model_api - INFO - setup_gauges.gauges_fn: grdc
2024-12-18 18:36:39,907 - build - model_api - INFO - setup_gauges.index_col: None
2024-12-18 18:36:39,907 - build - model_api - INFO - setup_gauges.snap_to_river: True
2024-12-18 18:36:39,907 - build - model_api - INFO - setup_gauges.mask: None
2024-12-18 18:36:39,907 - build - model_api - INFO - setup_gauges.snap_uparea: False
2024-12-18 18:36:39,907 - build - model_api - INFO - setup_gauges.max_dist: 10000.0
2024-12-18 18:36:39,908 - build - model_api - INFO - setup_gauges.wdw: 3
2024-12-18 18:36:39,908 - build - model_api - INFO - setup_gauges.rel_error: 0.05
2024-12-18 18:36:39,908 - build - model_api - INFO - setup_gauges.abs_error: 50.0
2024-12-18 18:36:39,908 - build - model_api - INFO - setup_gauges.fillna: False
2024-12-18 18:36:39,908 - build - model_api - INFO - setup_gauges.derive_subcatch: False
2024-12-18 18:36:39,908 - build - model_api - INFO - setup_gauges.basename: None
2024-12-18 18:36:39,908 - build - model_api - INFO - setup_gauges.toml_output: csv
2024-12-18 18:36:39,908 - build - model_api - INFO - setup_gauges.gauge_toml_header: ['Q', 'P']
2024-12-18 18:36:39,908 - build - model_api - INFO - setup_gauges.gauge_toml_param: ['lateral.river.q_av', 'vertical.precipitation']
2024-12-18 18:36:39,908 - build - geodataframe - INFO - Reading grdc csv data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/grdc.csv
2024-12-18 18:36:39,912 - build - geodataframe - DEBUG - Clip intersects [11.778, 45.807, 12.745, 46.690] (EPSG:4326)
2024-12-18 18:36:39,913 - build - wflow - INFO - 3 grdc gauge locations found within domain
2024-12-18 18:36:40,279 - build - wflow - INFO - Adding ['lateral.river.q_av', 'vertical.precipitation'] to csv section of toml.
2024-12-18 18:36:40,279 - build - model_api - INFO - setup_precip_forcing.precip_fn: era5
2024-12-18 18:36:40,279 - build - model_api - INFO - setup_precip_forcing.precip_clim_fn: None
2024-12-18 18:36:40,279 - build - model_api - INFO - setup_precip_forcing.chunksize: None
2024-12-18 18:36:40,280 - build - rasterdataset - INFO - Reading era5 netcdf data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/era5.nc
2024-12-18 18:36:40,292 - build - rasterdataset - DEBUG - Shifting time labels with 86400 sec.
2024-12-18 18:36:40,293 - build - rasterdataset - DEBUG - Slicing time dim (datetime.datetime(2010, 1, 1, 0, 0), datetime.datetime(2010, 3, 31, 0, 0))
2024-12-18 18:36:40,300 - build - rasterdataset - DEBUG - Clip to [11.778, 45.807, 12.745, 46.690] (epsg:4326))
2024-12-18 18:36:40,301 - build - rasterdataset - DEBUG - Convert units for 1 variables.
2024-12-18 18:36:40,348 - build - model_api - INFO - setup_temp_pet_forcing.temp_pet_fn: era5
2024-12-18 18:36:40,348 - build - model_api - INFO - setup_temp_pet_forcing.pet_method: debruin
2024-12-18 18:36:40,348 - build - model_api - INFO - setup_temp_pet_forcing.press_correction: True
2024-12-18 18:36:40,348 - build - model_api - INFO - setup_temp_pet_forcing.temp_correction: True
2024-12-18 18:36:40,348 - build - model_api - INFO - setup_temp_pet_forcing.wind_correction: True
2024-12-18 18:36:40,348 - build - model_api - INFO - setup_temp_pet_forcing.wind_altitude: 10
2024-12-18 18:36:40,348 - build - model_api - INFO - setup_temp_pet_forcing.reproj_method: nearest_index
2024-12-18 18:36:40,348 - build - model_api - INFO - setup_temp_pet_forcing.fillna_method: None
2024-12-18 18:36:40,348 - build - model_api - INFO - setup_temp_pet_forcing.dem_forcing_fn: era5_orography
2024-12-18 18:36:40,348 - build - model_api - INFO - setup_temp_pet_forcing.skip_pet: False
2024-12-18 18:36:40,348 - build - model_api - INFO - setup_temp_pet_forcing.chunksize: None
2024-12-18 18:36:40,349 - build - rasterdataset - INFO - Reading era5 netcdf data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/era5.nc
2024-12-18 18:36:40,361 - build - rasterdataset - DEBUG - Shifting time labels with 86400 sec.
2024-12-18 18:36:40,362 - build - rasterdataset - DEBUG - Slicing time dim (datetime.datetime(2010, 1, 1, 0, 0), datetime.datetime(2010, 3, 31, 0, 0))
2024-12-18 18:36:40,368 - build - rasterdataset - DEBUG - Clip to [11.778, 45.807, 12.745, 46.690] (epsg:4326))
2024-12-18 18:36:40,370 - build - rasterdataset - DEBUG - Convert units for 4 variables.
2024-12-18 18:36:40,396 - build - rasterdataset - INFO - Reading era5_orography netcdf data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/era5_orography.nc
2024-12-18 18:36:40,408 - build - rasterdataset - DEBUG - Clip to [11.625, 45.625, 12.875, 46.875] (epsg:4326))
2024-12-18 18:36:40,409 - build - rasterdataset - DEBUG - Convert units for 1 variables.
2024-12-18 18:36:40,598 - build - model_api - INFO - setup_constant_pars.dtype: float32
2024-12-18 18:36:40,598 - build - model_api - INFO - setup_constant_pars.nodata: -999
2024-12-18 18:36:40,598 - build - model_api - INFO - setup_constant_pars.KsatHorFrac: 100
2024-12-18 18:36:40,598 - build - model_api - INFO - setup_constant_pars.Cfmax: 3.75653
2024-12-18 18:36:40,598 - build - model_api - INFO - setup_constant_pars.cf_soil: 0.038
2024-12-18 18:36:40,598 - build - model_api - INFO - setup_constant_pars.EoverR: 0.11
2024-12-18 18:36:40,598 - build - model_api - INFO - setup_constant_pars.InfiltCapPath: 5
2024-12-18 18:36:40,598 - build - model_api - INFO - setup_constant_pars.InfiltCapSoil: 600
2024-12-18 18:36:40,598 - build - model_api - INFO - setup_constant_pars.MaxLeakage: 0
2024-12-18 18:36:40,599 - build - model_api - INFO - setup_constant_pars.rootdistpar: -500
2024-12-18 18:36:40,599 - build - model_api - INFO - setup_constant_pars.TT: 0
2024-12-18 18:36:40,599 - build - model_api - INFO - setup_constant_pars.TTI: 2
2024-12-18 18:36:40,599 - build - model_api - INFO - setup_constant_pars.TTM: 0
2024-12-18 18:36:40,599 - build - model_api - INFO - setup_constant_pars.WHC: 0.1
2024-12-18 18:36:40,599 - build - model_api - INFO - setup_constant_pars.G_Cfmax: 5.3
2024-12-18 18:36:40,599 - build - model_api - INFO - setup_constant_pars.G_SIfrac: 0.002
2024-12-18 18:36:40,599 - build - model_api - INFO - setup_constant_pars.G_TT: 1.3
2024-12-18 18:36:40,623 - build - wflow - INFO - Write model data to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_full
2024-12-18 18:36:40,657 - build - wflow - INFO - Write grid to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_full/staticmaps.nc
2024-12-18 18:36:40,868 - build - wflow - INFO - Writing model staticgeom to file.
2024-12-18 18:36:40,927 - build - wflow - INFO - Write forcing file
2024-12-18 18:36:40,931 - 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-12-18 18:36:40,934 - 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.42 ms
2024-12-18 18:36:41,057 - build - wflow - INFO - Writing model config to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_full/wflow_sbm.toml
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. Hereartifact_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
- hydromt.log
- wflow_sbm.toml
- inmaps-era5-2010.nc
- staticmaps.nc
- hydromt_data.yml
wflow_test_full/staticgeoms
- glaciers.geojson
- gauges_grdc.geojson
- region.geojson
- rivers.geojson
- basins_highres.geojson
- gauges.geojson
- basins.geojson
wflow_test_full/instate
wflow_test_full/run_default
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.