From 761c2d555b1d8cc8ec6f3caed8b0a843560787a7 Mon Sep 17 00:00:00 2001
From: Delaigue Olivier <olivier.delaigue@irstea.priv>
Date: Thu, 21 Feb 2019 10:47:22 +0100
Subject: [PATCH] v1.1.2.43 CLEAN: ErrorCrit now returns rescaled weights of
 composite criterion

---
 DESCRIPTION   | 4 ++--
 NEWS.rmd      | 2 +-
 R/ErrorCrit.R | 3 ++-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 10fb7287..81030809 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.1.2.42
-Date: 2019-02-19
+Version: 1.1.2.43
+Date: 2019-02-21
 Authors@R: c(
   person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
   person("Charles", "Perrin", role = c("aut", "ths"), comment = c(ORCID = "0000-0001-8552-1881")),
diff --git a/NEWS.rmd b/NEWS.rmd
index 26a690c1..d26d4414 100644
--- a/NEWS.rmd
+++ b/NEWS.rmd
@@ -13,7 +13,7 @@ output:
 
 
 
-### 1.1.2.42 Release Notes (2019-02-19)
+### 1.1.2.43 Release Notes (2019-02-21)
 
 
 
diff --git a/R/ErrorCrit.R b/R/ErrorCrit.R
index 7bbd69fb..feef2360 100644
--- a/R/ErrorCrit.R
+++ b/R/ErrorCrit.R
@@ -37,10 +37,11 @@ ErrorCrit <- function(InputsCrit, OutputsModel, FUN_CRIT, warnings = TRUE, verbo
     listValCrit  <- sapply(listOutputsCrit, function(x) x[["CritValue"]])
     listNameCrit <- sapply(listOutputsCrit, function(x) x[["CritName"]])
     listweights  <- unlist(lapply(InputsCrit, function(x) x[["weights"]]))
+    listweights <- listweights / sum(listweights)
     
     
     if (inherits(InputsCrit, "Compo")) {
-      CritValue <- sum(listValCrit * (listweights / sum(listweights)))
+      CritValue <- sum(listValCrit * listweights)
       OutputsCritCompo <- list(MultiCritValues  = listValCrit,
                                MultiCritNames   = listNameCrit,
                                MultiCritWeights = listweights)
-- 
GitLab