diff --git a/src/crop/almass.jl b/src/crop/almass.jl index eff3ad0d574cd70f09d73384bbb755acead0bcc5..c41353b077371b0c496df65ecdfca2d9e1526f1e 100644 --- a/src/crop/almass.jl +++ b/src/crop/almass.jl @@ -600,13 +600,21 @@ get_dddegs(model::SimulationModel) = bounds(supply_temperature(model)) # TODO efficiency: the fertiliser check is done in many places function growthcurve(cs::CropState) - curve = if fertiliser in cs.events - cs.croptype.highnutrientgrowth - else - cs.croptype.lownutrientgrowth + if ismissing(cs.croptype.lownutrientgrowth) && ismissing(cs.croptype.highnutrientgrowth) + error("No growth curves available for cropstate:\n $cs") end - if ismissing(curve) - error("Growth curve is missing for cropstate:\n $cs") + if fertiliser in cs.events + curve = cs.croptype.highnutrientgrowth + if ismissing(curve) + @warn "fertiliser used, but highnutrient growth curve is missing. Using lownutrient growth curve." + curve = cs.croptype.lownutrientgrowth + end + else + curve = cs.croptype.lownutrientgrowth + if ismissing(curve) + # @warn "fertiliser not used, but lownutrient growth curve is missing. Using highnutrient growth curve." + curve = cs.croptype.highnutrientgrowth + end end return curve end