diff --git a/src/crop/almass.jl b/src/crop/almass.jl index 14fec6d4405a9ae1e52dabf4cc88a3c0de83f8d4..d28238cea04c9a7ba9ffd1e6953acc7801401a79 100644 --- a/src/crop/almass.jl +++ b/src/crop/almass.jl @@ -93,6 +93,7 @@ struct CropType # not here. Also, we need to harmonise crops across the crop growth models. name::String group::String + is_c4_plant::Bool # false means it is a C3 plant minsowdate::Union{Missing,AnnualDate} maxsowdate::Union{Missing,AnnualDate} minharvestdate::Union{Missing,AnnualDate} @@ -250,8 +251,12 @@ function readcropparameters(generalcropfile::String, growthfile::String) # 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, + # TODO: it would be better to save this in the parameter file + # (Note that this matches the current ALMaSS code though, + # which also only hardcodes maize as a C4 crop) + is_c4_plant = occursin("maize", lowercase(crop.name)) + croptypes[crop.name] = CropType(crop.name, crop_group, is_c4_plant, crop.minsowdate, + crop.maxsowdate, crop.minharvestdate, crop.maxharvestdate, crop.mingrowthtemp, highnuts, lownuts) end croptypes diff --git a/test/crop_tests.jl b/test/crop_tests.jl index 9632b1d59549eea5decd4909982b54e16fce2eb4..852608516c3cc79b80a2abf746e8dc65429f7685 100644 --- a/test/crop_tests.jl +++ b/test/crop_tests.jl @@ -19,7 +19,7 @@ const TESTPARAM_SIMPLECROP = joinpath(pkgdir(Persefone), "test", "test_parameter end @testset "Submodule ALMaSS" begin - ct = Ps.ALMaSS.CropType("olive tree", "no_crop_group", + ct = Ps.ALMaSS.CropType("olive tree", "no_crop_group", false, missing, missing, missing, missing, missing, missing, missing) id = 0 pixels = [(0, 0)]