e2nIEE / pandapower

Convenient Power System Modelling and Analysis based on PYPOWER and pandas
https://www.pandapower.org
Other
841 stars 478 forks source link

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

Closed SteffenMeinecke closed 4 months ago

SteffenMeinecke commented 5 months ago

Bug report checklis

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

Label

KS-HTK commented 5 months ago

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.

SteffenMeinecke commented 5 months ago

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.