Commit b1efcab5 authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

v0.2.9.19 CLEAN: Hydromodel argument of the PrepGR function is now checked by...

v0.2.9.19 CLEAN: Hydromodel argument of the PrepGR function is now checked by the match.arg function
parent 45e6ccb2
Package: airGRteaching
Type: Package
Title: Teaching Hydrological Modelling with the GR Rainfall-Runoff Models ('Shiny' Interface Included)
Version: 0.2.9.18
Date: 2020-03-27
Version: 0.2.9.19
Date: 2020-03-29
Authors@R: c(
person("Olivier", "Delaigue", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7668-8468"), email = "airGR@inrae.fr"),
person("Laurent", "Coron", role = c("aut"), comment = c(ORCID = "0000-0002-1503-6204")),
......
......@@ -4,7 +4,7 @@
### 0.2.9.18 Release Notes (2020-03-27)
### 0.2.9.19 Release Notes (2020-03-29)
#### New features
......@@ -13,6 +13,7 @@
#### User-visible changes
- the <code>theme</code> agument of the <code>ShinyGR()<.code> function now works even if the user used the wrong character case
____________________________________________________________________________________
......@@ -66,6 +67,7 @@ ________________________________________________________________________________
### 0.2.6.29 Release Notes (2019-05-02)
#### Bug fixes
- <code>ShinyGR()</code> can export the csv table again. It was broken due to modifications to the version 1.2.13.16 of the 'airGR' package
......@@ -213,7 +215,6 @@ ________________________________________________________________________________
- bug fixed to disable calibration when there is no Qobs in <code>ShinyGR()</code>
#### User-visible changes
- it is now possible to draw the model diagram in <code>ShinyGR()</code> using the GR6J model
......@@ -315,6 +316,7 @@ ________________________________________________________________________________
#### CRAN-compatibility updates
- <code>dyplot()</code> updated to be compatible with dygraphs >= 1.1.1.4 (available only on GitHub)
____________________________________________________________________________________
......@@ -337,6 +339,7 @@ ________________________________________________________________________________
### 0.1.3.9 Release Notes (2017-06-22)
#### New features
- added GR5J in the Model diagram of <code>ShinyGR()</code>
......
......@@ -3,6 +3,9 @@ PrepGR <- function(ObsDF = NULL, DatesR = NULL, Precip = NULL, PotEvap = NULL, Q
HydroModel, CemaNeige = FALSE) {
SuiteGR <- paste0("GR", c("1A", "2M", "4J", "5J", "6J", "4H", "5H"))
HydroModel <- match.arg(arg = HydroModel, choices = SuiteGR)
if (is.null(ObsDF) && (is.null(DatesR) | is.null(Precip) | is.null(PotEvap))) {
stop("Missing input data")
}
......@@ -45,23 +48,17 @@ PrepGR <- function(ObsDF = NULL, DatesR = NULL, Precip = NULL, PotEvap = NULL, Q
stop("Non convenient date format. Time zone must be defined as \"UTC\"")
}
SuiteGR <- paste0("GR", c("1A", "2M", "4J", "5J", "6J", "4H", "5H"))
if (! any(HydroModel %in% SuiteGR)) {
stop("Non convenient model")
} else {
if (! CemaNeige) {
TypeModel <- sprintf("RunModel_%s", HydroModel)
}
if (CemaNeige && grepl("J|H", HydroModel)) {
TypeModel <- sprintf("RunModel_CemaNeige%s", HydroModel)
}
if (CemaNeige && !grepl("J|H", HydroModel)) {
warning("CemaNeige can not be used with ", HydroModel)
TypeModel <- sprintf("RunModel_%s", HydroModel)
}
FUN_MOD <- get(TypeModel)
if (! CemaNeige) {
TypeModel <- sprintf("RunModel_%s", HydroModel)
}
if (CemaNeige && grepl("J|H", HydroModel)) {
TypeModel <- sprintf("RunModel_CemaNeige%s", HydroModel)
}
if (CemaNeige && !grepl("J|H", HydroModel)) {
warning("CemaNeige can not be used with ", HydroModel)
TypeModel <- sprintf("RunModel_%s", HydroModel)
}
FUN_MOD <- get(TypeModel)
MOD_obs <- CreateInputsModel(FUN_MOD = FUN_MOD, DatesR = ObsDF$DatesR,
......
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