Commit 34fa85ff authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

v0.2.9.21 CLEAN: CalCrit and transfo arguments of the CalGR function are now...

v0.2.9.21 CLEAN: CalCrit and transfo arguments of the CalGR function are now checked by the match.arg function #12
parent f41b1bbd
Package: airGRteaching
Type: Package
Title: Teaching Hydrological Modelling with the GR Rainfall-Runoff Models ('Shiny' Interface Included)
Version: 0.2.9.20
Version: 0.2.9.21
Date: 2020-03-29
Authors@R: c(
person("Olivier", "Delaigue", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7668-8468"), email = "airGR@inrae.fr"),
......
......@@ -4,7 +4,7 @@
### 0.2.9.20 Release Notes (2020-03-29)
### 0.2.9.21 Release Notes (2020-03-29)
#### New features
......
CalGR <- function(PrepGR, CalCrit = c("NSE", "KGE", "KGE2", "RMSE"),
WupPer = NULL, CalPer, transfo = c("", "sqrt", "log", "inv", "sort"), verbose = TRUE) {
CalCrit <- match.arg(arg = CalCrit)
CalCrit <- sprintf("ErrorCrit_%s", CalCrit)
FUN_CRIT <- get(CalCrit)
transfo <- match.arg(transfo)
if (! any(class(PrepGR) %in% "PrepGR")) {
stop("Non convenient data for argument \"PrepGR\". Must be of class \"PrepGR\"")
}
......@@ -41,19 +48,7 @@ CalGR <- function(PrepGR, CalCrit = c("NSE", "KGE", "KGE2", "RMSE"),
}
}
if (! any(CalCrit %in% c("NSE", "KGE", "KGE2", "RMSE"))) {
stop("Non convenient efficiency criteria \"EffCrit\"")
} else {
CalCrit <- CalCrit[1L]
CalCrit <- sprintf("ErrorCrit_%s", CalCrit)
FUN_CRIT <- get(CalCrit)
}
if (! any(transfo %in% c("", "sqrt", "log", "inv", "sort"))) {
stop("Non convenient transformation \"transfo\"")
} else {
transfo <- transfo[1L]
}
MOD_opt <- CreateRunOptions(FUN_MOD = get(PrepGR$TypeModel), InputsModel = PrepGR$InputsModel,
IndPeriod_WarmUp = WupInd, IndPeriod_Run = CalInd, verbose = 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