Commit 47f142ec authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

v1.6.9.29 refactor: use [.InputsModel method in Imax to index by IndPeriod_Run

Refs #92
Showing with 3 additions and 9 deletions
+3 -9
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")),
......
......@@ -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))
____________________________________________________________________________________
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment