Skip to content

Commit b35ae50

Browse files
committed
fixing broken tests for legacy lightsim2grid
1 parent 29ff19d commit b35ae50

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

grid2op/Space/GridObjects.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,19 +1610,22 @@ def _fill_names(cls):
16101610
cls._reset_cls_dict()
16111611

16121612
if cls.shunts_data_available and cls.name_shunt is None:
1613-
cls.name_shunt = [
1614-
"shunt_{}_{}".format(bus_id, sh_id)
1615-
for sh_id, bus_id in enumerate(cls.shunt_to_subid)
1616-
]
1617-
cls.name_shunt = np.array(cls.name_shunt)
1618-
warnings.warn(
1619-
"name_shunt is None so default storage unit names have been assigned to your grid. "
1620-
"(FYI: storage names are used to make the correspondence between the chronics and "
1621-
"the backend)"
1622-
"This might result in impossibility to load data."
1623-
'\n\tIf "env.make" properly worked, you can safely ignore this warning.'
1624-
)
1625-
cls._reset_cls_dict()
1613+
if cls.shunt_to_subid is not None:
1614+
# used for legacy lightsim2grid
1615+
# shunt names were defined after...
1616+
cls.name_shunt = [
1617+
"shunt_{}_{}".format(bus_id, sh_id)
1618+
for sh_id, bus_id in enumerate(cls.shunt_to_subid)
1619+
]
1620+
cls.name_shunt = np.array(cls.name_shunt)
1621+
warnings.warn(
1622+
"name_shunt is None so default shunt names have been assigned to your grid. "
1623+
"(FYI: shunt names are used to make the correspondence between the chronics and "
1624+
"the backend)"
1625+
"This might result in impossibility to load data."
1626+
'\n\tIf "env.make" properly worked, you can safely ignore this warning.'
1627+
)
1628+
cls._reset_cls_dict()
16261629

16271630
@classmethod
16281631
def _check_names(cls):

0 commit comments

Comments
 (0)