Add GR2M in the GUI
Add GR2M in the GUI
The GR2M model is widely used, especially in teaching. It should be added in the GUI.
Activity
- Delaigue Olivier added GUI R SUGGESTION labels
added GUI R SUGGESTION labels
- Delaigue Olivier mentioned in commit 5b29a0ff
mentioned in commit 5b29a0ff
- Delaigue Olivier mentioned in commit a2cf55cc
mentioned in commit a2cf55cc
- Author Owner
First test:
It is possible to mix daily or monthly datasets in the inputs of the
ShinyGR()
function.library(airGRteaching) ## daily time series of a low-land basin data(L0123001, package = "airGR") BV_L0123001 <- BasinObs[0001:6000, c("DatesR", "P", "E", "Qmm", "T")] BI_L0123001 <- BasinInfo ## monthly time series of a low-land basin BV_L0123003 <- SeriesAggreg(TabSeries = BV_L0123001, TimeFormat = "daily", NewTimeFormat = "monthly", ConvertFun = c("sum", "sum", "sum", "mean")) ## daily time series of a mountainous basin data(L0123002, package = "airGR") BV_L0123002 <- BasinObs[5000:9999, c("DatesR", "P", "E", "Qmm", "T")] BI_L0123002 <- BasinInfo ShinyGR(ObsDF = list("Low-land basin [daily]" = BV_L0123001, "Mountainous basin [daily]" = BV_L0123002, "Low-land basin [monthly]" = BV_L0123003), ZInputs = list(NULL, median(BI_L0123002$HypsoData), NULL), HypsoData = list(NULL, BI_L0123002$HypsoData, NULL), NLayers = list(5, 5, NULL), SimPer = list(c("1994-01-01", "1998-12-01"), c("2004-01-01", "2006-12-31"), c("1994-01-01", "1998-12-01")), theme = "United")
Edited by Delaigue Olivier - Author Owner
We need to improve:
"State variables" panel:
- remove the labels of the legend that do not relate to the GR2M model
- the download plot button does not work; the static plot must be adapted
"Model diagram" panel:
- the "Event" slider is not displayed
- the diagram does not exist for GR2M; the plot must be added in the
.TypeModelGR()
function - the download plot button does not work; the static plot must be adapted
Edited by Delaigue Olivier - Delaigue Olivier mentioned in commit cb0d3c8b
mentioned in commit cb0d3c8b
- Delaigue Olivier mentioned in commit 870c3a54
mentioned in commit 870c3a54
- Delaigue Olivier mentioned in commit cbb063f9
mentioned in commit cbb063f9
- Delaigue Olivier mentioned in commit 1f8a7370
mentioned in commit 1f8a7370
- Delaigue Olivier mentioned in commit 0d15c67c
mentioned in commit 0d15c67c
- Delaigue Olivier mentioned in commit 607b64c6
mentioned in commit 607b64c6
- Delaigue Olivier mentioned in commit 556fa6b2
mentioned in commit 556fa6b2
- Author Owner
It seems to be OK, now. To be check. Only the GR2M model diagram is missing.
- Delaigue Olivier mentioned in commit fd766a6e
mentioned in commit fd766a6e
- Delaigue Olivier mentioned in commit 34cd227f
mentioned in commit 34cd227f
- Delaigue Olivier mentioned in commit bbad13a9
mentioned in commit bbad13a9
- Author Owner
There is still a bug: if you don't touch the Period slider, it displays dates in days instead of truncating them to the month. When the slider is updated everything is ok.
@guillaume.thirel and @pierre.brigode, I made a draft of the diagram. Can you take a look at the fluxes?
To test the model diagram (the
.DiagramGR()
function is in the Utils.R file):library(airGRteaching) ## Dataset preparation data(L0123001, package = "airGR") BasinObs4 <- BasinObs[, c("DatesR", "P", "E", "Qmm", "T")] BasinObs4 <- SeriesAggreg(TabSeries = BasinObs4, TimeFormat = "daily", NewTimeFormat = "monthly", ConvertFun = c("sum", "sum", "sum", "mean")) PREP <- PrepGR(ObsDF = BasinObs4, HydroModel = "GR2M", CemaNeige = FALSE) ## Calibration step CAL <- CalGR(PrepGR = PREP, CalCrit = "KGE2", transfo = "", WupPer = NULL, CalPer = c("1990-01-01", "1991-01-01")) ## Simulation step using the result of the automatic calibration method to set the model parameters SIM <- SimGR(PrepGR = PREP, Param = CAL, EffCrit = "KGE2", WupPer = NULL, SimPer = c("1994-01-01", "1998-01-01")) ## Variable declaration OutputsModel <- SIM$OutputsModel Param <- CAL$OutputsCalib$ParamFinalR SimPer <- as.POSIXct(c("1994-01-01", "1998-01-01"), tz = "UTC") EventDate <- as.POSIXct(c("1996-02-01"), tz = "UTC") .GlobalEnv$.ShinyGR.args$theme <- "" ## Diagram displaying .DiagramGR(OutputsModel = OutputsModel, Param = Param, SimPer = SimPer, EventDate = EventDate, HydroModel = "GR2M", CemaNeige = FALSE)
Edited by Delaigue Olivier - Delaigue Olivier mentioned in commit eb529e77
mentioned in commit eb529e77
- Owner
We miss
Ps
on the graph. I modified the GR2M airGR Fortran code (attached) so that you have access to this variable. It adds one output variable so please implement the related modifications is airGR.The arrow going to the right is directy
Pn
, notPn - Ps
. In calculation terms, this amount representsP-Ps
. There is a discrepancy with the airGR GR2M graph, where it is called P1.The PR arrow is missing on the graph.
- Delaigue Olivier mentioned in issue airgr#51 (closed)
mentioned in issue airgr#51 (closed)
- Delaigue Olivier mentioned in commit 5d8a37c9
mentioned in commit 5d8a37c9
- Delaigue Olivier mentioned in commit aa6b2285
mentioned in commit aa6b2285
- Delaigue Olivier mentioned in commit c55345f3
mentioned in commit c55345f3
- Delaigue Olivier mentioned in commit 43cb40d1
mentioned in commit 43cb40d1
- Delaigue Olivier mentioned in commit 9f8c8541
mentioned in commit 9f8c8541
- Delaigue Olivier mentioned in commit 7b2456b2
mentioned in commit 7b2456b2
- Author Owner
@guillaume.thirel and @pierre.brigode, can you check the use of monthly time series by the
ShinyGR()
function?Be careful, airGRteaching now depends on airGR >= 1.4.3.87, because Ps was missing in the GR2M outputs (see: airgr#51 (closed))
Could you specifically take a look at :
- the model diagram
- the help page (perhaps we need to add more explanation and to add an example using monthly time series)
A pirori, the interface works even if the dates of the simulation period do not start on the 1st of the month (whereas it is the case in the time series).
It is possible to give to
ShinyGR()
function a list of dataframes mixing daily and monthly time series.The period window slider presents a little bug. I don't know how to solve it yet, but I think that is not too annoying. The slider limits display the dates with the
YY-MM-DD
format. When the user move them or change to another panel, theYY-MM
format is displayed (it is better!). - Author Owner
Edges of "X6", "C1", "C2", "Period" and "Event" sliders are not anymore in the right colors. I think this is due to the add of the new "X2GR2M" slider. There is a shift in the numbering of the sliders in the CSS files.
Edited by Delaigue Olivier - Delaigue Olivier mentioned in commit 1f09e4bd
mentioned in commit 1f09e4bd
- Author Owner
Slider colors are now correct.
- Owner
The play button seems to go day by day, so we don't see anything. Please change if possible to month by month when GR2M is the model on display.
The help page seems ok for me. I just added some details. Of course, we should add an example at the monthly time step (the one above is fine). ShinyGR.Rd
- Author Owner
- Please register or sign in to reply
- Delaigue Olivier mentioned in commit 650616b2
mentioned in commit 650616b2
- Delaigue Olivier mentioned in commit ebd6c307
mentioned in commit ebd6c307
- Author Owner
I've simplified the example a little bit. Also, the example will need to be updated when the new version of the
airGR::SeriesAggreg()
function will be available.The play button seems to go day by day, so we don't see anything. Please change if possible to month by month when GR2M is the model on display.
Still to do.
- Delaigue Olivier mentioned in commit e69dcd81
mentioned in commit e69dcd81
- Delaigue Olivier mentioned in commit 703e2cc9
mentioned in commit 703e2cc9
- Delaigue Olivier mentioned in commit 674d4eff
mentioned in commit 674d4eff
- Delaigue Olivier mentioned in commit 343db2d0
mentioned in commit 343db2d0
- Delaigue Olivier mentioned in commit 2d7b8d75
mentioned in commit 2d7b8d75
- Delaigue Olivier mentioned in commit 5e3643dc
mentioned in commit 5e3643dc
- Delaigue Olivier mentioned in commit 64ccd245
mentioned in commit 64ccd245
- Author Owner
@guillaume.thirel, which syntax should we choose in the title of the exported graph in order to display the template parameters when GR2M is used?
- X1 = 1250 mm, X2 = 2 [-]
- X1 = 1250 mm, X2 = 2
For GR4J model, this is:
X1 = 1250 mm, X2 = 0 mm/d, X3 = 500 mm, X4 = 5.2 d
- Developer
For GR4J (and for all models): X1 = 1250 [mm], X2 = 0 [mm/d], X3 = 500 [mm], X4 = 5.2 [d] ?
- Delaigue Olivier mentioned in commit 3add44e2
mentioned in commit 3add44e2
- Author Owner
I'm sorry, I wasn't clear. It was just a comment about the unit display for GR2M parameters (and I was giving an example of how it is for GR4J).
- Developer
It was: my proposition is to surround every unit by "[]" characters, for GR4J, GR2M...
- Author Owner
Okay, sorry, I didn't understand.
- Owner
I'm ok with Pierre's suggestion.
- Delaigue Olivier mentioned in commit 40c7cec9
mentioned in commit 40c7cec9
- Author Owner
Done!
- Owner
I just played with the interface. @olivier.delaigue:
- on the flow error plot, please replace mm/d with mm/month when GR2M is used.
- on the model performance panel, the plot appears on a dark grey background. Is that intended with the Flatly theme? This happens both for GR2M and GR4J and this happens also for the model diagram scheme. I use Firefox.
- on the model performance diagram, I don't see yticks values on all plots but one on this panel.
These three issues are not present when we download the plots as png.
- Delaigue Olivier mentioned in commit 257e49b3
mentioned in commit 257e49b3
- Author Owner
- Owner
- Owner
Only theme = "Flatly" shows this problem. All other themes are ok for me.
- Author Owner
Indeed... it's not great. I will test with Windows 10.
- Owner
When using only one monthly basin
ShinyGR(ObsDF = list("Low-land basin [monthly]" = BV_L0123001m), SimPer = c("1994-01-01", "1998-12-01"))
I have the following warning/error:
Warning: Error in dyGroup: One or more of the specified series were not found. Valid series names are: Qsim, Qobs 100: stop 99: dyGroup 97: dygraphs::dyStackedRibbonGroup 96: func [C:\Data\Rpackages\airGRteaching\ShinyGR/server.R#727] 83: origRenderFunc 82: output$dyPlotSVq 2: shiny::runApp 1: ShinyGR [C:/Users/admin/Desktop/temp/airGRteaching/airgrteaching/R/ShinyGR.R#161]
I don't have this message with the daily data
BV_L0123001
. - Author Owner
This one is "normal". This is because a part of the code has to run with a default model (GR4J) before detecting the time step and automatically updating the chosen model. This is the only way I found to be able to mix different datasets at the input of the
ShinyGR()
function.So it returns an error message in the console when the first dataset is a monthly time series, but as soon as the model is updated, normally everything works fine.
Edited by Delaigue Olivier - Owner
Ok then I have detected no other issue. :)
- Delaigue Olivier mentioned in commit ca1b15b2
mentioned in commit ca1b15b2
- Author Owner
See issue #24 (closed) for problems linked to the background.
- Delaigue Olivier mentioned in merge request !5 (merged)
mentioned in merge request !5 (merged)
- Delaigue Olivier mentioned in commit a4dee305
mentioned in commit a4dee305
- Author Owner
GR2M seems to work in the GUI.
- Delaigue Olivier closed
closed
- Delaigue Olivier changed milestone to %v0.2.10
changed milestone to %v0.2.10
- Delaigue Olivier mentioned in issue airgrteaching-website#8
mentioned in issue airgrteaching-website#8