library(airGRteaching)
## data.frame of daily observed data of a low-land basin
data(L0123001, package = "airGR")
BV_L0123001 <- BasinObs[0001:6000, c("DatesR", "P", "E", "Qmm", "T")]
BI_L0123001 <- BasinInfo
## data.frame of daily observed data of a mountainous basin
data(L0123002, package = "airGR")
BV_L0123002 <- BasinObs[5000:9999, c("DatesR", "P", "E", "Qmm", "T")]
BI_L0123002 <- BasinInfo
## data.frame of monthly aggregated time series from daily observed data of a low-land basin
BV_L0123001m <- SeriesAggreg(BV_L0123001[BV_L0123001$DatesR < "2000-06-01", ],
Format = "%Y%m", ConvertFun = c("sum", "sum", "sum", "mean"))
## Interactive simulation when inputs set by using a data.frame
if (interactive()) {
ShinyGR(ObsDF = list("Low-land basin" = BV_L0123001, "Mountainous basin" = BV_L0123002),
ZInputs = list(NULL, median(BI_L0123002$HypsoData)),
HypsoData = list(NULL, BI_L0123002$HypsoData),
NLayers = list(5, 5),
SimPer = list(c("1994-01-01", "1998-12-31"), c("2004-01-01", "2006-12-31")),
theme = "United")
}
## Interactive simulation using when inputs set by using independant vectors
if (interactive()) {
ShinyGR(DatesR = BV_L0123002$DatesR,
Precip = BV_L0123002$P,
PotEvap = BV_L0123002$E,
Qobs = BV_L0123002$Qmm,
Temp = BV_L0123002$T,
ZInputs = median(BI_L0123002$HypsoData),
HypsoData = BI_L0123002$HypsoData,
NLayers = 5,
SimPer = c("2004-01-01", "2006-12-31"),
NamesObsBV = "Mountainous basin",
theme = "Saclay")
}
## Interactive simulation for an ungauged catchment (i.e. no observed discharge available)
## Observed discharge set to NA in the Qobs argument
## or in the 4th column of the data.frame if the ObsDF argument is used
if (interactive()) {
ShinyGR(DatesR = BV_L0123001$DatesR,
Precip = BV_L0123001$P,
PotEvap = BV_L0123001$E,
Qobs = NA,
SimPer = c("1994-01-01", "1998-12-31"),
NamesObsBV = "Low-land basin",
theme = "Cyborg")
}
## Interactive simulation when inputs are at different time steps
if (interactive()) {
ShinyGR(ObsDF = list("Low-land basin [daily]" = BV_L0123001,
"Low-land basin [monthly]" = BV_L0123001m),
SimPer = list(c("1994-01-01", "1998-12-01"),
c("1994-01-01", "1998-12-01")),
theme = "Flatly")
}
Run the code above in your browser using DataLab