Commit ee73e80d authored by Dorchies David's avatar Dorchies David
Browse files

refactor(CreateInputsCrit_Lavenne): rename CreateInputsCrit_DeLavenne to CreateInputsCrit_Lavenne

Refs #111
Showing with 17 additions and 16 deletions
+17 -16
...@@ -38,3 +38,4 @@ BugReports: https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues ...@@ -38,3 +38,4 @@ BugReports: https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues
NeedsCompilation: yes NeedsCompilation: yes
Encoding: UTF-8 Encoding: UTF-8
VignetteBuilder: knitr VignetteBuilder: knitr
RoxygenNote: 7.1.1
...@@ -27,7 +27,7 @@ export(CreateCalibOptions) ...@@ -27,7 +27,7 @@ export(CreateCalibOptions)
export(CreateErrorCrit_GAPX) export(CreateErrorCrit_GAPX)
export(CreateIniStates) export(CreateIniStates)
export(CreateInputsCrit) export(CreateInputsCrit)
export(CreateInputsCrit_DeLavenne) export(CreateInputsCrit_Lavenne)
export(CreateInputsModel) export(CreateInputsModel)
export(CreateRunOptions) export(CreateRunOptions)
export(DataAltiExtrapolation_Valery) export(DataAltiExtrapolation_Valery)
......
CreateInputsCrit_DeLavenne <- function(FUN_CRIT = ErrorCrit_KGE, CreateInputsCrit_Lavenne <- function(FUN_CRIT = ErrorCrit_KGE,
InputsModel, InputsModel,
RunOptions, RunOptions,
Obs, Obs,
......
\encoding{UTF-8} \encoding{UTF-8}
\name{CreateInputsCrit_DeLavenne} \name{CreateInputsCrit_Lavenne}
\alias{CreateInputsCrit_DeLavenne} \alias{CreateInputsCrit_Lavenne}
\title{Creation of the InputsCrit object for De Lavenne Criterion} \title{Creation of the InputsCrit object for De Lavenne Criterion}
...@@ -14,7 +14,7 @@ Creation of the \code{InputsCrit} object required to the \code{\link{ErrorCrit}} ...@@ -14,7 +14,7 @@ Creation of the \code{InputsCrit} object required to the \code{\link{ErrorCrit}}
\usage{ \usage{
CreateInputsCrit_DeLavenne(FUN_CRIT = ErrorCrit_KGE, CreateInputsCrit_Lavenne(FUN_CRIT = ErrorCrit_KGE,
InputsModel, InputsModel,
RunOptions, RunOptions,
Obs, Obs,
...@@ -55,7 +55,7 @@ CreateInputsCrit_DeLavenne(FUN_CRIT = ErrorCrit_KGE, ...@@ -55,7 +55,7 @@ CreateInputsCrit_DeLavenne(FUN_CRIT = ErrorCrit_KGE,
\value{ \value{
\code{CreateInputsCrit_DeLavenne} returns an object of class \emph{Compo} that is a list of lists such as the one described in \code{\link{CreateInputsCrit}}. \code{CreateInputsCrit_Lavenne} returns an object of class \emph{Compo} that is a list of lists such as the one described in \code{\link{CreateInputsCrit}}.
Items \code{Weights} of the criteria are respectively equal to \code{k} and \code{k * max(0,AprCrit)}. Items \code{Weights} of the criteria are respectively equal to \code{k} and \code{k * max(0,AprCrit)}.
...@@ -70,7 +70,7 @@ The parameters \code{FUN_CRIT}, \code{Obs}, \code{VarObs}, \code{BoolCrit}, \cod ...@@ -70,7 +70,7 @@ The parameters \code{FUN_CRIT}, \code{Obs}, \code{VarObs}, \code{BoolCrit}, \cod
\code{\link{ErrorCrit_RMSE}} cannot be used in a composite criterion since it is not a unitless value. \code{\link{ErrorCrit_RMSE}} cannot be used in a composite criterion since it is not a unitless value.
\code{CreateInputsCrit_DeLavenne} creates a composed criterion in respect with Equations 1 and 2 of de Lavenne et al. (2019). \code{CreateInputsCrit_Lavenne} creates a composed criterion in respect with Equations 1 and 2 of de Lavenne et al. (2019).
} }
...@@ -101,7 +101,7 @@ OutputsModel <- RunModel_GR4J(InputsModel = InputsModel, ...@@ -101,7 +101,7 @@ OutputsModel <- RunModel_GR4J(InputsModel = InputsModel,
AprParamR <- c(X1 = 157, X2 = 0.8, X3 = 100, X4 = 1.5) AprParamR <- c(X1 = 157, X2 = 0.8, X3 = 100, X4 = 1.5)
## Single efficiency criterion: GAPX with a priori parameters ## Single efficiency criterion: GAPX with a priori parameters
IC_DL <- CreateInputsCrit_DeLavenne(InputsModel = InputsModel, IC_DL <- CreateInputsCrit_Lavenne(InputsModel = InputsModel,
RunOptions = RunOptions, RunOptions = RunOptions,
Obs = BasinObs$Qmm[Ind_Run], Obs = BasinObs$Qmm[Ind_Run],
AprParamR = AprParamR) AprParamR = AprParamR)
......
context("CreateInputsCrit_DeLavenne") context("CreateInputsCrit_Lavenne")
data(L0123001) data(L0123001)
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR4J, DatesR = BasinObs$DatesR, InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR4J, DatesR = BasinObs$DatesR,
...@@ -14,7 +14,7 @@ OutputsModel <- RunModel_GR4J(InputsModel = InputsModel, ...@@ -14,7 +14,7 @@ OutputsModel <- RunModel_GR4J(InputsModel = InputsModel,
RunOptions = RunOptions, Param = Param) RunOptions = RunOptions, Param = Param)
k <- 0.15 k <- 0.15
IC_DL <- CreateInputsCrit_DeLavenne(FUN_CRIT = ErrorCrit_KGE, IC_DL <- CreateInputsCrit_Lavenne(FUN_CRIT = ErrorCrit_KGE,
InputsModel = InputsModel, InputsModel = InputsModel,
RunOptions = RunOptions, RunOptions = RunOptions,
Obs = BasinObs$Qmm[Ind_Run], Obs = BasinObs$Qmm[Ind_Run],
...@@ -40,7 +40,7 @@ test_that("should return KGE*(1-k)+k with parameters matching a priori parameter ...@@ -40,7 +40,7 @@ test_that("should return KGE*(1-k)+k with parameters matching a priori parameter
test_that("should return proper error if mismatch number of parameters", { test_that("should return proper error if mismatch number of parameters", {
expect_error( expect_error(
CreateInputsCrit_DeLavenne(FUN_CRIT = ErrorCrit_KGE, CreateInputsCrit_Lavenne(FUN_CRIT = ErrorCrit_KGE,
InputsModel = InputsModel, InputsModel = InputsModel,
RunOptions = RunOptions, RunOptions = RunOptions,
Obs = BasinObs$Qmm[Ind_Run], Obs = BasinObs$Qmm[Ind_Run],
......
...@@ -201,10 +201,10 @@ ParamDownTheo <- c(Velocity, OutputsCalibUp$ParamFinalR) ...@@ -201,10 +201,10 @@ ParamDownTheo <- c(Velocity, OutputsCalibUp$ParamFinalR)
The De Lavenne criterion is initialised with the a priori parameter set and the value of the KGE of the upstream basin. The De Lavenne criterion is initialised with the a priori parameter set and the value of the KGE of the upstream basin.
```{r} ```{r}
IC_DeLavenne <- CreateInputsCrit_DeLavenne(InputsModel = InputsModelDown2, IC_Lavenne <- CreateInputsCrit_Lavenne(InputsModel = InputsModelDown2,
RunOptions = RunOptionsDown, RunOptions = RunOptionsDown,
Obs = QObsDown[Ind_Run], Obs = QObsDown[Ind_Run],
AprParamR = ParamDownTheo, AprParamR = ParamDownTheo,
AprCrit = OutputsCalibUp$CritFinal) AprCrit = OutputsCalibUp$CritFinal)
``` ```
...@@ -213,7 +213,7 @@ The De Lavenne criterion is used instead of the KGE for calibration with regular ...@@ -213,7 +213,7 @@ The De Lavenne criterion is used instead of the KGE for calibration with regular
```{r} ```{r}
OutputsCalibDown3 <- Calibration_Michel(InputsModel = InputsModelDown2, OutputsCalibDown3 <- Calibration_Michel(InputsModel = InputsModelDown2,
RunOptions = RunOptionsDown, RunOptions = RunOptionsDown,
InputsCrit = IC_DeLavenne, InputsCrit = IC_Lavenne,
CalibOptions = CalibOptionsDown, CalibOptions = CalibOptionsDown,
FUN_MOD = RunModel_GR4J) FUN_MOD = RunModel_GR4J)
``` ```
...@@ -238,7 +238,7 @@ Both calibrations overestimate this parameter: ...@@ -238,7 +238,7 @@ Both calibrations overestimate this parameter:
```{r} ```{r}
mVelocity <- matrix(c(Velocity, mVelocity <- matrix(c(Velocity,
OutputsCalibDown1$ParamFinalR[1], OutputsCalibDown1$ParamFinalR[1],
OutputsCalibDown2$ParamFinalR[1], OutputsCalibDown2$ParamFinalR[1],
OutputsCalibDown3$ParamFinalR[1]), OutputsCalibDown3$ParamFinalR[1]),
ncol = 1, ncol = 1,
dimnames = list(c("theoretical", dimnames = list(c("theoretical",
...@@ -251,7 +251,7 @@ knitr::kable(mVelocity) ...@@ -251,7 +251,7 @@ knitr::kable(mVelocity)
## Value of the performance criteria with theoretical calibration ## Value of the performance criteria with theoretical calibration
Theoretically, the parameters of the downstream GR4J model should be the same as the upstream one with the velocity as extra parameter : Theoretically, the parameters of the downstream GR4J model should be the same as the upstream one with the velocity as extra parameter :
```{r} ```{r}
OutputsModelDownTheo <- RunModel(InputsModel = InputsModelDown2, OutputsModelDownTheo <- RunModel(InputsModel = InputsModelDown2,
......
Supports Markdown
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