Closed samaranin closed 1 year ago
I've fixed this by changing the method of clock_struct.n_seasons
calculation in aquacrop/initialize/read_model_parameters.py
from line 189:
diff_between_dates = (sim_end_date - sim_start_date).days
total_number_of_years = diff_between_dates // 365
clock_struct.n_seasons = total_number_of_years + 1
Hi @samaranin
Thanks for creating the pull request. Ill try and take a look at your example today but I will be on holiday for the next two weeks so the PR will likely not be merged before then, apologies.
Tom
Thanks a lot for the answer!
Of course, no problems, this is not a critical bug and doesn't need any immediate answer.
Have a good holiday!
I've got KeyError when trying to run a simulation on my data.
Simulation code and weather data can be found here -> WeTransfer <- and below.
My code and initial parameters for simulation:
And the error (just the main part of it)
I assume that this error appears when the simulation tries to switch to another season but
clock_struct.time_span
does not contain dates for this period (the next planting date is after the last available date inclock_struct.time_span
). I've fixed this with a quick fix insideaquacrop/timestep/update_time.py
from line 58:But I think that it needs to be fixed on a higher level. Maybe someone will have an idea of how or where this can be fixed.
UPDATE: I think this should be fixed in
aquacrop/initialize/read_model_parameters.py
from line 130, where the number of planting years is calculated because the number of seasons depends on this value. In cases similar to my should be only 1 planting year.