Commit 41ddfaab authored by unknown's avatar unknown
Browse files

v0.1.11.9 minor revision of functionalities tabPanel in ShinyGR

parent 5924412f
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.8
Version: 0.1.11.9
Date: 2018-01-29
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)
......
......@@ -15,11 +15,11 @@ plot.CalGR <- function(x, xlab = NULL, ylab = NULL, main = NULL, which = c("per
opar <- par(no.readonly = TRUE)
on.exit(par(opar))
if (any(which[1L] %in% c("perf"))) {
if (any(which[1L] %in% c("perf"))) {
plot(x$OutputsModel, Qobs = x$Qobs, ...)
}
if (any(which[1L] %in% c("iter"))) {
if (any(which[1L] %in% c("iter"))) {
layout.list <- list(matrix(c(1:2), ncol = 2),
matrix(c(1:3, 3), ncol = 2),
matrix(NA),
......@@ -37,11 +37,11 @@ plot.CalGR <- function(x, xlab = NULL, ylab = NULL, main = NULL, which = c("per
# layout.mat <- rbind(layout.mat, max(layout.mat)+1, max(layout.mat)+2)
# layout(mat = layout.mat, widths = layout.w, heights = layout.h)
# }
if (which[1L] %in% c("ts")) {
if (which[1L] %in% c("ts")) {
layout(mat = matrix(1:2), widths = c(1, 2), heights = c(1, 2))
}
if (any(which[1L] %in% c("iter"))) {
if (any(which[1L] %in% c("iter"))) {
ParamLab <- data.frame(Name = c(sprintf("X%i", 1:6), sprintf("C%i", 1:2)),
Label = c("prod. store capacity [mm]",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -35,7 +35,7 @@ To obtain help regarding the use of the <strong><font color="#009EE0">airGRteach
#### Preparation of observed data for modelling
A `data.frame` of hydrometeorological observations time series at the catchment scale is needed. The required fields are:
A `data.frame` of daily hydrometeorological observations time series at the catchment scale is needed. The required fields are:
* *DatesR* : dates in the `POSIXt` format
* *P* : average precipitation [mm/time step]
......@@ -60,9 +60,9 @@ head(BasinObs)
Before running a model, <strong><font color="#009EE0">airGRteaching</font></strong> functions require data and options with specific formats.
For this step, you just have to use the `ObsGR()` function. You have to define:
For this step, you just have to use the `PrepGR()` function. You have to define:
* `ObsBV`: `data.frame` of hydrometeorological observations time series
* `ObsDF`: `data.frame` of hydrometeorological observations time series
* `HydroModel`: the name of the hydrological model you want to run (GR1A, GR2M, GR4J, GR5J, GR6J or GR4H)
* `CemaNeige`: if you want or not to use the snowmelt and accumulation model
......@@ -74,26 +74,7 @@ If you want to use CemaNeige, you also have to define:
```r
OBS <- ObsGR(ObsBV = BasinObs, HydroModel = "GR5J", CemaNeige = FALSE)
```
```
## DatesR Precip PotEvap Qobs
## Min. :1984-01-01 Min. : 0.000 Min. :0.000 Min. : 0.0168
## 1st Qu.:1991-04-02 1st Qu.: 0.000 1st Qu.:0.600 1st Qu.: 0.3943
## Median :1998-07-02 Median : 0.300 Median :1.400 Median : 0.9768
## Mean :1998-07-02 Mean : 2.915 Mean :1.764 Mean : 1.4720
## 3rd Qu.:2005-10-01 3rd Qu.: 3.600 3rd Qu.:2.900 3rd Qu.: 1.8933
## Max. :2012-12-31 Max. :66.800 Max. :5.500 Max. :23.8800
## NA's :755
## TempMean
## Min. :-18.700
## 1st Qu.: 4.100
## Median : 9.100
## Mean : 9.147
## 3rd Qu.: 14.500
## Max. : 28.400
##
PREP <- PrepGR(ObsDF = BasinObs, HydroModel = "GR5J", CemaNeige = FALSE)
```
<br>
......@@ -102,7 +83,7 @@ OBS <- ObsGR(ObsBV = BasinObs, HydroModel = "GR5J", CemaNeige = FALSE)
To calibrate a model, you just have to use the `CalGR()` function. By default, the objective function used is the Nash–Sutcliffe criterion (`"NSE"`), and the warm-up period is automatically set (depends on model). You just have to define:
* `ObsGR`: the object returned by the `ObsGR()` function
* `PrepGR`: the object returned by the `PrepGR()` function
* `CalPer`: a vector of 2 dates to define the calibration period
......@@ -115,41 +96,41 @@ The calibration algorithm has been developed by Claude Michel (`Calibration_Mich
```r
CAL <- CalGR(ObsGR = OBS, CalCrit = "KGE",
CAL <- CalGR(PrepGR = PREP, CalCrit = "KGE2",
WupPer = NULL, CalPer = c("1990-01-01", "1993-12-31"))
```
```
## Grid-Screening in progress (0% 20% 40% 60% 80% 100%)
## Screening completed (243 runs)
## Param = 175.915 , -0.110 , 42.521 , 1.857 , 0.467
## Crit KGE[Q] = 0.8022
## Param = 175.915 , -0.110 , 83.931 , 1.857 , 0.467
## Crit KGE'[Q] = 0.8300
## Steepest-descent local search in progress
## Calibration completed (22 iterations, 443 runs)
## Param = 190.566 , 1.474 , 81.451 , 1.788 , 0.492
## Crit KGE[Q] = 0.8786
## Calibration completed (18 iterations, 406 runs)
## Param = 188.670 , 1.456 , 83.931 , 1.779 , 0.493
## Crit KGE'[Q] = 0.8787
```
<br>
#### Simulation step
The `ObsGR` and `WupPer` arguments are similar to the ones of the `CalGR()` function. Here, `EffCrit` is used to calculate the performance of the model over the simulation period `SimPer` and `CalGR` is the object returned by the `CalGR()` function.
The `PrepGR` and `WupPer` arguments are similar to the ones of the `CalGR()` function. Here, `EffCrit` is used to calculate the performance of the model over the simulation period `SimPer` and `CalGR` is the object returned by the `CalGR()` function.
```r
SIM <- SimGR(ObsGR = OBS, CalGR = CAL, EffCrit = "KGE2",
SIM <- SimGR(PrepGR = PREP, CalGR = CAL, EffCrit = "KGE2",
WupPer = NULL, SimPer = c("1994-01-01", "1998-12-31"))
```
```
## Crit. KGE'[Q] = 0.8555
## Crit. KGE'[Q] = 0.8545
```
```
## SubCrit. KGE'[Q] cor(sim, obs, "pearson") = 0.9007
## SubCrit. KGE'[Q] cv(sim)/cv(obs) = 0.8968
## SubCrit. KGE'[Q] mean(sim)/mean(obs) = 0.9812
## SubCrit. KGE'[Q] cor(sim, obs, "pearson") = 0.9008
## SubCrit. KGE'[Q] cv(sim)/cv(obs) = 0.8969
## SubCrit. KGE'[Q] mean(sim)/mean(obs) = 0.9737
```
<br>
......@@ -158,11 +139,11 @@ SIM <- SimGR(ObsGR = OBS, CalGR = CAL, EffCrit = "KGE2",
#### Static plots
The call of the `plot()` function with an `ObsGR` object draws the observed precipitation and discharge time series.
The call of the `plot()` function with an `PrepGR` object draws the observed precipitation and discharge time series.
```r
plot(OBS, main = "Observation")
plot(PREP, main = "Observation")
```
![](tab_fun_files/figure-html/unnamed-chunk-6-1.png)<!-- -->
......@@ -206,7 +187,7 @@ plot(SIM)
Dynamic plots, using the *dygraphs* JavaScript charting library, can be displayed by the package.
The `dyplot()` function can be applied on `ObsGR`, `CalGR` and `SimGR` objects and draws the time series of the observed precipitation, and the observed and simulated (except with `ObsGR` objects) flows.
The `dyplot()` function can be applied on `PrepGR`, `CalGR` and `SimGR` objects and draws the time series of the observed precipitation, and the observed and simulated (except with `PrepGR` objects) flows.
The user can zoom on the plot device and can read the exact values.
......@@ -215,7 +196,7 @@ With this function, users can easily explore the data time series and also explo
```r
dyplot(SIM)
dyplot(SIM, main = "Simulation")
```
<iframe src="fig/ShinyGR_dyplot.html", width = "670", height = "350"></iframe>
......@@ -228,12 +209,12 @@ The <strong><font color="#009EE0">airGRteaching</font></strong> package also pro
The `ShinyGR()` function just needs:
* `ObsBV`: a name of a `data.frame` (or a `list` of names)
* `ObsDF`: a name of a `data.frame` (or a `list` of names)
* `SimPer`: a vector of 2 dates to define the simulation period
By default, the objective function used is the Kling-Gupta criterion (KGE), and the warm-up period is automatically set (depending on model). You have to define:
* `ObsGR`: the object returned by the `ObsGR()` function
* `PrepGR`: the object returned by the `PrepGR()` function
* `CalPer`: a vector of 2 dates to define the calibration period
......@@ -243,7 +224,7 @@ You can obviously define another objective function or warm-up period:
```r
ShinyGR(ObsBV = "BasinObs", SimPer = c("1994-01-01", "1998-12-31"))
ShinyGR(ObsDF = "BasinObs", SimPer = c("1994-01-01", "1998-12-31"))
```
Only daily models are currently available (GR4J, GR5J, GR6J + CemaNeige).
......
......@@ -163,7 +163,7 @@ With this function, users can easily explore the data time series and also explo
```{r, eval=FALSE}
dyplot(SIM)
dyplot(SIM, main = "Simulation")
```
<iframe src="fig/ShinyGR_dyplot.html", width = "670", height = "350"></iframe>
......
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