Commit b461d285 authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

v1.2.11.10 BUG: check of range values now works when there is only one Q, SCA or SCE varObs

parent 28b6c1d5
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.2.11.9
Version: 1.2.11.10
Date: 2019-03-25
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
......
......@@ -13,7 +13,7 @@ output:
### 1.2.11.9 Release Notes (2019-03-25)
### 1.2.11.10 Release Notes (2019-03-25)
......
......@@ -85,6 +85,9 @@ CreateInputsCrit <- function(FUN_CRIT,
listArgs[[iArgs]] <- lapply(seq_along(listArgs$FUN_CRIT), function(x) NULL)
}
}
if (iArgs %in% c("FUN_CRIT", "varObs", "transfo", "weights") & length(listArgs[[iArgs]]) > 1L) {
listArgs[[iArgs]] <- as.list(listArgs[[iArgs]])
}
if (!is.list(listArgs[[iArgs]])) {
listArgs[[iArgs]] <- list(listArgs[[iArgs]])
}
......@@ -196,7 +199,11 @@ CreateInputsCrit <- function(FUN_CRIT,
## check 'varObs' + 'obs'
if (any(iListArgs2$varObs %in% "SCA")) {
idSCA <- which(iListArgs2$varObs == "SCA")
if (length(idSCA) == 1L) {
vecSCA <- iListArgs2$obs
} else {
vecSCA <- unlist(iListArgs2$obs[idSCA])
}
if (min(vecSCA, na.rm = TRUE) < 0 | max(vecSCA, na.rm = TRUE) > 1) {
stop("'obs' outside [0,1] for \"SCA\"", call. = FALSE)
}
......@@ -204,7 +211,11 @@ CreateInputsCrit <- function(FUN_CRIT,
inPosVarObs <- c("Q", "SWE")
if (any(iListArgs2$varObs %in% inPosVarObs)) {
idQSS <- which(iListArgs2$varObs %in% inPosVarObs)
if (length(idQSS) == 1L) {
vecQSS <- iListArgs2$obs
} else {
vecQSS <- unlist(iListArgs2$obs[idQSS])
}
if (min(vecQSS, na.rm = TRUE) < 0) {
stop(sprintf("'obs' outside [0,Inf[ for \"%s\"", iListArgs2$varObs), call. = FALSE)
}
......
Markdown is supported
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