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

Set the soil type of a FarmPlot to the most frequent soil type of its pixels

parent 5144fa4c
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,8 @@
### Functions for switchable crop models.
###
using StatsBase: mode
"""
initfields!(cropmodel, cropfile, growthfile)
......@@ -61,6 +63,12 @@ function initfields!(model::SimulationModel)
end
end
end
# Adjust soil type to most common soil type of the pixels
# belonging to a farmplot
for fp in model.farmplots
fp.soiltype = mode(map(p -> model.landscape[p[1], p[2]].soiltype, fp.pixels))
end
@info "Initialised $(length(model.farmplots)) farm plots."
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment