From 5f96d4f1c7d929e54008f0dd721c8db462ece707 Mon Sep 17 00:00:00 2001
From: Delaigue Olivier <olivier.delaigue@irstea.priv>
Date: Mon, 22 Oct 2018 17:36:13 +0200
Subject: [PATCH] v1.1.2.1 UPDATE: ErrorCrit_KGE compatible with new InputsCrit
 objects

---
 DESCRIPTION       | 2 +-
 R/ErrorCrit_KGE.R | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 478ecfe7..0b28246f 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.1.2.0
+Version: 1.1.2.1
 Date: 2018-10-22
 Authors@R: c(
   person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
diff --git a/R/ErrorCrit_KGE.R b/R/ErrorCrit_KGE.R
index 33dd24c7..1f28868f 100644
--- a/R/ErrorCrit_KGE.R
+++ b/R/ErrorCrit_KGE.R
@@ -6,6 +6,10 @@ ErrorCrit_KGE <- function(InputsCrit, OutputsModel, warnings = TRUE, verbose = T
       stop("InputsCrit must be of class 'InputsCrit' \n")
       return(NULL)
     }
+    if (inherits(InputsCrit, "Multi") | inherits(InputsCrit, "Compo")) {
+      stop("InputsCrit must be of class 'Single' \n")
+      return(NULL)
+    }
     if (!inherits(OutputsModel, "OutputsModel")) {
       stop("OutputsModel must be of class 'OutputsModel' \n")
       return(NULL)
@@ -36,7 +40,7 @@ ErrorCrit_KGE <- function(InputsCrit, OutputsModel, warnings = TRUE, verbose = T
     
     
     ##Data_preparation_______________________________
-    VarObs <- InputsCrit$Qobs
+    VarObs <- InputsCrit$obs
     VarObs[!InputsCrit$BoolCrit] <- NA
     VarSim <- OutputsModel$Qsim
     VarSim[!InputsCrit$BoolCrit] <- NA
@@ -198,6 +202,7 @@ ErrorCrit_KGE <- function(InputsCrit, OutputsModel, warnings = TRUE, verbose = T
                         Multiplier      = Multiplier,
                         Ind_notcomputed = Ind_TS_ignore
     )
+    # class(OutputsCrit) <- c("ErrorCrit", "KGE")
     return(OutputsCrit)
     
   }
-- 
GitLab