Update a 2D Delft3D FM model: mesh refinements#
Once you have a Delft3D FM model, you may want to update your model in order to use a new data map, change a parameter value, add structures or cross-sections data, use different boundary data, create and run different scenarios etc.
With HydroMT, you can easily read your model and update one or several components of your model using the update function of the command line interface (CLI). Here are the steps and some examples on how to refine the mesh 2D grid for an existing 1D2D model.
All lines in this notebook which starts 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 them in your shell to get more feedback.
Model setup configuration#
Updating a bedlevel or infiltration capacity map is an easy step with the command line but sometimes, for example with forcing or grid refinement, you need to update several things at the same time. This is possible by preparing a configuration file that includes every methods and settings that you want to do during your update.
The configuration-file contains the model setup configuration and determines which methods are updated and in which sequence and sets optional arguments for each method. This configuration is passed to HydroMT using -i <path_to_configuration_file>.
Each section, before indent, (e.g. setup_mesh2d_refine) corresponds with a model method which are explained in the docs (model methods).
Let’s open the example configuration file dflowfm_update_mesh2d_refine.yml from the model repository [examples folder] and have a look at the settings.
[1]:
fn_yml = "dflowfm_update_mesh2d_refine.yml"
with open(fn_yml, "r") as f:
txt = f.read()
print(txt)
modeltype: dflowfm
global:
crs: 3857
steps:
- setup_mesh2d_refine:
polygon_fn: ./data/refine.geojson
steps: 2
- setup_link1d2d:
link_direction: 1d_to_2d
- setup_config:
geometry.bedlevuni: -5
Here we can see that to fully refine the 2D grid, we will run two methods:
global: our model to update is defined in the projected CRS WGS84 EPSG 3857. Unfortunately Delft3D FM do not allow yet to store the model CRS information, and the CRS of the model to update needs to be passed to HydroMT again.
Then the model updating steps are:
setup_mesh2d_refine: we will refine our 2D mesh within the polygons defined in the file data/refine.geojson with 2 steps or iterations.
setup_link1d2d: in the model we would like to update, 1D elements are present. Because we will udpate the 2D mesh with our refinements, we need to update and re-create the 1D2D links so that they match the newly refined 2D grid.
You can find more information on the different methods and their options in the docs (model methods).
NOTE: to provide data to HydroMT, you can either provide a data catalog entry, a direct path to a file (provided reading that file is straightforward and no pre-processing is required) or for python users. We use a direct path in
setup_mesh2d_refinefor the refine polygon.
NOTE: Refinment of the 2D grid leads to a new grid definition. There fore the
setup_link1d2dis called again.
HydroMT CLI update interface#
Using the HydroMT build API, we can update one or several components of an already existing Delft3D FM model. Let’s get an overview of the available options:
[2]:
# Print the options available from the update command
!hydromt update --help
Usage: hydromt update [OPTIONS] MODEL MODEL_ROOT
Update a specific component of a model.
Set an output directory to copy the edited model to a new folder, otherwise
maps are overwritten.
Example usage: --------------
Update Wflow model components outlined in an .yml configuration file and
write the model to a directory: hydromt update wflow_sbm /path/to/model_root
-o /path/to/model_out -i /path/to/wflow_config.yml -d
/path/to/data_catalog.yml -v
Options:
-o, --model-out DIRECTORY Output model folder. Maps in MODEL_ROOT are
overwritten if left empty.
-i, --config PATH Path to hydroMT configuration file, for the model
specific implementation. [required]
-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
-q, --quiet Decrease verbosity.
-v, --verbose Increase verbosity.
--help Show this message and exit.
Update a 1D2D Delft3D FM model to refine the 2D mesh#
[3]:
# NOTE: copy this line (without !) to your shell for more direct feedback
!hydromt update dflowfm dflowfm_piave -o ./build/dflowfm_mesh2d_refine -i dflowfm_update_mesh2d_refine.yml -v
2026-05-06 06:29:23,698 - hydromt - log - INFO - HydroMT version: 1.3.1
2026-05-06 06:29:24,513 - hydromt.hydromt_delft3dfm.dflowfm - dflowfm - INFO - Reading dimr file at /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/dflowfm_piave/dimr_config.xml
2026-05-06 06:29:25,297 - hydromt.model.model - model - INFO - Initializing dflowfm model from hydromt_delft3dfm (v0.3.1.dev0).
2026-05-06 06:29:25,297 - hydromt.data_catalog.data_catalog - data_catalog - INFO - Parsing data catalog from /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/hydromt_delft3dfm/data/parameters_data.yml
2026-05-06 06:29:25,318 - hydromt.hydromt_delft3dfm.dflowfm - dflowfm - INFO - project crs: 3857
2026-05-06 06:29:25,326 - hydromt - log - INFO - HydroMT version: 1.3.1
2026-05-06 06:29:25,326 - hydromt.hydromt_delft3dfm.dflowfm - dflowfm - INFO - Reading model data from ModelRoot(path=/home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/dflowfm_piave, mode=ModelMode.READ)
2026-05-06 06:29:25,327 - hydromt.hydromt_delft3dfm.components.dimr - dimr - INFO - Reading dimr file at /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/dflowfm_piave/dimr_config.xml
2026-05-06 06:29:25,945 - hydromt.hydromt_delft3dfm.dflowfm - dflowfm - INFO - Reading mdu file at /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/dflowfm_piave/dflowfm/DFlowFM.mdu
2026-05-06 06:29:27,071 - hydromt.hydromt_delft3dfm.components.mesh - mesh - INFO - Reading branches GUI file
2026-05-06 06:29:27,449 - hydromt.hydromt_delft3dfm.components.geoms - geoms - INFO - Reading cross-sections files
2026-05-06 06:29:27,489 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: crosssections
2026-05-06 06:29:27,489 - hydromt.hydromt_delft3dfm.components.geoms - geoms - INFO - Reading manholes file
2026-05-06 06:29:27,543 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: manholes
2026-05-06 06:29:27,544 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: rivers
2026-05-06 06:29:27,545 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: pipes
2026-05-06 06:29:27,545 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: branches
2026-05-06 06:29:27,588 - hydromt.model.components.spatialdatasets - spatialdatasets - WARNING - Replacing xarray: elevtn
2026-05-06 06:29:27,592 - hydromt.model.components.spatialdatasets - spatialdatasets - WARNING - Replacing xarray: infiltcap
2026-05-06 06:29:27,596 - hydromt.model.components.spatialdatasets - spatialdatasets - WARNING - Replacing xarray: roughness_manning
2026-05-06 06:29:27,657 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: crosssections
2026-05-06 06:29:27,664 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: mesh2d
2026-05-06 06:29:27,667 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: rivers_nodes
2026-05-06 06:29:27,708 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: pipe_nodes
2026-05-06 06:29:27,748 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: branches
2026-05-06 06:29:27,751 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: rivers
2026-05-06 06:29:27,761 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: network1d
2026-05-06 06:29:27,799 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: pipes
2026-05-06 06:29:27,815 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: mesh1d
2026-05-06 06:29:27,819 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: boundaries
2026-05-06 06:29:27,850 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: manholes
2026-05-06 06:29:27,850 - hydromt.hydromt_delft3dfm.components.geoms - geoms - INFO - Reading cross-sections files
2026-05-06 06:29:28,086 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: crosssections
2026-05-06 06:29:28,086 - hydromt.hydromt_delft3dfm.components.geoms - geoms - INFO - Reading manholes file
2026-05-06 06:29:28,140 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: manholes
2026-05-06 06:29:28,239 - hydromt.model.components.spatialdatasets - spatialdatasets - WARNING - Replacing xarray: boundary1d_waterlevelbndbnd
2026-05-06 06:29:28,240 - hydromt.model.components.spatialdatasets - spatialdatasets - WARNING - Replacing xarray: rainfall_rate
2026-05-06 06:29:28,241 - hydromt.hydromt_delft3dfm.dflowfm - dflowfm - INFO - project crs: 3857
2026-05-06 06:29:28,241 - hydromt - log - INFO - HydroMT version: 1.3.1
2026-05-06 06:29:28,242 - hydromt.model.model - model - INFO - update: setup_mesh2d_refine
2026-05-06 06:29:28,242 - hydromt.model.model - model - INFO - setup_mesh2d_refine.polygon_fn=/home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/data/refine.geojson
2026-05-06 06:29:28,242 - hydromt.model.model - model - INFO - setup_mesh2d_refine.sample_fn=None
2026-05-06 06:29:28,242 - hydromt.model.model - model - INFO - setup_mesh2d_refine.steps=2
2026-05-06 06:29:28,242 - hydromt.hydromt_delft3dfm.dflowfm - dflowfm - INFO - reading geometry from file /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/data/refine.geojson.
2026-05-06 06:29:28,244 - hydromt.data_catalog.sources.data_source - data_source - INFO - Reading refine.geojson GeoDataFrame data from /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/data/refine.geojson
2026-05-06 06:29:28,269 - hydromt.hydromt_delft3dfm.workflows.mesh - mesh - INFO - 2d mesh refined based on polygon.Number of faces before: 460 and after: 828
2026-05-06 06:29:28,282 - hydromt.model.components.mesh - mesh - WARNING - Overwriting grid mesh2d and the corresponding data variables in mesh.
2026-05-06 06:29:28,406 - hydromt.model.model - model - INFO - update: setup_link1d2d
2026-05-06 06:29:28,406 - hydromt.model.model - model - INFO - setup_link1d2d.link_direction=1d_to_2d
2026-05-06 06:29:28,406 - hydromt.model.model - model - INFO - setup_link1d2d.link_type=embedded
2026-05-06 06:29:28,406 - hydromt.model.model - model - INFO - setup_link1d2d.polygon_fn=None
2026-05-06 06:29:28,406 - hydromt.model.model - model - INFO - setup_link1d2d.branch_type=None
2026-05-06 06:29:28,406 - hydromt.model.model - model - INFO - setup_link1d2d.max_length=inf
2026-05-06 06:29:28,406 - hydromt.model.model - model - INFO - setup_link1d2d.dist_factor=2.0
2026-05-06 06:29:28,407 - hydromt.hydromt_delft3dfm.dflowfm - dflowfm - WARNING - adding 1d2d links for all branches at non boundary locations.
2026-05-06 06:29:28,407 - hydromt.hydromt_delft3dfm.dflowfm - dflowfm - INFO - setting up 1d_to_2d links.
2026-05-06 06:29:28,545 - hydromt.model.model - model - INFO - update: setup_config
2026-05-06 06:29:28,545 - hydromt.model.model - model - INFO - setup_config.geometry.bedlevuni=-5
2026-05-06 06:29:28,545 - hydromt.hydromt_delft3dfm.dflowfm - dflowfm - INFO - Write model data to /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/build/dflowfm_mesh2d_refine
2026-05-06 06:29:28,547 - hydromt.hydromt_delft3dfm.components.inifield - inifield - INFO - Writing maps files to /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/build/dflowfm_mesh2d_refine/maps
2026-05-06 06:29:28,556 - hydromt.hydromt_delft3dfm.components.inifield - inifield - INFO - Writing file /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/build/dflowfm_mesh2d_refine/maps/bedlevel.tif
2026-05-06 06:29:28,562 - hydromt.hydromt_delft3dfm.components.inifield - inifield - INFO - Writing file /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/build/dflowfm_mesh2d_refine/maps/InfiltrationCapacity.tif
2026-05-06 06:29:28,569 - hydromt.hydromt_delft3dfm.components.inifield - inifield - INFO - Writing file /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/build/dflowfm_mesh2d_refine/maps/frictioncoefficient.tif
2026-05-06 06:29:28,581 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: mesh1d
2026-05-06 06:29:28,581 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: network1d
2026-05-06 06:29:28,582 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: mesh2d
2026-05-06 06:29:28,582 - hydromt.model.components.geoms - geoms - INFO - dflowfm.geoms: Writing geoms to /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/build/dflowfm_mesh2d_refine/geoms/crosssections.geojson.
2026-05-06 06:29:28,625 - hydromt.model.components.geoms - geoms - INFO - dflowfm.geoms: Writing geoms to /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/build/dflowfm_mesh2d_refine/geoms/mesh2d.geojson.
2026-05-06 06:29:28,638 - hydromt.model.components.geoms - geoms - INFO - dflowfm.geoms: Writing geoms to /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/build/dflowfm_mesh2d_refine/geoms/rivers_nodes.geojson.
2026-05-06 06:29:28,640 - hydromt.model.components.geoms - geoms - INFO - dflowfm.geoms: Writing geoms to /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/build/dflowfm_mesh2d_refine/geoms/pipe_nodes.geojson.
2026-05-06 06:29:28,669 - hydromt.model.components.geoms - geoms - INFO - dflowfm.geoms: Writing geoms to /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/build/dflowfm_mesh2d_refine/geoms/branches.geojson.
2026-05-06 06:29:28,700 - hydromt.model.components.geoms - geoms - INFO - dflowfm.geoms: Writing geoms to /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/build/dflowfm_mesh2d_refine/geoms/rivers.geojson.
2026-05-06 06:29:28,704 - hydromt.model.components.geoms - geoms - INFO - dflowfm.geoms: Writing geoms to /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/build/dflowfm_mesh2d_refine/geoms/network1d.geojson.
2026-05-06 06:29:28,713 - hydromt.model.components.geoms - geoms - INFO - dflowfm.geoms: Writing geoms to /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/build/dflowfm_mesh2d_refine/geoms/pipes.geojson.
2026-05-06 06:29:28,742 - hydromt.model.components.geoms - geoms - INFO - dflowfm.geoms: Writing geoms to /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/build/dflowfm_mesh2d_refine/geoms/mesh1d.geojson.
2026-05-06 06:29:28,757 - hydromt.model.components.geoms - geoms - INFO - dflowfm.geoms: Writing geoms to /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/build/dflowfm_mesh2d_refine/geoms/boundaries.geojson.
2026-05-06 06:29:28,760 - hydromt.model.components.geoms - geoms - INFO - dflowfm.geoms: Writing geoms to /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/build/dflowfm_mesh2d_refine/geoms/manholes.geojson.
2026-05-06 06:29:28,781 - hydromt.hydromt_delft3dfm.components.geoms - geoms - INFO - Writting cross-sections files crsdef and crsloc
2026-05-06 06:29:29,072 - hydromt.hydromt_delft3dfm.components.geoms - geoms - INFO - Writting friction file(s)
2026-05-06 06:29:29,077 - hydromt.hydromt_delft3dfm.components.geoms - geoms - INFO - Writting manholes file.
2026-05-06 06:29:29,328 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: mesh1d
2026-05-06 06:29:29,329 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: network1d
2026-05-06 06:29:29,329 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: mesh2d
2026-05-06 06:29:29,341 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: crosssections
2026-05-06 06:29:29,342 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: mesh2d
2026-05-06 06:29:29,343 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: rivers_nodes
2026-05-06 06:29:29,349 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: pipe_nodes
2026-05-06 06:29:29,357 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: branches
2026-05-06 06:29:29,358 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: rivers
2026-05-06 06:29:29,358 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: network1d
2026-05-06 06:29:29,365 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: pipes
2026-05-06 06:29:29,366 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: mesh1d
2026-05-06 06:29:29,367 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: boundaries
2026-05-06 06:29:29,372 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: manholes
2026-05-06 06:29:29,373 - hydromt.hydromt_delft3dfm.components.mesh - mesh - INFO - Writing mesh file.
2026-05-06 06:29:29,665 - hydromt.hydromt_delft3dfm.components.mesh - mesh - INFO - Writing branches.gui file
2026-05-06 06:29:29,955 - hydromt.hydromt_delft3dfm.components.forcing - forcing - INFO - Writing forcing files.
2026-05-06 06:29:30,656 - hydromt.hydromt_delft3dfm.components.dimr - dimr - INFO - Adding dflowfm component to dimr config
2026-05-06 06:29:30,663 - hydromt.hydromt_delft3dfm.components.dimr - dimr - INFO - Writing model dimr file to /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/build/dflowfm_mesh2d_refine/dimr_config.xml
Error in sys.excepthook:
Original exception was:
Error in sys.excepthook:
Original exception was:
Error in sys.excepthook:
Original exception was:
The example above means the following: run hydromt with:
update dflowfm: i.e. update a dflowfm modeldflowfm_piave: original model folder-o ./build/dflowfm_mesh2d_refine: output updated model folder-i dflowfm_update_mesh2d_refine.yml: setup configuration file containing the components to update and their different optionsv: give some extra verbosity (1 * v) to display feedback on screen. Now info messages are provided.
Model comparison#
From the information above, you can see that the mesh2d was refined and now contains 828 faces after refinement compared to 460 beforehand and that the 1D2D links have been regenerated.
Using the script from the plot example, we can compare the 2D mesh before and after the refinements.
First, let’s load some packages.
[4]:
import geopandas as gpd
import matplotlib.pyplot as plt
[5]:
# Load both models with hydromt
from hydromt_delft3dfm import DFlowFMModel
mod0 = DFlowFMModel(root="dflowfm_piave", mode="r")
mod1 = DFlowFMModel(root="build/dflowfm_mesh2d_refine", mode="r")
# read dflowfm mesh; extract the 2d grid part
mesh2d_0 = mod0.mesh.mesh_grids["mesh2d"]
mesh2d_1 = mod1.mesh.mesh_grids["mesh2d"]
/home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/.pixi/envs/default/lib/python3.12/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
from .autonotebook import tqdm as notebook_tqdm
2026-05-06 06:29:34,484 - hydromt.hydromt_delft3dfm.dflowfm - dflowfm - INFO - Reading dimr file at dflowfm_piave/dimr_config.xml
2026-05-06 06:29:35,249 - hydromt.model.model - model - INFO - Initializing dflowfm model from hydromt_delft3dfm (v0.3.1.dev0).
2026-05-06 06:29:35,250 - hydromt.data_catalog.data_catalog - data_catalog - INFO - Parsing data catalog from /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/hydromt_delft3dfm/data/parameters_data.yml
2026-05-06 06:29:35,270 - hydromt.hydromt_delft3dfm.dflowfm - dflowfm - INFO - Reading mdu file at /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/dflowfm_piave/dflowfm/DFlowFM.mdu
2026-05-06 06:29:36,396 - hydromt.hydromt_delft3dfm.components.mesh - mesh - INFO - Reading branches GUI file
2026-05-06 06:29:36,767 - hydromt.hydromt_delft3dfm.components.geoms - geoms - INFO - Reading cross-sections files
2026-05-06 06:29:36,807 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: crosssections
2026-05-06 06:29:36,808 - hydromt.hydromt_delft3dfm.components.geoms - geoms - INFO - Reading manholes file
2026-05-06 06:29:36,863 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: manholes
2026-05-06 06:29:36,864 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: rivers
2026-05-06 06:29:36,866 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: pipes
2026-05-06 06:29:36,866 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: branches
2026-05-06 06:29:36,869 - hydromt.hydromt_delft3dfm.dflowfm - dflowfm - INFO - project crs: 3857
2026-05-06 06:29:36,877 - hydromt.hydromt_delft3dfm.dflowfm - dflowfm - INFO - Reading dimr file at build/dflowfm_mesh2d_refine/dimr_config.xml
2026-05-06 06:29:37,716 - hydromt.model.model - model - INFO - Initializing dflowfm model from hydromt_delft3dfm (v0.3.1.dev0).
2026-05-06 06:29:37,717 - hydromt.data_catalog.data_catalog - data_catalog - INFO - Parsing data catalog from /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/hydromt_delft3dfm/data/parameters_data.yml
2026-05-06 06:29:37,722 - hydromt.hydromt_delft3dfm.dflowfm - dflowfm - INFO - Reading mdu file at /home/runner/work/hydromt_delft3dfm/hydromt_delft3dfm/docs/_examples/build/dflowfm_mesh2d_refine/dflowfm/DFlowFM.mdu
2026-05-06 06:29:38,892 - hydromt.hydromt_delft3dfm.components.mesh - mesh - INFO - Reading branches GUI file
2026-05-06 06:29:39,268 - hydromt.hydromt_delft3dfm.components.geoms - geoms - INFO - Reading cross-sections files
2026-05-06 06:29:39,328 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: crosssections
2026-05-06 06:29:39,330 - hydromt.hydromt_delft3dfm.components.geoms - geoms - INFO - Reading manholes file
2026-05-06 06:29:39,384 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: manholes
2026-05-06 06:29:39,384 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: rivers
2026-05-06 06:29:39,386 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: pipes
2026-05-06 06:29:39,387 - hydromt.model.components.geoms - geoms - WARNING - Replacing geom: branches
2026-05-06 06:29:39,390 - hydromt.hydromt_delft3dfm.dflowfm - dflowfm - INFO - project crs: 3857
[6]:
# read the polygon file we used for the refinement
polygons = gpd.read_file("data/refine.geojson")
[7]:
# Make 2 side-by-side plots to plot each mesh
zoom_level = 10
fig = plt.figure(figsize=(12, 6))
axs = fig.subplots(1, 2)
axs[0].set_title("Original mesh")
axs[1].set_title("Refined mesh")
# Plot the original mesh
mesh2d_0.plot(ax=axs[0], facecolor="none", edgecolor="k")
polygons.to_crs(mod0.crs).plot(ax=axs[0], facecolor="r", edgecolor="r")
# Plot the refined mesh
mesh2d_1.plot(ax=axs[1], facecolor="none", edgecolor="k")
polygons.to_crs(mod0.crs).plot(ax=axs[1], facecolor="none", edgecolor="r")
[7]:
<Axes: title={'center': 'Refined mesh'}>