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:
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
# 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
......@@ -172,20 +169,18 @@ end
mutable struct CropState <: AbstractCropState
croptype::CropType
height::Tlength # TODO: remove height field, supply from cropstate
soiltype::SoilType
cropstate::AquaCrop.AquaCropField
function CropState(croptype::CropType, model::SimulationModel,
soiltype::SoilType, height::Tlength=0.0cm)
aquacrop_cropfield = make_aquacrop_cropfield(croptype, model, soiltype)
return new(croptype, height, soiltype, aquacrop_cropfield)
end
CropState(croptype::CropType, model::SimulationModel, soiltype::SoilType) =
new(croptype, soiltype, make_aquacrop_cropfield(croptype, model, soiltype))
end
croptype(cs::CropState) = cs.croptype
cropname(cs::CropState) = cropname(croptype(cs))
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)
# TODO: linear model, fixed params
a = 2cm
......@@ -241,7 +236,6 @@ function sow!(cs::CropState, model::SimulationModel, cropname::String)
end
cs.croptype = new_croptype
cs.height = 0.0cm
# cs.soiltype stays the way it is
cs.cropstate = make_aquacrop_cropfield(cs.croptype, model, soiltype)
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment