Skip to content

Commit

Permalink
Bug fix do not raise error in case geom not in dict
Browse files Browse the repository at this point in the history
  • Loading branch information
birgits committed Mar 5, 2023
1 parent 013a3ac commit 27b3644
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions edisgo/network/topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -2082,7 +2082,7 @@ def _choose_random_substation_id():
# lv_grid.id
# )
# )
comp_data.pop("geom")
comp_data.pop("geom", None)
comp_data.pop("p")
comp_name = add_func(bus=self.mv_grid.station.index[0], **comp_data)
return comp_name
Expand Down Expand Up @@ -2180,7 +2180,7 @@ def _choose_random_substation_id():
bus = random.choice(
lv_grid.buses_df[~lv_grid.buses_df.in_building.astype(bool)].index
)
comp_data.pop("geom")
comp_data.pop("geom", None)
comp_data.pop("p")
comp_name = add_func(bus=bus, **comp_data)
return comp_name
Expand Down Expand Up @@ -2219,11 +2219,11 @@ def _choose_random_substation_id():
comp_bus = self._connect_to_lv_bus(
edisgo_object, lv_grid.station.index[0], comp_type, comp_data
)
comp_data.pop("geom")
comp_data.pop("geom", None)
comp_data.pop("p")
comp_name = add_func(bus=comp_bus, **comp_data)
else:
comp_data.pop("geom")
comp_data.pop("geom", None)
comp_data.pop("p")
comp_name = add_func(bus=lv_conn_target, **comp_data)
return comp_name
Expand Down

0 comments on commit 27b3644

Please sign in to comment.