From d75dad9eba027d9fe5e73a41ed46484e91ada4d9 Mon Sep 17 00:00:00 2001
From: unknown <olivier.delaigue@ANPI1430.antony.irstea.priv>
Date: Thu, 22 Jun 2017 10:09:35 +0200
Subject: [PATCH] v1.0.8.9 warning messages updated in CreateRunOptions

---
 DESCRIPTION          |  2 +-
 R/CreateRunOptions.R | 65 ++------------------------------------------
 2 files changed, 4 insertions(+), 63 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 3e57fdbd..1a0743c6 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.8.8
+Version: 1.0.8.9
 Date: 2017-06-22
 Authors@R: c(
   person("Laurent", "Coron", role = c("aut", "trl")),
diff --git a/R/CreateRunOptions.R b/R/CreateRunOptions.R
index 3fb6c920..19b7a817 100644
--- a/R/CreateRunOptions.R
+++ b/R/CreateRunOptions.R
@@ -146,10 +146,6 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
         stop("IniStates must be an object of class IniStates\n")
         return(NULL)
       }
-      # print(str(IniStates))
-      # print(ObjectClass)
-      # print(class(IniStates))
-      # print(sum(ObjectClass %in% class(IniStates)))
       if (sum(ObjectClass %in% class(IniStates)) < 2) {
         stop(paste0("Non convenient IniStates for this FUN_MOD\n"))
         return(NULL)
@@ -159,15 +155,15 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
         return(NULL)
       }
       if ((identical(FUN_MOD, RunModel_GR5J) | identical(FUN_MOD, RunModel_CemaNeigeGR5J)) & !all(is.na(IniStates$UH$UH1))) { ## GR5J
-        stop(paste0("Non convenient IniStates for this FUN_MOD. In IniStates, UH1 have to be a vector of NA for GR5J \n"))
+        stop(paste0("Non convenient IniStates for this FUN_MOD. In IniStates, UH1 has to be a vector of NA for GR5J \n"))
         return(NULL)
       }
       if ((identical(FUN_MOD, RunModel_GR6J) | identical(FUN_MOD, RunModel_CemaNeigeGR6J)) & is.na(IniStates$Store$Exp)) { ## GR6J
-        stop(paste0("Non convenient IniStates for this FUN_MOD. GR6J need an exponential store value in IniStates\n"))
+        stop(paste0("Non convenient IniStates for this FUN_MOD. GR6J needs an exponential store value in IniStates \n"))
         return(NULL)
       }
       if (!(identical(FUN_MOD, RunModel_GR6J) | identical(FUN_MOD, RunModel_CemaNeigeGR6J)) & !is.na(IniStates$Store$Exp)) { ## except GR6J
-        stop(paste0("Non convenient IniStates for this FUN_MOD\n"))
+        stop(paste0("Non convenient IniStates for this FUN_MOD. No exponential store value needed in IniStates \n"))
         return(NULL)
       }
       # if (length(na.omit(unlist(IniStates))) != NState) {
@@ -183,68 +179,13 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
       IniStates$Store$Rest <- rep(NA, 4)
       IniStates <- unlist(IniStates)
       IniStates[is.na(IniStates)] <- 0
-      # print(IniStates)
       if ("monthly" %in% ObjectClass) {
         IniStates <- IniStates[seq_len(NState)]
-        # print(NState)
-        # print(IniStates)
         }
     } else {
       IniStates <- as.double(rep(0.0, NState))
     }
 
-    # if (is.null(IniStates) & is.null(IniResLevels) & verbose) { 
-    #   warning("\t Model states initialisation not defined -> default configuration used \n")
-    # }
-    # if("CemaNeige" %in% ObjectClass){ NLayers <- length(InputsModel$LayerPrecip); } else { NLayers <- 0; }
-    # NState <- NULL;
-    # if("GR" %in% ObjectClass | "CemaNeige" %in% ObjectClass){ 
-    #   if("hourly"  %in% ObjectClass){ NState <- 3*24*20 + 7; }
-    #   if("daily"   %in% ObjectClass){ if (identical(FUN_MOD,RunModel_GR5J)){NState <- 2*20 + 2*NLayers + 7; } else {NState <- 3*20 + 2*NLayers + 7; }}
-    #   if("monthly" %in% ObjectClass){ NState <- 2; }
-    #   if("yearly"  %in% ObjectClass){ NState <- 1; }
-    # }
-    # if (!is.null(IniStates)) {
-    #   if (!is.vector( IniStates) | !is.numeric(IniStates)) {
-    #     stop("IniStates must be a vector of numeric values \n")
-    #     return(NULL)
-    #   }
-    #   if (length(IniStates) != NState) {
-    #     stop(paste0("The length of IniStates must be ", NState, " for the chosen FUN_MOD \n"))
-    #     return(NULL)
-    #   }
-    # } else {
-    #   IniStates <- as.double(rep(0.0, NState))
-    #   IniStates[1:3] <- NA
-    # }
-    # if ("GR" %in% ObjectClass & ("monthly" %in% ObjectClass | "daily" %in% ObjectClass | "hourly" %in% ObjectClass)) {
-    #   if (!is.null(IniResLevels)) {
-    #     if (!is.vector(IniResLevels) | !is.numeric(IniResLevels)) {
-    #       stop("IniResLevels must be a vector of numeric values \n")
-    #       return(NULL)
-    #     }
-    #     if ((identical(FUN_MOD, RunModel_GR4H) |
-    #          identical(FUN_MOD, RunModel_GR4J) | identical(FUN_MOD, RunModel_CemaNeigeGR4J) |
-    #          identical(FUN_MOD, RunModel_GR5J) | identical(FUN_MOD, RunModel_CemaNeigeGR5J) |
-    #          identical(FUN_MOD, RunModel_GR2M)) &
-    #         length(IniResLevels) != 2) {
-    #       stop("The length of IniStates must be 2 for the chosen FUN_MOD \n")
-    #       return(NULL)
-    #     }
-    #     if ((identical(FUN_MOD,RunModel_GR6J) | identical(FUN_MOD,RunModel_CemaNeigeGR6J)) &
-    #         length(IniResLevels) != 3) {
-    #       stop("The length of IniStates must be 3 for the chosen FUN_MOD \n")
-    #       return(NULL)
-    #     }
-    #   } else {
-    #     IniResLevels <- as.double(c(0.3, 0.5, 0))
-    #   }
-    # } else {
-    #   if (!is.null(IniResLevels)) {
-    #     stop("IniResLevels can only be used with monthly or daily or hourly GR models \n")
-    #   }
-    # }
-    
 
   ##check_Outputs_Cal_and_Sim
 
-- 
GitLab