From a69f0b5b3102b60ca7df1d0d2bbae172116d82be Mon Sep 17 00:00:00 2001
From: Delaigue Olivier <olivier.delaigue@irstea.priv>
Date: Wed, 22 May 2019 17:12:38 +0200
Subject: [PATCH] v1.3.2.4 BUG: check added for hourly data in PE_Oudin

---
 DESCRIPTION  | 2 +-
 NEWS.rmd     | 2 +-
 R/PE_Oudin.R | 6 ++++++
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 80afa620..70c5e92a 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.3.2.3
+Version: 1.3.2.4
 Date: 2019-05-22
 Authors@R: c(
   person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
diff --git a/NEWS.rmd b/NEWS.rmd
index 6a49d603..38a740db 100644
--- a/NEWS.rmd
+++ b/NEWS.rmd
@@ -14,7 +14,7 @@ output:
 
 
 
-### 1.3.2.3 Release Notes (2019-05-22)
+### 1.3.2.4 Release Notes (2019-05-22)
 
 
 #### New features
diff --git a/R/PE_Oudin.R b/R/PE_Oudin.R
index e02bfa47..f474924d 100644
--- a/R/PE_Oudin.R
+++ b/R/PE_Oudin.R
@@ -53,6 +53,12 @@ PE_Oudin <- function(JD, Temp,
   if (!(TimeStepOut %in% c("daily", "hourly"))) {
     stop("'TimeStepOut' must be one of \"daily\" or \"hourly\"")
   }
+  if (TimeStepIn == "daily") {
+    rleJD <- rle(JD)
+    if (any(rleJD$lengths != 1)) {
+      stop("each day must have only one identical value of julian days")
+    }
+  }
   
   
   ## ---------- hourly inputs aggregation
-- 
GitLab