Deltares / hydromt_delft3dfm

Delft3D FM plugin for HydroMT
https://deltares.github.io/hydromt_delft3dfm/
GNU General Public License v3.0
9 stars 2 forks source link

Add support for `global` yml section in `DFlowFMModel` #181

Closed veenstrajelmer closed 1 month ago

veenstrajelmer commented 1 month ago

tests/data/dflowfm_build.yml was aligned with examples/dflowfm_build.yml in #178. However, the global section was added but kept commented:

#global:
#  crs: 32647
#  network_snap_offset: 25
#  openwater_computation_node_distance: 40

The global section was also kept commented in tests/data/dflowfm_build_local.yml.

When uncommenting it, these tests fail:

FAILED tests/test_hydromt.py::test_model_build[piave] - ValueError: Model dflowfm has no method "global"
FAILED tests/test_hydromt.py::test_model_build[local] - ValueError: Model dflowfm has no method "global"

In this test, the model is built like this: https://github.com/Deltares/hydromt_delft3dfm/blob/533d58c2119f321c0918a7a3c8897c26a64b068e/tests/test_hydromt.py#L53-L66

So to resolve this issue, the opt should be passed to mod1.build() without the global section from a yml file. We can pop it in the test and assert whether the global arguments in the yml (crs/network_snap_offset/openwater_computation_node_distance) file correspond to the arguments that were passed via init.