diff --git a/DESCRIPTION b/DESCRIPTION index 293af8e4a95091fbea46aef2eb673575eca481ce..43ce4585bbba5d4974bf47b307a3f29b3e7a5c4b 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.5 +Version: 1.3.2.6 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 81761010feafbf786dbee1e9349003fbfc8f0279..8a92b5b5500cce457d4ffd330f05fb7e09f9f576 100644 --- a/NEWS.rmd +++ b/NEWS.rmd @@ -14,7 +14,7 @@ output: -### 1.3.2.5 Release Notes (2019-05-22) +### 1.3.2.6 Release Notes (2019-05-22) #### New features diff --git a/R/PE_Oudin.R b/R/PE_Oudin.R index 1324eaec24d6ac74cc5f61b420178f3863311871..6b865df15e5b89b005ec062e5ab709ae7a0290a1 100644 --- a/R/PE_Oudin.R +++ b/R/PE_Oudin.R @@ -53,22 +53,19 @@ 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") - } + rleJD <- rle(JD) + if (TimeStepIn == "daily" & any(rleJD$lengths != 1)) { + stop("each day must have only one identical value of julian days") + } + if (TimeStepIn == "hourly" & any(rleJD$lengths != 24)) { + stop("each day must have 24 identical values of julian days (one for each hour)") } ## ---------- hourly inputs aggregation if (TimeStepIn == "hourly") { - rleJD <- rle(JD) JD <- rleJD$values - if (any(rleJD$lengths != 24)) { - stop("each day must have 24 identical values of julian days (one for each hour)") - } idJD <- rep(seq_along(JD), each = rleJD$lengths[1L]) Temp <- as.vector(tapply(X = Temp, INDEX = idJD, FUN = mean)) }