Skip to content
Snippets Groups Projects
Commit fc6b78c3 authored by Marco Matthies's avatar Marco Matthies
Browse files

ALMaSS: avoid missing growth curves for low/high nutrients

parent b077630d
No related branches found
No related tags found
No related merge requests found
...@@ -600,13 +600,21 @@ get_dddegs(model::SimulationModel) = bounds(supply_temperature(model)) ...@@ -600,13 +600,21 @@ get_dddegs(model::SimulationModel) = bounds(supply_temperature(model))
# TODO efficiency: the fertiliser check is done in many places # TODO efficiency: the fertiliser check is done in many places
function growthcurve(cs::CropState) function growthcurve(cs::CropState)
curve = if fertiliser in cs.events if ismissing(cs.croptype.lownutrientgrowth) && ismissing(cs.croptype.highnutrientgrowth)
cs.croptype.highnutrientgrowth error("No growth curves available for cropstate:\n $cs")
else
cs.croptype.lownutrientgrowth
end end
if fertiliser in cs.events
curve = cs.croptype.highnutrientgrowth
if ismissing(curve) if ismissing(curve)
error("Growth curve is missing for cropstate:\n $cs") @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 end
return curve return curve
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment