Network clustering incorrectly preferring lines over links
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 615
- Forks
- 459
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 6
Description
Version Checks (indicate both or one)
-
I have confirmed this bug exists on the lastest release of PyPSA-Eur.
-
I have confirmed this bug exists on the current
masterbranch of PyPSA-Eur.
Issue Description
I'm working with an OSM pre-built and have two HVDC link relations that are pulled in as both a line and a link.
Relations:
In the pre-built they have been assigned to links and lines. This translates to one of each in resources(networks/base_s.nc), e.g.:
In [1]: network.links.filter(regex="18462073", axis=0)
Out[1]:
bus0 bus1 type ... dc underwater_fraction project_status
name ...
relation/18462073-525-DC way/1078532568-400 way/166703766-400 ... 1.0 0.590604
[1 rows x 43 columns]
In [2]: network.lines.filter(regex="18462073", axis=0)
Out[2]:
bus0 bus1 type x r ... r_pu_eff s_nom_opt v_nom i_nom dc
name ...
relation/18462073-525 way/160580052-525 way/133323988-525 Al/St 240/40 4-bundle 380.0 124.785648 15.217762 ... 0.0 0.0 380 2.58 0.0
[1 rows x 35 columns]
Once clustered, the link disappears and only the line is represented. This is an erroneous choice: this is a HVDC link.
There seem to be a few places where a bug could be introduced:
- In building the OSM network from raw data (creating an entry in both
lines.csvandlinks.csv) - In clustering the OSM network (choosing a line in preference to a link following the same route)
You won't find these specific relations in the v0.6 prebuilt. The osm prebuilt I'm using is a slight update to include some new infrastructure we needed to capture, based on running the pypsa-eur osm pre-built prep script a few months ago.
Reproducible Example
N/A
Expected Behavior
HVDC links should be links in the final clustered network
Installed Versions
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the OSM prebuilt prep script and compare how the affected relations are written to lines.csv and links.csv, then inspect the clustering step using resources(networks/base_s.nc). Reproduce the duplicate relation entries with the linked Zenodo prebuilt or equivalent input. Done means the clustered network retains these HVDC relations as links rather than replacing them with lines.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100