Commit 32f962c2 authored by unknown's avatar unknown
Browse files

v0.1.11.13 server.R file of the ShinyGR function cleaned

parent f9bdfb84
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.12
Version: 0.1.11.13
Date: 2018-01-31
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)
......
......@@ -26,7 +26,6 @@ shinyServer(function(input, output, session) {
if (input$SnowModel == "CemaNeige") {
PARAM <- c(PARAM, input$C1, input$C2)
}
# if (input$Dataset == "Unnamed watershed") {
if (input$Dataset == "Unnamed watershed") {
ObsDF <- NULL
} else {
......@@ -134,34 +133,10 @@ shinyServer(function(input, output, session) {
PARAM <- c(PARAM, input$C1, input$C2)
}
# if (dateWindow[1L] == dateWindow[2L]) {
# if (dateWindow[1L] == as.POSIXct(.ShinyGR.args$SimPer[2L], tz = "UTC")) {
# updateSliderInput(session, inputId = "Period",
# value = dateWindow - c(1, 0) * .TypeModelGR(input$HydroModel)$TimeLag)
# } else {
# updateSliderInput(session, inputId = "Period",
# value = dateWindow + c(0, 1) * .TypeModelGR(input$HydroModel)$TimeLag)
# }
# } else {
#
# }
#
#
#
#
## Simulated flows computation
SIM <- SimGR(PrepGR = getPrep()$PREP, Param = PARAM,
WupPer = substr(getPrep()$WUPPER, 1, 10),
SimPer = substr(c(input$Period[1], input$Period[2]), 1, 10), #substr(c(zzz1, zzz2), 1, 10), #
SimPer = substr(c(input$Period[1], input$Period[2]), 1, 10),
verbose = FALSE)
## Criteria computation
......@@ -413,31 +388,17 @@ shinyServer(function(input, output, session) {
value = as.POSIXct(.ShinyGR.args$SimPer[[input$Dataset]], tz = "UTC"))
}, priority = +10)
##################
# observe({
# print(.ShinyGR.args$SimPer[[input$Dataset]])
# updateSliderInput(session, inputId = "Period",
# min = as.POSIXct(.ShinyGR.args$SimPer[[input$Dataset]][1L], tz = "UTC"),
# max = as.POSIXct(.ShinyGR.args$SimPer[[input$Dataset]][2L], tz = "UTC"),
# value = as.POSIXct(.ShinyGR.args$SimPer[[input$Dataset]], tz = "UTC"))
# updateSliderInput(session, inputId = "Event",
# min = as.POSIXct(.ShinyGR.args$SimPer[[input$Dataset]][1L], tz = "UTC"),
# max = as.POSIXct(.ShinyGR.args$SimPer[[input$Dataset]][2L], tz = "UTC"),
# value = as.POSIXct(.ShinyGR.args$SimPer[[input$Dataset]][1L], tz = "UTC")+ .TypeModelGR(input$HydroModel)$TimeLag)
# }, priority = -1000)
##################
## Target date slider
## Time window slider
observeEvent({input$Dataset}, {
updateSliderInput(session, inputId = "Period",
min = as.POSIXct(.ShinyGR.args$SimPer[[input$Dataset]][1L], tz = "UTC"),
max = as.POSIXct(.ShinyGR.args$SimPer[[input$Dataset]][2L], tz = "UTC"),
value = as.POSIXct(.ShinyGR.args$SimPer[[input$Dataset]], tz = "UTC"))
# updateSliderInput(session, inputId = "Event",
# min = as.POSIXct(.ShinyGR.args$SimPer[[input$Dataset]][1L], tz = "UTC"),+ .TypeModelGR(input$HydroModel)$TimeLag,
# max = input$Period[2L],
# value = input$Period[1L] + .TypeModelGR(input$HydroModel)$TimeLag)
})
## Target date slider
eventReactive({input$Dataset}, {
updateSliderInput(session, inputId = "Event", label = "Select the target date:",
min = as.POSIXct(.ShinyGR.args$SimPer[[input$Dataset]][1L], tz = "UTC") + .TypeModelGR(input$HydroModel)$TimeLag,
......@@ -445,7 +406,6 @@ shinyServer(function(input, output, session) {
value = as.POSIXct(.ShinyGR.args$SimPer[[input$Dataset]][1L], tz = "UTC"), + .TypeModelGR(input$HydroModel)$TimeLag)
})
observe({
# observeEvent({input$Dataset}, {
updateSliderInput(session, inputId = "Event", label = "Select the target date:",
min = input$Period[1L] + .TypeModelGR(input$HydroModel)$TimeLag,
max = input$Period[2L])
......@@ -772,6 +732,7 @@ shinyServer(function(input, output, session) {
}
)
## Download plots
output$DownloadPlot <- downloadHandler(
filename = function() {
......
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