DHI / DHI/modelskill

Reuse network topology across from_res1d calls for calibration loops

Open
#682 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
56
Forks
9
Avg merge
57m
Merged PRs (30d)
3

Description

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:

```python
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.

Contributor guide

Open the contributing guide

Research direction

Start at Network.from_res1d and review the context in #679, including mikeio1d’s _get_total_length issue in #684. Trace how topology and result data are currently loaded, then determine how reuse should handle mismatched node and reach counts. Done means repeated calibration calls reuse the fixed graph and reread only changing result data.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.