From 3a5ea38fcb996f8da9e7745180a71bb71187de65 Mon Sep 17 00:00:00 2001 From: Delaigue Olivier <olivier.delaigue@irstea.priv> Date: Wed, 6 Mar 2019 09:02:43 +0100 Subject: [PATCH] v1.2.7.11 UPDATE: Calibration_Michel can now run with SCA and SWE --- DESCRIPTION | 2 +- NEWS.rmd | 2 +- R/Calibration_Michel.R | 13 ++++++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 125da67c..b5ac5732 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.7.10 +Version: 1.2.7.11 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 81a14a71..4932ab75 100644 --- a/NEWS.rmd +++ b/NEWS.rmd @@ -13,7 +13,7 @@ output: -### 1.2.7.10 Release Notes (2019-03-06) +### 1.2.7.11 Release Notes (2019-03-06) diff --git a/R/Calibration_Michel.R b/R/Calibration_Michel.R index e0c3c818..65948136 100644 --- a/R/Calibration_Michel.R +++ b/R/Calibration_Michel.R @@ -15,6 +15,14 @@ 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) { + 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) { + 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") + } if (!inherits(CalibOptions, "CalibOptions")) { stop("CalibOptions must be of class 'CalibOptions'") } @@ -22,11 +30,10 @@ Calibration_Michel <- function(InputsModel, RunOptions, InputsCrit, CalibOptions stop("CalibOptions must be of class 'HBAN' if Calibration_Michel is used") } if (!missing(FUN_CRIT)) { - warning("argument 'FUN_CRIT' is deprecated. The error criterion function is now automatically get from the 'InputsCrit' object", call. = FALSE) + warning("argument 'FUN_CRIT' is deprecated. The error criterion function is now automatically get from the 'InputsCrit' object") } - ##_check_FUN_TRANSFO if (is.null(FUN_TRANSFO)) { if (identical(FUN_MOD, RunModel_GR4H )) { @@ -61,7 +68,7 @@ Calibration_Michel <- function(InputsModel, RunOptions, InputsCrit, CalibOptions if (identical(FUN_MOD, RunModel_CemaNeigeGR5J)) { FUN1 <- TransfoParam_GR5J } - if (identical(FUN_MOD,RunModel_CemaNeigeGR6J)) { + if (identical(FUN_MOD, RunModel_CemaNeigeGR6J)) { FUN1 <- TransfoParam_GR6J } if (inherits(FUN_MOD, "hysteresis")) { -- GitLab