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

Check that sowdates dictionary really contains an entry for the farm

parent fa9c506e
No related branches found
No related tags found
No related merge requests found
......@@ -70,9 +70,15 @@ function stepagent!(farmer::BasicFarmer, model::SimulationModel)
@warn "minsowdate and/or maxsowdate is `missing` for crop \"$(ctype.name)\", not assigning sowdates"
end
end
elseif cropname(field) == "no growth" && model.date == farmer.sowdates[f]
# if a field has been harvested, check if the next crop can be sown
@sow(farmer.croprotations[f][1])
elseif cropname(field) == "no growth"
if haskey(farmer.sowdates, f)
if model.date == farmer.sowdates[f]
# if a field has been harvested, check if the next crop can be sown
@sow(farmer.croprotations[f][1])
end
else
@warn "farmer sowdates is empty, farmer = $farmer"
end
end
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment