diff --git a/DESCRIPTION b/DESCRIPTION index 6e64317fdb5896aa2678a13a0c8afa7c0e7948c9..84122143c473036f3e7d8985cd62e6d2e0933240 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: airGR Type: Package Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling -Version: 1.2.8.4 +Version: 1.2.8.5 Date: 2019-03-06 Authors@R: c( person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")), diff --git a/NEWS.rmd b/NEWS.rmd index cfd6b9063bf80992df24efe0e52b43bc0eb92fe1..ee266975d0a1543eeb481efaaa7ce3da898127ca 100644 --- a/NEWS.rmd +++ b/NEWS.rmd @@ -13,7 +13,7 @@ output: -### 1.2.8.4 Release Notes (2019-03-06) +### 1.2.8.5 Release Notes (2019-03-06) diff --git a/R/Calibration_Michel.R b/R/Calibration_Michel.R index 65948136242c9d2249a81d9874b9fa0e45ad142d..7649d7226167fc7bb2b11045049e300266c2a5c8 100644 --- a/R/Calibration_Michel.R +++ b/R/Calibration_Michel.R @@ -15,11 +15,17 @@ Calibration_Michel <- function(InputsModel, RunOptions, InputsCrit, CalibOptions if (inherits(InputsCrit, "Multi")) { stop("InputsCrit must be of class 'Single' or 'Compo'") } - if (inherits(InputsCrit, "Compo") & "SCA" %in% sapply(InputsCrit, "[[", "varObs") & !"Gratio" %in% RunOptions$Outputs_Cal) { + if (inherits(InputsCrit, "Single")) { + listVarObs <- InputsCrit$varObs + } + if (inherits(InputsCrit, "Compo")) { + listVarObs <- sapply(InputsCrit, FUN = "[[", "varObs") + } + if ("SCA" %in% listVarObs & !"Gratio" %in% RunOptions$Outputs_Cal) { warning("Missing 'Gratio' is automatically added to 'Output_Cal' in 'RunOptions' as it is necessary in the objective function for comparison with SCA") RunOptions$Outputs_Cal <- c(RunOptions$Outputs_Cal, "Gratio") } - if (inherits(InputsCrit, "Compo") & "SWE" %in% sapply(InputsCrit, "[[", "varObs") & !"SnowPack" %in% RunOptions$Outputs_Cal) { + if ("SWE" %in% listVarObs & !"SnowPack" %in% RunOptions$Outputs_Cal) { warning("Missing 'SnowPack' is automatically added to 'Output_Cal' in 'RunOptions' as it is necessary in the objective function for comparison with SWE") RunOptions$Outputs_Cal <- c(RunOptions$Outputs_Cal, "SnowPack") }