Commit 4ce6ecc7 authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

v1.6.10.3 docs(vignette): add line breaks to avoid too long code lines in sd_model vignette

parent e3747d43
Pipeline #19771 passed with stages
in 15 minutes and 39 seconds
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.6.10.2
Date: 2021-01-28
Version: 1.6.10.3
Date: 2021-01-29
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
person("Olivier", "Delaigue", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7668-8468"), email = "airGR@inrae.fr"),
......@@ -29,7 +29,7 @@ Imports:
Suggests:
knitr, rmarkdown,
caRamel, coda, DEoptim, dplyr, FME, ggmcmc, hydroPSO, imputeTS, Rmalschains,
ggplot2, GGally,
GGally, ggplot2,
testthat
Description: Hydrological modelling tools developed at INRAE-Antony (HYCAR Research Unit, France). The package includes several conceptual rainfall-runoff models (GR4H, GR5H, GR4J, GR5J, GR6J, GR2M, GR1A), a snow accumulation and melt model (CemaNeige) and the associated functions for their calibration and evaluation. Use help(airGR) for package description and references.
License: GPL-2
......
......@@ -2,7 +2,7 @@
### 1.6.10.2 Release Notes (2021-01-28)
### 1.6.10.3 Release Notes (2021-01-29)
#### New features
......
......@@ -69,10 +69,12 @@ InputsModelUp <- CreateInputsModel(FUN_MOD = RunModel_GR4J, DatesR = BasinObs$Da
Ind_Run <- seq(which(format(BasinObs$DatesR, format = "%Y-%m-%d") == "1990-01-01"),
which(format(BasinObs$DatesR, format = "%Y-%m-%d") == "1999-12-31"))
RunOptionsUp <- CreateRunOptions(FUN_MOD = RunModel_GR4J,
InputsModel = InputsModelUp, IndPeriod_Run = Ind_Run,
IniStates = NULL, IniResLevels = NULL, IndPeriod_WarmUp = NULL)
InputsModel = InputsModelUp
, IndPeriod_WarmUp = NULL, IndPeriod_Run = Ind_Run,
IniStates = NULL, IniResLevels = NULL)
InputsCritUp <- CreateInputsCrit(FUN_CRIT = ErrorCrit_NSE, InputsModel = InputsModelUp,
RunOptions = RunOptionsUp, VarObs = "Q", Obs = BasinObs$Qmm[Ind_Run])
RunOptions = RunOptionsUp,
VarObs = "Q", Obs = BasinObs$Qmm[Ind_Run])
CalibOptionsUp <- CreateCalibOptions(FUN_MOD = RunModel_GR4J, FUN_CALIB = Calibration_Michel)
OutputsCalibUp <- Calibration_Michel(InputsModel = InputsModelUp, RunOptions = RunOptionsUp,
InputsCrit = InputsCritUp, CalibOptions = CalibOptionsUp,
......@@ -101,9 +103,9 @@ we need to create the `InputsModel` object completed with upstream information:
InputsModelDown1 <- CreateInputsModel(
FUN_MOD = RunModel_GR4J, DatesR = BasinObs$DatesR,
Precip = BasinObs$P, PotEvap = BasinObs$E,
Qupstream = matrix(QObsUp, ncol = 1), # Upstream observed flow
LengthHydro = 100 * 1000, # Distance between upstream catchment outlet and the downstream one in m
BasinAreas = c(180, 180) # Upstream and downstream areas in km²
Qupstream = matrix(QObsUp, ncol = 1), # upstream observed flow
LengthHydro = 1e2 * 1e3, # distance between upstream catchment outlet & the downstream one [m]
BasinAreas = c(180, 180) # upstream and downstream areas [km²]
)
```
......@@ -111,15 +113,19 @@ And then calibrate the combination of Lag model for upstream flow transfer and G
```{r}
RunOptionsDown <- CreateRunOptions(FUN_MOD = RunModel_GR4J,
InputsModel = InputsModelDown1, IndPeriod_Run = Ind_Run,
IniStates = NULL, IniResLevels = NULL, IndPeriod_WarmUp = NULL)
InputsModel = InputsModelDown1,
IndPeriod_WarmUp = NULL, IndPeriod_Run = Ind_Run,
IniStates = NULL, IniResLevels = NULL)
InputsCritDown <- CreateInputsCrit(FUN_CRIT = ErrorCrit_NSE, InputsModel = InputsModelDown1,
RunOptions = RunOptionsDown, VarObs = "Q", Obs = QObsDown[Ind_Run])
RunOptions = RunOptionsDown,
VarObs = "Q", Obs = QObsDown[Ind_Run])
CalibOptionsDown <- CreateCalibOptions(FUN_MOD = RunModel_GR4J,
FUN_CALIB = Calibration_Michel,
IsSD = TRUE) # Don't forget to specify that it's an SD model here
OutputsCalibDown1 <- Calibration_Michel(InputsModel = InputsModelDown1, RunOptions = RunOptionsDown,
InputsCrit = InputsCritDown, CalibOptions = CalibOptionsDown,
IsSD = TRUE) # specify that it's a SD model
OutputsCalibDown1 <- Calibration_Michel(InputsModel = InputsModelDown1,
RunOptions = RunOptionsDown,
InputsCrit = InputsCritDown,
CalibOptions = CalibOptionsDown,
FUN_MOD = RunModel_GR4J)
```
......@@ -151,8 +157,10 @@ CritDown1 <- ErrorCrit_NSE(InputsCritDown, OutputsModelDown1)
We calibrate the model with the `InputsModel` object previously created for substituting the observed upstream flow with the simulated one:
```{r}
OutputsCalibDown2 <- Calibration_Michel(InputsModel = InputsModelDown2, RunOptions = RunOptionsDown,
InputsCrit = InputsCritDown, CalibOptions = CalibOptionsDown,
OutputsCalibDown2 <- Calibration_Michel(InputsModel = InputsModelDown2,
RunOptions = RunOptionsDown,
InputsCrit = InputsCritDown,
CalibOptions = CalibOptionsDown,
FUN_MOD = RunModel_GR4J)
ParamDown2 <- OutputsCalibDown2$ParamFinalR
```
......@@ -172,10 +180,14 @@ paste(format(Lag), "m/s")
Both calibrations overestimate this parameter:
```{r}
mLag <- matrix(c(Lag, OutputsCalibDown1$ParamFinalR[1], OutputsCalibDown2$ParamFinalR[1]), ncol = 1)
rownames(mLag) = c("theoretical", "calibrated with observed upstream flow",
"calibrated with simulated upstream flow")
colnames(mLag) = c("Lag parameter")
mLag <- matrix(c(Lag,
OutputsCalibDown1$ParamFinalR[1],
OutputsCalibDown2$ParamFinalR[1]),
ncol = 1,
dimnames = list(c("theoretical",
"calibrated with observed upstream flow",
"calibrated with simulated upstream flow"),
c("Lag parameter")))
knitr::kable(mLag)
```
......@@ -197,11 +209,17 @@ CritDownTheo <- ErrorCrit_NSE(InputsCritDown, OutputsModelDownTheo)
## Parameters and performance of each subcatchment for all calibrations
```{r}
comp <- matrix(c(0, OutputsCalibUp$ParamFinalR, rep(OutputsCalibDown1$ParamFinalR, 2),
OutputsCalibDown2$ParamFinalR, ParamDownTheo), ncol = 5, byrow = TRUE)
comp <- cbind(comp, c(OutputsCalibUp$CritFinal, OutputsCalibDown1$CritFinal,
CritDown1$CritValue, OutputsCalibDown2$CritFinal, CritDownTheo$CritValue))
colnames(comp) <- c("Lag", paste0("x", 1:4), "NSE")
comp <- matrix(c(0, OutputsCalibUp$ParamFinalR,
rep(OutputsCalibDown1$ParamFinalR, 2),
OutputsCalibDown2$ParamFinalR,
ParamDownTheo),
ncol = 5, byrow = TRUE)
comp <- cbind(comp, c(OutputsCalibUp$CritFinal,
OutputsCalibDown1$CritFinal,
CritDown1$CritValue,
OutputsCalibDown2$CritFinal,
CritDownTheo$CritValue))
colnames(comp) <- c("Lag", paste0("X", 1:4), "NSE")
rownames(comp) <- c("Calibration of the upstream subcatchment",
"Calibration 1 with observed upstream flow",
"Validation 1 with simulated upstream flow",
......
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