From 1c9553e73385d0fd328c53ae7d28f485addd2e57 Mon Sep 17 00:00:00 2001
From: Delaigue Olivier <olivier.delaigue@irstea.priv>
Date: Wed, 27 Mar 2019 09:21:04 +0100
Subject: [PATCH] v1.2.11.15 CLEAN: unnecessary command lines removed in
 CreateInputsCrit

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

diff --git a/DESCRIPTION b/DESCRIPTION
index 8c14ebf5..3fef612f 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.2.11.13
-Date: 2019-03-25
+Version: 1.2.11.15
+Date: 2019-03-26
 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 c511ac2b..8ba52233 100644
--- a/NEWS.rmd
+++ b/NEWS.rmd
@@ -13,7 +13,7 @@ output:
 
 
 
-### 1.2.11.13 Release Notes (2019-03-25) 
+### 1.2.11.15 Release Notes (2019-03-26) 
 
 
 
diff --git a/R/CreateInputsCrit.R b/R/CreateInputsCrit.R
index 4d84ec94..5ebd2437 100644
--- a/R/CreateInputsCrit.R
+++ b/R/CreateInputsCrit.R
@@ -295,14 +295,13 @@ CreateInputsCrit <- function(FUN_CRIT,
   ## define idLayer as an index of the layer to use
   for (iInCnVarObs in unique(listVarObs)) {
     if (iInCnVarObs == "Q") {
-      k <- 1
       for (i in which(listVarObs == iInCnVarObs)) {
         InputsCrit[[i]]$idLayer <- NA
-        k <- k + 1
       }
     } else {
       aa <- listGroupLayer0[listVarObs == iInCnVarObs]
-      bb <- c(0, aa[-length(aa)])
+      aa <- unname(aa)
+      bb <- cumsum(c(0, aa[-length(aa)]))
       cc <- lapply(seq_along(aa), function(x) seq_len(aa[x]) + bb[x])
       k <- 1
       for (i in which(listVarObs == iInCnVarObs)) {
-- 
GitLab