Calibration.Rd 4.11 KB
Newer Older
Delaigue Olivier's avatar
Delaigue Olivier committed
1
\encoding{UTF-8}
2
3


Delaigue Olivier's avatar
Delaigue Olivier committed
4
5
\name{Calibration}
\alias{Calibration}
6
7


8
\title{Calibration algorithm which optimises the error criterion selected as objective function using the provided functions}
9

Delaigue Olivier's avatar
Delaigue Olivier committed
10
11
\usage{
Calibration(InputsModel, RunOptions, InputsCrit, CalibOptions, FUN_MOD,
12
  FUN_CRIT, FUN_CALIB = Calibration_Michel, FUN_TRANSFO = NULL,
13
  verbose = TRUE)
Delaigue Olivier's avatar
Delaigue Olivier committed
14
}
15
16


Delaigue Olivier's avatar
Delaigue Olivier committed
17
18
19
20
21
22
23
24
25
\arguments{
\item{InputsModel}{[object of class \emph{InputsModel}] see \code{\link{CreateInputsModel}} for details}

\item{RunOptions}{[object of class \emph{RunOptions}] see \code{\link{CreateRunOptions}} for details}

\item{InputsCrit}{[object of class \emph{InputsCrit}] see \code{\link{CreateInputsCrit}} for details}

\item{CalibOptions}{[object of class \emph{CalibOptions}] see \code{\link{CreateCalibOptions}} for details}

26
\item{FUN_MOD}{[function] hydrological model function (e.g. \code{\link{RunModel_GR4J}}, \code{\link{RunModel_CemaNeigeGR4J}})}
Delaigue Olivier's avatar
Delaigue Olivier committed
27

28
\item{FUN_CRIT}{[function] error criterion function (e.g. \code{\link{ErrorCrit_RMSE}}, \code{\link{ErrorCrit_NSE}})}
Delaigue Olivier's avatar
Delaigue Olivier committed
29

30
\item{FUN_CALIB}{(optional) [function] calibration algorithm function (e.g. \code{\link{Calibration_Michel}}), \code{default = Calibration_Michel}}
Delaigue Olivier's avatar
Delaigue Olivier committed
31

32
\item{FUN_TRANSFO}{(optional) [function] model parameters transformation function, if the \code{FUN_MOD} used is native in the package \code{FUN_TRANSFO} is automatically defined}
Delaigue Olivier's avatar
Delaigue Olivier committed
33

34
\item{verbose}{(optional) [boolean] boolean indicating if the function is run in verbose mode or not, default = \code{TRUE}}
Delaigue Olivier's avatar
Delaigue Olivier committed
35
}
36
37


Delaigue Olivier's avatar
Delaigue Olivier committed
38
\value{
39
[list] see \code{\link{Calibration_Michel}}
Delaigue Olivier's avatar
Delaigue Olivier committed
40
}
41
42


Delaigue Olivier's avatar
Delaigue Olivier committed
43
\description{
44
Calibration algorithm which optimises the error criterion selected as objective function using the provided functions.
Delaigue Olivier's avatar
Delaigue Olivier committed
45
}
46
47


Delaigue Olivier's avatar
Delaigue Olivier committed
48
\examples{
49
library(airGR)
unknown's avatar
unknown committed
50
51

## loading catchment data
Delaigue Olivier's avatar
Delaigue Olivier committed
52
53
54
data(L0123001)

## preparation of InputsModel object
55
56
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR4J, DatesR = BasinObs$DatesR, 
                                 Precip = BasinObs$P, PotEvap = BasinObs$E)
Delaigue Olivier's avatar
Delaigue Olivier committed
57
58

## calibration period selection
59
60
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"))
Delaigue Olivier's avatar
Delaigue Olivier committed
61
62

## preparation of RunOptions object
63
64
RunOptions <- CreateRunOptions(FUN_MOD = RunModel_GR4J,
                               InputsModel = InputsModel, IndPeriod_Run = Ind_Run)
Delaigue Olivier's avatar
Delaigue Olivier committed
65
66

## calibration criterion: preparation of the InputsCrit object
67
68
InputsCrit <- CreateInputsCrit(FUN_CRIT = ErrorCrit_NSE, InputsModel = InputsModel, 
                               RunOptions = RunOptions, Qobs = BasinObs$Qmm[Ind_Run])
Delaigue Olivier's avatar
Delaigue Olivier committed
69
70

## preparation of CalibOptions object
71
CalibOptions <- CreateCalibOptions(FUN_MOD = RunModel_GR4J, FUN_CALIB = Calibration_Michel)
Delaigue Olivier's avatar
Delaigue Olivier committed
72
73

## calibration
74
75
76
77
OutputsCalib <- Calibration(InputsModel = InputsModel, RunOptions = RunOptions,
                            InputsCrit = InputsCrit,  CalibOptions = CalibOptions,
                            FUN_MOD = RunModel_GR4J, FUN_CRIT = ErrorCrit_NSE, 
                            FUN_CALIB = Calibration_Michel)
Delaigue Olivier's avatar
Delaigue Olivier committed
78
79
80

## simulation
Param <- OutputsCalib$ParamFinalR
81
82
OutputsModel <- RunModel(InputsModel = InputsModel, RunOptions = RunOptions, 
                         Param = Param, FUN = RunModel_GR4J)
Delaigue Olivier's avatar
Delaigue Olivier committed
83
84

## results preview
85
plot(OutputsModel, Qobs = BasinObs$Qmm[Ind_Run])
Delaigue Olivier's avatar
Delaigue Olivier committed
86
87

## efficiency criterion: Nash-Sutcliffe Efficiency
88
89
90
InputsCrit  <- CreateInputsCrit(FUN_CRIT = ErrorCrit_NSE, InputsModel = InputsModel, 
                                RunOptions = RunOptions, Qobs = BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_NSE(InputsCrit = InputsCrit, OutputsModel = OutputsModel)
Delaigue Olivier's avatar
Delaigue Olivier committed
91
92

## efficiency criterion: Kling-Gupta Efficiency
93
94
95
InputsCrit  <- CreateInputsCrit(FUN_CRIT = ErrorCrit_KGE, InputsModel = InputsModel, 
                                RunOptions = RunOptions, Qobs = BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_KGE(InputsCrit = InputsCrit, OutputsModel = OutputsModel)
Delaigue Olivier's avatar
Delaigue Olivier committed
96
}
97
98


Delaigue Olivier's avatar
Delaigue Olivier committed
99
\author{
100
Laurent Coron
Delaigue Olivier's avatar
Delaigue Olivier committed
101
}
102
103


Delaigue Olivier's avatar
Delaigue Olivier committed
104
\seealso{
105
106
\code{\link{Calibration_Michel}},
         \code{\link{ErrorCrit}}, \code{\link{TransfoParam}},
Delaigue Olivier's avatar
Delaigue Olivier committed
107
         \code{\link{CreateInputsModel}}, \code{\link{CreateRunOptions}}, 
Delaigue Olivier's avatar
Delaigue Olivier committed
108
109
110
         \code{\link{CreateInputsCrit}}, \code{\link{CreateCalibOptions}}.
}