Skip to content

Commit

Permalink
Add a return on condition in case there is no isolated nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
ekatef committed Oct 26, 2023
1 parent 4aabc91 commit 6391b21
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/simplify_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,11 @@ def merge_into_network(n, aggregation_strategies=dict()):
# ]

i_connected = n.buses.index.difference(i_islands)

# return the original network if no isolated nodes are detected
if len(i_islands) == 0:
return n, n.buses.index.to_series()

points_buses = np.array(
list(zip(n.buses.loc[i_connected].x, n.buses.loc[i_connected].y))
)
Expand Down

0 comments on commit 6391b21

Please sign in to comment.