Commit b13fefc2 authored by unknown's avatar unknown
Browse files

v1.0.9.48 Param_Sets_GR4J example modified

parent 576bacdc
Package: airGR Package: airGR
Type: Package Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.0.9.47 Version: 1.0.9.48
Date: 2017-09-13 Date: 2017-09-13
Authors@R: c( Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl")), person("Laurent", "Coron", role = c("aut", "trl")),
......
...@@ -19,10 +19,10 @@ ...@@ -19,10 +19,10 @@
\description{ \description{
These parameter sets can be used for the grid-screening calibration procedure (i.e. first step in \code{\link{Calibration_Michel}}). These parameter sets can be used as an alternative for the grid-screening calibration procedure (i.e. first step in \code{\link{Calibration_Michel}}).
Please note that the given GR4J X4u variable does not correspond to the actual GR4J X4 parameter. Please note that the given GR4J X4u variable does not correspond to the actual GR4J X4 parameter. As explained in Andréassian et al. (2014; section 2.1), the given GR4J X4u value has to be adjusted (rescaled) using catchment area (S) [km2] as follows: {X4 = X4u / 5.995 * S^0.3}.
As explained in Andréassian \emph{et al.} (2014; section 2.1), the given GR4J X4u value has to be adjusted (rescaled) using catchment area (S) [km2] as follows: {X4 = X4u * S^0.3}. 3 (please note that the formula is erroneous in the publication). Please, see the example below. \cr
Please, see the example below. As shown in Andréassian et al. (2014; figure 4), only using these parameters sets as the tested values for calibration is more efficient than a classical calibration when the amount of data is low (6 months or less).
} }
...@@ -48,8 +48,8 @@ data(L0123001) ...@@ -48,8 +48,8 @@ data(L0123001)
data(Param_Sets_GR4J) data(Param_Sets_GR4J)
str(Param_Sets_GR4J) str(Param_Sets_GR4J)
## generalist parameter sets with real GR4J X4 ## computation of the real GR4J X4
Param_Sets_GR4J$X4 <- Param_Sets_GR4J$X4u * BasinInfo$BasinArea^0.3 Param_Sets_GR4J$X4 <- Param_Sets_GR4J$X4u / 5.995 * BasinInfo$BasinArea^0.3
Param_Sets_GR4J$X4u <- NULL Param_Sets_GR4J$X4u <- NULL
Param_Sets_GR4J <- as.matrix(Param_Sets_GR4J) Param_Sets_GR4J <- as.matrix(Param_Sets_GR4J)
...@@ -57,33 +57,47 @@ Param_Sets_GR4J <- as.matrix(Param_Sets_GR4J) ...@@ -57,33 +57,47 @@ Param_Sets_GR4J <- as.matrix(Param_Sets_GR4J)
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR4J, DatesR = BasinObs$DatesR, InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR4J, DatesR = BasinObs$DatesR,
Precip = BasinObs$P, PotEvap = BasinObs$E) Precip = BasinObs$P, PotEvap = BasinObs$E)
## run period selection ## ---- calibration step
Ind_Run <- seq(which(format(BasinObs$DatesR, format = "\%d/\%m/\%Y \%H:\%M")=="01/01/1990 00:00"),
which(format(BasinObs$DatesR, format = "\%d/\%m/\%Y \%H:\%M")=="31/12/1999 00:00")) ## short calibration period selection (< 6 months)
Ind_Cal <- seq(which(format(BasinObs$DatesR, format = "\%d/\%m/\%Y \%H:\%M")=="01/01/1990 00:00"),
which(format(BasinObs$DatesR, format = "\%d/\%m/\%Y \%H:\%M")=="01/03/1990 00:00"))
## preparation of the RunOptions object for the calibration period
RunOptions_Cal <- CreateRunOptions(FUN_MOD = RunModel_GR4J,
InputsModel = InputsModel, IndPeriod_Run = Ind_Cal)
## simulation and efficiency criterion (Nash-Sutcliffe Efficiency) with all generalist parameter sets on the calibration period
OutputsCrit_Loop <- apply(Param_Sets_GR4J, 1, function(Param) {
OutputsModel_Cal <- RunModel_GR4J(InputsModel = InputsModel, RunOptions = RunOptions_Cal, Param = Param)
InputsCrit <- CreateInputsCrit(FUN_CRIT = ErrorCrit_NSE, InputsModel = InputsModel,
RunOptions = RunOptions_Cal, Qobs = BasinObs$Qmm[Ind_Cal])
OutputsCrit <- ErrorCrit_NSE(InputsCrit = InputsCrit, OutputsModel = OutputsModel_Cal)
return(OutputsCrit$CritValue)
})
## preparation of RunOptions object ## best parameter set
RunOptions <- CreateRunOptions(FUN_MOD = RunModel_GR4J, Param_Best <- unlist(Param_Sets_GR4J[which.max(OutputsCrit_Loop), ])
InputsModel = InputsModel, IndPeriod_Run = Ind_Run)
## calibration criterion: preparation of the InputsCrit object
InputsCrit <- CreateInputsCrit(FUN_CRIT = ErrorCrit_NSE, InputsModel = InputsModel,
RunOptions = RunOptions, Qobs = BasinObs$Qmm[Ind_Run])
## preparation of CalibOptions object using the generalist parameter sets as starting point ## ---- validation step
CalibOptions <- CreateCalibOptions(FUN_MOD = RunModel_GR4J, FUN_CALIB = Calibration_Michel,
StartParamList = Param_Sets_GR4J) ## validation period selection
Ind_Val <- seq(which(format(BasinObs$DatesR, format = "\%d/\%m/\%Y \%H:\%M")=="01/01/1991 00:00"),
which(format(BasinObs$DatesR, format = "\%d/\%m/\%Y \%H:\%M")=="31/12/1999 00:00"))
## preparation of the RunOptions object for the validation period
RunOptions_Val <- CreateRunOptions(FUN_MOD = RunModel_GR4J,
InputsModel = InputsModel, IndPeriod_Run = Ind_Val)
## calibration ## simulation with the best parameter set on the validation period
OutputsCalib <- Calibration(InputsModel = InputsModel, RunOptions = RunOptions, OutputsModel_Val <- RunModel_GR4J(InputsModel = InputsModel, RunOptions = RunOptions_Val, Param = Param_Best)
InputsCrit = InputsCrit, CalibOptions = CalibOptions,
FUN_MOD = RunModel_GR4J, FUN_CRIT = ErrorCrit_NSE,
FUN_CALIB = Calibration_Michel)
## simulation ## results preview of the simulation with the best parameter set on the validation period
Param <- OutputsCalib$ParamFinalR plot(OutputsModel_Val, Qobs = BasinObs$Qmm[Ind_Val])
OutputsModel <- RunModel(InputsModel = InputsModel, RunOptions = RunOptions,
Param = Param, FUN = RunModel_GR4J)
## results preview ## efficiency criterion (Nash-Sutcliffe Efficiency) on the validation period
plot(OutputsModel, Qobs = BasinObs$Qmm[Ind_Run]) InputsCrit_Val <- CreateInputsCrit(FUN_CRIT = ErrorCrit_NSE, InputsModel = InputsModel,
RunOptions = RunOptions_Val, Qobs = BasinObs$Qmm[Ind_Val])
OutputsCrit_Val <- ErrorCrit_NSE(InputsCrit = InputsCrit_Val, OutputsModel = OutputsModel_Val)
} }
\ No newline at end of file
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