From aa6dccd0ad0f2392b269b7a46df7fdac3565a6a8 Mon Sep 17 00:00:00 2001 From: unknown <olivier.delaigue@ANPI1430.antony.irstea.priv> Date: Thu, 28 Sep 2017 11:36:46 +0200 Subject: [PATCH] v0.1.6.8 bug fixed when zoom after changing snow model on plot to see the last simulation in ShinyGR --- DESCRIPTION | 4 ++-- R/Utils.R | 7 ++++--- inst/ShinyGR/server.R | 9 +++++++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 0672ad1..7ee9552 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 dc92e37..c39d213 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 5f65f65..207c431 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), -- GitLab