diff --git a/src/core/simulation.jl b/src/core/simulation.jl index 7c2e8f20dacf8d6960da5774371ac1e7ad3f83f0..ed8b2dafd9e8296001085b95a01efb358ca849c2 100644 --- a/src/core/simulation.jl +++ b/src/core/simulation.jl @@ -23,7 +23,6 @@ mutable struct AgricultureModel <: SimulationModel weather::Dict{Date,Weather} crops::Dict{String,ALMaSS.CropType} farmers::Vector{Farmer} - #farmplots::Vector{ALMaSS.FarmPlot} farmplots::Vector{AbstractFarmPlot} animals::Vector{Union{Animal,Nothing}} migrants::Vector{Pair{Animal,Date}} diff --git a/test/crop_tests.jl b/test/crop_tests.jl index 2ab0affb0eaad04c1a71e141c06c49e497d21185..53ee874d8f0a4964d893d02e961542c1bbe93c5c 100644 --- a/test/crop_tests.jl +++ b/test/crop_tests.jl @@ -1,6 +1,14 @@ ### Persefone.jl - a model of agricultural landscapes and ecosystems in Europe. ### -### These are the tests for the crop growth model. +### These are the tests for the crop growth models. ### -#TODO +const TESTPARAM_ALMASS = joinpath(pkgdir(Persefone), "test", "test_parameters_almass.toml") +const TESTPARAM_SIMPLECROP = joinpath(pkgdir(Persefone), "test", "test_parameters_simplecrop.toml") + +@testset "Model initialisation" begin + for paramfile in (TESTPARAM_ALMASS, TESTPARAM_SIMPLECROP) + model = initialise(paramfile) + @test model isa AgricultureModel + end +end diff --git a/test/test_parameters_almass.toml b/test/test_parameters_almass.toml new file mode 100644 index 0000000000000000000000000000000000000000..94d6a9a8b25be61910d3a7d690079d2405256295 --- /dev/null +++ b/test/test_parameters_almass.toml @@ -0,0 +1,44 @@ +### Persefone.jl - a model of agricultural landscapes and ecosystems in Europe. +### +### This configuration file is used for the test suite. +### + +#XXX remember that changes here may break tests! + +[core] +configfile = "test_parameters.toml" # location of the configuration file +outdir = "results_testsuite" # location and name of the output folder +logoutput = "both" +overwrite = true # overwrite the output directory? (true/false/"ask") +csvoutput = true # save collected data in CSV files +visualise = true # generate result graphs +storedata = true # keep collected data in memory +loglevel = "warn" # verbosity level: "debug", "info", "warn" +processors = 6 # number of processors to use on parallel runs +seed = 1 # seed value for the RNG (0 -> random value) +# dates to start and end the simulation +startdate = 2022-02-01 +enddate = 2022-03-31 + +[world] +mapdirectory = "." # the directory in which all geographic data are stored +mapresolution = 10 # map resolution in meters +landcovermap = "landcover_jena.tif" # location of the landcover map +farmfieldsmap = "fields_jena.tif" # location of the field geometry map +weatherfile = "weather_jena.csv" # location of the weather data file + +[farm] +farmmodel = "FieldManager" # which version of the farm model to use (not yet implemented) + +[nature] +targetspecies = ["Wolpertinger", "Wyvern"] # list of target species to simulate - example species +#targetspecies = ["Skylark"] # list of target species to simulate +popoutfreq = "daily" # output frequency population-level data, daily/monthly/yearly/end/never +indoutfreq = "daily" # output frequency individual-level data, daily/monthly/yearly/end/never +insectmodel = ["season", "habitat", "pesticides"] # which factors affect insect growth ("weather" is not yet implemented) + +[crop] +cropmodel = "almass" # crop growth model to use, "almass", "aquacrop", or "simple" +cropfile = "crop_data_general.csv" # file with general crop parameters +growthfile = "almass_crop_growth_curves.csv" # file with crop growth parameters + diff --git a/test/test_parameters_simplecrop.toml b/test/test_parameters_simplecrop.toml new file mode 100644 index 0000000000000000000000000000000000000000..c0fe15ca888d7754e8033d98168d550d6cc55b3e --- /dev/null +++ b/test/test_parameters_simplecrop.toml @@ -0,0 +1,43 @@ +### Persefone.jl - a model of agricultural landscapes and ecosystems in Europe. +### +### This configuration file is used for the test suite. +### + +#XXX remember that changes here may break tests! + +[core] +configfile = "test_parameters.toml" # location of the configuration file +outdir = "results_testsuite" # location and name of the output folder +logoutput = "both" +overwrite = true # overwrite the output directory? (true/false/"ask") +csvoutput = true # save collected data in CSV files +visualise = true # generate result graphs +storedata = true # keep collected data in memory +loglevel = "warn" # verbosity level: "debug", "info", "warn" +processors = 6 # number of processors to use on parallel runs +seed = 1 # seed value for the RNG (0 -> random value) +# dates to start and end the simulation +startdate = 2022-02-01 +enddate = 2022-03-31 + +[world] +mapdirectory = "." # the directory in which all geographic data are stored +mapresolution = 10 # map resolution in meters +landcovermap = "landcover_jena.tif" # location of the landcover map +farmfieldsmap = "fields_jena.tif" # location of the field geometry map +weatherfile = "weather_jena.csv" # location of the weather data file + +[farm] +farmmodel = "FieldManager" # which version of the farm model to use (not yet implemented) + +[nature] +targetspecies = ["Wolpertinger", "Wyvern"] # list of target species to simulate - example species +#targetspecies = ["Skylark"] # list of target species to simulate +popoutfreq = "daily" # output frequency population-level data, daily/monthly/yearly/end/never +indoutfreq = "daily" # output frequency individual-level data, daily/monthly/yearly/end/never +insectmodel = ["season", "habitat", "pesticides"] # which factors affect insect growth ("weather" is not yet implemented) + +[crop] +cropmodel = "simple" # crop growth model to use, "almass", "aquacrop", or "simple" +cropfile = "crop_data_general.csv" # file with general crop parameters +growthfile = "almass_crop_growth_curves.csv" # file with crop growth parameters