From ef6e1c5a5eb95b01e2be288032a75ce750e2b7bf Mon Sep 17 00:00:00 2001
From: Marco Matthies <71844+marcom@users.noreply.github.com>
Date: Wed, 4 Sep 2024 17:33:50 +0200
Subject: [PATCH] Update to newest version of AquaCrop, implement stepagent!()
 for AquaCropState

---
 src/crop/aquacrop.jl | 4 ++--
 test/crop_tests.jl   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/crop/aquacrop.jl b/src/crop/aquacrop.jl
index cea2b2f..c591def 100644
--- a/src/crop/aquacrop.jl
+++ b/src/crop/aquacrop.jl
@@ -16,7 +16,7 @@ mutable struct AquaCropState
 
     function AquaCropState(croptype::AquaCropType, height::Length{Float64}=0.0cm)
         ac_parentdir = AquaCrop.test_toml_dir  # TODO: hardcoded croptype
-        ac_runtype = :Julia
+        ac_runtype = :Toml
         cropstate, allok = AquaCrop.initialize_cropfield(; parentdir=ac_parentdir, runtype=ac_runtype)
         if ! allok.logi
             error("AquaCrop.initialize_cropfield() failed, status = $allok")
@@ -38,7 +38,7 @@ isharvestable(cs::AquaCropState) = true  # TODO: implement this correctly
 Update a crop state by one day.
 """
 function stepagent!(cs::AquaCropState, model::SimulationModel)
-    # TODO: call into AquaCrop.jl to simulate one day
+    AquaCrop.dailyupdate!(cs.cropstate)
 end
 
 """
diff --git a/test/crop_tests.jl b/test/crop_tests.jl
index dabcf84..5f83b61 100644
--- a/test/crop_tests.jl
+++ b/test/crop_tests.jl
@@ -19,6 +19,7 @@ import Unitful
         model = initialise(parampath)
         stepsimulation!(model)
         @test model isa AgricultureModel
+        # TODO: test stepagent!(), sow!(), harvest!()
     end
 end
 
@@ -69,5 +70,4 @@ end
     @test cropheight(fp) isa Length{Float64}
     @test cropcover(fp) isa Float64
     @test Unitful.dimension(cropyield(fp)) == Unitful.𝐌 * Unitful.𝐋^-2
-    # TODO: test stepagent!(), sow!(), harvest!()
 end
-- 
GitLab