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

friction values are not assigned to branches when a model is read #168

Open shartgring opened 1 month ago

shartgring commented 1 month ago

Version checks

Reproducible Example

The workflow for setting point cross-sections, which is used for cross-sections but also bridges and culverts, relies on the branches containing the columns ["frictionid", "frictiontype", "frictionvalue"]. In workflows.crosssections.py: https://github.com/Deltares/hydromt_delft3dfm/blob/8862432e235ff5740c83dd322d76d22f6b22271b/hydromt_delft3dfm/workflows/crosssections.py#L594-L598

However, when a DFlowFM model is read using read_model, these attributes are not read, and only columns found in the branches.gui file are included. I looked at prepare_default_friction_and_crosssection() but I think it that we might be looking for something else

Current behaviour

When a model is read, no friction info is added to the branches. This info is used by other parts of the code

Desired behaviour

Either change workflows such that the friction info is not needed, or enhance model reading such that the friction of the branches can be inferred from a model. A possible (easy) solution is reading the branches geom, but this will then not work with DFlowFM models that are not built using hydromt_delft3dfm. Either way, I think there are multiple solutions and that therefore some extra thinking is required for finding the best solution

Additional context

No response

shartgring commented 1 month ago

See also the tests in #169 where this problem was found. Ideally, the tests of setup_bridges and setup_culverts should be able to run directly after reading the test model, without first calling the setup_channels method