Closed Atomao closed 3 months ago
I think this is a fundamental issue with the codebase that affects the run_model
function in the GreenLightModel
class. Here's a detailed breakdown of the problem:
Initial Run:
run_model
function is called with gl_params
that do not contain the 'd' dictionary.gl_params = extract_last_value_from_nested_dict(gl_params)
which converts the 2D ndarrays in the gl_params
dictionary to 1D ndarrays, does not affect 'd' as it is not present.
Subsequent Runs:
on_end_of_zone_timestep_after_zone_reporting
), gl_params
includes the 'd' dictionary with string keys and 2D np.ndarray values.extract_last_value_from_nested_dict
function now affects 'd', resulting in float values instead of ndarrays. This conversion causes issues because:
self.d = self.convert_dict_to_array(self.gl['d']).copy()
fails to initialize ODESolver
correctly, as its variable depends on 'd' being an ndarray.
Impact:
convert_dict_to_array
method cannot process float values and retrieve their shapes, leading to errors.Could the author, @greenpeer, please address this issue or provide guidance on how to manage the effects of this inconsistency? Thank you!
@Atomao Thank you for raising this issue. @gsoykan Thank you for your detailed analysis.
This issue has been resolved.
The problem was addressed through modifications to the ODESolver
class in the create_green_light_model/ode.py
file. The following changes were implemented:
d
was added to the ODESolver
class constructor.self.d = self.convert_dict_to_array(self.gl['d']).copy()
was removed.self.d = d # Store the entire uncontrolled variables matrix
.These adjustments prevent the issue where 2D arrays were being converted to float values.
To utilize this fix, the latest version of the repository should be pulled. The simulation should now run without encountering the previous error.
Hi, tested new version and current error not appeared so close issue.
Hi, I was trying to run the provided code with different value for parameter
season_interval = 5
I got an error like this and need help to fix it. The error I got on second iteration of simulation for loop and from what I can understand on first iter everything works because
data_dict
is a dict with matrices(np.ndarray) values, but on second iteration the corresponding matrices are just decimal numbers.