diff --git a/DESCRIPTION b/DESCRIPTION index 2b8e37107376634ca25746f4deaea8da5ac90090..65e33ba981873bb13e5a5cdad84e0b4c48de7531 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.15.1 +Version: 1.2.15.2 Date: 2019-05-02 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 07b5425865f484e10f8284e5a6d9bd3606007c29..289474446d92cd9d7672b24991c970c6e6ee3d7d 100644 --- a/NEWS.rmd +++ b/NEWS.rmd @@ -14,7 +14,7 @@ output: -### 1.2.15.1 Release Notes (2019-05-02) +### 1.2.15.2 Release Notes (2019-05-02) #### New features @@ -26,6 +26,8 @@ output: - <code>plot.OutputsModel()</code> can no drawn PET or error time serie if <code>which = "all"</code> or <code>"PotEvap"</code> or <code>"Error"</code>. +- <code>plot.OutputsModel()</code> now allowed new values for the which argument : <code>"all"</code> corresponds to all graphs, <code>"synth"</code> corresponds to the main graphs (correspondinf to <code>"all"</code> in the previous versions of the pcakage) (<code>c("Precip", "Temp", "SnowPack", "Flows", "Regime", "CumFreq", "CorQQ")</code>), "ts" corresponds to the time serie graphs (<code>c("Precip", "PotEvap", "Temp", "SnowPack", "Flows")</code>) and <code>"perf"</code> corresponds to the perfomance graphs (<code>c("Error", "Regime", "CumFreq", "CorQQ")</code>). + #### Minor user-visible changes diff --git a/R/plot.OutputsModel.R b/R/plot.OutputsModel.R index 479edb7eeb82db5ca4ff281bfcf1259cd2834894..7a7ca69d26e513e235c772c0dc0079c057e273cd 100644 --- a/R/plot.OutputsModel.R +++ b/R/plot.OutputsModel.R @@ -1,4 +1,4 @@ -plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea = NULL, which = "all", log_scale = FALSE, +plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea = NULL, which = "synth", log_scale = FALSE, cex.axis = 1, cex.lab = 0.9, cex.leg = 0.9, lwd = 1, verbose = TRUE, ...) { OutputsModel <- x @@ -66,19 +66,30 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea = if (!is.character(which)) { stop("'which' must be a vector of character") } - if (any(!which %in% c("all", "PotEvap", "Precip", 'Temp', "SnowPack", "Flows", "Error", "Regime", "CumFreq", "CorQQ"))) { - stop("incorrect element found in argument 'which':\nit can only contain 'all', 'Precip', 'PotEvap', 'Temp', 'SnowPack', 'Error', 'Flows', 'Regime', 'CumFreq' or 'CorQQ'") + if (any(!which %in% c("all", "synth", "ts", "perf", "PotEvap", "Precip", 'Temp', "SnowPack", "Flows", "Error", "Regime", "CumFreq", "CorQQ"))) { + stop("incorrect element found in argument 'which':\nit can only contain 'all', 'synth', 'ts', 'perf', 'Precip', 'PotEvap', 'Temp', 'SnowPack', 'Error', 'Flows', 'Regime', 'CumFreq' or 'CorQQ'") } if (all(which %in% c("Temp", "SnowPack")) & !inherits(OutputsModel, "CemaNeige")) { - stop("Incorrect element found in argument 'which':\nwithout CemaNeige it can only contain 'all', 'Precip', 'PotEvap', 'Flows', 'Error', 'Regime', 'CumFreq' or 'CorQQ'") + stop("Incorrect element found in argument 'which':\nwithout CemaNeige it can only contain 'all', 'synth', 'ts', 'perf', 'Precip', 'PotEvap', 'Flows', 'Error', 'Regime', 'CumFreq' or 'CorQQ'") } if (length(unique(which %in% c("Temp", "SnowPack"))) == 2 & !inherits(OutputsModel, "CemaNeige")) { - warning("Incorrect element found in argument 'which':\nit can only contain 'all', 'Precip', 'PotEvap', 'Flows', 'Error', 'Regime', 'CumFreq' or 'CorQQ'\nwithout CemaNeige 'Temp' and 'SnowPack' are not available") + warning("Incorrect element found in argument 'which':\nit can only contain 'all'synth', 'ts', 'perf', 'Precip', 'PotEvap', 'Flows', 'Error', 'Regime', 'CumFreq' or 'CorQQ'\nwithout CemaNeige 'Temp' and 'SnowPack' are not available") } + if ("all" %in% which) { which <- c("Precip", "PotEvap", "Temp", "SnowPack", "Flows", "Error", "Regime", "CumFreq", "CorQQ") } + if ("synth" %in% which) { + which <- c("Precip", "Temp", "SnowPack", "Flows", "Regime", "CumFreq", "CorQQ") + } + if ("ts" %in% which) { + which <- c("Precip", "PotEvap", "Temp", "SnowPack", "Flows") + } + if ("perf" %in% which) { + which <- c("Error", "Regime", "CumFreq", "CorQQ") + } + if (is.null(Qobs)) { if (length(which) == 1 & any(which %in% "Error")) { @@ -204,7 +215,7 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea = Sum1 <- sum(c(BOOLPLOT_Precip, BOOLPLOT_SnowPack, BOOLPLOT_Flows)) Sum2 <- sum(c(BOOLPLOT_Regime, BOOLPLOT_CumFreq, BOOLPLOT_CorQQ)) if (BOOLPLOT_Precip) { - matlayout <- rbind(matlayout, c(iPlot+1, iPlot+1, iPlot+1)) + matlayout <- rbind(matlayout, c(iPlot + 1, iPlot + 1, iPlot + 1)) iPlot <- iPlot + 1 } if (BOOLPLOT_PotEvap) { @@ -212,7 +223,7 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea = iPlot <- iPlot + 1 } if (BOOLPLOT_Temp) { - matlayout <- rbind(matlayout, c(iPlot+1, iPlot+1, iPlot+1), c(iPlot+1, iPlot+1, iPlot+1)) + matlayout <- rbind(matlayout, c(iPlot + 1, iPlot + 1, iPlot + 1), c(iPlot + 1, iPlot + 1, iPlot + 1)) iPlot <- iPlot + 1 } if (BOOLPLOT_SnowPack) {