e2nIEE / pandapower

Convenient Power System Modelling and Analysis based on PYPOWER and pandas

Home Page:https://www.pandapower.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[bug] simple_plot() does not pot lines since geojson update

SteffenMeinecke opened this issue · comments

Bug report checklis

  • Searched the issues page for similar reports

  • Read the relevant sections of the documentation

  • Browse the tutorials and tests for usefull code snippets and examples of use

  • Reproduced the issue after updating with pip install --upgrade pandapower (or git pull)

  • Tried basic troubleshooting (if a bug/error) like restarting the interpreter and checking the pythonpath

Reproducible Example

import pandapower as pp

net = pp.networks.case30()
pp.plotting.simple_plot(net)
plt.show()

Issue Description and Traceback

Before merging #1731, simple_plot() was able to plot lines between buses. @KS-HTK and @vogt31337 can you have a look why this is failing now?

Expected Behavior

grey lines between plotted blue buses

Installed Versions

  • python version: 3.10.11
  • pandas version: 2.2.1
  • networkx version: 2.6.3
  • scipy version: 1.12.0
  • numpy version: 1.26.0
  • packaging version: 23.0
  • tqdm version: 4.65.0
  • deepdiff version: 5.8.1
  • Operating System name/version: windows 10

Label

  • Relevant labels are selected

This issue is a bit broadly worded. It only failes if lines do not contain geodata.

How would you expect it to be handled if some lines do and some lines do not contain geodata?
Draw all geodata based on the from_bus and to_bus or only use the bus geodata if the line does not contain its own geodata?

The issue itself is use_bus_geodata = len(net.line.geo) == 0. This only evaluates true if no lines exist. Don't know what i was thinking there. 😅
But the create_line_collection is a bit unflexible. I would have to create two line collections if only some lines do not contain any geodata.
Or just move the check inside that function. Is there a reason to force use of bus geodata instead of present line geodata. Or is this something that could just be decided inside the create_line_collection?

[EDIT]
My prefered solution would be to use line geodata when present and only use bus geodata if no line geodata is present or use_bus_geodata is set. I do not see any value in not drawing lines that have no geodata present but drawing lines where the geodata is present.

An alternative would be to only draw the lines where geodata is present and then using a second line collection to draw the lines where no geodata is present.

Hi @KS-HTK,
I think it is a common use case that only geodata of buses are available and you want to have plotted lines between the buses.
If geodata is available for some or several lines, I think, the default can still be that the geodata is filled by the geodata of two ends (buses) of the lines. In this case I would log the filling as info.