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

v1.2.9.12 CLEAN: warning messages clarified in CreateInputsCrit

parent f28fc6e3
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.2.9.11
Version: 1.2.9.12
Date: 2019-03-18
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
......
......@@ -13,7 +13,7 @@ output:
### 1.2.9.11 Release Notes (2019-03-18)
### 1.2.9.12 Release Notes (2019-03-18)
......
......@@ -169,7 +169,7 @@ CreateInputsCrit <- function(FUN_CRIT,
stop("incorrect 'FUN_CRIT' for use in 'CreateInputsCrit'", call. = FALSE)
}
if (identical(iListArgs2$FUN_CRIT, ErrorCrit_RMSE) & length(listArgs$weights) > 1 & all(!is.null(unlist(listArgs$weights)))) {
stop("calculating a composite criterion with the RMSE is not allowed since RMSE is not an adimensional measure", call. = FALSE)
stop("calculating a composite criterion with the RMSE is not allowed since RMSE is not a dimensionless metric", call. = FALSE)
}
## check 'obs'
......@@ -198,7 +198,7 @@ CreateInputsCrit <- function(FUN_CRIT,
idSCA <- which(iListArgs2$varObs == "SCA")
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\" for 'varObs'", call. = FALSE)
stop("'obs' outside [0,1] for \"SCA\"", call. = FALSE)
}
}
inPosVarObs <- c("Q", "SWE")
......@@ -206,7 +206,7 @@ CreateInputsCrit <- function(FUN_CRIT,
idQSS <- which(iListArgs2$varObs %in% inPosVarObs)
vecQSS <- unlist(iListArgs2$obs[idQSS])
if (min(vecQSS, na.rm = TRUE) < 0) {
stop(sprintf("'obs' outside [0,Inf[ for \"%s\" for 'varObs'", iListArgs2$varObs), call. = FALSE)
stop(sprintf("'obs' outside [0,Inf[ for \"%s\"", iListArgs2$varObs), call. = FALSE)
}
}
......@@ -229,12 +229,12 @@ CreateInputsCrit <- function(FUN_CRIT,
stop("'epsilon' must be a single (list of) positive value(s)", call. = FALSE)
}
} else if (iListArgs2$transfo %in% c("log", "inv") & any(iListArgs2$obs %in% 0) & warnings) {
warning("zeroes detected in obs: the corresponding time-steps will be excluded by the 'ErrorCrit*' functions if the epsilon agrument = NULL", call. = FALSE)
warning("zeroes detected in obs: the corresponding time-steps will be excluded by the 'ErrorCrit*' functions as the epsilon argument was set to NULL", call. = FALSE)
}
## check 'transfo' + 'FUN_CRIT'
if (iListArgs2$transfo == "log" & warnings) {
warn_log_kge <- "we do not advise using the %s with a log transformation on obs (see the details part in the 'CreateInputsCrit' help)"
warn_log_kge <- "we do not advise using the %s with a log transformation on obs (see the details section in the 'CreateInputsCrit' help)"
if (identical(iListArgs2$FUN_CRIT, ErrorCrit_KGE)) {
warning(sprintf(warn_log_kge, "KGE"), call. = FALSE)
}
......@@ -263,7 +263,7 @@ CreateInputsCrit <- function(FUN_CRIT,
inCnVarObs <- c("SCA", "SWE")
if (!"ZLayers" %in% names(InputsModel)) {
if(any(listVarObs %in% inCnVarObs)) {
stop(sprintf("'varOBS' can not be equal to %i if CemaNeige is not used",
stop(sprintf("'varObs' can not be equal to %i if CemaNeige is not used",
paste(sapply(inCnVarObs, shQuote), collapse = " or ")))
}
} else {
......
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