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
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 the couple_lpjml branch.
Full error is
File "/home/leander/Documents/Studium/13/Masterthesis/pycopancore/studies/run_core_lpjml.py", line 109, in <module>
traj = runner.run(t_0=0, 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 53, 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]) # TODO: define lpjml_cell_id, or do all cells in environment, double-think about dimensions and units
File "/home/leander/Documents/Studium/13/Masterthesis/pycopancore/pycopancore/data_model/variable.py", line 633, in __getitem__
return self.get_value(instance)
File "/home/leander/Documents/Studium/13/Masterthesis/pycopancore/pycopancore/data_model/variable.py", line 614, in get_value
v = getattr(instance, self.codename)
AttributeError: 'str' object has no attribute 'old_out_dict'
The text was updated successfully, but these errors were encountered:
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
The text was updated successfully, but these errors were encountered: