From a9f4f45d027cf664e68c56d35b26dc3e665be16b Mon Sep 17 00:00:00 2001
From: Marco Matthies <71844+marcom@users.noreply.github.com>
Date: Mon, 21 Oct 2024 01:04:20 +0200
Subject: [PATCH] Make code clearer

---
 src/crop/almass.jl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/crop/almass.jl b/src/crop/almass.jl
index 4d8bc8f..14fec6d 100644
--- a/src/crop/almass.jl
+++ b/src/crop/almass.jl
@@ -272,14 +272,14 @@ function setphase!(cs::CropState, phase::GrowthPhase)
     height = curve.height[cs.phase]
     LAItotal = curve.LAItotal[cs.phase]
     LAIgreen = curve.LAIgreen[cs.phase]
-
     if (length(GDD) == 0
         || length(height) == 0
         || length(LAItotal) == 0
         || length(LAIgreen) == 0)
         error("One of these has length zero:\n  GDD = $GDD\n  height = $height\n  LAItotal = $LAItotal\n  LAIgreen = $LAIgreen")
     end
-    if GDD[1] == -1.0
+    is_valid_start = GDD[1] == -1
+    if is_valid_start
         # set height, LAItotal, LAIgreen
         # TODO: what about when
         #           GDD[1] == curve.GDD[cs.phase][1] == 99999.0
-- 
GitLab