From 459e32d9f9f13a6aa91139e3ed9ca543104bf620 Mon Sep 17 00:00:00 2001
From: unknown <olivier.delaigue@ANPI1430.antony.irstea.priv>
Date: Wed, 15 Mar 2017 17:05:12 +0100
Subject: [PATCH] v1.0.5.27 when X6 < 1e-2, new value set to 1e-2

---
 DESCRIPTION                |  2 +-
 R/RunModel_CemaNeigeGR6J.R |  4 ++++
 R/RunModel_GR4J.R          |  2 +-
 R/RunModel_GR6J.R          | 18 +++++++++++-------
 4 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index dd96f525..05983058 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.5.26
+Version: 1.0.5.27
 Date: 2017-03-15
 Authors@R: c(
   person("Laurent", "Coron", role = c("aut", "trl")),
diff --git a/R/RunModel_CemaNeigeGR6J.R b/R/RunModel_CemaNeigeGR6J.R
index 120899b5..89c01dc0 100644
--- a/R/RunModel_CemaNeigeGR6J.R
+++ b/R/RunModel_CemaNeigeGR6J.R
@@ -25,6 +25,10 @@ RunModel_CemaNeigeGR6J <- function(InputsModel,RunOptions,Param){
         warning(sprintf("Param[3] (X3: routing store capacity [mm]) < %.2f\n New X3 value: %.2f", Param_X1X3_threshold, Param_X1X3_threshold))
         Param[3L] <- Param_X1X3_threshold
       }
+      if (Param[6L] < Param_X1X3X6_threshold) {
+        warning(sprintf("Param[6] (X6: coefficient for emptying exponential store [mm]) < %.2f\n New X6 value: %.2f", Param_X1X3X6_threshold, Param_X1X3X6_threshold))
+        Param[6L] <- Param_X1X3X6_threshold
+      }         
 
     ##Input_data_preparation
       if(identical(RunOptions$IndPeriod_WarmUp,as.integer(0))){ RunOptions$IndPeriod_WarmUp <- NULL; }
diff --git a/R/RunModel_GR4J.R b/R/RunModel_GR4J.R
index c657d694..a413ce93 100644
--- a/R/RunModel_GR4J.R
+++ b/R/RunModel_GR4J.R
@@ -54,7 +54,7 @@ RunModel_GR4J <- function(InputsModel,RunOptions,Param){
                      )
       RESULTS$Outputs[ round(RESULTS$Outputs ,3)==(-999.999)] <- NA;
       RESULTS$StateEnd[round(RESULTS$StateEnd,3)==(-999.999)] <- NA;
-print(head(RESULTS$Outputs[, c(3,9)]))
+
     ##Output_data_preparation
       IndPeriod2     <- (length(RunOptions$IndPeriod_WarmUp)+1):LInputSeries;
       ExportDatesR   <- "DatesR"   %in% RunOptions$Outputs_Sim;
diff --git a/R/RunModel_GR6J.R b/R/RunModel_GR6J.R
index d96bd13a..87800dec 100644
--- a/R/RunModel_GR6J.R
+++ b/R/RunModel_GR6J.R
@@ -13,15 +13,19 @@ RunModel_GR6J <- function(InputsModel,RunOptions,Param){
       if(sum(!is.na(Param))!=NParam){ stop(paste("Param must be a vector of length ",NParam," and contain no NA \n",sep="")); return(NULL); }
       Param <- as.double(Param);
       
-      Param_X1X3_threshold <- 1e-2
-      if (Param[1L] < Param_X1X3_threshold) {
-        warning(sprintf("Param[1] (X1: production store capacity [mm]) < %.2f\n New X1 value: %.2f", Param_X1X3_threshold, Param_X1X3_threshold))
-        Param[1L] <- Param_X1X3_threshold
+      Param_X1X3X6_threshold <- 1e-2
+      if (Param[1L] < Param_X1X3X6_threshold) {
+        warning(sprintf("Param[1] (X1: production store capacity [mm]) < %.2f\n New X1 value: %.2f", Param_X1X3X6_threshold, Param_X1X3X6_threshold))
+        Param[1L] <- Param_X1X3X6_threshold
       }
-      if (Param[3L] < Param_X1X3_threshold) {
-        warning(sprintf("Param[6] (X3: routing store capacity [mm]) < %.2f\n New X3 value: %.2f", Param_X1X3_threshold, Param_X1X3_threshold))
-        Param[3L] <- Param_X1X3_threshold
+      if (Param[3L] < Param_X1X3X6_threshold) {
+        warning(sprintf("Param[3] (X3: routing store capacity [mm]) < %.2f\n New X3 value: %.2f", Param_X1X3X6_threshold, Param_X1X3X6_threshold))
+        Param[3L] <- Param_X1X3X6_threshold
       }
+      if (Param[6L] < Param_X1X3X6_threshold) {
+        warning(sprintf("Param[6] (X6: coefficient for emptying exponential store [mm]) < %.2f\n New X6 value: %.2f", Param_X1X3X6_threshold, Param_X1X3X6_threshold))
+        Param[6L] <- Param_X1X3X6_threshold
+      }      
 
     ##Input_data_preparation
       if(identical(RunOptions$IndPeriod_WarmUp,as.integer(0))){ RunOptions$IndPeriod_WarmUp <- NULL; }
-- 
GitLab