diff --git a/DESCRIPTION b/DESCRIPTION index 0672ad1e00303cbd7dbf63f81b7c3eb902fd722d..7ee955206f5f885e2232732a655c10c787b8ff64 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: airGRteaching Type: Package Title: Tools to Simplify the Use of the airGR Hydrological Package for Education (Including a Shiny Interface) -Version: 0.1.6.7 -Date: 2017-09-27 +Version: 0.1.6.8 +Date: 2017-09-28 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) Imports: xts, dygraphs (>= 1.1.1.4), shiny, plotrix, markdown diff --git a/R/Utils.R b/R/Utils.R index dc92e3709e6f7d9ca9c45ec17a7144e6514eb245..c39d213a2d5a02c950a4110a0605c1d97c1bbb08 100644 --- a/R/Utils.R +++ b/R/Utils.R @@ -25,15 +25,16 @@ if (getRversion() >= "2.15.1") { } StrName <- "(.*)(GR)(\\d{1})(\\D{1})" + NameModel <- gsub(StrName, "\\2\\3\\4", x) TimeUnitFR <- gsub(StrName, "\\4", x) TimeUnit <- switch(TimeUnitFR, H = "hour", J = "day", M = "month", A = "year") TimeLag <- switch(TimeUnit, "hour" = 3600, "day" = 3600*24, "month" = 3600*24*31, "year" = 366) NbParam <- gsub(StrName, "\\3", x) isCN <- grepl("CemaNeige" , x) - res <- list(TypeModel = x, NbParam = as.numeric(NbParam), - TimeUnit = TimeUnit, TimeLag = TimeLag, - CemaNeige = isCN) + res <- list(TypeModel = x, NameModel = NameModel, CemaNeige = isCN, + NbParam = as.numeric(NbParam), + TimeUnit = TimeUnit, TimeLag = TimeLag) return(res) } diff --git a/inst/ShinyGR/server.R b/inst/ShinyGR/server.R index 5f65f659d15f699c855e826f2d154ec1d19840bd..207c431bfd0c3d0f83d04c0c43d3cc0a21e48563 100644 --- a/inst/ShinyGR/server.R +++ b/inst/ShinyGR/server.R @@ -137,6 +137,15 @@ shinyServer(function(input, output, session) { if (length(.GlobalEnv$.ShinyGR.hist[[1]]$Qsim) != length(.GlobalEnv$.ShinyGR.hist[[2]]$Qsim)) { OBSold <- getPrep()$OBS OBSold$TypeModel <- .GlobalEnv$.ShinyGR.hist[[1]]$TypeModel + if (.TypeModelGR(OBSold)$CemaNeige & !.TypeModelGR(getPrep()$OBS)$CemaNeige) { # present: No CemaNeige ; old: CemaNeige + OBSold <- ObsGR(ObsBV = get(input$Dataset), HydroModel = .TypeModelGR(OBSold)$NameModel, + CemaNeige = .TypeModelGR(OBSold)$CemaNeige, + Precip = .ShinyGR.args$Precip, PotEvap = .ShinyGR.args$PotEvap, + Qobs = get(input$Dataset), TempMean = .ShinyGR.args$TempMean, + ZInputs = .ShinyGR.args$ZInputs, HypsoData = .ShinyGR.args$HypsoData, + NLayers = .ShinyGR.args$NLayers) + } + SIMold <- SimGR(ObsGR = OBSold, Param = .GlobalEnv$.ShinyGR.hist[[1]]$Param, WupPer = substr(getPrep()$WUPPER, 1, 10),