Commit 48919ad1 authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

fix(SimGR): allow to rin SimGR when no Qobs on SimPer

Refs #43
parent 778e9791
Pipeline #25969 passed with stage
in 1 minute and 44 seconds
......@@ -16,11 +16,6 @@ SimGR <- function(PrepGR, CalGR = NULL, Param, EffCrit = c("NSE", "KGE", "KGE2",
stop("Non convenient data for argument \"PrepGR\". Must be of class \"PrepGR\"")
}
isQobs <- !all(is.na(PrepGR$Qobs))
if (!isQobs) {
warning("\"PrepGR\" does not contain any Qobs values. The efficiency criterion is not computed")
}
if (!missing(CalGR)) {
warning("Deprecated \"CalGR\" argument. Use \"Param\" instead")
}
......@@ -74,16 +69,17 @@ SimGR <- function(PrepGR, CalGR = NULL, Param, EffCrit = c("NSE", "KGE", "KGE2",
}
MOD_opt <- CreateRunOptions(FUN_MOD = get(PrepGR$TypeModel), InputsModel = PrepGR$InputsModel,
IndPeriod_WarmUp = WupInd, IndPeriod_Run = SimInd, verbose = verbose)
if (isQobs) {
MOD_crt <- CreateInputsCrit(FUN_CRIT = FUN_CRIT, InputsModel = PrepGR$InputsModel,
RunOptions = MOD_opt, Obs = PrepGR$Qobs[SimInd], transfo = transfo)
} else {
MOD_crt <- NULL
# NA in Qobs
isQobs <- !all(is.na(PrepGR$Qobs))
isQobsSimPer <- !all(is.na(PrepGR$Qobs[SimInd]))
if (!isQobs) {
warning("\"PrepGR\" does not contain any Qobs values. The efficiency criterion is not computed")
} else if (!isQobsSimPer) {
message("\"PrepGR\" does not contain any Qobs values on \"SimPer\". The efficiency criterion is not computed")
}
......@@ -91,9 +87,12 @@ SimGR <- function(PrepGR, CalGR = NULL, Param, EffCrit = c("NSE", "KGE", "KGE2",
Param = Param, FUN_MOD = get(PrepGR$TypeModel))
if (isQobs) {
if (isQobsSimPer) {
MOD_crt <- CreateInputsCrit(FUN_CRIT = FUN_CRIT, InputsModel = PrepGR$InputsModel,
RunOptions = MOD_opt, Obs = PrepGR$Qobs[SimInd], transfo = transfo)
CRT <- ErrorCrit(InputsCrit = MOD_crt, OutputsModel = SIM, verbose = verbose)
} else {
MOD_crt <- NULL
CRT <- NULL
}
......
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