diff --git a/src/crop/almass.jl b/src/crop/almass.jl index 1903cbb6d797dfcabb3d43c0c736b27dcf77ef09..25d6c4deb1045e42798ac13cb1433f0b34e0b061 100644 --- a/src/crop/almass.jl +++ b/src/crop/almass.jl @@ -599,8 +599,17 @@ end get_dddegs(model::SimulationModel) = bounds(supply_temperature(model)) # TODO efficiency: the fertiliser check is done in many places -growthcurve(cs::CropState) = - fertiliser in cs.events ? cs.croptype.lownutrientgrowth : cs.croptype.highnutrientgrowth +function growthcurve(cs::CropState) + curve = if fertiliser in cs.events + cs.croptype.highnutrientgrowth + else + cs.croptype.lownutrientgrowth + end + if ismissing(curve) + error("Growth curve is missing for cropstate:\n $cs") + end + return curve +end # Function in original ALMaSS code: # `double PlantGrowthData::GetStartValue(int a_veg_type, int a_phase, int a_type)` in `Landscape/Plants.h`, line 142