Commit bd06f1eb authored by unknown's avatar unknown
Browse files

v0.1.9.5 v0.1.9.4 exp store now apprears in different colors (+ or -) in state...

v0.1.9.5 v0.1.9.4 exp store now apprears in different colors (+ or -) in state variables plot in ShinyGR when GR6J is used
parent 3a324ffd
Package: airGRteaching
Type: Package
Title: Tools to Simplify the Use of the airGR Hydrological Package for Education (Including a Shiny Interface)
Version: 0.1.9.4
Version: 0.1.9.5
Date: 2018-01-22
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)
......
......@@ -612,7 +612,7 @@ DiagramGR <- function(OutputsModel, Param, SimPer, EventDate, HydroModel) {
# Reservoir exponentiel
rect(xleft = xy_min_EXPO[1], xright = xy_min_EXPO[1]+base_res,
ybottom = xy_min_EXPO[2], ytop = xy_min_EXPO[2]+OutputsModel$Exp[i_pdt]*fact_res+tmp_triche,
col = ifelse(OutputsModel$Exp[i_pdt] > 0, "green3", "red"), border = NA)
col = ifelse(OutputsModel$Exp[i_pdt] > 0, "#10B510", "#FF0303"), border = NA)
# rect(xleft = xy_min_EXPO[1], xright = xy_min_EXPO[1]+base_res,
# ybottom = xy_min_EXPO[2], ytop = xy_min_EXPO[2]-OutputsModel$Exp[i_pdt]*fact_res-tmp_triche,
# col = col_SR, border = NA)
......
......@@ -300,19 +300,23 @@ shinyServer(function(input, output, session) {
PET = OutputsModel2$PotEvap,
prod. = OutputsModel2$Prod,
rout. = OutputsModel2$Rout,
exp. = rep(NA, length(OutputsModel2$DatesR)),
# exp. = rep(NA, length(OutputsModel2$DatesR)),
# 'exp. (+)'= rep(NA, length(OutputsModel2$DatesR)),
# 'exp. (-)'= rep(NA, length(OutputsModel2$DatesR)),
Qr = OutputsModel2$QR,
Qd = OutputsModel2$QD,
Qsim = OutputsModel2$Qsim,
Qobs = OutputsModel2$Qobs,
QsimOld = rep(NA, length(OutputsModel2$DatesR)),
QrExp = rep(NA, length(OutputsModel2$DatesR)))
QsimOld = rep(NA, length(OutputsModel2$DatesR)))
# QrExp = rep(NA, length(OutputsModel2$DatesR)))
if (length(.GlobalEnv$.ShinyGR.hist) == 2 & input$ShowOldQsim == "Yes") {
data$QsimOld <- .GlobalEnv$.ShinyGR.hist[[1]]$Qsim
}
if (input$HydroModel == "GR6J") {
data$'exp.'<- OutputsModel2$Exp
data$'exp.' <- NULL
data$'exp. (+)'<- ifelse(OutputsModel2$Exp >= 0, OutputsModel2$Exp, NA)
data$'exp. (-)'<- ifelse(OutputsModel2$Exp < 0, OutputsModel2$Exp, NA)
data$QrExp <- OutputsModel2$QRExp
}
......@@ -499,12 +503,19 @@ shinyServer(function(input, output, session) {
# data <- data.frame(DatesR = OutputsModel$DatesR,
# prod. = OutputsModel$Prod,
# rout. = OutputsModel$Rout)
data <- getData()$Tab[, c("DatesR", "prod.", "rout.", "exp.")]
data.xts <- xts::xts(data[, -1L], order.by = data$DatesR)
data <- getData()$Tab[, c("DatesR", "prod.", "rout.", grep("^exp", colnames(getData()$Tab), value = TRUE))]
data.xts <- xts::xts(data[, -1L], order.by = data$DatesR)
if (input$HydroModel == "GR6J") {
colors = c("#00008B", "#008B8B", "#10B510", "#FF0303")
} else {
colors = c("#00008B", "#008B8B")
}
op <- getPlotPar()$par
dg2 <- dygraphs::dygraph(data.xts, group = "state_var", ylab = "store [mm]")
dg2 <- dygraphs::dyOptions(dg2, colors = c("#00008B", "#008B8B", "red"),
dg2 <- dygraphs::dyOptions(dg2, colors = colors,
fillGraph = TRUE, fillAlpha = 0.3,
drawXAxis = FALSE, axisLineColor = op$fg, axisLabelColor = op$fg, retainDateWindow = FALSE)
dg2 <- dygraphs::dyLegend(dg2, show = "always", width = 325)
......@@ -532,16 +543,24 @@ shinyServer(function(input, output, session) {
# } else {
# data$QrExp <- NA
# }
data <- getData()$Tab[, c("DatesR", "Qr", "Qd", "QrExp", "Qsim", "Qobs")]
data <- getData()$Tab[, c("DatesR", "Qr", "Qd", grep("^QrExp", colnames(getData()$Tab), value = TRUE), "Qsim", "Qobs")]
data.xts <- xts::xts(data[, -1L], order.by = data$DatesR)
if (input$HydroModel == "GR6J") {
names <- c("Qd", "Qr", "QrExp")
colors <- c("#FFD700", "#EE6300", "brown")
} else {
names <- c("Qd", "Qr")
colors <- c("#FFD700", "#EE6300")
}
op <- getPlotPar()$par
dg3 <- dygraphs::dygraph(data.xts, group = "state_var", ylab = "flow [mm/d]", main = " ")
dg3 <- dygraphs::dyOptions(dg3, fillAlpha = 1.0,
axisLineColor = op$fg, axisLabelColor = op$fg,
titleHeight = 10, retainDateWindow = FALSE)
dg3 <- dygraphs::dyStackedRibbonGroup(dg3, name = c("Qd", "Qr", "QrExp"),
color = c("#FFD700", "#EE6300", "brown"), strokeBorderColor = "black")
dg3 <- dygraphs::dyStackedRibbonGroup(dg3, name = names,
color = colors, strokeBorderColor = "black")
dg3 <- dygraphs::dySeries(dg3, name = "Qobs", fillGraph = FALSE, drawPoints = TRUE, color = op$fg)
dg3 <- dygraphs::dySeries(dg3, name = "Qsim", fillGraph = FALSE, color = "orangered")
dg3 <- dygraphs::dyCrosshair(dg3, direction = "vertical")
......
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