From e538aac6ef35e98e710a601fe21f59adb3dfc5ef Mon Sep 17 00:00:00 2001
From: unknown <olivier.delaigue@ANPI1430.antony.irstea.priv>
Date: Fri, 11 Aug 2017 15:20:48 +0200
Subject: [PATCH] v1.0.9.19 bug fixed when verbose = FALSE in CreateIniStates,
 default favlues are now set

---
 DESCRIPTION         |  2 +-
 R/CreateIniStates.R | 28 +++++++++++++++++++---------
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index b2094a21..89b09984 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,7 +1,7 @@
 Package: airGR
 Type: Package
 Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
-Version: 1.0.9.18
+Version: 1.0.9.19
 Date: 2017-08-11
 Authors@R: c(
   person("Laurent", "Coron", role = c("aut", "trl")),
diff --git a/R/CreateIniStates.R b/R/CreateIniStates.R
index ccf7e41a..756b095b 100644
--- a/R/CreateIniStates.R
+++ b/R/CreateIniStates.R
@@ -67,25 +67,33 @@ CreateIniStates <- function(FUN_MOD, InputsModel,
       stop("'RunModel_*GR6J' need an 'ExpStore' value")
       return(NULL)
     }
-  } else if (!is.null(ExpStore) & verbose) {
-    warning("This 'FUN_MOD' does not require 'ExpStore'. Value set to NA")
+  } else if (!is.null(ExpStore)) {
+    if (verbose) {
+      warning("This 'FUN_MOD' does not require 'ExpStore'. Value set to NA")
+    }
     ExpStore <- Inf
   }
   
-  if (identical(FUN_MOD, RunModel_GR2M) & verbose) {
+  if (identical(FUN_MOD, RunModel_GR2M)) {
     if (!is.null(UH1)) {
-      warning("This 'FUN_MOD' does not require 'UH1'. Values set to NA")
+      if (verbose) {
+        warning("This 'FUN_MOD' does not require 'UH1'. Values set to NA")
+      }
       UH1 <- rep(Inf, UH1n)
     }
     if (!is.null(UH2)) {
-      warning("This 'FUN_MOD' does not require 'UH2'. Values set to NA")
+      if (verbose) {
+        warning("This 'FUN_MOD' does not require 'UH2'. Values set to NA")
+      }
       UH2 <- rep(Inf, UH2n)
     }
     
   }
   
-  if ((identical(FUN_MOD, RunModel_GR5J) | identical(FUN_MOD, RunModel_CemaNeigeGR5J)) & !is.null(UH1) & verbose) {
-    warning("This 'FUN_MOD' does not require 'UH1'. Values set to NA")
+  if ((identical(FUN_MOD, RunModel_GR5J) | identical(FUN_MOD, RunModel_CemaNeigeGR5J)) & !is.null(UH1)) {
+    if (verbose) {
+      warning("This 'FUN_MOD' does not require 'UH1'. Values set to NA")
+    }
     UH1 <- rep(Inf, UH1n)
   }
   
@@ -95,8 +103,10 @@ CreateIniStates <- function(FUN_MOD, InputsModel,
     return(NULL)
   }
   if(!"CemaNeige" %in% ObjectClass &
-     (!is.null(GCemaNeigeLayers) | !is.null(eTGCemaNeigeLayers)) & verbose) {
-    warning("This 'FUN_MOD' does not require 'GCemaNeigeLayers' and 'GCemaNeigeLayers'. Values set to NA")
+     (!is.null(GCemaNeigeLayers) | !is.null(eTGCemaNeigeLayers))) {
+    if (verbose) {
+      warning("This 'FUN_MOD' does not require 'GCemaNeigeLayers' and 'GCemaNeigeLayers'. Values set to NA")
+    }
     GCemaNeigeLayers   <- Inf
     eTGCemaNeigeLayers <- Inf
   }
-- 
GitLab