Skip to content

Reuse network topology across from_res1d calls for calibration loops #682

Description

@jpalm3r

Follow-up from #679.

In a calibration loop the network topology is fixed and only the result file changes, but
from_res1d rebuilds the whole graph on every trial. A test user reports 18–25 s per build on a
7,955-node EPANET-backed file, most of it topology, against ~1.5 s for the data they actually need.

They suggest:

network = Network.from_res1d(new_res, topology=existing_network)

which would copy the graph structure from an existing Network and re-read only the data.

This is the largest remaining win from #679. It also sidesteps mikeio1d's _get_total_length
(#684) entirely, since the reach loop never runs.

Open question: how much should we check that the reused topology actually matches the new file?
Options range from documenting it as the caller's responsibility to comparing node and reach counts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions