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

ALMaSS: fix logic when choosing low or high nutrient growth curves

Previously, we chose the lownutrientgrowth curve when the was a
`fertiliser` event for the cropstate, otherwise the highnutrientgrowth
curve.

It should be the other way around.
parent 34f64fad
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment