Build a Delft3D FM 1D2D model from scratch#
This notebook demonstrates how to prepare a 1D2D Delft3D FM model from scratch using the command line interace (CLI).
We will combine elements that were prepared in the Build 1D model and Build 2D model notebooks, so we advise you to have a look at these before starting this one.
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 Delft3D FM model is recognized by HydroMT:
[1]:
# this should return "dflowfm" to build DFlowFM components of Delft3D FM
# as well as the generic HydroMT models "grid_model, lumped_model, mesh_model, network_model"
!hydromt --models
model plugins:
- dflowfm (hydromt_delft3dfm 0.3.1.dev0)
generic models (hydromt 0.10.1):
- grid_model
- vector_model
- mesh_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.
Data for model setup#
Most of the time, 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 information on how to write a data catalog yml file can be found in the HydroMT core docs
NOTE: In HydroMT-Delft3D FM, an additional data catalog with all default parameters values is always used parameters_data.yml. It contains default values for 1D network elements and structures as well as default 2D landuse parameter mapping tables.
Model setup configuration#
The HydroMT configuration file contains the model setup configuration and determines which methods are used to prepare the different components of a Delft3D FM model and in which order and optionally sets non-default arguments for each method. This configuration is passed to HydroMT using -i <path_to_configuration_file>
. We have prepared several example yml-files which are available in the model repository examples folder
and from the docs (building a model).
Each section, before indent, (e.g. setup_rivers_from_dem) corresponds to a model method. All model methods are explained in the docs (model components). The global
section contains direct model initialisation properties.
We will load the default dflowfm build 1D2D yaml file for inspection:
[3]:
fn_yml = "dflowfm_build_piave.yml"
with open(fn_yml, "r") as f:
txt = f.read()
print(txt)
global:
crs: 3857
network_snap_offset: 25
openwater_computation_node_distance: 40
setup_rivers_from_dem:
region:
bbox: [12.4331, 46.4661, 12.5212, 46.5369]
hydrography_fn: merit_hydro
river_geom_fn: hydro_rivers_lin
rivers_defaults_fn: rivers_defaults
rivdph_method: gvf
rivwth_method: geom
river_upa: 25.0
friction_type: "Manning"
friction_value: 0.023
rivbankq: 25
setup_pipes:
region:
bbox: [12.4331, 46.4661, 12.5212, 46.5369]
pipes_fn: grip_roads
pipes_defaults_fn: pipes_defaults
pipe_filter: pipe
spacing: 50
friction_type: WhiteColeBrook
friction_value: 0.003
crosssections_shape: circle
crosssections_value: 0.5
dem_fn: merit_hydro # [copdem30, merit]
pipes_depth: 2.0
snap_offset: 0.5
pipes_invlev: 3.
setup_manholes:
manholes_fn:
manholes_defaults_fn: manholes_defaults
dem_fn: merit_hydro
bedlevel_shift: 0.5
setup_1dboundary:
boundary_value: -2.0
branch_type: river
boundary_type: waterlevel
boundary_unit: m
boundary_locs: both
setup_mesh2d:
region:
bbox: [12.4331, 46.4661, 12.5212, 46.5369]
res: 500
setup_maps_from_rasterdataset:
raster_fn: merit_hydro
variables: ["elevtn"]
fill_method: nearest
interpolation_method: nearestNb
setup_maps_from_raster_reclass:
raster_fn: vito_2015
reclass_table_fn: vito_mapping
reclass_variables: ['roughness_manning', 'infiltcap']
interpolation_method: triangulation
setup_rainfall_from_constant:
constant_value: 150
setup_link1d2d:
link_direction: 1d_to_2d
Looking at this file, you see that we will prepare the following information for our model:
global: Our model will be defined in the projected CRS WGS84 EPSG 3857. TO ensure the 1D network is connected, we will allow snapping of 25 meters using argument network_snap_offset. The 1D computational grid for the open water system will be created at 40 meters distance using argument openwater_computation_node_distance.
setup_rivers_from_dem: We will derive the 1D rivers lines based on the MERIT Hydro DEM and that intersects with the region bounding box [12.4331, 46.4661, 12.5212, 46.5369]. River roughness will be a Manning constant of 25.0 and we will use data from rivers_lin2019 database to prepare rectangular cross-sections.
setup_pipes: We will add pipes by assuming that they are located under the roads, with a standard length of 50 meters. The roads are defined in the grip_roads data and the standard length are defined in the argument spacing. Roughness will be a WhiteColeBrook constant of 0.003 and we will use a circular cross-sections of 0.5m. The pipes invert levels will be derived from the MERIT Hydro DEM assuming a constant depth of the pipe underground of 2 meters.
setup_manholes: For a pipe network, manholes are present at pipe connections. Here we do not have specific input data locations for our pipes, so manholes will be generated based on a set of standards specified in manholes_defaults_fn.
setup_1dboundary: Finally as a default, we will apply both upstream and downstream boundaries of our rivers with a constant waterlevel of -2.0 meter a.s.l
setup_mesh2d: we will prepare a regular grid for the region bounding box [12.4331, 46.4661, 12.5212, 46.5369] of 500**500* meters resolution.
setup_maps_from_rasterdataset: prepares gridded elevation (bedlevel) from merit_hydro. Here elevation is extracted from merit_hydro and any no data is filled using nearest method. When running, the Delft3D FM kernel will interpolate it to the mesh 2D grid using the nearestNb method.
setup_maps_from_raster_reclass: prepares gridded Manning roughness and infiltration capacity data from landuse, by reclassifying the landuse categories in vito landuse data, using parameters values defined per landuse category in vito_mapping table. When running, the Delft3D FM kernel will interpolate it to the mesh 2D grid using the triangulation method.
setup_rainfall_from_constant: prepares a constant rainfall rate of 150 mm/day as meteo forcing to the model. Feel free to use the links of each components to know more about how each function works and what are all the available settings. Additionnally to a 1D or 2D models only, we have now added a new method:
setup_link1d2d: we will link our 1D and 2D mesh by setting up links from the 1D network to the 2D grid. As you can imagine, this function can only be run once both the schematisation of the 1D and the 2D grids are finalized. If any change is made to the 1D or the 2D grid, this funcion should be run again.
Feel free to use the links of each components to know more about how each function works and what are all the available settings.
NOTE: In this example, we apply region argument in setup_rivers_from_dem, setup_pipes and setup_mesh2d. They are identical in this example but one can alter them to have different region for rivers, for pipes and for 2dmesh. This allows the user to customize their model as much as possible, as the extent of the 1D river can differ from the extent of the 1D urban network or the 2D inundation grid. The region bbox are in WGS 84 as required, but the user should specify the dflowfm model destination CRS in the
global
section in order to allow to use grid definition data (rivers, pipes) from different data sources or CRS.
Building a 1D2D Delft3D FM model#
[4]:
# NOTE: copy this line (without !) to your shell for more direct feedback - should take about 1 minute or 2 to run
!hydromt build dflowfm "./build/dflowfm_1d2d" -i dflowfm_build_piave.yml -d artifact_data --fo -vv
2025-03-03 12:38:32,778 - build - log - DEBUG - Writing log messages to new file /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/build/dflowfm_1d2d/hydromt.log.
2025-03-03 12:38:32,778 - build - log - INFO - HydroMT version: 0.10.1
2025-03-03 12:38:32,778 - build - main - INFO - Building instance of dflowfm model at /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/build/dflowfm_1d2d.
2025-03-03 12:38:32,778 - 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'.
2025-03-03 12:38:33,955 - build - data_catalog - INFO - Reading data catalog artifact_data latest
2025-03-03 12:38:33,955 - 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'
2025-03-03 12:38:37,612 - build - model_api - INFO - Initializing dflowfm model from hydromt_delft3dfm (v0.3.1.dev0).
2025-03-03 12:38:37,612 - build - data_catalog - INFO - Parsing data catalog from /usr/share/miniconda/envs/test/lib/python3.12/site-packages/hydromt_delft3dfm/data/parameters_data.yml
2025-03-03 12:38:37,616 - build - dflowfm - INFO - Initialising empty mdu file
2025-03-03 12:38:37,621 - build - dflowfm - INFO - project crs: 3857
2025-03-03 12:38:37,621 - build - model_api - INFO - setup_rivers_from_dem.region: {'bbox': [12.4331, 46.4661, 12.5212, 46.5369]}
2025-03-03 12:38:37,621 - build - model_api - INFO - setup_rivers_from_dem.hydrography_fn: merit_hydro
2025-03-03 12:38:37,621 - build - model_api - INFO - setup_rivers_from_dem.river_geom_fn: hydro_rivers_lin
2025-03-03 12:38:37,621 - build - model_api - INFO - setup_rivers_from_dem.rivers_defaults_fn: rivers_defaults
2025-03-03 12:38:37,621 - build - model_api - INFO - setup_rivers_from_dem.rivdph_method: gvf
2025-03-03 12:38:37,621 - build - model_api - INFO - setup_rivers_from_dem.rivwth_method: geom
2025-03-03 12:38:37,621 - build - model_api - INFO - setup_rivers_from_dem.river_upa: 25.0
2025-03-03 12:38:37,621 - build - model_api - INFO - setup_rivers_from_dem.river_len: 1000
2025-03-03 12:38:37,621 - build - model_api - INFO - setup_rivers_from_dem.min_rivwth: 50.0
2025-03-03 12:38:37,621 - build - model_api - INFO - setup_rivers_from_dem.min_rivdph: 1.0
2025-03-03 12:38:37,621 - build - model_api - INFO - setup_rivers_from_dem.rivbank: True
2025-03-03 12:38:37,621 - build - model_api - INFO - setup_rivers_from_dem.rivbankq: 25
2025-03-03 12:38:37,621 - build - model_api - INFO - setup_rivers_from_dem.segment_length: 3000.0
2025-03-03 12:38:37,621 - build - model_api - INFO - setup_rivers_from_dem.smooth_length: 10000.0
2025-03-03 12:38:37,621 - build - model_api - INFO - setup_rivers_from_dem.friction_type: Manning
2025-03-03 12:38:37,622 - build - model_api - INFO - setup_rivers_from_dem.friction_value: 0.023
2025-03-03 12:38:37,622 - build - model_api - INFO - setup_rivers_from_dem.constrain_rivbed: True
2025-03-03 12:38:37,622 - build - model_api - INFO - setup_rivers_from_dem.constrain_estuary: True
2025-03-03 12:38:37,622 - build - dflowfm - INFO - Preparing river shape from hydrography data.
2025-03-03 12:38:37,627 - build - rasterdataset - INFO - Reading merit_hydro raster data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/merit_hydro/{variable}.tif
2025-03-03 12:38:37,719 - build - rasterdataset - DEBUG - Clip to [12.433, 46.466, 12.521, 46.537] (epsg:4326))
2025-03-03 12:38:37,722 - 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
2025-03-03 12:38:37,730 - build - geodataframe - DEBUG - Clip intersects [1384045.361, 5855358.290, 1393854.608, 5866810.259] (EPSG:3857)
2025-03-03 12:38:44,481 - build - dem - INFO - Deriving bankfull river surface elevation from its banks.
2025-03-03 12:38:55,202 - build - dem - INFO - Smoothing river width (n=2).
2025-03-03 12:38:56,623 - build - dataframe - INFO - Reading rivers_defaults csv data from /usr/share/miniconda/envs/test/lib/python3.12/site-packages/hydromt_delft3dfm/data/branches/rivers_defaults.csv
2025-03-03 12:38:56,635 - build - branches - INFO - Processing branches
2025-03-03 12:38:56,635 - build - branches - DEBUG - Cleaning up branches
2025-03-03 12:38:56,639 - build - branches - DEBUG - Exploding branches.
2025-03-03 12:38:56,640 - build - branches - DEBUG - Removing 0 branches which have duplicated geometry.
2025-03-03 12:38:56,641 - build - branches - DEBUG - Removing 1 branches that are shorter than 0.1 meter.
2025-03-03 12:38:56,643 - build - branches - DEBUG - Renaming 0 id_col duplicates. Convention:BRANCH_1, BRANCH_1 --> BRANCH_1, BRANCH_1-2.
2025-03-03 12:38:56,648 - build - branches - DEBUG - Reducing precision of the GeoDataFrame.Rounding precision (e-6) .
2025-03-03 12:38:56,649 - build - branches - DEBUG - Performing snapping at all branch ends, excluding intersections(To avoid messy results, please use a lower snap_offset)..
2025-03-03 12:38:56,650 - build - branches - DEBUG - Splitting branches based on spacing
2025-03-03 12:38:56,651 - build - branches - DEBUG - clipping branches into 5 segments
2025-03-03 12:38:56,652 - build - branches - DEBUG - Generating branchnodes
2025-03-03 12:38:56,656 - build - branches - INFO - Validating branches
2025-03-03 12:38:56,657 - build - crosssections - INFO - Adding/Filling branches attributes values
2025-03-03 12:38:56,660 - build - dflowfm - INFO - Preparing crossections from branch.
2025-03-03 12:38:56,668 - build - dflowfm - DEBUG - Adding crosssections vector to geoms.
2025-03-03 12:38:56,668 - build - dflowfm - DEBUG - Adding rivers and river_nodes vector to geoms.
2025-03-03 12:38:56,671 - build - model_api - WARNING - Replacing geom: rivers
2025-03-03 12:38:56,672 - build - dflowfm - DEBUG - Adding branches vector to geoms.
2025-03-03 12:38:56,672 - build - dflowfm - DEBUG - Updating branches in network.
2025-03-03 12:38:56,728 - build - model_api - INFO - setup_pipes.region: {'bbox': [12.4331, 46.4661, 12.5212, 46.5369]}
2025-03-03 12:38:56,728 - build - model_api - INFO - setup_pipes.pipes_fn: grip_roads
2025-03-03 12:38:56,728 - build - model_api - INFO - setup_pipes.pipes_defaults_fn: pipes_defaults
2025-03-03 12:38:56,728 - build - model_api - INFO - setup_pipes.pipe_filter: pipe
2025-03-03 12:38:56,728 - build - model_api - INFO - setup_pipes.spacing: 50
2025-03-03 12:38:56,728 - build - model_api - INFO - setup_pipes.friction_type: WhiteColeBrook
2025-03-03 12:38:56,728 - build - model_api - INFO - setup_pipes.friction_value: 0.003
2025-03-03 12:38:56,728 - build - model_api - INFO - setup_pipes.crosssections_shape: circle
2025-03-03 12:38:56,728 - build - model_api - INFO - setup_pipes.crosssections_value: 0.5
2025-03-03 12:38:56,728 - build - model_api - INFO - setup_pipes.dem_fn: merit_hydro
2025-03-03 12:38:56,728 - build - model_api - INFO - setup_pipes.pipes_depth: 2.0
2025-03-03 12:38:56,728 - build - model_api - INFO - setup_pipes.pipes_invlev: 3.0
2025-03-03 12:38:56,728 - build - model_api - INFO - setup_pipes.snap_offset: 0.5
2025-03-03 12:38:56,728 - build - model_api - INFO - setup_pipes.allow_intersection_snapping: True
2025-03-03 12:38:56,728 - build - dflowfm - INFO - Preparing 1D pipes.
2025-03-03 12:38:56,730 - build - geodataframe - INFO - Reading grip_roads vector data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/grip_roads.gpkg
2025-03-03 12:38:56,739 - build - geodataframe - DEBUG - Clip intersects [1384046.361, 5855359.290, 1393853.608, 5866809.259] (EPSG:3857)
2025-03-03 12:38:56,740 - build - dataframe - INFO - Reading pipes_defaults csv data from /usr/share/miniconda/envs/test/lib/python3.12/site-packages/hydromt_delft3dfm/data/branches/pipes_defaults.csv
2025-03-03 12:38:56,746 - build - branches - INFO - Processing branches
2025-03-03 12:38:56,747 - build - branches - DEBUG - Cleaning up branches
2025-03-03 12:38:56,753 - build - branches - DEBUG - Exploding branches.
2025-03-03 12:38:56,755 - build - branches - DEBUG - Removing 0 branches which have duplicated geometry.
2025-03-03 12:38:56,755 - build - branches - DEBUG - Removing 0 branches that are shorter than 0.1 meter.
2025-03-03 12:38:56,766 - build - branches - DEBUG - Renaming 0 id_col duplicates. Convention:BRANCH_1, BRANCH_1 --> BRANCH_1, BRANCH_1-2.
2025-03-03 12:38:56,797 - build - branches - DEBUG - Reducing precision of the GeoDataFrame.Rounding precision (e-6) .
2025-03-03 12:38:56,802 - build - branches - DEBUG - Performing snapping at all branch ends, including intersections(To avoid messy results, please use a lower snap_offset).
2025-03-03 12:38:56,802 - build - branches - DEBUG - Splitting branches based on spacing
2025-03-03 12:38:58,741 - build - branches - DEBUG - clipping branches into 2826 segments
2025-03-03 12:38:58,741 - build - branches - DEBUG - Generating branchnodes
2025-03-03 12:38:59,148 - build - branches - INFO - Validating branches
2025-03-03 12:38:59,151 - build - crosssections - INFO - Adding/Filling branches attributes values
2025-03-03 12:38:59,162 - build - dflowfm - INFO - grip_roads does not have columns [invlev_up, invlev_dn].Invert levels will be generated from dem_fn ordefault value 3.0
2025-03-03 12:38:59,162 - build - rasterdataset - INFO - Reading merit_hydro raster data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/merit_hydro/{variable}.tif
2025-03-03 12:38:59,173 - build - rasterdataset - DEBUG - Clip to [12.433, 46.466, 12.521, 46.537] (epsg:4326))
2025-03-03 12:38:59,613 - build - dflowfm - INFO - Preparing crossections from branch.
2025-03-03 12:38:59,682 - build - dflowfm - DEBUG - Adding crosssections vector to geoms.
2025-03-03 12:38:59,700 - build - model_api - WARNING - Replacing geom: crosssections
2025-03-03 12:38:59,701 - build - dflowfm - DEBUG - Adding pipes and pipe_nodes vector to geoms.
2025-03-03 12:39:00,127 - build - model_api - WARNING - Replacing geom: rivers
2025-03-03 12:39:00,130 - build - model_api - WARNING - Replacing geom: pipes
2025-03-03 12:39:00,130 - build - dflowfm - DEBUG - Adding branches vector to geoms.
2025-03-03 12:39:00,130 - build - model_api - WARNING - Replacing geom: branches
2025-03-03 12:39:00,131 - build - dflowfm - DEBUG - Updating branches in network.
2025-03-03 12:39:00,942 - build - model_mesh - WARNING - Overwriting grid network1d and the corresponding data variables in mesh.
2025-03-03 12:39:00,980 - build - model_mesh - WARNING - Overwriting grid mesh1d and the corresponding data variables in mesh.
2025-03-03 12:39:01,170 - build - model_api - WARNING - Replacing geom: boundaries
2025-03-03 12:39:01,170 - build - model_api - INFO - setup_manholes.manholes_fn: None
2025-03-03 12:39:01,170 - build - model_api - INFO - setup_manholes.manholes_defaults_fn: manholes_defaults
2025-03-03 12:39:01,171 - build - model_api - INFO - setup_manholes.bedlevel_shift: 0.5
2025-03-03 12:39:01,171 - build - model_api - INFO - setup_manholes.dem_fn: merit_hydro
2025-03-03 12:39:01,171 - build - model_api - INFO - setup_manholes.snap_offset: 0.001
2025-03-03 12:39:01,171 - build - dflowfm - INFO - generating manholes locations and bedlevels.
2025-03-03 12:39:01,171 - build - manholes - INFO - Generating manholes on pipes and/or tunnels
2025-03-03 12:39:01,392 - build - manholes - INFO - Shifting manholes bedlevels based on bedlevel_shift = 0.5
2025-03-03 12:39:01,561 - build - model_api - WARNING - Replacing geom: rivers
2025-03-03 12:39:01,563 - build - model_api - WARNING - Replacing geom: pipes
2025-03-03 12:39:01,563 - build - dflowfm - DEBUG - Adding branches vector to geoms.
2025-03-03 12:39:01,564 - build - model_api - WARNING - Replacing geom: branches
2025-03-03 12:39:01,564 - build - dflowfm - DEBUG - Updating branches in network.
2025-03-03 12:39:01,564 - build - dataframe - INFO - Reading manholes_defaults csv data from /usr/share/miniconda/envs/test/lib/python3.12/site-packages/hydromt_delft3dfm/data/storages/manholes_defaults.csv
2025-03-03 12:39:01,574 - build - dflowfm - INFO - overwriting manholes street level from dem.
2025-03-03 12:39:01,575 - build - rasterdataset - INFO - Reading merit_hydro raster data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/merit_hydro/{variable}.tif
2025-03-03 12:39:01,586 - build - rasterdataset - DEBUG - Clip to [12.433, 46.466, 12.521, 46.537] (epsg:4326))
2025-03-03 12:39:01,652 - build - dflowfm - DEBUG - street level mean is 863.6583862304688
2025-03-03 12:39:01,652 - build - dflowfm - DEBUG - dropping duplicated manholeid
2025-03-03 12:39:01,689 - build - dflowfm - DEBUG - Adding manholes vector to geoms.
2025-03-03 12:39:01,689 - build - model_api - INFO - setup_1dboundary.boundaries_geodataset_fn: None
2025-03-03 12:39:01,689 - build - model_api - INFO - setup_1dboundary.boundaries_timeseries_fn: None
2025-03-03 12:39:01,689 - build - model_api - INFO - setup_1dboundary.boundary_value: -2.0
2025-03-03 12:39:01,690 - build - model_api - INFO - setup_1dboundary.branch_type: river
2025-03-03 12:39:01,690 - build - model_api - INFO - setup_1dboundary.boundary_type: waterlevel
2025-03-03 12:39:01,690 - build - model_api - INFO - setup_1dboundary.boundary_unit: m
2025-03-03 12:39:01,690 - build - model_api - INFO - setup_1dboundary.boundary_locs: both
2025-03-03 12:39:01,690 - build - model_api - INFO - setup_1dboundary.snap_offset: 1.0
2025-03-03 12:39:01,690 - build - dflowfm - INFO - Preparing 1D waterlevel boundaries for river.
2025-03-03 12:39:01,691 - build - boundaries - INFO - Using constant value -2.0 mfor all waterlevel boundaries.
2025-03-03 12:39:01,692 - build - model_api - INFO - setup_mesh2d.region: {'bbox': [12.4331, 46.4661, 12.5212, 46.5369]}
2025-03-03 12:39:01,692 - build - model_api - INFO - setup_mesh2d.res: 500
2025-03-03 12:39:01,755 - build - model_api - INFO - setup_maps_from_rasterdataset.raster_fn: merit_hydro
2025-03-03 12:39:01,755 - build - model_api - INFO - setup_maps_from_rasterdataset.variables: ['elevtn']
2025-03-03 12:39:01,755 - build - model_api - INFO - setup_maps_from_rasterdataset.fill_method: nearest
2025-03-03 12:39:01,755 - build - model_api - INFO - setup_maps_from_rasterdataset.reproject_method: nearest
2025-03-03 12:39:01,755 - build - model_api - INFO - setup_maps_from_rasterdataset.interpolation_method: nearestNb
2025-03-03 12:39:01,755 - build - model_api - INFO - setup_maps_from_rasterdataset.locationtype: 2d
2025-03-03 12:39:01,755 - build - model_api - INFO - setup_maps_from_rasterdataset.name: None
2025-03-03 12:39:01,755 - build - model_api - INFO - setup_maps_from_rasterdataset.split_dataset: True
2025-03-03 12:39:01,755 - build - model_api - INFO - Preparing maps data from raster source merit_hydro
2025-03-03 12:39:01,755 - build - rasterdataset - INFO - Reading merit_hydro raster data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/merit_hydro/{variable}.tif
2025-03-03 12:39:01,766 - build - rasterdataset - DEBUG - Clip to [12.433, 46.466, 12.523, 46.538] (epsg:4326))
2025-03-03 12:39:01,856 - build - model_api - INFO - setup_maps_from_raster_reclass.raster_fn: vito_2015
2025-03-03 12:39:01,856 - build - model_api - INFO - setup_maps_from_raster_reclass.reclass_table_fn: vito_mapping
2025-03-03 12:39:01,856 - build - model_api - INFO - setup_maps_from_raster_reclass.reclass_variables: ['roughness_manning', 'infiltcap']
2025-03-03 12:39:01,856 - build - model_api - INFO - setup_maps_from_raster_reclass.fill_method: None
2025-03-03 12:39:01,856 - build - model_api - INFO - setup_maps_from_raster_reclass.reproject_method: nearest
2025-03-03 12:39:01,856 - build - model_api - INFO - setup_maps_from_raster_reclass.interpolation_method: triangulation
2025-03-03 12:39:01,856 - build - model_api - INFO - setup_maps_from_raster_reclass.locationtype: 2d
2025-03-03 12:39:01,856 - build - model_api - INFO - setup_maps_from_raster_reclass.name: None
2025-03-03 12:39:01,856 - build - model_api - INFO - setup_maps_from_raster_reclass.split_dataset: True
2025-03-03 12:39:01,856 - build - model_api - INFO - Preparing map data by reclassifying the data in vito_2015 based on vito_mapping
2025-03-03 12:39:01,856 - build - rasterdataset - INFO - Reading vito_2015 raster data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/vito.tif
2025-03-03 12:39:01,865 - build - rasterdataset - DEBUG - Clip to [12.433, 46.466, 12.523, 46.538] (epsg:4326))
2025-03-03 12:39:01,866 - build - dataframe - INFO - Reading vito_mapping csv data from /usr/share/miniconda/envs/test/lib/python3.12/site-packages/hydromt_delft3dfm/data/landuse/vito_mapping.csv
The nodata value None is not in the reclass table.None will be used for the params.
2025-03-03 12:39:01,966 - build - model_api - INFO - setup_rainfall_from_constant.constant_value: 150
2025-03-03 12:39:01,966 - build - dflowfm - INFO - Preparing rainfall meteo forcing from uniform timeseries.
2025-03-03 12:39:01,968 - build - boundaries - INFO - Preparing global (spatially uniform) timeseries.
2025-03-03 12:39:01,968 - build - boundaries - WARNING - time unit days is not supported by the current GUI version: 2022.04
2025-03-03 12:39:01,970 - build - model_api - INFO - setup_link1d2d.link_direction: 1d_to_2d
2025-03-03 12:39:01,970 - build - model_api - INFO - setup_link1d2d.link_type: embedded
2025-03-03 12:39:01,970 - build - model_api - INFO - setup_link1d2d.polygon_fn: None
2025-03-03 12:39:01,970 - build - model_api - INFO - setup_link1d2d.branch_type: None
2025-03-03 12:39:01,970 - build - model_api - INFO - setup_link1d2d.max_length: inf
2025-03-03 12:39:01,970 - build - model_api - INFO - setup_link1d2d.dist_factor: 2.0
2025-03-03 12:39:01,970 - build - dflowfm - WARNING - adding 1d2d links for all branches at non boundary locations.
2025-03-03 12:39:01,970 - build - dflowfm - INFO - setting up 1d_to_2d links.
2025-03-03 12:39:02,116 - build - dflowfm - INFO - Writing model data to /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/build/dflowfm_1d2d
2025-03-03 12:39:02,117 - build - dflowfm - INFO - Writing maps files to /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/build/dflowfm_1d2d/maps
2025-03-03 12:39:02,166 - build - model_api - DEBUG - Writing file geoms/crosssections.geojson
2025-03-03 12:39:02,222 - build - model_api - DEBUG - Writing file geoms/rivers.geojson
2025-03-03 12:39:02,226 - build - model_api - DEBUG - Writing file geoms/rivers_nodes.geojson
2025-03-03 12:39:02,229 - build - model_api - DEBUG - Writing file geoms/branches.geojson
2025-03-03 12:39:02,269 - build - model_api - DEBUG - Writing file geoms/boundaries.geojson
2025-03-03 12:39:02,274 - build - model_api - DEBUG - Writing file geoms/pipes.geojson
2025-03-03 12:39:02,312 - build - model_api - DEBUG - Writing file geoms/pipe_nodes.geojson
2025-03-03 12:39:02,353 - build - model_api - DEBUG - Writing file geoms/manholes.geojson
2025-03-03 12:39:02,384 - build - model_api - DEBUG - Writing file geoms/region.geojson
2025-03-03 12:39:02,386 - build - model_api - DEBUG - Writing file geoms/network1d.geojson
2025-03-03 12:39:02,400 - build - model_api - DEBUG - Writing file geoms/mesh1d.geojson
2025-03-03 12:39:02,423 - build - model_api - DEBUG - Writing file geoms/mesh2d.geojson
2025-03-03 12:39:02,435 - build - dflowfm - INFO - Writting cross-sections files crsdef and crsloc
2025-03-03 12:39:02,766 - build - dflowfm - INFO - Writting friction file(s)
2025-03-03 12:39:02,771 - build - dflowfm - INFO - Writting manholes file.
2025-03-03 12:39:03,237 - build - model_api - WARNING - Replacing geom: network1d
2025-03-03 12:39:03,238 - build - model_api - WARNING - Replacing geom: mesh1d
2025-03-03 12:39:03,238 - build - model_api - WARNING - Replacing geom: mesh2d
2025-03-03 12:39:03,251 - build - model_api - WARNING - Replacing geom: crosssections
2025-03-03 12:39:03,253 - build - model_api - WARNING - Replacing geom: rivers
2025-03-03 12:39:03,254 - build - model_api - WARNING - Replacing geom: rivers_nodes
2025-03-03 12:39:03,263 - build - model_api - WARNING - Replacing geom: branches
2025-03-03 12:39:03,266 - build - model_api - WARNING - Replacing geom: boundaries
2025-03-03 12:39:03,275 - build - model_api - WARNING - Replacing geom: pipes
2025-03-03 12:39:03,283 - build - model_api - WARNING - Replacing geom: pipe_nodes
2025-03-03 12:39:03,290 - build - model_api - WARNING - Replacing geom: manholes
2025-03-03 12:39:03,291 - build - model_api - WARNING - Replacing geom: region
2025-03-03 12:39:03,291 - build - model_api - WARNING - Replacing geom: network1d
2025-03-03 12:39:03,292 - build - model_api - WARNING - Replacing geom: mesh1d
2025-03-03 12:39:03,292 - build - model_api - WARNING - Replacing geom: mesh2d
2025-03-03 12:39:03,293 - build - model_api - DEBUG - Writing file geoms/crosssections.geojson
2025-03-03 12:39:03,348 - build - model_api - DEBUG - Writing file geoms/rivers.geojson
2025-03-03 12:39:03,352 - build - model_api - DEBUG - Writing file geoms/rivers_nodes.geojson
2025-03-03 12:39:03,355 - build - model_api - DEBUG - Writing file geoms/branches.geojson
2025-03-03 12:39:03,395 - build - model_api - DEBUG - Writing file geoms/boundaries.geojson
2025-03-03 12:39:03,399 - build - model_api - DEBUG - Writing file geoms/pipes.geojson
2025-03-03 12:39:03,439 - build - model_api - DEBUG - Writing file geoms/pipe_nodes.geojson
2025-03-03 12:39:03,481 - build - model_api - DEBUG - Writing file geoms/manholes.geojson
2025-03-03 12:39:03,512 - build - model_api - DEBUG - Writing file geoms/region.geojson
2025-03-03 12:39:03,514 - build - model_api - DEBUG - Writing file geoms/network1d.geojson
2025-03-03 12:39:03,528 - build - model_api - DEBUG - Writing file geoms/mesh1d.geojson
2025-03-03 12:39:03,550 - build - model_api - DEBUG - Writing file geoms/mesh2d.geojson
2025-03-03 12:39:03,844 - build - dflowfm - INFO - Writting branches.gui file
2025-03-03 12:39:03,992 - build - dflowfm - INFO - Writting forcing files.
2025-03-03 12:39:04,794 - build - dflowfm - INFO - Initialising empty dimr file
2025-03-03 12:39:04,794 - build - dflowfm - INFO - Adding dflowfm component to dimr config
2025-03-03 12:39:04,794 - build - dflowfm - INFO - Writing model dimr file to /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/build/dflowfm_1d2d/dimr_config.xml
The example above means the following: run hydromt build with:
dflowfm
: i.e. build a FM model./build/dflowfm_1d2d
: output model folder-i dflowfm_build_piave.yml
: model build configuration file-d artifact_data
: data catalog to use. Here the default artifact data catalog with global data for Northern Italy.--fo
: force overwritting in case a model already exists in the output folder.-vv
: give some extra verbosity (2 * v) to display feedback on screen. Now debug and info messages are provided rather than only warnings and errors.
NOTE: You can use as many data catalogs as you need within the same command line, by repeating the
-d
options and name of the catalog to use several times.
Next we check which files have been created.
[5]:
import os
root = "./build/dflowfm_1d2d/"
for path, _, files in os.walk(root):
print(path)
for name in files:
print(f" - {name}")
./build/dflowfm_1d2d/
- dimr_config.xml
- hydromt_data.yml
- hydromt.log
./build/dflowfm_1d2d/geoms
- mesh2d.geojson
- rivers.geojson
- boundaries.geojson
- crosssections.geojson
- rivers_nodes.geojson
- pipe_nodes.geojson
- region.geojson
- manholes.geojson
- pipes.geojson
- mesh1d.geojson
- branches.geojson
- network1d.geojson
./build/dflowfm_1d2d/dflowfm
- DFlowFM.mdu
- fieldFile.ini
- boundarycondition1d.bc
- branches.gui
- nodeFile.ini
- fm_net.nc
- roughness_WhiteColeBrook_0.003.ini
- crsloc.ini
- bnd.ext
- roughness_Manning_0.023.ini
- crsdef.ini
- meteo_boundaryconditions.bc
./build/dflowfm_1d2d/maps
- bedlevel.tif
- InfiltrationCapacity.tif
- frictioncoefficient.tif
The model root should contain three files and four folders:
dimr_config.xml: Configuration file to execute Delft3D FM in Deltares Integrated Model Runner (DIMR).
hydromt.log: log saved by HydroMT on model building steps.
hydromt_data.yml: information saved by HydroMT on used datasets for reproducibility.
dflowfm folder: dflowfm files, here for our 2D model. Contains all necessary information to run a 2D model including the mesh2d, and settings and paths to the mesh2d data files in the maps folder. The configuration MDU file is also created.
geoms folder: folder containing a copy of the dflowfm data in an easily readable GIS format rather than the ini or UGRID netcdf file.
maps folder: folder containing regular gridded data that Delft3D FM can interpolate to the 2D mesh grid. Here we see our elevation or bedlevel data, as well as the roughness / friction and infiltration capacity maps.
Visualize and/or inspect model schematization#
We can now load the dimr_config.xml into Delft3D FM GUI.
The dflowfm plot example notebook contains scripts to visualize your model in python: