Upgrade your model to Wflow.jl version 1#
To ease the process of upgrading your Wflow.jl model to version 1+, HydroMT includes an upgrade function that helps you convert your model very easily: upgrade_to_v1_wflow
.
For sbm type of models, the main difference between Wflow version 0.8.1 and less or Wflow version 1.0.0 and more is that the TOML file structure was updated into new sections and standard names are used to link to internal variable names in the code. For example lateral.river.q_av is now *river_water__volume_flow_rate*.
For sediment type of models, apart from the difference in the TOML file, estimation of some of the parameters has been moved outside of the Wflow.jl code and into HydroMT-Wflow. This allows the user to more easily adjust values of these parameters if they have local data or calibrate some parameters more easily.
The upgrade_to_v1_wflow function directly convert the TOML file to v1 format and in the case of wflow_sediment also calls again setup_soilmaps
and setup_riverbedsed
functions to create the new required parameters.
Let’s see how you can use this function.
Upgrading a Wflow SBM model#
We can call the upgrade_to_v1_wflow
function using the update
CLI of HydroMT. Here is the configuration file that we will use:
[1]:
fn_config = "wflow_update_v1_sbm.yml"
with open(fn_config, "r") as f:
txt = f.read()
print(txt)
global:
config_fn: wflow_sbm_v0x.toml
upgrade_to_v1_wflow:
write_config:
config_name: wflow_sbm_v1.toml
In this config, we start by setting the name of the TOML file of the version 0x model (if different than wflow_sbm.toml), call the upgrade_to_v1_wflow
method, and then save the updated TOML file into a new wflow_sbm_v1.toml file.
Note that if you use the standard wflow_sbm.toml name and do not mind it being overwritten, the above example can be reduced into only calling upgrade_to_v1_wflow
.
Let’s now call HydroMT update to update our old config (in this case we do not need a data catalog):
[2]:
!hydromt update wflow "./data/wflow_upgrade/sbm" -i wflow_update_v1_sbm.yml -vvv
2025-06-26 14:11:33,641 - update - log - DEBUG - Writing log messages to new file /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/data/wflow_upgrade/sbm/hydromt.log.
2025-06-26 14:11:33,641 - update - log - INFO - HydroMT version: 0.10.1
2025-06-26 14:11:33,641 - update - main - INFO - Updating wflow model at /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/data/wflow_upgrade/sbm (r+).
2025-06-26 14:11:33,641 - update - main - INFO - Output dir: /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/data/wflow_upgrade/sbm
2025-06-26 14:11:33,641 - update - main - INFO - User settings:
2025-06-26 14:11:33,670 - update - model_api - INFO - Initializing wflow model from hydromt_wflow (v1.0.0rc1).
2025-06-26 14:11:33,670 - update - data_catalog - INFO - Parsing data catalog from /home/runner/work/hydromt_wflow/hydromt_wflow/hydromt_wflow/data/parameters_data.yml
2025-06-26 14:11:33,683 - update - wflow - INFO - Supported Wflow.jl version v1+
2025-06-26 14:11:33,703 - update - model_api - DEBUG - Model config read from /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/data/wflow_upgrade/sbm/wflow_sbm_v0x.toml
2025-06-26 14:11:33,724 - update - model_api - DEBUG - Model config read from /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/data/wflow_upgrade/sbm/wflow_sbm_v0x.toml
2025-06-26 14:11:33,725 - update - wflow - INFO - Reading model table files.
2025-06-26 14:11:33,726 - update - wflow - INFO - Model read
2025-06-26 14:11:33,726 - update - utils - INFO - Converting config to Wflow v1 format
2025-06-26 14:11:33,726 - update - utils - INFO - Converting config general, time and model sections
2025-06-26 14:11:33,727 - update - utils - INFO - Converting config state section
2025-06-26 14:11:33,732 - update - utils - INFO - Converting config input section
key: subcatchment, variables: {'wflow_v0': 'subcatchment', 'wflow_v1': 'subbasin_location__count', 'hydromt_name': 'basins'}
key: local_drain_direction, variables: {'wflow_v0': 'ldd', 'wflow_v1': 'basin__local_drain_direction', 'hydromt_name': 'flwdir'}
key: lake_area_id, variables: {'wflow_v0': 'lateral.river.lake.areas', 'wflow_v1': 'lake_area__count', 'hydromt_name': 'lake_area_id'}
key: lake_outlet_id, variables: {'wflow_v0': 'lateral.river.lake.locs', 'wflow_v1': 'lake_location__count', 'hydromt_name': 'lake_outlet_id'}
key: reservoir_area_id, variables: {'wflow_v0': 'lateral.river.reservoir.areas', 'wflow_v1': 'reservoir_area__count', 'hydromt_name': 'reservoir_area_id'}
key: reservoir_outlet_id, variables: {'wflow_v0': 'lateral.river.reservoir.locs', 'wflow_v1': 'reservoir_location__count', 'hydromt_name': 'reservoir_outlet_id'}
key: river_mask, variables: {'wflow_v0': 'river_location', 'wflow_v1': 'river_location__mask', 'hydromt_name': 'rivmsk'}
key: pits, variables: {'wflow_v0': 'pits', 'wflow_v1': 'basin_pit_location__mask '}
key: precip, variables: {'wflow_v0': 'vertical.precipitation', 'wflow_v1': 'atmosphere_water__precipitation_volume_flux', 'hydromt_name': 'precip'}
key: temp, variables: {'wflow_v0': 'vertical.temperature', 'wflow_v1': 'atmosphere_air__temperature', 'hydromt_name': 'temp'}
key: pet, variables: {'wflow_v0': 'vertical.potential_evaporation', 'wflow_v1': 'land_surface_water__potential_evaporation_volume_flux', 'hydromt_name': 'pet'}
key: snow_degree_day_coefficient, variables: {'wflow_v0': 'vertical.cfmax', 'wflow_v1': 'snowpack__degree-day_coefficient'}
key: snow_tt, variables: {'wflow_v0': 'vertical.tt', 'wflow_v1': 'atmosphere_air__snowfall_temperature_threshold'}
key: snow_tti, variables: {'wflow_v0': 'vertical.tti', 'wflow_v1': 'atmosphere_air__snowfall_temperature_interval'}
key: snow_ttm, variables: {'wflow_v0': 'vertical.ttm', 'wflow_v1': 'snowpack__melting_temperature_threshold'}
key: snow_whc, variables: {'wflow_v0': 'vertical.water_holding_capacity', 'wflow_v1': 'snowpack__liquid_water_holding_capacity'}
key: glacier_fraction, variables: {'wflow_v0': 'vertical.glacierfrac', 'wflow_v1': 'glacier_surface__area_fraction', 'hydromt_name': 'glacfracs'}
key: glacier_initial_leq_depth, variables: {'wflow_v0': 'vertical.glacierstore', 'wflow_v1': 'glacier_ice__initial_leq-depth', 'hydromt_name': 'glacstore'}
key: glacier_ttm, variables: {'wflow_v0': 'vertical.g_ttm', 'wflow_v1': 'glacier_ice__melting_temperature_threshold'}
key: glacier_degree_day_coefficient, variables: {'wflow_v0': 'vertical.g_cfmax', 'wflow_v1': 'glacier_ice__degree-day_coefficient'}
key: glacier_snow_to_ice_fraction, variables: {'wflow_v0': 'vertical.g_sifrac', 'wflow_v1': 'glacier_firn_accumulation__snowpack~dry_leq-depth_fraction'}
key: vegetation_gash_e_r, variables: {'wflow_v0': 'vertical.e_r', 'wflow_v1': 'vegetation_canopy_water__mean_evaporation-to-mean_precipitation_ratio'}
key: vegetation_kext, variables: {'wflow_v0': 'vertical.kext', 'wflow_v1': 'vegetation_canopy__light-extinction_coefficient'}
key: vegetation_leaf_area_index, variables: {'wflow_v0': 'vertical.leaf_area_index', 'wflow_v1': 'vegetation__leaf-area_index', 'hydromt_name': 'LAI'}
key: vegetation_root_depth, variables: {'wflow_v0': 'vertical.rootingdepth', 'wflow_v1': 'vegetation_root__depth'}
key: vegetation_leaf_storage, variables: {'wflow_v0': 'vertical.specific_leaf', 'wflow_v1': 'vegetation__specific-leaf_storage', 'hydromt_name': 'leaf_storage'}
key: vegetation_wood_storage, variables: {'wflow_v0': 'vertical.storage_wood', 'wflow_v1': 'vegetation_wood_water__storage_capacity', 'hydromt_name': 'wood_storage'}
key: vegetation_crop_factor, variables: {'wflow_v0': 'vertical.kc', 'wflow_v1': 'vegetation__crop_factor'}
key: vegetation_feddes_alpha_h1, variables: {'wflow_v0': 'vertical.alpha_h1', 'wflow_v1': 'vegetation_root__feddes_critial_pressure_head_h~1_reduction_coefficient'}
key: vegetation_feddes_h1, variables: {'wflow_v0': 'vertical.h1', 'wflow_v1': 'vegetation_root__feddes_critial_pressure_head_h~1'}
key: vegetation_feddes_h2, variables: {'wflow_v0': 'vertical.h2', 'wflow_v1': 'vegetation_root__feddes_critial_pressure_head_h~2'}
key: vegetation_feddes_h3_high, variables: {'wflow_v0': 'vertical.h3_high', 'wflow_v1': 'vegetation_root__feddes_critial_pressure_head_h~3~high'}
key: vegetation_feddes_h3_low, variables: {'wflow_v0': 'vertical.h3_low', 'wflow_v1': 'vegetation_root__feddes_critial_pressure_head_h~3~low'}
key: vegetation_feddes_h4, variables: {'wflow_v0': 'vertical.h4', 'wflow_v1': 'vegetation_root__feddes_critial_pressure_head_h~4'}
key: soil_brooks_corey_c, variables: {'wflow_v0': 'vertical.c', 'wflow_v1': 'soil_layer_water__brooks-corey_exponent', 'hydromt_name': 'soil_brooks_corey_c'}
key: soil_cf, variables: {'wflow_v0': 'vertical.cf_soil', 'wflow_v1': 'soil_surface_water__infiltration_reduction_parameter'}
key: soil_ksat_vertical, variables: {'wflow_v0': 'vertical.kv_0', 'wflow_v1': 'soil_surface_water__vertical_saturated_hydraulic_conductivity', 'hydromt_name': 'ksat_vertical'}
key: soil_ksat_vertical_factor, variables: {'wflow_v0': 'vertical.kvfrac', 'wflow_v1': 'soil_water__vertical_saturated_hydraulic_conductivity_factor'}
key: subsurface_ksat_horizontal_ratio, variables: {'wflow_v0': 'lateral.subsurface.ksathorfrac', 'wflow_v1': 'subsurface_water__horizontal-to-vertical_saturated_hydraulic_conductivity_ratio'}
key: soil_f, variables: {'wflow_v0': 'vertical.f', 'wflow_v1': 'soil_water__vertical_saturated_hydraulic_conductivity_scale_parameter', 'hydromt_name': 'f'}
key: soil_compacted_infiltration_capacity, variables: {'wflow_v0': 'vertical.infiltcappath', 'wflow_v1': 'soil~compacted_surface_water__infiltration_capacity'}
key: InfiltCapSoil, variables: {'wflow_v0': 'vertical.infiltcapsoil', 'wflow_v1': None}
key: soil_theta_r, variables: {'wflow_v0': 'vertical.theta_r', 'wflow_v1': 'soil_water__residual_volume_fraction', 'hydromt_name': 'theta_r'}
key: soil_theta_s, variables: {'wflow_v0': 'vertical.theta_s', 'wflow_v1': 'soil_water__saturated_volume_fraction', 'hydromt_name': 'theta_s'}
key: soil_max_leakage, variables: {'wflow_v0': 'vertical.maxleakage', 'wflow_v1': 'soil_water_sat-zone_bottom__max_leakage_volume_flux'}
key: soil_compacted_fraction, variables: {'wflow_v0': 'vertical.pathfrac', 'wflow_v1': 'soil~compacted__area_fraction'}
key: soil_rootdistpar, variables: {'wflow_v0': 'vertical.rootdistpar', 'wflow_v1': 'soil_root~wet__sigmoid_function_shape_parameter'}
key: soil_thickness, variables: {'wflow_v0': 'vertical.soilthickness', 'wflow_v1': 'soil__thickness'}
key: land_water_fraction, variables: {'wflow_v0': 'vertical.waterfrac', 'wflow_v1': 'land~water-covered__area_fraction'}
key: demand_allocation_area_id, variables: {'wflow_v0': 'vertical.allocation.areas', 'wflow_v1': 'land_water_allocation_area__count', 'hydromt_name': 'allocation_areas'}
key: demand_surface_water_ratio, variables: {'wflow_v0': 'vertical.allocation.frac_sw_used', 'wflow_v1': 'land_surface_water__withdrawal_fraction'}
key: demand_domestic_gross, variables: {'wflow_v0': 'vertical.domestic.demand_gross', 'wflow_v1': 'land~domestic__gross_water_demand_volume_flux', 'hydromt_name': 'domestic_gross'}
key: demand_domestic_net, variables: {'wflow_v0': 'vertical.domestic.demand_net', 'wflow_v1': 'land~domestic__net_water_demand_volume_flux', 'hydromt_name': 'domestic_net'}
key: demand_industry_gross, variables: {'wflow_v0': 'vertical.industry.demand_gross', 'wflow_v1': 'land~industry__gross_water_demand_volume_flux', 'hydromt_name': 'industry_gross'}
key: demand_industry_net, variables: {'wflow_v0': 'vertical.industry.demand_net', 'wflow_v1': 'land~industry__net_water_demand_volume_flux', 'hydromt_name': 'industry_net'}
key: demand_livestock_gross, variables: {'wflow_v0': 'vertical.livestock.demand_gross', 'wflow_v1': 'land~livestock__gross_water_demand_volume_flux', 'hydromt_name': 'livestock_gross'}
key: demand_livestock_net, variables: {'wflow_v0': 'vertical.livestock.demand_net', 'wflow_v1': 'land~livestock__net_water_demand_volume_flux', 'hydromt_name': 'livestock_net'}
key: demand_paddy_h_min, variables: {'wflow_v0': 'vertical.paddy.h_min', 'wflow_v1': 'land~irrigated-paddy__min_depth'}
key: demand_paddy_h_opt, variables: {'wflow_v0': 'vertical.paddy.h_opt', 'wflow_v1': 'land~irrigated-paddy__optimal_depth'}
key: demand_paddy_h_max, variables: {'wflow_v0': 'vertical.paddy.h_max', 'wflow_v1': 'land~irrigated-paddy__max_depth'}
key: demand_paddy_irrigated_mask, variables: {'wflow_v0': 'vertical.paddy.irrigation_areas', 'wflow_v1': 'land~irrigated-paddy_area__count'}
key: demand_paddy_irrigation_trigger, variables: {'wflow_v0': 'vertical.paddy.irrigation_trigger', 'wflow_v1': 'land~irrigated-paddy__irrigation_trigger_flag'}
key: demand_nonpaddy_irrigated_mask, variables: {'wflow_v0': 'vertical.nonpaddy.irrigation_areas', 'wflow_v1': 'land~irrigated-non-paddy_area__count'}
key: demand_nonpaddy_irrigation_trigger, variables: {'wflow_v0': 'vertical.nonpaddy.irrigation_trigger', 'wflow_v1': 'land~irrigated-non-paddy__irrigation_trigger_flag'}
key: N, variables: {'wflow_v0': 'lateral.land.n', 'wflow_v1': 'land_surface_water_flow__manning_n_parameter'}
key: land_elevation, variables: {'wflow_v0': 'lateral.land.elevation', 'wflow_v1': 'land_surface_water_flow__ground_elevation', 'hydromt_name': 'elevtn'}
key: land_slope, variables: {'wflow_v0': 'lateral.land.slope', 'wflow_v1': 'land_surface__slope', 'hydromt_name': 'lndslp'}
key: floodplain_volume, variables: {'wflow_v0': 'lateral.river.floodplain.volume', 'wflow_v1': 'floodplain_water__sum_of_volume-per-depth', 'hydromt_name': 'floodplain_volume'}
key: river_bank_elevation, variables: {'wflow_v0': 'lateral.river.bankfull_elevation', 'wflow_v1': 'river_bank_water__elevation', 'hydromt_name': 'hydrodem'}
key: river_inflow, variables: {'wflow_v0': 'lateral.river.inflow', 'wflow_v1': 'river_water_inflow~external__volume_flow_rate'}
key: river_depth, variables: {'wflow_v0': 'lateral.river.bankfull_depth', 'wflow_v1': 'river_bank_water__depth', 'hydromt_name': 'rivdph'}
key: river_length, variables: {'wflow_v0': 'lateral.river.length', 'wflow_v1': 'river__length', 'hydromt_name': 'rivlen'}
key: river_manning_n, variables: {'wflow_v0': 'lateral.river.n', 'wflow_v1': 'river_water_flow__manning_n_parameter'}
key: river_slope, variables: {'wflow_v0': 'lateral.river.slope', 'wflow_v1': 'river__slope', 'hydromt_name': 'rivslp'}
key: river_width, variables: {'wflow_v0': 'lateral.river.width', 'wflow_v1': 'river__width', 'hydromt_name': 'rivwth'}
key: lake_area, variables: {'wflow_v0': 'lateral.river.lake.area', 'wflow_v1': 'lake_surface__area', 'hydromt_name': 'lake_area'}
key: lake_initial_depth, variables: {'wflow_v0': 'lateral.river.lake.waterlevel', 'wflow_v1': 'lake_water_surface__initial_elevation', 'hydromt_name': 'lake_initial_depth'}
key: lake_outflow_threshold, variables: {'wflow_v0': 'lateral.river.lake.threshold', 'wflow_v1': 'lake_water_flow_threshold-level__elevation', 'hydromt_name': 'lake_outflow_threshold'}
key: lake_b, variables: {'wflow_v0': 'lateral.river.lake.b', 'wflow_v1': 'lake_water__rating_curve_coefficient', 'hydromt_name': 'lake_b'}
key: lake_e, variables: {'wflow_v0': 'lateral.river.lake.e', 'wflow_v1': 'lake_water__rating_curve_exponent', 'hydromt_name': 'lake_e'}
key: lake_rating_curve, variables: {'wflow_v0': 'lateral.river.lake.outflowfunc', 'wflow_v1': 'lake_water__rating_curve_type_count', 'hydromt_name': 'lake_rating_curve'}
key: lake_storage_curve, variables: {'wflow_v0': 'lateral.river.lake.storfunc', 'wflow_v1': 'lake_water__storage_curve_type_count', 'hydromt_name': 'lake_storage_curve'}
key: lake_lower_id, variables: {'wflow_v0': 'lateral.river.lake.linkedlakelocs', 'wflow_v1': 'lake~lower_location__count', 'hydromt_name': 'lake_lower_id'}
key: reservoir_area, variables: {'wflow_v0': 'lateral.river.reservoir.area', 'wflow_v1': 'reservoir_surface__area', 'hydromt_name': 'reservoir_area'}
key: reservoir_demand, variables: {'wflow_v0': 'lateral.river.reservoir.demand', 'wflow_v1': 'reservoir_water_demand~required~downstream__volume_flow_rate', 'hydromt_name': 'reservoir_demand'}
key: reservoir_max_release, variables: {'wflow_v0': 'lateral.river.reservoir.maxrelease', 'wflow_v1': 'reservoir_water_release-below-spillway__max_volume_flow_rate', 'hydromt_name': 'reservoir_max_release'}
key: reservoir_max_volume, variables: {'wflow_v0': 'lateral.river.reservoir.maxvolume', 'wflow_v1': 'reservoir_water__max_volume', 'hydromt_name': 'reservoir_max_volume'}
key: reservoir_target_full_fraction, variables: {'wflow_v0': 'lateral.river.reservoir.targetfullfrac', 'wflow_v1': 'reservoir_water~full-target__volume_fraction', 'hydromt_name': 'reservoir_target_full_fraction'}
key: reservoir_target_min_fraction, variables: {'wflow_v0': 'lateral.river.reservoir.targetminfrac', 'wflow_v1': 'reservoir_water~min-target__volume_fraction', 'hydromt_name': 'reservoir_target_min_fraction'}
key: altitude, variables: {'wflow_v0': 'altitude', 'wflow_v1': 'land_surface__elevation'}
key: groundwater_constant_head, variables: {'wflow_v0': 'lateral.subsurface.constant_head', 'wflow_v1': 'model_boundary_condition~constant_hydraulic_head'}
key: groundwater_ksat_horizontal, variables: {'wflow_v0': 'lateral.subsurface.conductivity', 'wflow_v1': 'subsurface_surface_water__horizontal_saturated_hydraulic_conductivity'}
key: river_bed_elevation, variables: {'wflow_v0': 'lateral.subsurface.river_bottom', 'wflow_v1': 'river_bottom__elevation'}
key: river_bed_exfiltration_conductance, variables: {'wflow_v0': 'lateral.subsurface.infiltration_conductance', 'wflow_v1': 'river_water__infiltration_conductance'}
key: river_bed_infiltration_conductance, variables: {'wflow_v0': 'lateral.subsurface.exfiltration_conductance', 'wflow_v1': 'river_water__exfiltration_conductance'}
key: groundwater_specific_yield, variables: {'wflow_v0': 'lateral.subsurface.specific_yield', 'wflow_v1': 'subsurface_water__specific_yield'}
key: groundwater_f, variables: {'wflow_v0': 'lateral.subsurface.gwf_f', 'wflow_v1': 'subsurface__horizontal_saturated_hydraulic_conductivity_scale_parameter'}
key: drain, variables: {'wflow_v0': 'lateral.subsurface.drain', 'wflow_v1': 'land_drain_location__mask'}
key: drain_conductance, variables: {'wflow_v0': 'lateral.subsurface.drain_conductance', 'wflow_v1': 'land_drain__conductance'}
key: drain_elevation, variables: {'wflow_v0': 'lateral.subsurface.drain_elevation', 'wflow_v1': 'land_drain__elevation'}
2025-06-26 14:11:33,759 - update - utils - INFO - Converting config output sections
2025-06-26 14:11:33,775 - update - model_api - INFO - write_config.config_name: wflow_sbm_v1.toml
2025-06-26 14:11:33,776 - update - model_api - INFO - write_config.config_root: None
2025-06-26 14:11:33,776 - update - wflow - INFO - Writing model config to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/data/wflow_upgrade/sbm/wflow_sbm_v1.toml
And let’s see the results. Here is what our old TOML file looked like:
[3]:
toml_v0x = "./data/wflow_upgrade/sbm/wflow_sbm_v0x.toml"
with open(toml_v0x, "r") as f:
txt = f.read()
print(txt)
casename = "wflow_sbm"
calendar = "proleptic_gregorian"
starttime = "2010-02-02T00:00:00"
endtime = "2010-02-10T00:00:00"
time_units = "days since 1900-01-01 00:00:00"
timestepsecs = 86400
dir_output = "run_default"
[state]
path_input = "instate/instates.nc"
path_output = "outstate/outstates.nc"
[input]
path_forcing = "inmaps.nc"
path_static = "staticmaps.nc"
gauges = "wflow_gauges"
ldd = "wflow_ldd"
river_location = "wflow_river"
subcatchment = "wflow_subcatch"
forcing = [ "vertical.precipitation", "vertical.temperature", "vertical.potential_evaporation",]
cyclic = [ "vertical.leaf_area_index",]
gauges_grdc = "wflow_gauges_grdc"
[model]
type = "sbm"
masswasting = true
snow = true
reinit = true
reservoirs = true
lakes = true
glacier = true
kin_wave_iteration = true
kw_river_tstep = 900
kw_land_tstep = 3600
thicknesslayers = [ 100, 300, 800,]
[state.vertical]
satwaterdepth = "satwaterdepth"
snow = "snow"
tsoil = "tsoil"
ustorelayerdepth = "ustorelayerdepth"
snowwater = "snowwater"
canopystorage = "canopystorage"
glacierstore = "glacierstore"
[input.vertical]
alpha_h1 = "alpha_h1"
altitude = "wflow_dem"
c = "c"
cf_soil = "cf_soil"
cfmax = "Cfmax"
e_r = "EoverR"
f = "f"
infiltcappath = "InfiltCapPath"
infiltcapsoil = "InfiltCapSoil"
kext = "Kext"
kv_0 = "KsatVer"
leaf_area_index = "LAI"
m = "M_"
maxleakage = "MaxLeakage"
pathfrac = "PathFrac"
potential_evaporation = "pet"
precipitation = "precip"
rootdistpar = "rootdistpar"
rootingdepth = "RootingDepth"
soilminthickness = "SoilMinThickness"
soilthickness = "SoilThickness"
specific_leaf = "Sl"
storage_wood = "Swood"
temperature = "temp"
tt = "TT"
tti = "TTI"
ttm = "TTM"
water_holding_capacity = "WHC"
waterfrac = "WaterFrac"
theta_s = "thetaS"
theta_r = "thetaR"
glacierstore = "wflow_glacierstore"
glacierfrac = "wflow_glacierfrac"
g_cfmax = "G_Cfmax"
g_ttm = "G_TTM"
g_sifrac = "G_SIfrac"
[state.lateral.river]
q = "q_river"
h = "h_river"
h_av = "h_av_river"
[state.lateral.subsurface]
ssf = "ssf"
[state.lateral.land]
q = "q_land"
h = "h_land"
h_av = "h_av_land"
[input.lateral.river]
length = "wflow_riverlength"
n = "N_River"
slope = "RiverSlope"
width = "wflow_riverwidth"
bankfull_depth = "RiverDepth"
[input.lateral.subsurface]
ksathorfrac = "KsatHorFrac"
[input.lateral.land]
n = "N"
slope = "Slope"
[state.lateral.river.reservoir]
volume = "volume_reservoir"
[state.lateral.river.lake]
waterlevel = "waterlevel_lake"
[input.lateral.river.reservoir]
area = "ResSimpleArea"
areas = "wflow_reservoirareas"
demand = "ResDemand"
locs = "wflow_reservoirlocs"
maxrelease = "ResMaxRelease"
maxvolume = "ResMaxVolume"
targetfullfrac = "ResTargetFullFrac"
targetminfrac = "ResTargetMinFrac"
[input.lateral.river.lake]
area = "LakeArea"
areas = "wflow_lakeareas"
b = "Lake_b"
e = "Lake_e"
locs = "wflow_lakelocs"
outflowfunc = "LakeOutflowFunc"
storfunc = "LakeStorFunc"
threshold = "LakeThreshold"
linkedlakelocs = "LinkedLakeLocs"
waterlevel = "LakeAvgLevel"
[output]
path = "output.nc"
[output.lateral.river]
q_av = "q_river"
[output.lateral.land]
h = "h_land"
[netcdf]
path = "output_scalar.nc"
[[netcdf.variable]]
name = "Q"
map = "gauges"
parameter = "lateral.river.q"
[[netcdf.variable]]
name = "temp_coord"
location = "temp_bycoord"
coordinate.x = 11.9594
coordinate.y = 45.8925
parameter = "vertical.temperature"
[csv]
path = "output.csv"
[[csv.column]]
header = "Q-max"
parameter = "lateral.river.q_av"
reducer = "maximum"
[[csv.column]]
header = "res-volume"
index = 1
parameter = "lateral.river.reservoir.volume"
[[csv.column]]
header = "temp_bycoord"
coordinate.x = 11.95
coordinate.y = 45.9
parameter = "vertical.temperature"
[[csv.column]]
header = "temp_byindex"
index.x = 11
index.y = 6
parameter = "vertical.temperature"
[[csv.column]]
header = "Q"
map = "gauges_grdc"
parameter = "lateral.river.q_av"
[[csv.column]]
header = "P"
map = "subcatchment"
parameter = "vertical.precipitation"
reducer = "mean"
And here is the same TOML in version 1 format:
[4]:
toml_v1 = "./data/wflow_upgrade/sbm/wflow_sbm_v1.toml"
with open(toml_v1, "r") as f:
txt = f.read()
print(txt)
dir_output = "run_default"
[time]
calendar = "proleptic_gregorian"
starttime = "2010-02-02T00:00:00"
endtime = "2010-02-10T00:00:00"
time_units = "days since 1900-01-01 00:00:00"
timestepsecs = 86400
[model]
snow_gravitional_transport__flag = true
snow__flag = true
cold_start__flag = true
reservoir__flag = true
lake__flag = true
glacier__flag = true
kinematic_wave__adaptive_time_step_flag = true
river_kinematic_wave__time_step = 900
land_kinematic_wave__time_step = 3600
soil_layer__thickness = [ 100, 300, 800,]
[state]
path_input = "instate/instates.nc"
path_output = "outstate/outstates.nc"
[state.variables]
vegetation_canopy_water__depth = "canopystorage"
soil_water_sat-zone__depth = "satwaterdepth"
soil_layer_water_unsat-zone__depth = "ustorelayerdepth"
soil_surface__temperature = "tsoil"
"snowpack~dry__leq-depth" = "snow"
"snowpack~liquid__depth" = "snowwater"
glacier_ice__leq-depth = "glacierstore"
land_surface_water__instantaneous_volume_flow_rate = "q_land"
land_surface_water__instantaneous_depth = "h_land"
subsurface_water__volume_flow_rate = "ssf"
river_water__instantaneous_volume_flow_rate = "q_river"
river_water__instantaneous_depth = "h_river"
lake_water_surface__instantaneous_elevation = "waterlevel_lake"
reservoir_water__instantaneous_volume = "volume_reservoir"
[input]
path_forcing = "inmaps.nc"
path_static = "staticmaps.nc"
gauges = "wflow_gauges"
basin__local_drain_direction = "wflow_ldd"
river_location__mask = "wflow_river"
subbasin_location__count = "wflow_subcatch"
gauges_grdc = "wflow_gauges_grdc"
lake_area__count = "wflow_lakeareas"
lake_location__count = "wflow_lakelocs"
reservoir_area__count = "wflow_reservoirareas"
reservoir_location__count = "wflow_reservoirlocs"
"lake~lower_location__count" = "LinkedLakeLocs"
[input.forcing]
atmosphere_water__precipitation_volume_flux = "precip"
atmosphere_air__temperature = "temp"
land_surface_water__potential_evaporation_volume_flux = "pet"
[input.cyclic]
vegetation__leaf-area_index = "LAI"
[input.static]
snowpack__degree-day_coefficient = "Cfmax"
atmosphere_air__snowfall_temperature_threshold = "TT"
atmosphere_air__snowfall_temperature_interval = "TTI"
snowpack__melting_temperature_threshold = "TTM"
snowpack__liquid_water_holding_capacity = "WHC"
glacier_surface__area_fraction = "wflow_glacierfrac"
glacier_ice__initial_leq-depth = "wflow_glacierstore"
glacier_ice__melting_temperature_threshold = "G_TTM"
glacier_ice__degree-day_coefficient = "G_Cfmax"
"glacier_firn_accumulation__snowpack~dry_leq-depth_fraction" = "G_SIfrac"
vegetation_canopy_water__mean_evaporation-to-mean_precipitation_ratio = "EoverR"
vegetation_canopy__light-extinction_coefficient = "Kext"
vegetation_root__depth = "RootingDepth"
vegetation__specific-leaf_storage = "Sl"
vegetation_wood_water__storage_capacity = "Swood"
"vegetation_root__feddes_critial_pressure_head_h~1_reduction_coefficient" = "alpha_h1"
soil_layer_water__brooks-corey_exponent = "c"
soil_surface_water__infiltration_reduction_parameter = "cf_soil"
soil_surface_water__vertical_saturated_hydraulic_conductivity = "KsatVer"
subsurface_water__horizontal-to-vertical_saturated_hydraulic_conductivity_ratio = "KsatHorFrac"
soil_water__vertical_saturated_hydraulic_conductivity_scale_parameter = "f"
"soil~compacted_surface_water__infiltration_capacity" = "InfiltCapPath"
soil_water__residual_volume_fraction = "thetaR"
soil_water__saturated_volume_fraction = "thetaS"
soil_water_sat-zone_bottom__max_leakage_volume_flux = "MaxLeakage"
"soil~compacted__area_fraction" = "PathFrac"
"soil_root~wet__sigmoid_function_shape_parameter" = "rootdistpar"
soil__thickness = "SoilThickness"
"land~water-covered__area_fraction" = "WaterFrac"
land_surface_water_flow__manning_n_parameter = "N"
land_surface__slope = "Slope"
river_bank_water__depth = "RiverDepth"
river__length = "wflow_riverlength"
river_water_flow__manning_n_parameter = "N_River"
river__slope = "RiverSlope"
river__width = "wflow_riverwidth"
lake_surface__area = "LakeArea"
lake_water_surface__initial_elevation = "LakeAvgLevel"
lake_water_flow_threshold-level__elevation = "LakeThreshold"
lake_water__rating_curve_coefficient = "Lake_b"
lake_water__rating_curve_exponent = "Lake_e"
lake_water__rating_curve_type_count = "LakeOutflowFunc"
lake_water__storage_curve_type_count = "LakeStorFunc"
reservoir_surface__area = "ResSimpleArea"
"reservoir_water_demand~required~downstream__volume_flow_rate" = "ResDemand"
reservoir_water_release-below-spillway__max_volume_flow_rate = "ResMaxRelease"
reservoir_water__max_volume = "ResMaxVolume"
"reservoir_water~full-target__volume_fraction" = "ResTargetFullFrac"
"reservoir_water~min-target__volume_fraction" = "ResTargetMinFrac"
[output.netcdf_grid]
path = "output.nc"
compressionlevel = 1
[output.netcdf_grid.variables]
river_water__volume_flow_rate = "q_river"
land_surface_water__instantaneous_depth = "h_land"
[output.netcdf_scalar]
path = "output_scalar.nc"
variable = [{name = "Q",map = "gauges",parameter = "river_water__instantaneous_volume_flow_rate"}, {name = "temp_coord",location = "temp_bycoord",coordinate = {x = 11.9594,y = 45.8925},parameter = "atmosphere_air__temperature"}]
[output.csv]
path = "output.csv"
column = [{header = "Q-max",parameter = "river_water__volume_flow_rate",reducer = "maximum"}, {header = "res-volume",index = 1,parameter = "reservoir_water__instantaneous_volume"}, {header = "temp_bycoord",coordinate = {x = 11.95,y = 45.9},parameter = "atmosphere_air__temperature"}, {header = "temp_byindex",index = {x = 11,y = 6},parameter = "atmosphere_air__temperature"}, {header = "Q",map = "gauges_grdc",parameter = "river_water__volume_flow_rate"}, {header = "P",map = "subbasin_location__count",parameter = "atmosphere_water__precipitation_volume_flux",reducer = "mean"}]
Upgrading a Wflow Sediment model#
We can call the upgrade_to_v1_wflow
function using the update
CLI of HydroMT. Here is the configuration file that we will use:
[5]:
fn_config = "wflow_update_v1_sediment.yml"
with open(fn_config, "r") as f:
txt = f.read()
print(txt)
global:
config_fn: wflow_sediment_v0x.toml
upgrade_to_v1_wflow:
soil_fn: soilgrids
write_config:
config_name: wflow_sediment_v1.toml
write_grid:
fn_out: staticmaps_v1.nc
In this config, we start by setting the name of the TOML file of the version 0x model (if different than wflow_sediment.toml), call the upgrade_to_v1_wflow
method, and then save the updated TOML file into a new wflow_sbm_v1.toml file and the updated staticmaps file with the additional parameters in staticmaps_v1.toml.
Note that if you use the standard wflow_sediment.toml name and do not mind it or the staticmaps file being overwritten, the above example can be reduced into only calling upgrade_to_v1_wflow
.
Let’s now call HydroMT update to update our old config (in this case we do need a data catalog as we will update some of the soil parameters):
[6]:
!hydromt update wflow_sediment "./data/wflow_upgrade/sediment" -i wflow_update_v1_sediment.yml -d artifact_data -vvv
2025-06-26 14:11:36,071 - update - log - DEBUG - Writing log messages to new file /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/data/wflow_upgrade/sediment/hydromt.log.
2025-06-26 14:11:36,071 - update - log - INFO - HydroMT version: 0.10.1
2025-06-26 14:11:36,071 - update - main - INFO - Updating wflow_sediment model at /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/data/wflow_upgrade/sediment (r+).
2025-06-26 14:11:36,071 - update - main - INFO - Output dir: /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/data/wflow_upgrade/sediment
2025-06-26 14:11:36,071 - update - main - INFO - User settings:
2025-06-26 14:11:36,147 - update - data_catalog - INFO - Reading data catalog artifact_data latest
2025-06-26 14:11:36,147 - update - data_catalog - INFO - Parsing data catalog from /home/runner/.hydromt_data/artifact_data/v0.0.9/data_catalog.yml
2025-06-26 14:11:36,704 - update - model_api - INFO - Initializing wflow_sediment model from hydromt_wflow (v1.0.0rc1).
2025-06-26 14:11:36,704 - update - data_catalog - INFO - Parsing data catalog from /home/runner/work/hydromt_wflow/hydromt_wflow/hydromt_wflow/data/parameters_data.yml
2025-06-26 14:11:36,717 - update - wflow - INFO - Supported Wflow.jl version v1+
2025-06-26 14:11:36,727 - update - model_api - DEBUG - Model config read from /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/data/wflow_upgrade/sediment/wflow_sediment_v0x.toml
2025-06-26 14:11:36,729 - update - wflow - INFO - Read grid from /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/data/wflow_upgrade/sediment/staticmaps_v0x.nc
2025-06-26 14:11:37,331 - update - model_api - INFO - upgrade_to_v1_wflow.soil_fn: soilgrids
2025-06-26 14:11:37,331 - update - model_api - INFO - upgrade_to_v1_wflow.usle_k_method: renard
2025-06-26 14:11:37,331 - update - model_api - INFO - upgrade_to_v1_wflow.strord_name: wflow_streamorder
2025-06-26 14:11:37,342 - update - model_api - DEBUG - Model config read from /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/data/wflow_upgrade/sediment/wflow_sediment_v0x.toml
2025-06-26 14:11:37,342 - update - wflow - INFO - Read grid from /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/data/wflow_upgrade/sediment/staticmaps_v0x.nc
2025-06-26 14:11:37,369 - update - model_grid - WARNING - Replacing grid map: x_out
2025-06-26 14:11:37,370 - update - model_grid - WARNING - Replacing grid map: y_out
2025-06-26 14:11:37,372 - update - model_grid - WARNING - Replacing grid map: idx_out
2025-06-26 14:11:37,373 - update - model_grid - WARNING - Replacing grid map: wflow_ldd
2025-06-26 14:11:37,374 - update - model_grid - WARNING - Replacing grid map: wflow_subcatch
2025-06-26 14:11:37,375 - update - model_grid - WARNING - Replacing grid map: wflow_uparea
2025-06-26 14:11:37,376 - update - model_grid - WARNING - Replacing grid map: subare
2025-06-26 14:11:37,377 - update - model_grid - WARNING - Replacing grid map: dem_subgrid
2025-06-26 14:11:37,378 - update - model_grid - WARNING - Replacing grid map: wflow_streamorder
2025-06-26 14:11:37,379 - update - model_grid - WARNING - Replacing grid map: wflow_dem
2025-06-26 14:11:37,380 - update - model_grid - WARNING - Replacing grid map: Slope
2025-06-26 14:11:37,381 - update - model_grid - WARNING - Replacing grid map: wflow_river
2025-06-26 14:11:37,382 - update - model_grid - WARNING - Replacing grid map: wflow_riverlength
2025-06-26 14:11:37,383 - update - model_grid - WARNING - Replacing grid map: RiverSlope
2025-06-26 14:11:37,384 - update - model_grid - WARNING - Replacing grid map: N_River
2025-06-26 14:11:37,385 - update - model_grid - WARNING - Replacing grid map: wflow_riverwidth
2025-06-26 14:11:37,386 - update - model_grid - WARNING - Replacing grid map: RiverDepth
2025-06-26 14:11:37,387 - update - model_grid - WARNING - Replacing grid map: wflow_reservoirareas
2025-06-26 14:11:37,388 - update - model_grid - WARNING - Replacing grid map: wflow_reservoirlocs
2025-06-26 14:11:37,389 - update - model_grid - WARNING - Replacing grid map: ResMaxVolume
2025-06-26 14:11:37,390 - update - model_grid - WARNING - Replacing grid map: ResSimpleArea
2025-06-26 14:11:37,392 - update - model_grid - WARNING - Replacing grid map: ResDemand
2025-06-26 14:11:37,393 - update - model_grid - WARNING - Replacing grid map: ResMaxRelease
2025-06-26 14:11:37,394 - update - model_grid - WARNING - Replacing grid map: ResTargetFullFrac
2025-06-26 14:11:37,395 - update - model_grid - WARNING - Replacing grid map: ResTargetMinFrac
2025-06-26 14:11:37,396 - update - model_grid - WARNING - Replacing grid map: wflow_lakeareas
2025-06-26 14:11:37,397 - update - model_grid - WARNING - Replacing grid map: wflow_lakelocs
2025-06-26 14:11:37,398 - update - model_grid - WARNING - Replacing grid map: LakeArea
2025-06-26 14:11:37,399 - update - model_grid - WARNING - Replacing grid map: LakeAvgLevel
2025-06-26 14:11:37,400 - update - model_grid - WARNING - Replacing grid map: LakeAvgOut
2025-06-26 14:11:37,401 - update - model_grid - WARNING - Replacing grid map: Lake_b
2025-06-26 14:11:37,402 - update - model_grid - WARNING - Replacing grid map: Lake_e
2025-06-26 14:11:37,403 - update - model_grid - WARNING - Replacing grid map: LakeStorFunc
2025-06-26 14:11:37,404 - update - model_grid - WARNING - Replacing grid map: LakeOutflowFunc
2025-06-26 14:11:37,405 - update - model_grid - WARNING - Replacing grid map: LakeThreshold
2025-06-26 14:11:37,406 - update - model_grid - WARNING - Replacing grid map: LinkedLakeLocs
2025-06-26 14:11:37,407 - update - model_grid - WARNING - Replacing grid map: D50_River
2025-06-26 14:11:37,408 - update - model_grid - WARNING - Replacing grid map: ClayF_River
2025-06-26 14:11:37,409 - update - model_grid - WARNING - Replacing grid map: SiltF_River
2025-06-26 14:11:37,410 - update - model_grid - WARNING - Replacing grid map: SandF_River
2025-06-26 14:11:37,411 - update - model_grid - WARNING - Replacing grid map: GravelF_River
2025-06-26 14:11:37,412 - update - model_grid - WARNING - Replacing grid map: wflow_landuse
2025-06-26 14:11:37,413 - update - model_grid - WARNING - Replacing grid map: Kext
2025-06-26 14:11:37,414 - update - model_grid - WARNING - Replacing grid map: PathFrac
2025-06-26 14:11:37,415 - update - model_grid - WARNING - Replacing grid map: Sl
2025-06-26 14:11:37,416 - update - model_grid - WARNING - Replacing grid map: Swood
2025-06-26 14:11:37,417 - update - model_grid - WARNING - Replacing grid map: USLE_C
2025-06-26 14:11:37,418 - update - model_grid - WARNING - Replacing grid map: LAI
2025-06-26 14:11:37,419 - update - model_grid - WARNING - Replacing grid map: CanopyHeight
2025-06-26 14:11:37,420 - update - model_grid - WARNING - Replacing grid map: PercentClay
2025-06-26 14:11:37,421 - update - model_grid - WARNING - Replacing grid map: PercentSilt
2025-06-26 14:11:37,422 - update - model_grid - WARNING - Replacing grid map: PercentOC
2025-06-26 14:11:37,423 - update - model_grid - WARNING - Replacing grid map: ErosK
2025-06-26 14:11:37,424 - update - model_grid - WARNING - Replacing grid map: USLE_K
2025-06-26 14:11:37,425 - update - model_grid - WARNING - Replacing grid map: wflow_gauges
2025-06-26 14:11:37,426 - update - model_grid - WARNING - Replacing grid map: wflow_gauges_grdc
2025-06-26 14:11:37,427 - update - model_grid - WARNING - Replacing grid map: c_Bagnold
2025-06-26 14:11:37,428 - update - model_grid - WARNING - Replacing grid map: eros_expo
2025-06-26 14:11:37,429 - update - model_grid - WARNING - Replacing grid map: eros_ov
2025-06-26 14:11:37,429 - update - model_grid - WARNING - Replacing grid map: eros_spl_EUROSEM
2025-06-26 14:11:37,430 - update - model_grid - WARNING - Replacing grid map: exp_Bagnold
2025-06-26 14:11:37,431 - update - model_grid - WARNING - Replacing grid map: ResTrapEff
2025-06-26 14:11:37,433 - update - wflow - INFO - Reading model table files.
2025-06-26 14:11:37,433 - update - wflow - INFO - Model read
2025-06-26 14:11:37,433 - update - utils - INFO - Converting config to Wflow v1 format
2025-06-26 14:11:37,433 - update - utils - INFO - Converting config general, time and model sections
2025-06-26 14:11:37,434 - update - utils - INFO - Converting config state section
2025-06-26 14:11:37,436 - update - utils - INFO - Converting config input section
key: subcatchment, variables: {'wflow_v0': 'subcatchment', 'wflow_v1': 'subbasin_location__count', 'hydromt_name': 'basins'}
key: local_drain_direction, variables: {'wflow_v0': 'ldd', 'wflow_v1': 'basin__local_drain_direction', 'hydromt_name': 'flwdir'}
key: lake_area_id, variables: {'wflow_v0': 'vertical.lakeareas', 'wflow_v1': 'lake_area__count', 'hydromt_name': 'lake_area_id'}
key: lake_outlet_id, variables: {'wflow_v0': 'lateral.river.lakelocs', 'wflow_v1': 'lake_location__count', 'hydromt_name': 'lake_outlet_id'}
key: reservoir_area_id, variables: {'wflow_v0': 'vertical.resareas', 'wflow_v1': 'reservoir_area__count', 'hydromt_name': 'reservoir_area_id'}
key: reservoir_outlet_id, variables: {'wflow_v0': 'lateral.river.reslocs', 'wflow_v1': 'reservoir_location__count', 'hydromt_name': 'reservoir_outlet_id'}
key: river_mask, variables: {'wflow_v0': 'river_location', 'wflow_v1': 'river_location__mask', 'hydromt_name': 'rivmsk'}
key: precip, variables: {'wflow_v0': 'vertical.precipitation', 'wflow_v1': 'atmosphere_water__precipitation_volume_flux', 'hydromt_name': 'precip'}
key: vegetation_interception, variables: {'wflow_v0': 'vertical.interception', 'wflow_v1': 'vegetation_canopy_water__interception_volume_flux', 'hydromt_name': 'interception'}
key: land_h, variables: {'wflow_v0': 'vertical.h_land', 'wflow_v1': 'land_surface_water__depth'}
key: land_q, variables: {'wflow_v0': 'vertical.q_land', 'wflow_v1': 'land_surface_water__volume_flow_rate'}
key: river_h, variables: {'wflow_v0': 'lateral.river.h_riv', 'wflow_v1': 'river_water__depth'}
key: river_q, variables: {'wflow_v0': 'lateral.river.q_riv', 'wflow_v1': 'river_water__volume_flow_rate'}
key: land_slope, variables: {'wflow_v0': 'lateral.land.slope', 'wflow_v1': 'land_surface__slope', 'hydromt_name': 'lndslp'}
key: river_length, variables: {'wflow_v0': 'lateral.river.length', 'wflow_v1': 'river__length', 'hydromt_name': 'rivlen'}
key: river_slope, variables: {'wflow_v0': 'lateral.river.slope', 'wflow_v1': 'river__slope', 'hydromt_name': 'rivslp'}
key: river_width, variables: {'wflow_v0': 'lateral.river.width', 'wflow_v1': 'river__width', 'hydromt_name': 'rivwth'}
key: reservoir_area, variables: {'wflow_v0': 'lateral.river.resarea', 'wflow_v1': 'reservoir_surface__area', 'hydromt_name': 'reservoir_area'}
key: lake_area, variables: {'wflow_v0': 'lateral.river.lakearea', 'wflow_v1': 'lake_surface__area', 'hydromt_name': 'lake_area'}
key: reservoir_trapping_efficiency, variables: {'wflow_v0': 'lateral.river.restrapeff', 'wflow_v1': 'reservoir_water_sediment~bedload__trapping_efficiency', 'hydromt_name': 'reservoir_trapping_efficiency'}
key: vegetation_gap_fraction, variables: {'wflow_v0': 'vertical.canopygapfraction', 'wflow_v1': 'vegetation_canopy__gap_fraction'}
key: vegetation_height, variables: {'wflow_v0': 'vertical.canopyheight', 'wflow_v1': 'vegetation_canopy__height'}
key: vegetation_kext, variables: {'wflow_v0': 'vertical.kext', 'wflow_v1': None}
key: leaf_storage, variables: {'wflow_v0': 'vertical.specific_leaf', 'wflow_v1': None, 'hydromt_name': 'leaf_storage'}
key: vegetation_wood_storage, variables: {'wflow_v0': 'vertical.storage_wood', 'wflow_v1': None, 'hydromt_name': 'wood_storage'}
key: soil_compacted_fraction, variables: {'wflow_v0': 'vertical.pathfrac', 'wflow_v1': 'soil~compacted__area_fraction'}
key: land_water_fraction, variables: {'wflow_v0': None, 'wflow_v1': 'land~water-covered__area_fraction'}
key: erosion_soil_detachability, variables: {'wflow_v0': 'vertical.erosk', 'wflow_v1': 'soil_erosion__rainfall_soil_detachability_factor'}
key: erosion_eurosem_exp, variables: {'wflow_v0': 'vertical.erosspl', 'wflow_v1': 'soil_erosion__eurosem_exponent'}
key: erosion_usle_k, variables: {'wflow_v0': 'vertical.usleK', 'wflow_v1': 'soil_erosion__usle_k_factor', 'hydromt_name': 'usle_k'}
key: erosion_usle_c, variables: {'wflow_v0': 'vertical.usleC', 'wflow_v1': 'soil_erosion__usle_c_factor', 'hydromt_name': 'usle_c'}
key: erosion_answers_sheet_factor, variables: {'wflow_v0': 'vertical.erosov', 'wflow_v1': 'soil_erosion__answers_overland_flow_factor'}
key: erosion_answers_rain_factor, variables: {'wflow_v0': None, 'wflow_v1': 'soil_erosion__answers_rainfall_factor'}
key: soil_clay_fraction, variables: {'wflow_v0': None, 'wflow_v1': 'soil_clay__mass_fraction'}
key: soil_silt_fraction, variables: {'wflow_v0': None, 'wflow_v1': 'soil_silt__mass_fraction'}
key: soil_sand_fraction, variables: {'wflow_v0': None, 'wflow_v1': 'soil_sand__mass_fraction'}
key: soil_sagg_fraction, variables: {'wflow_v0': None, 'wflow_v1': 'soil_aggregates~small__mass_fraction'}
key: soil_lagg_fraction, variables: {'wflow_v0': None, 'wflow_v1': 'soil_aggregates~large__mass_fraction'}
key: land_govers_c, variables: {'wflow_v0': None, 'wflow_v1': 'land_surface_water_sediment__govers_transport_capacity_coefficient'}
key: land_govers_n, variables: {'wflow_v0': None, 'wflow_v1': 'land_surface_water_sediment__govers_transport_capacity_exponent'}
key: soil_sediment_d50, variables: {'wflow_v0': None, 'wflow_v1': 'land_surface_sediment__median_diameter'}
key: sediment_density, variables: {'wflow_v0': 'lateral.river.rhos', 'wflow_v1': 'sediment__particle_density'}
key: river_sediment_d50, variables: {'wflow_v0': 'lateral.river.d50engelund', 'wflow_v1': None}
key: river_bagnold_c, variables: {'wflow_v0': 'lateral.river.cbagnold', 'wflow_v1': 'river_water_sediment__bagnold_transport_capacity_coefficient'}
key: river_bagnold_exp, variables: {'wflow_v0': 'lateral.river.ebagnold', 'wflow_v1': 'river_water_sediment__bagnold_transport_capacity_exponent'}
key: river_kodatie_a, variables: {'wflow_v0': None, 'wflow_v1': 'river_water_sediment__kodatie_transport_capacity_a-coefficient'}
key: river_kodatie_b, variables: {'wflow_v0': None, 'wflow_v1': 'river_water_sediment__kodatie_transport_capacity_b-coefficient'}
key: river_kodatie_c, variables: {'wflow_v0': None, 'wflow_v1': 'river_water_sediment__kodatie_transport_capacity_c-coefficient'}
key: river_kodatie_d, variables: {'wflow_v0': None, 'wflow_v1': 'river_water_sediment__kodatie_transport_capacity_d-coefficient'}
key: river_bed_sediment_d50, variables: {'wflow_v0': 'lateral.river.d50', 'wflow_v1': 'river_bottom-and-bank_sediment__median_diameter'}
key: river_bed_clay_fraction, variables: {'wflow_v0': 'lateral.river.fclayriv', 'wflow_v1': 'river_bottom-and-bank_clay__mass_fraction'}
key: river_bed_silt_fraction, variables: {'wflow_v0': 'lateral.river.fsiltriv', 'wflow_v1': 'river_bottom-and-bank_silt__mass_fraction'}
key: river_bed_sand_fraction, variables: {'wflow_v0': 'lateral.river.fsandriv', 'wflow_v1': 'river_bottom-and-bank_sand__mass_fraction'}
key: river_bed_gravel_fraction, variables: {'wflow_v0': 'lateral.river.fgravelriv', 'wflow_v1': 'river_bottom-and-bank_gravel__mass_fraction'}
key: sediment_clay_dm, variables: {'wflow_v0': None, 'wflow_v1': 'clay__mean_diameter'}
key: sediment_silt_dm, variables: {'wflow_v0': None, 'wflow_v1': 'silt__mean_diameter'}
key: sediment_sand_dm, variables: {'wflow_v0': None, 'wflow_v1': 'sand__mean_diameter'}
key: sediment_sagg_dm, variables: {'wflow_v0': None, 'wflow_v1': 'sediment_aggregates~small__mean_diameter'}
key: sediment_lagg_dm, variables: {'wflow_v0': None, 'wflow_v1': 'sediment_aggregates~large__mean_diameter'}
key: sediment_gravel_dm, variables: {'wflow_v0': None, 'wflow_v1': 'gravel__mean_diameter'}
2025-06-26 14:11:37,442 - update - utils - INFO - Converting config output sections
2025-06-26 14:11:37,453 - update - wflow_sediment - INFO - Preparing soil parameter maps.
2025-06-26 14:11:37,458 - update - rasterdataset - INFO - Reading soilgrids raster data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/soilgrids/{variable}.tif
2025-06-26 14:11:37,813 - update - rasterdataset - DEBUG - Clip to [11.775, 45.808, 12.742, 46.692] (epsg:4326))
2025-06-26 14:11:37,824 - update - rasterdataset - DEBUG - Convert units for 21 variables.
2025-06-26 14:11:38,433 - update - soilgrids - INFO - Interpolate NAN values for erosion_soil_detachability
2025-06-26 14:11:38,468 - update - soilgrids - INFO - Interpolate NAN values for usle_k
2025-06-26 14:11:38,505 - update - soilgrids - INFO - Interpolate NAN values for soil_sediment_d50
2025-06-26 14:11:38,549 - update - soilgrids - INFO - Interpolate NAN values for land_govers_c
2025-06-26 14:11:38,592 - update - soilgrids - INFO - Interpolate NAN values for land_govers_n
2025-06-26 14:11:38,608 - update - soilgrids - INFO - Interpolate NAN values for soil_clay_fraction
2025-06-26 14:11:38,625 - update - soilgrids - INFO - Interpolate NAN values for soil_silt_fraction
2025-06-26 14:11:38,644 - update - soilgrids - INFO - Interpolate NAN values for soil_sagg_fraction
2025-06-26 14:11:38,667 - update - soilgrids - INFO - Interpolate NAN values for soil_sand_fraction
No numerical nodata value found, skipping set_nodata
2025-06-26 14:11:38,711 - update - soilgrids - INFO - Interpolate NAN values for soil_lagg_fraction
2025-06-26 14:11:38,723 - update - wflow_sediment - INFO - Preparing riverbedsed parameter maps.
2025-06-26 14:11:38,724 - update - dataframe - INFO - Reading riverbedsed_mapping_default csv data from /home/runner/work/hydromt_wflow/hydromt_wflow/hydromt_wflow/data/wflow_sediment/riverbedsed_mapping.csv
2025-06-26 14:11:38,731 - update - landuse - INFO - Deriving river_bed_sediment_d50 using average resampling (nodata=-999.0).
2025-06-26 14:11:38,736 - update - landuse - INFO - Deriving river_bed_clay_fraction using average resampling (nodata=-999.0).
2025-06-26 14:11:38,740 - update - landuse - INFO - Deriving river_bed_silt_fraction using average resampling (nodata=-999.0).
2025-06-26 14:11:38,744 - update - landuse - INFO - Deriving river_bed_sand_fraction using average resampling (nodata=-999.0).
2025-06-26 14:11:38,748 - update - landuse - INFO - Deriving river_bed_gravel_fraction using average resampling (nodata=-999.0).
2025-06-26 14:11:38,752 - update - landuse - INFO - Deriving river_kodatie_a using average resampling (nodata=nan).
2025-06-26 14:11:38,756 - update - landuse - INFO - Deriving river_kodatie_b using average resampling (nodata=nan).
2025-06-26 14:11:38,760 - update - landuse - INFO - Deriving river_kodatie_c using average resampling (nodata=nan).
2025-06-26 14:11:38,764 - update - landuse - INFO - Deriving river_kodatie_d using average resampling (nodata=nan).
2025-06-26 14:11:38,780 - update - model_api - INFO - write_config.config_name: wflow_sediment_v1.toml
2025-06-26 14:11:38,780 - update - model_api - INFO - write_config.config_root: None
2025-06-26 14:11:38,780 - update - wflow - INFO - Writing model config to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/data/wflow_upgrade/sediment/wflow_sediment_v1.toml
2025-06-26 14:11:38,781 - update - model_api - INFO - write_grid.fn_out: staticmaps_v1.nc
2025-06-26 14:11:38,823 - update - wflow - INFO - Write grid to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/data/wflow_upgrade/sediment/staticmaps_v1.nc
And let’s see the results. Here is what our old TOML file looked like:
[7]:
toml_v0x = "./data/wflow_upgrade/sediment/wflow_sediment_v0x.toml"
with open(toml_v0x, "r") as f:
txt = f.read()
print(txt)
casename = "wflow_sediment"
calendar = "proleptic_gregorian"
starttime = "2010-02-01T00:00:00"
endtime = "2010-02-10T00:00:00"
time_units = "days since 1900-01-01 00:00:00"
timestepsecs = 86400
dir_output = "run_default"
[state]
path_input = "instate/instates.nc"
path_output = "outstate/outstates.nc"
[input]
path_forcing = "inmaps.nc"
path_static = "staticmaps_v0x.nc"
ldd = "wflow_ldd"
river_location = "wflow_river"
subcatchment = "wflow_subcatch"
forcing = [ "vertical.h_land", "vertical.interception", "vertical.precipitation", "vertical.q_land", "lateral.river.h_riv", "lateral.river.q_riv",]
cyclic = [ "vertical.leaf_area_index",]
gauges = "wflow_gauges"
gauges_grdc = "wflow_gauges_grdc"
[model]
type = "sediment"
reinit = true
runrivermodel = true
doreservoir = true
dolake = true
rainerosmethod = "answers"
landtransportmethod = "yalinpart"
rivtransportmethod = "bagnold"
reservoirs = false
lakes = false
[output]
path = "output.nc"
[csv]
path = "output.csv"
[[csv.column]]
header = "TSS"
map = "gauges"
parameter = "lateral.river.SSconc"
[[csv.column]]
header = "Q"
map = "gauges_grdc"
parameter = "lateral.river.q_riv"
[[csv.column]]
header = "TSS"
map = "gauges_grdc"
parameter = "lateral.river.SSconc"
[input.vertical]
altitude = "wflow_dem"
canopyheight = "CanopyHeight"
erosk = "ErosK"
erosspl = "eros_spl_EUROSEM"
erosov = "eros_ov"
h_land = "lwl"
interception = "int"
kext = "Kext"
leaf_area_index = "LAI"
pathfrac = "PathFrac"
precipitation = "prec"
q_land = "lro"
slope = "Slope"
specific_leaf = "Sl"
storage_wood = "Swood"
usleC = "USLE_C"
usleK = "USLE_K"
pclay = "PercentClay"
psilt = "PercentSilt"
rivcell = "wflow_river"
resareas = "wflow_reservoirareas"
lakeareas = "wflow_lakeareas"
[output.vertical]
soilloss = "soilloss"
[state.lateral.river]
clayload = "clayload"
siltload = "siltload"
sandload = "sandload"
saggload = "saggload"
laggload = "laggload"
gravload = "gravload"
claystore = "claystore"
siltstore = "siltstore"
sandstore = "sandstore"
saggstore = "saggstore"
laggstore = "laggstore"
gravstore = "gravstore"
outclay = "outclay"
outsilt = "outsilt"
outsand = "outsand"
outsagg = "outsagg"
outlagg = "outlagg"
outgrav = "outgrav"
[input.lateral.land]
slope = "Slope"
[input.lateral.river]
h_riv = "rwl"
q_riv = "rro"
cbagnold = "c_Bagnold"
d50 = "D50_River"
d50engelund = "D50_River"
ebagnold = "exp_Bagnold"
fclayriv = "ClayF_River"
fsiltriv = "SiltF_River"
fsandriv = "SandF_River"
fgravriv = "GravelF_River"
length = "wflow_riverlength"
slope = "RiverSlope"
width = "wflow_riverwidth"
resarea = "ResSimpleArea"
restrapeff = "ResTrapEff"
resareas = "wflow_reservoirareas"
reslocs = "wflow_reservoirlocs"
lakearea = "LakeArea"
lakeareas = "wflow_lakeareas"
lakelocs = "wflow_lakelocs"
bankfull_depth = "RiverDepth"
[output.lateral.river]
SSconc = "SSconc"
And here is the same TOML in version 1 format:
[8]:
toml_v1 = "./data/wflow_upgrade/sediment/wflow_sediment_v1.toml"
with open(toml_v1, "r") as f:
txt = f.read()
print(txt)
dir_output = "run_default"
[time]
calendar = "proleptic_gregorian"
starttime = "2010-02-01T00:00:00"
endtime = "2010-02-10T00:00:00"
time_units = "days since 1900-01-01 00:00:00"
timestepsecs = 86400
[model]
cold_start__flag = true
run_river_model__flag = true
reservoir__flag = true
lake__flag = true
rainfall_erosion = "answers"
land_transport = "yalinpart"
river_transport = "bagnold"
[state]
path_input = "instate/instates.nc"
path_output = "outstate/outstates.nc"
[state.variables]
river_water_clay__mass = "clayload"
river_bed_clay__mass = "claystore"
river_water_clay__mass_flow_rate = "outclay"
river_water_gravel__mass = "gravload"
river_bed_gravel__mass = "gravstore"
river_water_gravel__mass_flow_rate = "outgrav"
"river_water_aggregates~large__mass" = "laggload"
"river_bed_aggregates~large__mass" = "laggstore"
"river_water_aggregates~large__mass_flow_rate" = "outlagg"
"river_water_aggregates~small__mass" = "saggload"
"river_bed_aggregates~small__mass" = "saggstore"
"river_water_aggregates~small__mass_flow_rate" = "outsagg"
river_water_sand__mass = "sandload"
river_bed_sand__mass = "sandstore"
river_water_sand__mass_flow_rate = "outsand"
river_water_silt__mass = "siltload"
river_bed_silt__mass = "siltstore"
river_water_silt__mass_flow_rate = "outsilt"
[input]
path_forcing = "inmaps.nc"
path_static = "staticmaps_v0x.nc"
basin__local_drain_direction = "wflow_ldd"
river_location__mask = "wflow_river"
subbasin_location__count = "wflow_subcatch"
gauges = "wflow_gauges"
gauges_grdc = "wflow_gauges_grdc"
lake_area__count = "wflow_lakeareas"
lake_location__count = "wflow_lakelocs"
reservoir_area__count = "wflow_reservoirareas"
reservoir_location__count = "wflow_reservoirlocs"
[input.forcing]
atmosphere_water__precipitation_volume_flux = "prec"
vegetation_canopy_water__interception_volume_flux = "int"
land_surface_water__depth = "lwl"
land_surface_water__volume_flow_rate = "lro"
river_water__depth = "rwl"
river_water__volume_flow_rate = "rro"
[input.cyclic]
[input.static]
land_surface__slope = "Slope"
river__length = "wflow_riverlength"
river__slope = "RiverSlope"
river__width = "wflow_riverwidth"
reservoir_surface__area = "ResSimpleArea"
lake_surface__area = "LakeArea"
"reservoir_water_sediment~bedload__trapping_efficiency" = "ResTrapEff"
vegetation_canopy__height = "CanopyHeight"
"soil~compacted__area_fraction" = "PathFrac"
soil_erosion__eurosem_exponent = "eros_spl_EUROSEM"
soil_erosion__usle_c_factor = "USLE_C"
soil_erosion__answers_overland_flow_factor = "eros_ov"
river_water_sediment__bagnold_transport_capacity_coefficient = "c_Bagnold"
river_water_sediment__bagnold_transport_capacity_exponent = "exp_Bagnold"
soil_erosion__rainfall_soil_detachability_factor = "erosion_soil_detachability"
soil_erosion__usle_k_factor = "erosion_usle_k"
land_surface_sediment__median_diameter = "soil_sediment_d50"
land_surface_water_sediment__govers_transport_capacity_coefficient = "land_govers_c"
land_surface_water_sediment__govers_transport_capacity_exponent = "land_govers_n"
soil_clay__mass_fraction = "soil_clay_fraction"
soil_silt__mass_fraction = "soil_silt_fraction"
"soil_aggregates~small__mass_fraction" = "soil_sagg_fraction"
soil_sand__mass_fraction = "soil_sand_fraction"
"soil_aggregates~large__mass_fraction" = "soil_lagg_fraction"
river_bottom-and-bank_sediment__median_diameter = "river_bed_sediment_d50"
river_bottom-and-bank_clay__mass_fraction = "river_bed_clay_fraction"
river_bottom-and-bank_silt__mass_fraction = "river_bed_silt_fraction"
river_bottom-and-bank_sand__mass_fraction = "river_bed_sand_fraction"
river_bottom-and-bank_gravel__mass_fraction = "river_bed_gravel_fraction"
river_water_sediment__kodatie_transport_capacity_a-coefficient = "river_kodatie_a"
river_water_sediment__kodatie_transport_capacity_b-coefficient = "river_kodatie_b"
river_water_sediment__kodatie_transport_capacity_c-coefficient = "river_kodatie_c"
river_water_sediment__kodatie_transport_capacity_d-coefficient = "river_kodatie_d"
[output.netcdf_grid]
path = "output.nc"
compressionlevel = 1
[output.netcdf_grid.variables]
soil_erosion__mass_flow_rate = "soilloss"
"river_water_sediment~suspended__mass_concentration" = "SSconc"
[output.csv]
path = "output.csv"
column = [{header = "TSS",map = "gauges",parameter = "river_water_sediment~suspended__mass_concentration"}, {header = "Q",map = "gauges_grdc",parameter = "river_water__volume_flow_rate"}, {header = "TSS",map = "gauges_grdc",parameter = "river_water_sediment~suspended__mass_concentration"}]
You can also note that the new staticmaps file was generated. Here are all the available variables:
[9]:
import xarray as xr
staticmaps = xr.open_dataset("./data/wflow_upgrade/sediment/staticmaps_v1.nc")
print(list(staticmaps.data_vars.keys()))
['x_out', 'y_out', 'idx_out', 'wflow_ldd', 'wflow_subcatch', 'wflow_uparea', 'subare', 'dem_subgrid', 'wflow_streamorder', 'wflow_dem', 'Slope', 'wflow_river', 'wflow_riverlength', 'RiverSlope', 'N_River', 'wflow_riverwidth', 'RiverDepth', 'wflow_reservoirareas', 'wflow_reservoirlocs', 'ResMaxVolume', 'ResSimpleArea', 'ResDemand', 'ResMaxRelease', 'ResTargetFullFrac', 'ResTargetMinFrac', 'wflow_lakeareas', 'wflow_lakelocs', 'LakeArea', 'LakeAvgLevel', 'LakeAvgOut', 'Lake_b', 'Lake_e', 'LakeStorFunc', 'LakeOutflowFunc', 'LakeThreshold', 'LinkedLakeLocs', 'D50_River', 'ClayF_River', 'SiltF_River', 'SandF_River', 'GravelF_River', 'wflow_landuse', 'Kext', 'PathFrac', 'Sl', 'Swood', 'USLE_C', 'LAI', 'CanopyHeight', 'PercentClay', 'PercentSilt', 'PercentOC', 'ErosK', 'USLE_K', 'wflow_gauges', 'wflow_gauges_grdc', 'c_Bagnold', 'eros_expo', 'eros_ov', 'eros_spl_EUROSEM', 'exp_Bagnold', 'ResTrapEff', 'erosion_soil_detachability', 'erosion_usle_k', 'soil_sediment_d50', 'land_govers_c', 'land_govers_n', 'soil_clay_fraction', 'soil_silt_fraction', 'soil_sagg_fraction', 'soil_sand_fraction', 'soil_lagg_fraction', 'river_bed_sediment_d50', 'river_bed_clay_fraction', 'river_bed_silt_fraction', 'river_bed_sand_fraction', 'river_bed_gravel_fraction', 'river_kodatie_a', 'river_kodatie_b', 'river_kodatie_c', 'river_kodatie_d']