From 33986184b29907cf872aa482fb191dc74824a2b7 Mon Sep 17 00:00:00 2001
From: unknown <olivier.delaigue@ANPI1430.antony.irstea.priv>
Date: Thu, 7 Sep 2017 11:38:48 +0200
Subject: [PATCH] v1.0.9.39 state values checking fixed in CreateIniStates

---
 DESCRIPTION         | 4 ++--
 R/CreateIniStates.R | 9 ++++++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index a6d74838..1556c120 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,8 +1,8 @@
 Package: airGR
 Type: Package
 Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
-Version: 1.0.9.38
-Date: 2017-09-05
+Version: 1.0.9.39
+Date: 2017-09-07
 Authors@R: c(
   person("Laurent", "Coron", role = c("aut", "trl")),
   person("Charles", "Perrin", role = c("aut", "ths")),
diff --git a/R/CreateIniStates.R b/R/CreateIniStates.R
index faa603ec..6cf925a4 100644
--- a/R/CreateIniStates.R
+++ b/R/CreateIniStates.R
@@ -62,11 +62,14 @@ CreateIniStates <- function(FUN_MOD, InputsModel,
   
   
   ## check states
-  if (any(ProdStore < 0) | any(RoutStore < 0) | any(ExpStore < 0) |
+  if (any(ProdStore < 0) | any(RoutStore < 0) |
       any(UH1 < 0) | any(UH2 < 0) |
-      any(GCemaNeigeLayers < 0) | any(eTGCemaNeigeLayers < 0)) {
-    stop("Negative values are not allowed for any state variables")
+      any(GCemaNeigeLayers < 0)) {
+    stop("Negative values are not allowed for any of 'ProdStore', 'RoutStore', 'UH1', 'UH2', 'GCemaNeigeLayers'")
   }
+  if (any(eTGCemaNeigeLayers > 0)) {
+    stop("Positive values are not allowed for 'eTGCemaNeigeLayers'")
+  }  
   
   if (identical(FUN_MOD, RunModel_GR6J) | identical(FUN_MOD, RunModel_CemaNeigeGR6J)) {
     if (is.null(ExpStore)) {
-- 
GitLab