Open leander-j opened 2 years ago
The Variable old_out_dict
does not have a default
property in the above example. If default = {}
is set, the following error shows:
Traceback (most recent call last):
File "/home/leander/Documents/Studium/13/Masterthesis/pycopancore/studies/run_core_lpjml.py", line 105, in <module>
traj = runner.run(t_0=2005, t_1=t_max, dt=dt)
File "/home/leander/Documents/Studium/13/Masterthesis/pycopancore/pycopancore/runners/runner.py", line 290, in run
self.apply_explicits(t_0)
File "/home/leander/Documents/Studium/13/Masterthesis/pycopancore/pycopancore/runners/runner.py", line 117, in apply_explicits
spec(inst, t)
File "/home/leander/Documents/Studium/13/Masterthesis/pycopancore/pycopancore/model_components/lpjml/implementation/cell.py", line 46, in read_cftfrac
self.cftfrac = np.sum((np.ceil(t)-t)*self.social_system.world.environment.old_out_dict["cftfrac"][self.lpjml_grid_cell_ids] + (t-np.floor(t))*self.social_system.world.environment.out_dict["cftfrac"][self.lpjml_grid_cell_ids]) # extrapolation over the year and summation over grid cells
KeyError: 'cftfrac'
This is to be expected since cftfrac
is supposed to be the key for an entry in the dictionary which has not been read in yet.
I found the error message
AttributeError: 'str' object has no attribute 'old_out_dict'
not very useful, especially since the string object is the explicit instance of the Environment class which I do not expect to be a string.The error came from not giving
old_out_dict
an initial value when instantiating the environment on thecouple_lpjml
branch.Full error is