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

v0.2.9.20 CLEAN: EffCrit and transfo arguments of the SimGR function are now...

v0.2.9.20 CLEAN: EffCrit and transfo arguments of the SimGR function are now checked by the match.arg function #12
parent b1efcab5
Package: airGRteaching
Type: Package
Title: Teaching Hydrological Modelling with the GR Rainfall-Runoff Models ('Shiny' Interface Included)
Version: 0.2.9.19
Version: 0.2.9.20
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.19 Release Notes (2020-03-29)
### 0.2.9.20 Release Notes (2020-03-29)
#### New features
......
SimGR <- function(PrepGR, CalGR = NULL, Param, EffCrit = c("NSE", "KGE", "KGE2", "RMSE"),
WupPer = NULL, SimPer, transfo = c("", "sqrt", "log", "inv", "sort"), verbose = TRUE) {
EffCrit <- match.arg(arg = EffCrit)
EffCrit <- sprintf("ErrorCrit_%s", EffCrit)
FUN_CRIT <- get(EffCrit)
transfo <- match.arg(transfo)
if (! any(class(PrepGR) %in% "PrepGR")) {
stop("Non convenient data for argument \"PrepGR\". Must be of class \"PrepGR\"")
}
......@@ -61,20 +68,6 @@ SimGR <- function(PrepGR, CalGR = NULL, Param, EffCrit = c("NSE", "KGE", "KGE2",
SimInd <- which(PrepGR$InputsModel$DatesR == SimPer[1]):which(PrepGR$InputsModel$DatesR == SimPer[2])
}
}
if (! any(EffCrit %in% c("NSE", "KGE", "KGE2", "RMSE"))) {
stop("Non convenient efficiency criteria \"EffCrit\"")
} else {
EffCrit <- EffCrit[1L]
EffCrit <- sprintf("ErrorCrit_%s", EffCrit)
FUN_CRIT <- get(EffCrit)
}
if (! any(transfo %in% c("", "sqrt", "log", "inv", "sort"))) {
stop("Non convenient transformation \"transfo\"")
} else {
transfo <- transfo[1L]
}
......
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