Hi all,
more bugs!
CropSuite fails when reading in the plant parameterizations for miscanthus, redcanarygrass and switchgrass with this error message:
Traceback (most recent call last):
File "/home/jansen/CropSuite/CropSuite.py", line 386, in <module>
run(silent, config, gui=None, no_version_check=noversioncheck)
File "/home/jansen/CropSuite/CropSuite.py", line 228, in run
rpp.plot_all_parameterizations(plant_params_formulas, plant_params)
File "/home/jansen/CropSuite/src/read_plant_params.py", line 88, in plot_all_parameterizations
plot_plant_params(form_arr[crop], crop, len_growing_cycle=int(crop_dict[crop]['growing_cycle'][0]))
File "/home/jansen/CropSuite/src/read_plant_params.py", line 30, in plot_plant_params
plt.plot(np.linspace(form_arr[param]['min_val'], form_arr[param]['max_val'], no_stops), np.clip(100*form_arr[param]['formula'](np.linspace(form_arr[param]['min_val'], form_arr[param]['max_val'], no_stops)), 0, 100), 'k')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jansen/CropSuite/src/read_plant_params.py", line 141, in <lambda>
interpolator = lambda xi: np.interp(xi, x_vals, y_vals)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jansen/.conda/envs/cropsuite/lib/python3.12/site-packages/numpy/lib/function_base.py", line 1599, in interp
return interp_func(x, xp, fp, left, right)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: fp and xp are not of the same length.
I sussed this out by looking into the generated parameterization plots folder, as that one seems to stop making new plots at the crop where it fails. Deleting miscanthus.inf, CropSuite ran until redcanarygrass, and so on. With all three deleted, CropSuite ran successfully until the end.
It might be due to the base_sat values being of unequal lengths in all three plant parameterization files (shown here is redcanarygrass, but the values are the same for the three crops):
base_sat_vals = 0,20,50,35,100 ; 5 values
base_sat_suit = 0,0.75,0.92,1 ; 4 values
Seems like there is a suitability value missing for a base saturation of 20. Would 0.5 be appropriate?
Given that users can create these as well, it might be worth to include a check for equal lengths of vals and suit vectors.
Hi all,
more bugs!
CropSuite fails when reading in the plant parameterizations for miscanthus, redcanarygrass and switchgrass with this error message:
I sussed this out by looking into the generated parameterization plots folder, as that one seems to stop making new plots at the crop where it fails. Deleting
miscanthus.inf, CropSuite ran until redcanarygrass, and so on. With all three deleted, CropSuite ran successfully until the end.It might be due to the base_sat values being of unequal lengths in all three plant parameterization files (shown here is redcanarygrass, but the values are the same for the three crops):
Seems like there is a suitability value missing for a base saturation of 20. Would 0.5 be appropriate?
Given that users can create these as well, it might be worth to include a check for equal lengths of
valsandsuitvectors.