You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Getting the forecasted prod and load values without calling obs.simulate before raises a KeyError
How to reproduce
Code snippet
importgrid2opprint (grid2op.__version__)
env=grid2op.make("l2rpn_wcci_2020")
# Get forecast after a simulate works obs=env.reset()
obs.simulate(env.action_space({}))
prod_p_f, prod_v_f, load_p_f, load_q_f=obs.get_forecasted_inj()
print (prod_p_f.shape, prod_v_f.shape, load_p_f.shape, load_q_f.shape)
# Get forecast before any simulate doesnt work obs=env.reset()
prod_p_f, prod_v_f, load_p_f, load_q_f=obs.get_forecasted_inj()
print (prod_p_f.shape, prod_v_f.shape, load_p_f.shape, load_q_f.shape)
Current output
1.1.1
(22,) (22,) (37,) (37,)
Traceback (most recent call last):
File "./forecast.py", line 13, in <module>
prod_p_f, prod_v_f, load_p_f, load_q_f = obs.get_forecasted_inj()
File "XXX/grid2op/Observation/BaseObservation.py", line 666, in get_forecasted_inj
a = self._forecasted_grid_act[time_step]["inj_action"]
KeyError: 1
Use private attribute _forecasted_inj to get values instead of using the action built from _forecasted_inj in simulate; which removes the need to call simulate
Environment
1.1.1
ubuntu20
Bug description
Getting the forecasted prod and load values without calling
obs.simulate
before raises aKeyError
How to reproduce
Code snippet
Current output
Expected output
The text was updated successfully, but these errors were encountered: