diff --git a/src/core/simulation.jl b/src/core/simulation.jl index b3e4cf0153b5f1747037aa24f021b95b87bbf40f..ac9a4570dfe97298e33f1cf582162cb4236daccd 100644 --- a/src/core/simulation.jl +++ b/src/core/simulation.jl @@ -140,7 +140,7 @@ function initmodel(settings::Dict{String, Any}) ) saveinputfiles(model) - initfields!(model, settings["crop.cropmodel"]) + initfields!(model) initfarms!(model) initnature!(model) model diff --git a/src/crop/cropmodels.jl b/src/crop/cropmodels.jl index f175b9f7530ad9e9f6e37b7ffbf6e5f00a99a5a9..0cc9477e24cef131078a5929e02b760b28ba2bc8 100644 --- a/src/crop/cropmodels.jl +++ b/src/crop/cropmodels.jl @@ -24,7 +24,7 @@ end Initialise the model with its farm plots. """ -function initfields!(model::SimulationModel, cropmodel::AbstractString) +function initfields!(model::SimulationModel) n = 0 convertid = Dict{Int64,Int64}() width, height = size(model.landscape) @@ -40,7 +40,7 @@ function initfields!(model::SimulationModel, cropmodel::AbstractString) model.landscape[x,y].fieldid = objectid push!(model.farmplots[objectid].pixels, (x,y)) else - cropstate = make_cropstate(model, cropmodel) + cropstate = make_cropstate(model, @param(crop.cropmodel)) fp = FarmPlot( length(model.farmplots) + 1, [(x, y)], diff --git a/test/landscape_tests.jl b/test/landscape_tests.jl index d2d3f02c05acfc029ac621b6a1d765c312fe46b8..b82576512052685ee743d91ff42a5f3dfdfcfeb4 100644 --- a/test/landscape_tests.jl +++ b/test/landscape_tests.jl @@ -6,8 +6,7 @@ @testset "Landscape initialisation" begin model = inittestmodel(false) # these tests are specific to the Jena maps - cropmodel = "almass" - @test_logs (:info, "Initialised 2092 farm plots.") match_mode=:any Ps.initfields!(model, cropmodel) + @test_logs (:info, "Initialised 2092 farm plots.") match_mode=:any Ps.initfields!(model) @test size(model.landscape) == (1754, 1602) @test Ps.landcover((100,100), model) == Ps.forest @test Ps.landcover((300,1), model) == Ps.soil diff --git a/test/runtests.jl b/test/runtests.jl index e826c76d1fef94a54ed1fec13784faa13678369b..4aaf78eb80ee893ba409eed6b396547f056721ab 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -43,7 +43,7 @@ function inittestmodel(smallmap=true) TESTSETTINGS["world.weatherfile"]), TESTSETTINGS["core.startdate"], TESTSETTINGS["core.enddate"]) - # TODO: allow init of other crop models besides ALMaSS + # TODO: support other crop models besides ALMaSS crops = Ps.ALMaSS.readcropparameters(TESTSETTINGS["crop.cropfile"], TESTSETTINGS["crop.growthfile"]) farmers = Vector{Farmer}()