diff --git a/DESCRIPTION b/DESCRIPTION index 7bfe39274afb2b93a3411bc8c36edc4fe1c87038..5cb8621cdf270862f76da0f90a78c077bff176bf 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.16.28 +Version: 1.2.16.29 Date: 2019-06-07 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 68cbb735d955f98cec531f6a540cd13f2a45a61b..0c6143ca37af212a06fc18a1411990d36a706dc9 100644 --- a/NEWS.rmd +++ b/NEWS.rmd @@ -14,7 +14,7 @@ output: -### 1.2.16.28 Release Notes (2019-06-07) +### 1.2.16.29 Release Notes (2019-06-07) #### New features diff --git a/R/plot.OutputsModel.R b/R/plot.OutputsModel.R index f5b06900c57965f6092c67c621bd543c261c60fe..a14c1d7c91428588df5966e4b3fcf2215b7a2001 100644 --- a/R/plot.OutputsModel.R +++ b/R/plot.OutputsModel.R @@ -77,7 +77,10 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea = whichTS <- c("Precip", "PotEvap", "Temp", "SnowPack", "Flows" ) whichPerf <- c( "Error", "Regime", "CumFreq", "CorQQ") whichCN <- c( "Temp", "SnowPack" ) - warnMsgWhich <- "'which' must be a vector of character" + warnMsgWhich <- "'which' must be a vector of character" + warnMsgWhichCN <- sprintf("incorrect element found in argument 'which':\n\twithout CemaNeige, %s are not available \n\tit can only contain %s", + paste0(shQuote(whichCN), collapse = " and "), + paste0(shQuote(c(whichDashboard, whichAll[!whichAll %in% whichCN])), collapse = ", ")) if (is.null(which)) { stop(warnMsgWhich) } @@ -88,21 +91,15 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea = stop(warnMsgWhich) } if (any(!which %in% c(whichDashboard, whichAll))) { - stop("incorrect element found in argument 'which': ", paste0(shQuote(which[!which %in% c(whichDashboard, whichAll)])), - "\nit can only contain ", - paste0(shQuote(c(whichDashboard, whichAll)), collapse = ", ")) + stop(sprintf("incorrect element found in argument 'which': %s\nit can only contain %s", + paste0(shQuote(which[!which %in% c(whichDashboard, whichAll)])), + paste0(shQuote(c(whichDashboard, whichAll)), collapse = ", "))) } if (all(which %in% whichCN) & !inherits(OutputsModel, "CemaNeige")) { - stop("incorrect element found in argument 'which':", - "\n\twithout CemaNeige, ", paste0(shQuote(whichCN), collapse = " and "), " are not available", - "\n\tit can only contain ", - paste0(shQuote(c(whichDashboard, whichAll[!whichAll %in% whichCN])), collapse = ", ")) + stop(warnMsgWhichCN) } if (length(unique(which %in% whichCN)) == 2 & !inherits(OutputsModel, "CemaNeige")) { - warning("incorrect element found in argument 'which':", - "\n\twithout CemaNeige, ", paste0(shQuote(whichCN), collapse = " and "), " are not available", - "\n\tit can only contain ", - paste0(shQuote(c(whichDashboard, whichAll[!whichAll %in% whichCN])), collapse = ", ")) + warning(warnMsgWhichCN) } if ("perf" %in% which) { which <- c(which, whichPerf) @@ -118,7 +115,8 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea = } if (is.null(Qobs)) { if (length(which) == 1 & any(which %in% whichNeedQobs)) { - stop(sprintf("the %s plot(s) cannot be drawn if there is no 'Qobs'", shQuote(which))) + stop(sprintf("the %s plot(s) cannot be drawn if there is no 'Qobs'", + shQuote(which))) } if (length(which) != 1 & any(which %in% whichNeedQobs)) { BOOL_CorQQ <- FALSE