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

ALMaSS: properly get biomass_scale factor for each crop

parent 9d2631fe
No related branches found
No related tags found
No related merge requests found
name,minsowdate,maxsowdate,minharvestdate,maxharvestdate,mingrowthtemp,group name,minsowdate,maxsowdate,minharvestdate,maxharvestdate,mingrowthtemp,group,biomass_scale
"spring rape",NA,NA,NA,NA,NA,"grain" "spring rape",NA,NA,NA,NA,NA,"grain",1.071
"winter rape","20 August","25 August",NA,NA,NA,"grain" "winter rape","20 August","25 August",NA,NA,NA,"grain",1.071
"winter wheat","15 October","31 October",NA,NA,0,"grain" "winter wheat","15 October","31 October",NA,NA,0,"grain",1.0
"spring wheat",NA,NA,NA,NA,NA,"grain" "spring wheat",NA,NA,NA,NA,NA,"grain",1.0
"winter barley","15 September","30 September",NA,NA,0,"grain" "winter barley","15 September","30 September",NA,NA,0,"grain",0.857
"spring barley","1 March","10 April",NA,NA,0,"grain" "spring barley","1 March","10 April",NA,NA,0,"grain",0.857
"undersown spring barley",NA,NA,NA,NA,0,"grain" "undersown spring barley",NA,NA,NA,NA,0,"grain",0.857
"winter rye","23 September","15 October",NA,NA,NA,"grain" "winter rye","23 September","15 October",NA,NA,NA,"grain",0.857
"triticale","25 September","10 October",NA,NA,NA,"grain" "triticale","25 September","10 October",NA,NA,NA,"grain",1.0
"oats",NA,NA,NA,NA,NA,"grain" "oats",NA,NA,NA,NA,NA,"grain",0.857
"maize","15 April","30 April",NA,NA,8,"grain" "maize","15 April","30 April",NA,NA,8,"grain",1.0
"potatoes",NA,NA,NA,NA,4,"root" "potatoes",NA,NA,NA,NA,4,"root",0.857
"carrots",NA,NA,NA,NA,NA,"root" "carrots",NA,NA,NA,NA,NA,"root",0.7857
"beet","15 March","10 May",NA,NA,NA,"root" "beet","15 March","10 May",NA,NA,NA,"root",0.857
"sunflower","25 March","15 April",NA,NA,NA,"other" "sunflower","25 March","15 April",NA,NA,NA,"other",1.0
"lucerne",NA,NA,NA,NA,NA,"legumes" "lucerne",NA,NA,NA,NA,NA,"legumes",1.2
"peas/beans","15 February","15 March",NA,NA,5,"legumes" "peas/beans","15 February","15 March",NA,NA,5,"legumes",0.857
"silage clover/grass",NA,NA,NA,NA,NA,"legumes" "silage clover/grass",NA,NA,NA,NA,NA,"legumes",1.1
"fodder/clover",NA,NA,NA,NA,NA,"legumes" "fodder/clover",NA,NA,NA,NA,NA,"legumes",1.2
"lawn",NA,NA,NA,NA,NA,"grass" "lawn",NA,NA,NA,NA,NA,"grass",0.5
"permanent grassland (grazed)",NA,NA,NA,NA,NA,"grass" "permanent grassland (grazed)",NA,NA,NA,NA,NA,"grass",1.1
"permanent grassland (seeded)",NA,NA,NA,NA,NA,"grass" "permanent grassland (seeded)",NA,NA,NA,NA,NA,"grass",1.1
"permanent grassland (low yield)",NA,NA,NA,NA,NA,"grass" "permanent grassland (low yield)",NA,NA,NA,NA,NA,"grass",1.0
"permanent set-aside",NA,NA,NA,NA,NA,"semi-natural" "permanent set-aside",NA,NA,NA,NA,NA,"semi-natural",0.7857
"natural grass",NA,NA,NA,NA,NA,"semi-natural" "natural grass",NA,NA,NA,NA,NA,"semi-natural",0.567
"no growth",NA,NA,NA,NA,NA,"semi-natural" "no growth",NA,NA,NA,NA,NA,"semi-natural",0.0
"heath",NA,NA,NA,NA,NA,"semi-natural" "heath",NA,NA,NA,NA,NA,"semi-natural",0.567
...@@ -114,6 +114,7 @@ struct CropType ...@@ -114,6 +114,7 @@ struct CropType
mingrowthtemp::Union{Missing,Float64} mingrowthtemp::Union{Missing,Float64}
highnutrientgrowth::Union{Missing,CropCurveParams} highnutrientgrowth::Union{Missing,CropCurveParams}
lownutrientgrowth::Union{Missing,CropCurveParams} lownutrientgrowth::Union{Missing,CropCurveParams}
biomass_scale::Float64
end end
cropname(ct::CropType) = ct.name cropname(ct::CropType) = ct.name
...@@ -366,7 +367,7 @@ Parse a CSV file containing the required parameter values for each crop ...@@ -366,7 +367,7 @@ Parse a CSV file containing the required parameter values for each crop
function readcropparameters(cropdirectory::String) function readcropparameters(cropdirectory::String)
@debug "Reading crop parameters" @debug "Reading crop parameters"
cropdata = CSV.File(joinpath(cropdirectory, CROPFILE), missingstring="NA", cropdata = CSV.File(joinpath(cropdirectory, CROPFILE), missingstring="NA",
types=[String,AnnualDate,AnnualDate,AnnualDate,AnnualDate,Float64,String]) types=[String,AnnualDate,AnnualDate,AnnualDate,AnnualDate,Float64,String,Float64])
growthdata = CSV.File(joinpath(cropdirectory, GROWTHFILE), missingstring="NA", growthdata = CSV.File(joinpath(cropdirectory, GROWTHFILE), missingstring="NA",
types=[Int,String,String,GrowthPhase,String, types=[Int,String,String,GrowthPhase,String,
Float64,Float64,Float64,Float64]) Float64,Float64,Float64,Float64])
...@@ -387,7 +388,7 @@ function readcropparameters(cropdirectory::String) ...@@ -387,7 +388,7 @@ function readcropparameters(cropdirectory::String)
is_c4_plant = occursin("maize", lowercase(crop.name)) is_c4_plant = occursin("maize", lowercase(crop.name))
croptypes[crop.name] = CropType(crop.name, crop_group, is_c4_plant, crop.minsowdate, croptypes[crop.name] = CropType(crop.name, crop_group, is_c4_plant, crop.minsowdate,
crop.maxsowdate, crop.minharvestdate, crop.maxharvestdate, crop.maxsowdate, crop.minharvestdate, crop.maxharvestdate,
crop.mingrowthtemp, highnuts, lownuts) crop.mingrowthtemp, highnuts, lownuts, crop.biomass_scale)
end end
croptypes croptypes
end end
...@@ -761,8 +762,7 @@ function recalculate_bugs_n_stuff!(cs::CropState, model::SimulationModel) ...@@ -761,8 +762,7 @@ function recalculate_bugs_n_stuff!(cs::CropState, model::SimulationModel)
if cs.LAtotal >= cs.oldLAtotal if cs.LAtotal >= cs.oldLAtotal
# we are in positive growth so grow depending on our equation # we are in positive growth so grow depending on our equation
# TODO: biomass_scale biomass_scale = cs.croptype.biomass_scale
biomass_scale = 1.0
cs.newgrowth = useful_veg_cover * glrad * radconv * biomass_scale cs.newgrowth = useful_veg_cover * glrad * radconv * biomass_scale
# TODO: ignoring farm intensity # TODO: ignoring farm intensity
......
...@@ -20,7 +20,7 @@ end ...@@ -20,7 +20,7 @@ end
@testset "Submodule ALMaSS" begin @testset "Submodule ALMaSS" begin
ct = Ps.ALMaSS.CropType("olive tree", "no_crop_group", false, ct = Ps.ALMaSS.CropType("olive tree", "no_crop_group", false,
missing, missing, missing, missing, missing, missing, missing) missing, missing, missing, missing, missing, missing, missing, 1.0)
id = 0 id = 0
pixels = [(0, 0)] pixels = [(0, 0)]
farmer = 0 farmer = 0
......
name,minsowdate,maxsowdate,minharvestdate,maxharvestdate,mingrowthtemp,group name,minsowdate,maxsowdate,minharvestdate,maxharvestdate,mingrowthtemp,group,biomass_scale
"spring rape",NA,NA,NA,NA,NA,"grain" "spring rape",NA,NA,NA,NA,NA,"grain",1.071
"winter rape","20 August","25 August",NA,NA,NA,"grain" "winter rape","20 August","25 August",NA,NA,NA,"grain",1.071
"winter wheat","15 October","31 October",NA,NA,0,"grain" "winter wheat","15 October","31 October",NA,NA,0,"grain",1.0
"spring wheat",NA,NA,NA,NA,NA,"grain" "spring wheat",NA,NA,NA,NA,NA,"grain",1.0
"winter barley","15 September","30 September",NA,NA,0,"grain" "winter barley","15 September","30 September",NA,NA,0,"grain",0.857
"spring barley","1 March","10 April",NA,NA,0,"grain" "spring barley","1 March","10 April",NA,NA,0,"grain",0.857
"undersown spring barley",NA,NA,NA,NA,0,"grain" "undersown spring barley",NA,NA,NA,NA,0,"grain",0.857
"winter rye","23 September","15 October",NA,NA,NA,"grain" "winter rye","23 September","15 October",NA,NA,NA,"grain",0.857
"triticale","25 September","10 October",NA,NA,NA,"grain" "triticale","25 September","10 October",NA,NA,NA,"grain",1.0
"oats",NA,NA,NA,NA,NA,"grain" "oats",NA,NA,NA,NA,NA,"grain",0.857
"maize","15 April","30 April",NA,NA,8,"grain" "maize","15 April","30 April",NA,NA,8,"grain",1.0
"potatoes",NA,NA,NA,NA,4,"root" "potatoes",NA,NA,NA,NA,4,"root",0.857
"carrots",NA,NA,NA,NA,NA,"root" "carrots",NA,NA,NA,NA,NA,"root",0.7857
"beet","15 March","10 May",NA,NA,NA,"root" "beet","15 March","10 May",NA,NA,NA,"root",0.857
"sunflower","25 March","15 April",NA,NA,NA,"other" "sunflower","25 March","15 April",NA,NA,NA,"other",1.0
"lucerne",NA,NA,NA,NA,NA,"legumes" "lucerne",NA,NA,NA,NA,NA,"legumes",1.2
"peas/beans","15 February","15 March",NA,NA,5,"legumes" "peas/beans","15 February","15 March",NA,NA,5,"legumes",0.857
"silage clover/grass",NA,NA,NA,NA,NA,"legumes" "silage clover/grass",NA,NA,NA,NA,NA,"legumes",1.1
"fodder/clover",NA,NA,NA,NA,NA,"legumes" "fodder/clover",NA,NA,NA,NA,NA,"legumes",1.2
"lawn",NA,NA,NA,NA,NA,"grass" "lawn",NA,NA,NA,NA,NA,"grass",0.5
"permanent grassland (grazed)",NA,NA,NA,NA,NA,"grass" "permanent grassland (grazed)",NA,NA,NA,NA,NA,"grass",1.1
"permanent grassland (seeded)",NA,NA,NA,NA,NA,"grass" "permanent grassland (seeded)",NA,NA,NA,NA,NA,"grass",1.1
"permanent grassland (low yield)",NA,NA,NA,NA,NA,"grass" "permanent grassland (low yield)",NA,NA,NA,NA,NA,"grass",1.0
"permanent set-aside",NA,NA,NA,NA,NA,"semi-natural" "permanent set-aside",NA,NA,NA,NA,NA,"semi-natural",0.7857
"natural grass",NA,NA,NA,NA,NA,"semi-natural" "natural grass",NA,NA,NA,NA,NA,"semi-natural",0.567
"no growth",NA,NA,NA,NA,NA,"semi-natural" "no growth",NA,NA,NA,NA,NA,"semi-natural",0.0
"heath",NA,NA,NA,NA,NA,"semi-natural" "heath",NA,NA,NA,NA,NA,"semi-natural",0.567
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment