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

Remove old height var

parent 2ccb7dc5
No related branches found
No related tags found
No related merge requests found
...@@ -35,9 +35,6 @@ import Persefone: ...@@ -35,9 +35,6 @@ import Persefone:
using Unitful: @u_str using Unitful: @u_str
# We can't use Length{Float64} as that is a Union type
const Tlength = typeof(1.0cm)
# TODO: read crop names directly from AquaCrop.jl # TODO: read crop names directly from AquaCrop.jl
# names extracted by running this command in the AquaCrop.jl src dir: # names extracted by running this command in the AquaCrop.jl src dir:
# grep -nir 'crop_type ==' src/ | cut -d '=' -f 3 | sed 's/$/,/' | sort | uniq # grep -nir 'crop_type ==' src/ | cut -d '=' -f 3 | sed 's/$/,/' | sort | uniq
...@@ -172,20 +169,18 @@ end ...@@ -172,20 +169,18 @@ end
mutable struct CropState <: AbstractCropState mutable struct CropState <: AbstractCropState
croptype::CropType croptype::CropType
height::Tlength # TODO: remove height field, supply from cropstate
soiltype::SoilType soiltype::SoilType
cropstate::AquaCrop.AquaCropField cropstate::AquaCrop.AquaCropField
function CropState(croptype::CropType, model::SimulationModel, CropState(croptype::CropType, model::SimulationModel, soiltype::SoilType) =
soiltype::SoilType, height::Tlength=0.0cm) new(croptype, soiltype, make_aquacrop_cropfield(croptype, model, soiltype))
aquacrop_cropfield = make_aquacrop_cropfield(croptype, model, soiltype)
return new(croptype, height, soiltype, aquacrop_cropfield)
end
end end
croptype(cs::CropState) = cs.croptype croptype(cs::CropState) = cs.croptype
cropname(cs::CropState) = cropname(croptype(cs)) cropname(cs::CropState) = cropname(croptype(cs))
function cropheight(cs::CropState) function cropheight(cs::CropState)
# AquaCrop does not explicitly model crop height, so we have to
# estimate crop height from biomass
biomass = get_aquacrop_biomass(cs) biomass = get_aquacrop_biomass(cs)
# TODO: linear model, fixed params # TODO: linear model, fixed params
a = 2cm a = 2cm
...@@ -241,7 +236,6 @@ function sow!(cs::CropState, model::SimulationModel, cropname::String) ...@@ -241,7 +236,6 @@ function sow!(cs::CropState, model::SimulationModel, cropname::String)
end end
cs.croptype = new_croptype cs.croptype = new_croptype
cs.height = 0.0cm
# cs.soiltype stays the way it is # cs.soiltype stays the way it is
cs.cropstate = make_aquacrop_cropfield(cs.croptype, model, soiltype) cs.cropstate = make_aquacrop_cropfield(cs.croptype, model, soiltype)
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment