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

Fix some of the failures in the unit tests

- fix calls to `ALMaSS.CropType()`

- fix calls to `FarmPlot()`

- temporarily deal with `group` column not present in ALMaSS growth
  curves csv file

- fix farm model settings in parameter toml files under `test/`
parent 99174d27
Branches
Tags
No related merge requests found
...@@ -172,7 +172,10 @@ function readcropparameters(generalcropfile::String, growthfile::String) ...@@ -172,7 +172,10 @@ function readcropparameters(generalcropfile::String, growthfile::String)
filter(x -> x.nutrient_status=="high")) filter(x -> x.nutrient_status=="high"))
lownuts = buildgrowthcurve(cropgrowthdata |> lownuts = buildgrowthcurve(cropgrowthdata |>
filter(x -> x.nutrient_status=="low")) filter(x -> x.nutrient_status=="low"))
croptypes[crop.name] = CropType(crop.name, crop.group, crop.minsowdate, crop.maxsowdate, # TODO: set crop group temporarily until there is a column in
# the csv file
crop_group = "CROP_GROUP_NOT_SET"
croptypes[crop.name] = CropType(crop.name, crop_group, crop.minsowdate, crop.maxsowdate,
crop.minharvestdate, crop.maxharvestdate, crop.minharvestdate, crop.maxharvestdate,
crop.mingrowthtemp, highnuts, lownuts) crop.mingrowthtemp, highnuts, lownuts)
end end
......
...@@ -19,13 +19,15 @@ const TESTPARAM_SIMPLECROP = joinpath(pkgdir(Persefone), "test", "test_parameter ...@@ -19,13 +19,15 @@ const TESTPARAM_SIMPLECROP = joinpath(pkgdir(Persefone), "test", "test_parameter
end end
@testset "Submodule ALMaSS" begin @testset "Submodule ALMaSS" begin
ct = Ps.ALMaSS.CropType("olive tree", missing, missing, missing, missing, missing, ct = Ps.ALMaSS.CropType("olive tree", "no_crop_group",
missing, missing) missing, missing, missing, missing, missing, missing, missing)
id = 0 id = 0
pixels = [(0, 0)] pixels = [(0, 0)]
farmer = 0 farmer = 0
mature = false
events = Ps.Management[]
fp = FarmPlot(id, pixels, farmer, fp = FarmPlot(id, pixels, farmer,
Ps.ALMaSS.CropState(ct, Ps.ALMaSS.janfirst, 0.0, 0.0m, 0.0, 0.0, Ps.Management[])) Ps.ALMaSS.CropState(ct, Ps.ALMaSS.janfirst, 0.0, 0.0m, 0.0, 0.0, mature, events))
@test fp isa FarmPlot @test fp isa FarmPlot
@test fp isa FarmPlot{Ps.ALMaSS.CropState} @test fp isa FarmPlot{Ps.ALMaSS.CropState}
@test croptype(fp) isa Ps.ALMaSS.CropType @test croptype(fp) isa Ps.ALMaSS.CropType
......
...@@ -28,7 +28,9 @@ farmfieldsmap = "fields_jena.tif" # location of the field geometry map ...@@ -28,7 +28,9 @@ farmfieldsmap = "fields_jena.tif" # location of the field geometry map
weatherfile = "weather_jena.csv" # location of the weather data file weatherfile = "weather_jena.csv" # location of the weather data file
[farm] [farm]
farmmodel = "FieldManager" # which version of the farm model to use (not yet implemented) farmmodel = "BasicFarmer" # which version of the farm model to use
setaside = 0.04 # proportion of farm area set aside as fallow
fieldoutfreq = "daily" # output frequency for crop/field data, daily/monthly/yearly/end/never
[nature] [nature]
targetspecies = ["Wolpertinger", "Wyvern"] # list of target species to simulate - example species targetspecies = ["Wolpertinger", "Wyvern"] # list of target species to simulate - example species
......
...@@ -28,7 +28,9 @@ farmfieldsmap = "fields_jena.tif" # location of the field geometry map ...@@ -28,7 +28,9 @@ farmfieldsmap = "fields_jena.tif" # location of the field geometry map
weatherfile = "weather_jena.csv" # location of the weather data file weatherfile = "weather_jena.csv" # location of the weather data file
[farm] [farm]
farmmodel = "FieldManager" # which version of the farm model to use (not yet implemented) farmmodel = "BasicFarmer" # which version of the farm model to use
setaside = 0.04 # proportion of farm area set aside as fallow
fieldoutfreq = "daily" # output frequency for crop/field data, daily/monthly/yearly/end/never
[nature] [nature]
targetspecies = ["Wolpertinger", "Wyvern"] # list of target species to simulate - example species targetspecies = ["Wolpertinger", "Wyvern"] # list of target species to simulate - example species
......
...@@ -28,7 +28,9 @@ farmfieldsmap = "fields_jena.tif" # location of the field geometry map ...@@ -28,7 +28,9 @@ farmfieldsmap = "fields_jena.tif" # location of the field geometry map
weatherfile = "weather_jena.csv" # location of the weather data file weatherfile = "weather_jena.csv" # location of the weather data file
[farm] [farm]
farmmodel = "FieldManager" # which version of the farm model to use (not yet implemented) farmmodel = "BasicFarmer" # which version of the farm model to use
setaside = 0.04 # proportion of farm area set aside as fallow
fieldoutfreq = "daily" # output frequency for crop/field data, daily/monthly/yearly/end/never
[nature] [nature]
targetspecies = ["Wolpertinger", "Wyvern"] # list of target species to simulate - example species targetspecies = ["Wolpertinger", "Wyvern"] # list of target species to simulate - example species
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment