Commit c11c79fc authored by unknown's avatar unknown
Browse files

v0.1.11.3 add a new check on the length of warm-up, calibration and simulation...

v0.1.11.3 add a new check on the length of warm-up, calibration and simulation periods in CalGR and SimGR functions
parent e1699d90
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)
......
......@@ -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 {
......
......@@ -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 {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment