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

v1.2.8.5 BUG: Calibration_Michel can manage with single or compo InputsCrit to...

v1.2.8.5 BUG: Calibration_Michel can manage with single or compo InputsCrit to check needed missing outputs in RunOptions when SCA or SWE is used
Showing with 10 additions and 4 deletions
+10 -4
Package: airGR Package: airGR
Type: Package Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.2.8.4 Version: 1.2.8.5
Date: 2019-03-06 Date: 2019-03-06
Authors@R: c( Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")), person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
......
...@@ -13,7 +13,7 @@ output: ...@@ -13,7 +13,7 @@ output:
### 1.2.8.4 Release Notes (2019-03-06) ### 1.2.8.5 Release Notes (2019-03-06)
......
...@@ -15,11 +15,17 @@ Calibration_Michel <- function(InputsModel, RunOptions, InputsCrit, CalibOptions ...@@ -15,11 +15,17 @@ Calibration_Michel <- function(InputsModel, RunOptions, InputsCrit, CalibOptions
if (inherits(InputsCrit, "Multi")) { if (inherits(InputsCrit, "Multi")) {
stop("InputsCrit must be of class 'Single' or 'Compo'") 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") 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") 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") 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") RunOptions$Outputs_Cal <- c(RunOptions$Outputs_Cal, "SnowPack")
} }
......
Supports Markdown
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