diff --git a/DESCRIPTION b/DESCRIPTION index 3facf08453ca826b81967fee81a362d1448abbf3..487c9ef89ccf52fc7d4beecb8782a1ecfdeecef1 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.6.9.28 +Version: 1.6.9.29 Date: 2021-01-25 Authors@R: c( person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")), diff --git a/NEWS.md b/NEWS.md index 2b90594be7fe879c3122b69e438edd13598f0c0d..b4cd125ef75dd8a231b3c71e05192069ace86267 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,7 +6,7 @@ #### Major user-visible changes -- `Imax()` now returns an error message when `IndPeriod_Run` doesn't select 24 hours by day). ([#92](https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/92)) +- `Imax()` now returns an error message when `IndPeriod_Run` doesn't select 24 hours by day, instead of `numeric(0)`. ([#92](https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/92)) ____________________________________________________________________________________ diff --git a/R/Imax.R b/R/Imax.R index 59abad65dde473044233b1ae19261d540bfc8b56..b783ce65939c9d93da948c9065676649c1467a66 100644 --- a/R/Imax.R +++ b/R/Imax.R @@ -34,18 +34,13 @@ Imax <- function(InputsModel, ## ---------- hourly inputs aggregation ## aggregate data at the daily time step - TabSeries <- data.frame(DatesR = InputsModel$DatesR[IndPeriod_Run], - Precip = InputsModel$Precip[IndPeriod_Run], - PotEvap = InputsModel$PotEvap[IndPeriod_Run]) - daily_data <- SeriesAggreg(TabSeries, Format = "%Y%m%d", - ConvertFun = c("sum", "sum")) + daily_data <- SeriesAggreg(InputsModel[IndPeriod_Run], Format = "%Y%m%d") ## ---------- calculate interception ## calculate total interception of daily GR models on the period cum_daily <- sum(pmin(daily_data$Precip, daily_data$PotEvap)) - if (anyNA(cum_daily)) { stop("'IndPeriod_Run' must be set to select 24 hours by day") } @@ -53,7 +48,6 @@ Imax <- function(InputsModel, ## calculate total interception of the GR5H interception store on the period ## and compute difference with daily values differences <- array(NA, c(length(TestedValues))) - print(differences) for (Imax in TestedValues) { C0 <- 0 cum_hourly <- 0