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.0)
- wflow_sediment (hydromt_wflow 0.7.0)
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-11-11 08:40:23,598 - build - log - DEBUG - Writing log messages to new file /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_full/hydromt.log.
2024-11-11 08:40:23,598 - build - log - INFO - HydroMT version: 0.10.0
2024-11-11 08:40:23,598 - build - main - INFO - Building instance of wflow model at /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_full.
2024-11-11 08:40:23,598 - 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-11-11 08:40:24,175 - build - data_catalog - INFO - Reading data catalog artifact_data latest
2024-11-11 08:40:24,175 - 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-11-11 08:40:26,433 - build - model_api - INFO - Initializing wflow model from hydromt_wflow (v0.7.0).
2024-11-11 08:40:26,433 - build - data_catalog - INFO - Parsing data catalog from /home/runner/work/hydromt_wflow/hydromt_wflow/hydromt_wflow/data/parameters_data.yml
2024-11-11 08:40:26,445 - build - model_api - DEBUG - Setting model config options.
2024-11-11 08:40:26,446 - build - model_api - DEBUG - Default config read from /home/runner/work/hydromt_wflow/hydromt_wflow/hydromt_wflow/data/wflow/wflow_sbm.toml
2024-11-11 08:40:26,446 - build - model_api - INFO - setup_basemaps.region: {'subbasin': [12.2051, 45.8331], 'strord': 4, 'bounds': [11.7, 45.35, 12.95, 46.7]}
2024-11-11 08:40:26,446 - build - model_api - INFO - setup_basemaps.hydrography_fn: merit_hydro
2024-11-11 08:40:26,446 - build - model_api - INFO - setup_basemaps.basin_index_fn: merit_hydro_index
2024-11-11 08:40:26,446 - build - model_api - INFO - setup_basemaps.res: 0.00833
2024-11-11 08:40:26,446 - build - model_api - INFO - setup_basemaps.upscale_method: ihu
2024-11-11 08:40:26,446 - build - wflow - INFO - Preparing base hydrography basemaps.
2024-11-11 08:40:26,448 - 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-11-11 08:40:26,535 - 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-11-11 08:40:30,103 - build - basin_mask - INFO - subbasin bbox: [11.7750, 45.8042, 12.7450, 46.6900]
2024-11-11 08:40:30,166 - build - wflow - DEBUG - Adding basins vector to geoms.
2024-11-11 08:40:30,167 - build - basemaps - DEBUG - Mask in dataset assumed to represent subbasins.
2024-11-11 08:40:30,167 - build - basemaps - DEBUG - (Sub)basin at original resolution has 664756 cells.
2024-11-11 08:40:30,225 - build - basemaps - DEBUG - Burn subbasin outlet in upstream area data.
2024-11-11 08:40:30,253 - build - basemaps - INFO - Upscale flow direction data: 10x, ihu method.
2024-11-11 08:40:44,430 - build - basemaps - DEBUG - Derive stream order.
2024-11-11 08:40:44,586 - build - basemaps - DEBUG - Map shape: (106, 116); active cells: 6637.
2024-11-11 08:40:44,586 - build - basemaps - DEBUG - Outlet coordinates (1/1): (12.20750,45.83583).
2024-11-11 08:40:44,724 - build - wflow - DEBUG - Adding region vector to geoms.
2024-11-11 08:40:44,727 - build - model_api - INFO - setup_rivers.hydrography_fn: merit_hydro
2024-11-11 08:40:44,727 - build - model_api - INFO - setup_rivers.river_geom_fn: hydro_rivers_lin
2024-11-11 08:40:44,727 - build - model_api - INFO - setup_rivers.river_upa: 30
2024-11-11 08:40:44,727 - build - model_api - INFO - setup_rivers.rivdph_method: powlaw
2024-11-11 08:40:44,727 - build - model_api - INFO - setup_rivers.slope_len: 2000
2024-11-11 08:40:44,727 - build - model_api - INFO - setup_rivers.min_rivlen_ratio: 0.0
2024-11-11 08:40:44,727 - build - model_api - INFO - setup_rivers.min_rivdph: 1
2024-11-11 08:40:44,727 - build - model_api - INFO - setup_rivers.min_rivwth: 30
2024-11-11 08:40:44,727 - build - model_api - INFO - setup_rivers.smooth_len: 5000
2024-11-11 08:40:44,727 - build - model_api - INFO - setup_rivers.rivman_mapping_fn: roughness_river_mapping_default
2024-11-11 08:40:44,727 - build - model_api - INFO - setup_rivers.elevtn_map: wflow_dem
2024-11-11 08:40:44,727 - build - model_api - INFO - setup_rivers.river_routing: kinematic-wave
2024-11-11 08:40:44,727 - build - model_api - INFO - setup_rivers.connectivity: 8
2024-11-11 08:40:44,727 - build - wflow - INFO - Preparing river maps.
2024-11-11 08:40:44,728 - 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-11-11 08:40:44,797 - build - rasterdataset - DEBUG - Clip to [11.778, 45.807, 12.745, 46.690] (epsg:4326))
2024-11-11 08:40:44,806 - build - river - DEBUG - Set river mask (min uparea: 30 km2) and prepare flow dirs.
2024-11-11 08:40:44,897 - build - river - DEBUG - Derive river length.
2024-11-11 08:40:49,976 - build - river - DEBUG - Derive river slope.
2024-11-11 08:40:50,549 - build - river - DEBUG - Derive rivwth from hydrography dataset.
2024-11-11 08:40:50,558 - 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-11-11 08:40:50,563 - build - landuse - INFO - Deriving N_River using average resampling (nodata=-999.0).
2024-11-11 08:40:50,730 - 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-11-11 08:40:50,739 - build - geodataframe - DEBUG - Clip intersects [11.778, 45.807, 12.745, 46.690] (EPSG:4326)
2024-11-11 08:40:50,935 - build - river - DEBUG - Derive ['rivwth', 'qbankfull'] from shapefile.
2024-11-11 08:40:50,983 - build - river - DEBUG - Valid for 381/655 river cells (max dist: 392 m).
2024-11-11 08:40:54,946 - build - wflow - DEBUG - Adding rivers vector to geoms.
2024-11-11 08:40:55,718 - build - model_api - INFO - setup_reservoirs.reservoirs_fn: hydro_reservoirs
2024-11-11 08:40:55,718 - build - model_api - INFO - setup_reservoirs.timeseries_fn: gww
2024-11-11 08:40:55,718 - build - model_api - INFO - setup_reservoirs.min_area: 1.0
2024-11-11 08:40:55,718 - build - wflow - INFO - Preparing reservoir maps.
2024-11-11 08:40:55,718 - build - geodataframe - INFO - Reading hydro_reservoirs vector data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/hydro_reservoirs.gpkg
2024-11-11 08:40:55,735 - build - geodataframe - DEBUG - Clip contains [11.775, 45.804, 12.745, 46.690] (EPSG:4326)
2024-11-11 08:40:55,737 - build - geodataframe - DEBUG - Convert units for 5 columns.
2024-11-11 08:40:55,739 - build - wflow - WARNING - No reservoirs of sufficient size found within region! Skipping reservoir procedures!
2024-11-11 08:40:55,739 - build - wflow - INFO - Skipping method, as no data has been found
2024-11-11 08:40:55,739 - build - model_api - INFO - setup_lakes.lakes_fn: hydro_lakes
2024-11-11 08:40:55,739 - build - model_api - INFO - setup_lakes.rating_curve_fns: None
2024-11-11 08:40:55,739 - build - model_api - INFO - setup_lakes.min_area: 10.0
2024-11-11 08:40:55,739 - build - model_api - INFO - setup_lakes.add_maxstorage: False
2024-11-11 08:40:55,739 - build - wflow - INFO - Preparing lake maps.
2024-11-11 08:40:55,739 - build - geodataframe - INFO - Reading hydro_lakes vector data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/hydro_lakes.gpkg
2024-11-11 08:40:55,749 - build - geodataframe - DEBUG - Clip contains [11.775, 45.804, 12.745, 46.690] (EPSG:4326)
2024-11-11 08:40:55,750 - build - geodataframe - DEBUG - Convert units for 1 columns.
2024-11-11 08:40:55,751 - build - wflow - WARNING - No lakes of sufficient size found within region! Skipping lake procedures!
2024-11-11 08:40:55,751 - build - wflow - INFO - Skipping method, as no data has been found
2024-11-11 08:40:55,751 - build - model_api - INFO - setup_glaciers.glaciers_fn: rgi
2024-11-11 08:40:55,751 - build - model_api - INFO - setup_glaciers.min_area: 1.0
2024-11-11 08:40:55,751 - build - wflow - INFO - Preparing glacier maps.
2024-11-11 08:40:55,752 - build - geodataframe - INFO - Reading rgi vector data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/rgi.gpkg
2024-11-11 08:40:55,763 - build - geodataframe - DEBUG - Clip intersects [11.775, 45.804, 12.745, 46.690] (EPSG:4326)
2024-11-11 08:40:55,765 - build - wflow - INFO - 1 glaciers of sufficient size found within region.
2024-11-11 08:40:55,777 - build - glaciers - DEBUG - Creating vector grid for calculating glacier fraction and storage per grid cell
2024-11-11 08:40:55,825 - build - glaciers - DEBUG - Setting glacierfrac and store values per glacier.
2024-11-11 08:40:57,641 - build - model_api - INFO - setup_lulcmaps.lulc_fn: globcover_2009
2024-11-11 08:40:57,641 - build - model_api - INFO - setup_lulcmaps.lulc_mapping_fn: globcover_mapping_default
2024-11-11 08:40:57,641 - 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-11-11 08:40:57,642 - build - wflow - INFO - Preparing LULC parameter maps.
2024-11-11 08:40:57,642 - build - rasterdataset - INFO - Reading globcover_2009 raster data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/globcover.tif
2024-11-11 08:40:57,652 - build - rasterdataset - DEBUG - Clip to [11.778, 45.807, 12.745, 46.690] (epsg:4326))
2024-11-11 08:40:57,653 - 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-11-11 08:40:57,659 - build - landuse - INFO - Deriving landuse using nearest resampling (nodata=230).
2024-11-11 08:40:57,679 - build - landuse - INFO - Deriving Kext using average resampling (nodata=-999.0).
2024-11-11 08:40:57,699 - build - landuse - INFO - Deriving N using average resampling (nodata=-999.0).
2024-11-11 08:40:57,719 - build - landuse - INFO - Deriving PathFrac using average resampling (nodata=-999.0).
2024-11-11 08:40:57,739 - build - landuse - INFO - Deriving RootingDepth using average resampling (nodata=-999.0).
2024-11-11 08:40:57,759 - build - landuse - INFO - Deriving Sl using average resampling (nodata=-999.0).
2024-11-11 08:40:57,778 - build - landuse - INFO - Deriving Swood using average resampling (nodata=-999.0).
2024-11-11 08:40:57,798 - build - landuse - INFO - Deriving WaterFrac using average resampling (nodata=-999.0).
2024-11-11 08:40:57,818 - build - landuse - INFO - Deriving kc using average resampling (nodata=-999.0).
2024-11-11 08:40:57,838 - build - landuse - INFO - Deriving alpha_h1 using mode resampling (nodata=-999).
2024-11-11 08:40:57,896 - build - landuse - INFO - Deriving h1 using average resampling (nodata=-999).
2024-11-11 08:40:57,917 - build - landuse - INFO - Deriving h2 using average resampling (nodata=-999).
2024-11-11 08:40:57,938 - build - landuse - INFO - Deriving h3_high using average resampling (nodata=-999).
2024-11-11 08:40:57,958 - build - landuse - INFO - Deriving h3_low using average resampling (nodata=-999).
2024-11-11 08:40:57,978 - build - landuse - INFO - Deriving h4 using average resampling (nodata=-999).
2024-11-11 08:40:58,009 - build - model_api - INFO - setup_laimaps.lai_fn: modis_lai
2024-11-11 08:40:58,009 - build - model_api - INFO - setup_laimaps.lulc_fn: None
2024-11-11 08:40:58,009 - build - model_api - INFO - setup_laimaps.lulc_sampling_method: any
2024-11-11 08:40:58,009 - build - model_api - INFO - setup_laimaps.lulc_zero_classes: []
2024-11-11 08:40:58,009 - build - model_api - INFO - setup_laimaps.buffer: 2
2024-11-11 08:40:58,009 - build - wflow - INFO - Preparing LAI maps.
2024-11-11 08:40:58,010 - build - rasterdataset - INFO - Reading modis_lai netcdf data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/modis_lai.nc
2024-11-11 08:40:58,034 - build - rasterdataset - DEBUG - Clip to [11.778, 45.807, 12.745, 46.690] (epsg:4326))
2024-11-11 08:40:58,036 - build - rasterdataset - DEBUG - Convert units for 1 variables.
2024-11-11 08:40:58,041 - build - landuse - INFO - Deriving LAI using average resampling (nodata=nan).
2024-11-11 08:40:58,110 - build - model_api - INFO - setup_soilmaps.soil_fn: soilgrids
2024-11-11 08:40:58,110 - build - model_api - INFO - setup_soilmaps.ptf_ksatver: brakensiek
2024-11-11 08:40:58,110 - build - model_api - INFO - setup_soilmaps.wflow_thicknesslayers: [100, 300, 800]
2024-11-11 08:40:58,110 - build - wflow - INFO - Preparing soil parameter maps.
2024-11-11 08:40:58,111 - build - rasterdataset - INFO - Reading soilgrids raster data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/soilgrids/{variable}.tif
2024-11-11 08:40:58,430 - build - rasterdataset - DEBUG - Clip to [11.778, 45.807, 12.745, 46.690] (epsg:4326))
2024-11-11 08:40:58,440 - build - rasterdataset - DEBUG - Convert units for 21 variables.
2024-11-11 08:40:58,669 - build - soilgrids - INFO - calculate and resample thetaS
2024-11-11 08:40:58,901 - build - soilgrids - INFO - calculate and resample thetaR
2024-11-11 08:40:59,168 - build - soilgrids - INFO - calculate and resample KsatVer
2024-11-11 08:40:59,233 - build - soilgrids - INFO - calculate and resample pore size distribution index
2024-11-11 08:40:59,738 - build - soilgrids - INFO - fit z - log(KsatVer) with numpy linalg regression (y = b*x) -> M_
2024-11-11 08:41:00,169 - build - soilgrids - INFO - fit zi - Ksat with curve_fit (scipy.optimize) -> M
2024-11-11 08:41:02,863 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for thetaS
2024-11-11 08:41:02,977 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for thetaR
2024-11-11 08:41:03,113 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for SoilThickness
No numerical nodata value found, skipping set_nodata
2024-11-11 08:41:03,131 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for SoilMinThickness
No numerical nodata value found, skipping set_nodata
2024-11-11 08:41:03,149 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for c
2024-11-11 08:41:03,157 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer
2024-11-11 08:41:03,200 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_0.0cm
2024-11-11 08:41:03,245 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_5.0cm
2024-11-11 08:41:03,289 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_15.0cm
2024-11-11 08:41:03,333 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_30.0cm
2024-11-11 08:41:03,377 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_60.0cm
2024-11-11 08:41:03,421 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_100.0cm
2024-11-11 08:41:03,465 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_200.0cm
2024-11-11 08:41:03,510 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for M_original_
No numerical nodata value found, skipping set_nodata
2024-11-11 08:41:03,669 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for M_
No numerical nodata value found, skipping set_nodata
2024-11-11 08:41:03,972 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for f_
No numerical nodata value found, skipping set_nodata
2024-11-11 08:41:04,131 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for M_original
No numerical nodata value found, skipping set_nodata
2024-11-11 08:41:04,286 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for M
No numerical nodata value found, skipping set_nodata
2024-11-11 08:41:04,448 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for f
No numerical nodata value found, skipping set_nodata
2024-11-11 08:41:04,606 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for wflow_soil
2024-11-11 08:41:04,720 - build - model_api - INFO - setup_outlets.river_only: True
2024-11-11 08:41:04,720 - build - model_api - INFO - setup_outlets.toml_output: csv
2024-11-11 08:41:04,720 - build - model_api - INFO - setup_outlets.gauge_toml_header: ['Q']
2024-11-11 08:41:04,720 - build - model_api - INFO - setup_outlets.gauge_toml_param: ['lateral.river.q_av']
2024-11-11 08:41:04,720 - build - wflow - INFO - Gauges locations set based on river outlets.
2024-11-11 08:41:04,724 - build - wflow - INFO - Gauges map based on catchment river outlets added.
2024-11-11 08:41:04,724 - build - wflow - INFO - Adding ['lateral.river.q_av'] to csv section of toml.
2024-11-11 08:41:04,725 - build - model_api - INFO - setup_gauges.gauges_fn: grdc
2024-11-11 08:41:04,725 - build - model_api - INFO - setup_gauges.index_col: None
2024-11-11 08:41:04,725 - build - model_api - INFO - setup_gauges.snap_to_river: True
2024-11-11 08:41:04,725 - build - model_api - INFO - setup_gauges.mask: None
2024-11-11 08:41:04,725 - build - model_api - INFO - setup_gauges.snap_uparea: False
2024-11-11 08:41:04,725 - build - model_api - INFO - setup_gauges.max_dist: 10000.0
2024-11-11 08:41:04,725 - build - model_api - INFO - setup_gauges.wdw: 3
2024-11-11 08:41:04,725 - build - model_api - INFO - setup_gauges.rel_error: 0.05
2024-11-11 08:41:04,725 - build - model_api - INFO - setup_gauges.abs_error: 50.0
2024-11-11 08:41:04,725 - build - model_api - INFO - setup_gauges.fillna: False
2024-11-11 08:41:04,725 - build - model_api - INFO - setup_gauges.derive_subcatch: False
2024-11-11 08:41:04,725 - build - model_api - INFO - setup_gauges.basename: None
2024-11-11 08:41:04,725 - build - model_api - INFO - setup_gauges.toml_output: csv
2024-11-11 08:41:04,725 - build - model_api - INFO - setup_gauges.gauge_toml_header: ['Q', 'P']
2024-11-11 08:41:04,725 - build - model_api - INFO - setup_gauges.gauge_toml_param: ['lateral.river.q_av', 'vertical.precipitation']
2024-11-11 08:41:04,725 - build - geodataframe - INFO - Reading grdc csv data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/grdc.csv
2024-11-11 08:41:04,729 - build - geodataframe - DEBUG - Clip intersects [11.778, 45.807, 12.745, 46.690] (EPSG:4326)
2024-11-11 08:41:04,730 - build - wflow - INFO - 3 grdc gauge locations found within domain
2024-11-11 08:41:05,090 - build - wflow - INFO - Adding ['lateral.river.q_av', 'vertical.precipitation'] to csv section of toml.
2024-11-11 08:41:05,090 - build - model_api - INFO - setup_precip_forcing.precip_fn: era5
2024-11-11 08:41:05,090 - build - model_api - INFO - setup_precip_forcing.precip_clim_fn: None
2024-11-11 08:41:05,090 - build - model_api - INFO - setup_precip_forcing.chunksize: None
2024-11-11 08:41:05,091 - build - rasterdataset - INFO - Reading era5 netcdf data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/era5.nc
2024-11-11 08:41:05,103 - build - rasterdataset - DEBUG - Shifting time labels with 86400 sec.
2024-11-11 08:41:05,104 - build - rasterdataset - DEBUG - Slicing time dim (datetime.datetime(2010, 1, 1, 0, 0), datetime.datetime(2010, 3, 31, 0, 0))
2024-11-11 08:41:05,110 - build - rasterdataset - DEBUG - Clip to [11.778, 45.807, 12.745, 46.690] (epsg:4326))
2024-11-11 08:41:05,112 - build - rasterdataset - DEBUG - Convert units for 1 variables.
2024-11-11 08:41:05,163 - build - model_api - INFO - setup_temp_pet_forcing.temp_pet_fn: era5
2024-11-11 08:41:05,163 - build - model_api - INFO - setup_temp_pet_forcing.pet_method: debruin
2024-11-11 08:41:05,163 - build - model_api - INFO - setup_temp_pet_forcing.press_correction: True
2024-11-11 08:41:05,163 - build - model_api - INFO - setup_temp_pet_forcing.temp_correction: True
2024-11-11 08:41:05,163 - build - model_api - INFO - setup_temp_pet_forcing.wind_correction: True
2024-11-11 08:41:05,163 - build - model_api - INFO - setup_temp_pet_forcing.wind_altitude: 10
2024-11-11 08:41:05,163 - build - model_api - INFO - setup_temp_pet_forcing.reproj_method: nearest_index
2024-11-11 08:41:05,163 - build - model_api - INFO - setup_temp_pet_forcing.fillna_method: None
2024-11-11 08:41:05,163 - build - model_api - INFO - setup_temp_pet_forcing.dem_forcing_fn: era5_orography
2024-11-11 08:41:05,163 - build - model_api - INFO - setup_temp_pet_forcing.skip_pet: False
2024-11-11 08:41:05,163 - build - model_api - INFO - setup_temp_pet_forcing.chunksize: None
2024-11-11 08:41:05,164 - build - rasterdataset - INFO - Reading era5 netcdf data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/era5.nc
2024-11-11 08:41:05,176 - build - rasterdataset - DEBUG - Shifting time labels with 86400 sec.
2024-11-11 08:41:05,177 - build - rasterdataset - DEBUG - Slicing time dim (datetime.datetime(2010, 1, 1, 0, 0), datetime.datetime(2010, 3, 31, 0, 0))
2024-11-11 08:41:05,184 - build - rasterdataset - DEBUG - Clip to [11.778, 45.807, 12.745, 46.690] (epsg:4326))
2024-11-11 08:41:05,186 - build - rasterdataset - DEBUG - Convert units for 4 variables.
2024-11-11 08:41:05,212 - build - rasterdataset - INFO - Reading era5_orography netcdf data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/era5_orography.nc
2024-11-11 08:41:05,226 - build - rasterdataset - DEBUG - Clip to [11.625, 45.625, 12.875, 46.875] (epsg:4326))
2024-11-11 08:41:05,227 - build - rasterdataset - DEBUG - Convert units for 1 variables.
2024-11-11 08:41:05,425 - build - model_api - INFO - setup_constant_pars.dtype: float32
2024-11-11 08:41:05,425 - build - model_api - INFO - setup_constant_pars.nodata: -999
2024-11-11 08:41:05,425 - build - model_api - INFO - setup_constant_pars.KsatHorFrac: 100
2024-11-11 08:41:05,425 - build - model_api - INFO - setup_constant_pars.Cfmax: 3.75653
2024-11-11 08:41:05,425 - build - model_api - INFO - setup_constant_pars.cf_soil: 0.038
2024-11-11 08:41:05,425 - build - model_api - INFO - setup_constant_pars.EoverR: 0.11
2024-11-11 08:41:05,425 - build - model_api - INFO - setup_constant_pars.InfiltCapPath: 5
2024-11-11 08:41:05,425 - build - model_api - INFO - setup_constant_pars.InfiltCapSoil: 600
2024-11-11 08:41:05,425 - build - model_api - INFO - setup_constant_pars.MaxLeakage: 0
2024-11-11 08:41:05,426 - build - model_api - INFO - setup_constant_pars.rootdistpar: -500
2024-11-11 08:41:05,426 - build - model_api - INFO - setup_constant_pars.TT: 0
2024-11-11 08:41:05,426 - build - model_api - INFO - setup_constant_pars.TTI: 2
2024-11-11 08:41:05,426 - build - model_api - INFO - setup_constant_pars.TTM: 0
2024-11-11 08:41:05,426 - build - model_api - INFO - setup_constant_pars.WHC: 0.1
2024-11-11 08:41:05,426 - build - model_api - INFO - setup_constant_pars.G_Cfmax: 5.3
2024-11-11 08:41:05,426 - build - model_api - INFO - setup_constant_pars.G_SIfrac: 0.002
2024-11-11 08:41:05,426 - build - model_api - INFO - setup_constant_pars.G_TT: 1.3
2024-11-11 08:41:05,450 - build - wflow - INFO - Write model data to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_full
2024-11-11 08:41:05,485 - build - wflow - INFO - Write grid to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_test_full/staticmaps.nc
2024-11-11 08:41:05,697 - build - wflow - INFO - Writing model staticgeom to file.
2024-11-11 08:41:05,754 - build - wflow - INFO - Write forcing file
2024-11-11 08:41:05,758 - 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-11-11 08:41:05,762 - 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.73 ms
2024-11-11 08:41:05,890 - 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.