Skip to content

from_res1d cannot reach EPANET link quantities — no breakpoint for single-gridpoint reaches #680

Description

@jpalm3r

Summary

from_res1d can't reach EPANET link quantities, because EPANET-style water distribution links never get a breakpoint to match against.

Root cause

Res1DReach.__init__ (src/modelskill/model/adapters/_res1d.py:77-109) only creates intermediate breakpoints when a reach has more than 2 gridpoints:

intermediate_gridpoints = (
    reach.gridpoints[1:-1] if len(reach.gridpoints) > 2 else []  # line 95-97
)

EPANET-style links typically have exactly 2 gridpoints (start and end only, no intermediate H-points), so intermediate_gridpoints is always empty and Res1DReach.breakpoints is always [] for these links. As a result, NetworkModelResult._extract_reach (src/modelskill/model/network.py:212-281) can never find data to match a ReachObservation against such a link, and always falls through to the ValueError at lines 277-281.

Request

Treat a 2-gridpoint reach as having one implicit mid-reach breakpoint. This fits the existing ReachBreakPoint/BasicReach data model without changing it. A proof of concept for this already exists.

Relevant extension points

  • ReachBreakPoint (src/modelskill/network.py:81-138)
  • BasicReach (network.py:270-323)

Found by a test user evaluating the network functionality ahead of a 1.4.0 release.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions