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

Add tests for model initialisation with different crop models (ALMaSS, SimpleCrop)

parent f89a240c
No related branches found
No related tags found
No related merge requests found
...@@ -23,7 +23,6 @@ mutable struct AgricultureModel <: SimulationModel ...@@ -23,7 +23,6 @@ mutable struct AgricultureModel <: SimulationModel
weather::Dict{Date,Weather} weather::Dict{Date,Weather}
crops::Dict{String,ALMaSS.CropType} crops::Dict{String,ALMaSS.CropType}
farmers::Vector{Farmer} farmers::Vector{Farmer}
#farmplots::Vector{ALMaSS.FarmPlot}
farmplots::Vector{AbstractFarmPlot} farmplots::Vector{AbstractFarmPlot}
animals::Vector{Union{Animal,Nothing}} animals::Vector{Union{Animal,Nothing}}
migrants::Vector{Pair{Animal,Date}} migrants::Vector{Pair{Animal,Date}}
......
### Persefone.jl - a model of agricultural landscapes and ecosystems in Europe. ### 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
### 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
### 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment