Commit 1e56de7d authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

v1.2.12.7 CLEAN: syntax revision of cemaneige_hysteris vignette

parent bb4622f1
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.2.12.6
Version: 1.2.12.7
Date: 2019-03-29
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
......
......@@ -13,7 +13,7 @@ output:
### 1.2.12.6 Release Notes (2019-03-28)
### 1.2.12.7 Release Notes (2019-03-28)
......
......@@ -46,8 +46,11 @@ The calibration period has been defined from 2000-09-01 to 2005-08-31, and the v
```{r, warning=FALSE}
## preparation of the InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_CemaNeigeGR4J, DatesR = BasinObs$DatesR,
Precip = BasinObs$P, PotEvap = BasinObs$E)
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_CemaNeigeGR4J,
DatesR = BasinObs$DatesR, Precip = BasinObs$P,
PotEvap = BasinObs$E, TempMean = BasinObs$T,
ZInputs = median(BasinInfo$HypsoData),
HypsoData = BasinInfo$HypsoData, NLayers = 5)
## ---- calibration step
......@@ -72,14 +75,17 @@ In order to use the hysteresis, a new argument (IsHyst) is added in the CreateRu
```{r, warning=FALSE}
## preparation of the RunOptions object for the calibration period
RunOptions_Cal <- CreateRunOptions(FUN_MOD = RunModel_CemaNeigeGR4J,
InputsModel = InputsModel, IndPeriod_Run = Ind_Cal, IsHyst = TRUE)
InputsModel = InputsModel, IndPeriod_Run = Ind_Cal,
IsHyst = TRUE)
## preparation of the RunOptions object for the validation period
RunOptions_Val <- CreateRunOptions(FUN_MOD = RunModel_CemaNeigeGR4J,
InputsModel = InputsModel, IndPeriod_Run = Ind_Val, IsHyst = TRUE)
InputsModel = InputsModel, IndPeriod_Run = Ind_Val,
IsHyst = TRUE)
## preparation of the CalibOptions object
CalibOptions <- CreateCalibOptions(FUN_MOD = RunModel_CemaNeigeGR4J, FUN_CALIB = Calibration_Michel,
CalibOptions <- CreateCalibOptions(FUN_MOD = RunModel_CemaNeigeGR4J,
FUN_CALIB = Calibration_Michel,
IsHyst = TRUE)
```
......@@ -88,14 +94,14 @@ In order to calibrate and assess the model performance, we will follow the recom
```{r, warning=FALSE}
## efficiency criteria: 75 % KGE'(Q) + 5 % KGE'(SCA) on each of the 5 layers
InputsCrit_Cal <- CreateInputsCrit(FUN_CRIT = list(ErrorCrit_KGE2, ErrorCrit_KGE2, ErrorCrit_KGE2, ErrorCrit_KGE2, ErrorCrit_KGE2, ErrorCrit_KGE2),
InputsCrit_Cal <- CreateInputsCrit(FUN_CRIT = rep("ErrorCrit_KGE2", 6),
InputsModel = InputsModel, RunOptions = RunOptions_Cal,
obs = list(BasinObs$Qmm[Ind_Cal], BasinObs$SCA1[Ind_Cal], BasinObs$SCA2[Ind_Cal],
BasinObs$SCA3[Ind_Cal], BasinObs$SCA4[Ind_Cal], BasinObs$SCA5[Ind_Cal]),
varObs = list("Q", "SCA", "SCA", "SCA", "SCA", "SCA"),
weights = list(0.75, 0.05, 0.05, 0.05, 0.05, 0.05))
InputsCrit_Val <- CreateInputsCrit(FUN_CRIT = list(ErrorCrit_KGE2, ErrorCrit_KGE2, ErrorCrit_KGE2, ErrorCrit_KGE2, ErrorCrit_KGE2, ErrorCrit_KGE2),
InputsCrit_Val <- CreateInputsCrit(FUN_CRIT = rep("ErrorCrit_KGE2", 6),
InputsModel = InputsModel, RunOptions = RunOptions_Val,
obs = list(BasinObs$Qmm[Ind_Val], BasinObs$SCA1[Ind_Val], BasinObs$SCA2[Ind_Val],
BasinObs$SCA3[Ind_Val], BasinObs$SCA4[Ind_Val], BasinObs$SCA5[Ind_Val]),
......@@ -114,36 +120,41 @@ OutputsCalib <- Calibration(InputsModel = InputsModel, RunOptions = RunOptions_C
```
Now we can run it on the calibration and validation periods and assess it.
Now we can run it on the calibration periods and assess it.
```{r, warning=FALSE}
```{r, warning=FALSE, message=FALSE}
## run on the calibration period
OutputsModel_Val <- RunModel_CemaNeigeGR4J(InputsModel = InputsModel, RunOptions = RunOptions,
OutputsModel_Cal <- RunModel_CemaNeigeGR4J(InputsModel = InputsModel,
RunOptions = RunOptions_Cal,
Param = OutputsCalib$ParamFinalR)
## evaluation
OutputsCrit_Cal <- ErrorCrit(InputsCrit = InputsCrit, OutputsModel = OutputsModel_Cal)
OutputsCrit_Cal <- ErrorCrit(InputsCrit = InputsCrit_Cal, OutputsModel = OutputsModel_Cal)
```
Find below the performance of the model over the calibration period.
```{r, warning=FALSE}
str(OutputsCrit_Cal)
str(OutputsCrit_Cal, max.level = 2)
```
Now we can run it on the validation periods and assess it.
```{r, warning=FALSE}
## run on the validation period
OutputsModel_Val <- RunModel_CemaNeigeGR4J(InputsModel = InputsModel, RunOptions = RunOptions,
OutputsModel_Val <- RunModel_CemaNeigeGR4J(InputsModel = InputsModel,
RunOptions = RunOptions_Val,
Param = OutputsCalib$ParamFinalR)
## evaluation
OutputsCrit_Val <- ErrorCrit(InputsCrit = InputsCrit, OutputsModel = OutputsModel_Val)
OutputsCrit_Val <- ErrorCrit(InputsCrit = InputsCrit_Val, OutputsModel = OutputsModel_Val)
```
Find below the performance of the model over the validation period.
```{r, warning=FALSE}
str(OutputsCrit_Val)
str(OutputsCrit_Val, max.level = 2)
```
......@@ -154,51 +165,67 @@ Here we use the same InputsModel object and calibration and validation periods.
```{r, warning=FALSE}
## preparation of RunOptions object
RunOptions_Cal_NoHyst <- CreateRunOptions(FUN_MOD = RunModel_CemaNeigeGR4J,
InputsModel = InputsModel, IndPeriod_Run = Ind_Cal, IsHyst = FALSE)
InputsModel = InputsModel,
IndPeriod_Run = Ind_Cal,
IsHyst = FALSE)
RunOptions_Val_NoHyst <- CreateRunOptions(FUN_MOD = RunModel_CemaNeigeGR4J, InputsModel = InputsModel,
IndPeriod_Run = Ind_Val, IsHyst = FALSE)
RunOptions_Val_NoHyst <- CreateRunOptions(FUN_MOD = RunModel_CemaNeigeGR4J,
InputsModel = InputsModel,
IndPeriod_Run = Ind_Val,
IsHyst = FALSE)
InputsCrit_Cal_NoHyst <- CreateInputsCrit(FUN_CRIT = ErrorCrit_KGE2,
InputsModel = InputsModel, RunOptions = RunOptions_Cal_NoHyst,
obs = BasinData$Q[Ind_Cal], varObs = "Q")
InputsModel = InputsModel,
RunOptions = RunOptions_Cal_NoHyst,
obs = BasinObs$Qmm[Ind_Cal], varObs = "Q")
## preparation of CalibOptions object
CalibOptions_NoHyst <- CreateCalibOptions(FUN_MOD = RunModel_CemaNeigeGR4J,
FUN_CALIB = Calibration_Michel, IsHyst = FALSE)
FUN_CALIB = Calibration_Michel,
IsHyst = FALSE)
```
We can now calibrate it.
```{r, warning=FALSE}
## calibration
OutputsCalib_NoHyst <- Calibration(InputsModel = InputsModel, RunOptions = RunOptions,
InputsCrit = InputsCrit_Cal_NoHyst, CalibOptions = CalibOptions_NoHyst,
FUN_MOD = RunModel_CemaNeigeGR4J,
FUN_CALIB = Calibration_Michel)
OutputsCalib_NoHyst <- Calibration(InputsModel = InputsModel, InputsCrit = InputsCrit_Cal_NoHyst,
RunOptions = RunOptions_Cal_NoHyst, CalibOptions = CalibOptions_NoHyst,
FUN_MOD = RunModel_CemaNeigeGR4J, FUN_CALIB = Calibration_Michel)
```
And run it over the calibration and validation periods.
```{r, warning=FALSE}
OutputsModel_Cal_NoHyst <- RunModel_CemaNeigeGR4J(InputsModel = InputsModel, RunOptions = RunOptions_Cal_NoHyst,
OutputsModel_Cal_NoHyst <- RunModel_CemaNeigeGR4J(InputsModel = InputsModel,
RunOptions = RunOptions_Cal_NoHyst,
Param = OutputsCalib_NoHyst$ParamFinalR)
OutputsModel_Val_NoHyst <- RunModel_CemaNeigeGR4J(InputsModel = InputsModel, RunOptions = RunOptions_Val_NoHyst,
Param = OutputsCalib$ParamFinalR)
OutputsModel_Val_NoHyst <- RunModel_CemaNeigeGR4J(InputsModel = InputsModel,
RunOptions = RunOptions_Val_NoHyst,
Param = OutputsCalib_NoHyst$ParamFinalR)
```
In order to assess the model performance over the two periods, we will use the InputsCrit objects prepared before, which allow assessing also the performance in terms of snow simulation.
```{r, warning=FALSE}
OutputsCrit_Cal_NoHyst <- ErrorCrit(InputsCrit = InputsCrit_Cal, OutputsModel = OutputsModel_Cal_NoHyst)
```{r, warning=FALSE, message=FALSE}
OutputsCrit_Cal_NoHyst <- ErrorCrit(InputsCrit = InputsCrit_Cal,
OutputsModel = OutputsModel_Cal_NoHyst)
OutputsCrit_Val_NoHyst <- ErrorCrit(InputsCrit = InputsCrit_Val,
OutputsModel = OutputsModel_Val_NoHyst)
```
We can check the performance over the calibration and the validation period.
OutputsCrit_Val_NoHyst <- ErrorCrit(InputsCrit = InputsCrit_Val, OutputsModel = OutputsModel_Val_NoHyst)
```{r, warning=FALSE}
str(OutputsCrit_Cal_NoHyst, max.level = 2)
str(OutputsCrit_Val_NoHyst, max.level = 2)
```
We can see below that the performance of the initial model is similar to the new one over the calibration period in terms of discharge, but also that the new version calibrated using SCA provides better performance in terms of snow.
However, over the validation, we see that the discharge simulated by the new version brings better performance (in addition to improved SCA also). This shows the interests of the combined use of an hysteresis and of SCA data for calibration in CemaNeige.
However, over the validation period, we see that the discharge simulated by the new version brings better performance (in addition to improved SCA also). This shows the interests of the combined use of an hysteresis and of SCA data for calibration in CemaNeige.
Reference
......
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