diff --git a/DESCRIPTION b/DESCRIPTION index da2fd85e89aa4fdfd00e2c79a92d65e571725124..487d7801d04b2b0455a5a243198ad8bd4df6f155 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.1.3.4 +Version: 1.1.3.5 Date: 2019-02-21 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 45ae42e6264984ed275515e6f42a3ff7eb92b557..822eb07f8964b9f19c2fc87f36d8e3892e6ef57b 100644 --- a/NEWS.rmd +++ b/NEWS.rmd @@ -13,7 +13,7 @@ output: -### 1.1.3.4 Release Notes (2019-02-21) +### 1.1.3.5 Release Notes (2019-02-21) diff --git a/R/ErrorCrit_RMSE.R b/R/ErrorCrit_RMSE.R index fb35521b4900852f748c3a58df3125c34d40827b..e665f3ee0aa7f02bd39e445e0e30251521a63523 100644 --- a/R/ErrorCrit_RMSE.R +++ b/R/ErrorCrit_RMSE.R @@ -6,6 +6,10 @@ ErrorCrit_RMSE <- function(InputsCrit, OutputsModel, warnings = TRUE, verbose = stop("InputsCrit must be of class 'InputsCrit' \n") return(NULL) } + if (inherits(InputsCrit, "Multi") | inherits(InputsCrit, "Compo")) { + stop("InputsCrit must be of class 'Single'. Use the ErrorCrit function on objects of class 'Multi' with RMSE") + return(NULL) + } if (!inherits(OutputsModel, "OutputsModel")) { stop("OutputsModel must be of class 'OutputsModel' \n") return(NULL) @@ -14,24 +18,26 @@ ErrorCrit_RMSE <- function(InputsCrit, OutputsModel, warnings = TRUE, verbose = ##Initialisation_________________________________ CritName <- NA + CritVar <- InputsCrit$varObs if (InputsCrit$transfo == "") { - CritName <- "RMSE[Q]" + CritName <- "RMSE[CritVar]" } if (InputsCrit$transfo == "sqrt") { - CritName <- "RMSE[sqrt(Q)]" + CritName <- "RMSE[sqrt(CritVar)]" } if (InputsCrit$transfo == "log") { - CritName <- "RMSE[log(Q)]" + CritName <- "RMSE[log(CritVar)]" } if (InputsCrit$transfo == "inv") { - CritName <- "RMSE[1/Q]" + CritName <- "RMSE[1/CritVar]" } if (InputsCrit$transfo == "sort") { - CritName <- "RMSE[sort(Q)]" + CritName <- "RMSE[sort(CritVar)]" } - CritValue <- NA - CritBestValue <- +1 - Multiplier <- +1 + CritName <- gsub(pattern = "CritVar", replacement = CritVar, x = CritName) + CritValue <- NA + CritBestValue <- +1 + Multiplier <- +1 ### must be equal to -1 or +1 only