diff --git a/DESCRIPTION b/DESCRIPTION index bdd74e17453423fa80d336be9803424ad9d5549f..bcb3898d8db991761672cccc89ab9e9a972ea963 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: airGRteaching Type: Package Title: Tools to Simplify the Use of the airGR Hydrological Package for Education (Including a Shiny Interface) -Version: 0.1.11.2 +Version: 0.1.11.3 Date: 2018-01-29 Authors@R: c(person("Olivier", "Delaigue", role = c("aut", "cre"), email = "airGR@irstea.fr"), person("Laurent", "Coron", role = c("aut")), person("Pierre", "Brigode", role = c("aut")), person("Guillaume", "Thirel", role = c("ctb"))) Depends: airGR (>= 1.0.9.43) diff --git a/R/CalGR.R b/R/CalGR.R index dc549eaddc60c5fc2db3c7a8b4618c06bd537ba8..76507f8273cb53f225f9220faeda511000691762 100644 --- a/R/CalGR.R +++ b/R/CalGR.R @@ -8,6 +8,9 @@ CalGR <- function(PrepGR, CalCrit = c("NSE", "KGE", "KGE2", "RMSE"), WupInd <- NULL if (!is.null(WupPer)) { WupPer <- as.POSIXct(WupPer, tz = "UTC") + if (length(WupPer) != 2) { + stop("Warm-up period \"WupPer\" must be of length 2") + } if (any(is.na(WupPer))) { stop("Non convenient date format for the warm-up period \"WupPer\"") } else { @@ -20,6 +23,9 @@ CalGR <- function(PrepGR, CalCrit = c("NSE", "KGE", "KGE2", "RMSE"), } CalPer <- as.POSIXct(CalPer, tz = "UTC") + if (length(CalPer) != 2) { + stop("Calibration period \"CalPer\" must be of length 2") + } if (any(is.na(CalPer))) { stop("Non convenient date format for the calibration period \"CalPer\"") } else { diff --git a/R/SimGR.R b/R/SimGR.R index 20812d53b8875458e46a6b9b8156c9e00ad3a6e7..e1e329e4543066aefc3c1c14afa9ece7d5580ec3 100644 --- a/R/SimGR.R +++ b/R/SimGR.R @@ -9,7 +9,7 @@ SimGR <- function(PrepGR, CalGR = NULL, Param = NULL, EffCrit = c("NSE", "KGE", stop("Non convenient data for argument \"CalGR\". Must be of class \"CalGR\"") } if (is.null(CalGR) & is.null(Param)) { - stop("Arguments \"CalGR\" and \"Param\" are missing, with no default. You must fill in one of these two arguments.") + stop("Arguments \"CalGR\" and \"Param\" are missing, with no default. You must fill in one of these two arguments") } if (is.null(Param)) { @@ -19,6 +19,9 @@ SimGR <- function(PrepGR, CalGR = NULL, Param = NULL, EffCrit = c("NSE", "KGE", WupInd <- NULL if (!is.null(WupPer)) { WupPer <- as.POSIXct(WupPer, tz = "UTC") + if (length(WupPer) != 2) { + stop("Warm-up period \"WupPer\" must be of length 2") + } if (any(is.na(WupPer))) { stop("Non convenient date format for the warm-up period \"WupPer\"") } else { @@ -31,6 +34,9 @@ SimGR <- function(PrepGR, CalGR = NULL, Param = NULL, EffCrit = c("NSE", "KGE", } SimPer <- as.POSIXct(SimPer, tz = "UTC") + if (length(SimPer) != 2) { + stop("Simulation period \"SimPer\" must be of length 2") + } if (any(is.na(SimPer))) { stop("Non convenient date format for the simulation period \"SimPer\"") } else {