Calibration.Rd 4.03 KB
Newer Older
Delaigue Olivier's avatar
Delaigue Olivier committed
1
2
3
\encoding{UTF-8}
\name{Calibration}
\alias{Calibration}
4
\title{Calibration algorithm which optimises the error criterion selected as objective function using the provided functions}
Delaigue Olivier's avatar
Delaigue Olivier committed
5
6
\usage{
Calibration(InputsModel, RunOptions, InputsCrit, CalibOptions, FUN_MOD,
7
  FUN_CRIT, FUN_CALIB = Calibration_Michel, FUN_TRANSFO = NULL,
8
  verbose = TRUE)
Delaigue Olivier's avatar
Delaigue Olivier committed
9
10
11
12
13
14
15
16
17
18
19
20
21
22
}
\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}

\item{FUN_MOD}{[function] hydrological model function (e.g. RunModel_GR4J, RunModel_CemaNeigeGR4J)}

\item{FUN_CRIT}{[function] error criterion function (e.g. ErrorCrit_RMSE, ErrorCrit_NSE)}

23
\item{FUN_CALIB}{(optional) [function] calibration algorithm function (e.g. Calibration_Michel), default=Calibration_Michel}
Delaigue Olivier's avatar
Delaigue Olivier committed
24
25
26

\item{FUN_TRANSFO}{(optional) [function] model parameters transformation function, if the FUN_MOD used is native in the package FUN_TRANSFO is automatically defined}

27
\item{verbose}{(optional) [boolean] boolean indicating if the function is run in verbose mode or not, default=TRUE}
Delaigue Olivier's avatar
Delaigue Olivier committed
28
29
}
\value{
30
[list] see \code{\link{Calibration_Michel}}
Delaigue Olivier's avatar
Delaigue Olivier committed
31
32
}
\description{
33
Calibration algorithm which optimises the error criterion selected as objective function using the provided functions. \cr
Delaigue Olivier's avatar
Delaigue Olivier committed
34
35
}
\examples{
36
library(airGR)
unknown's avatar
unknown committed
37
38

## loading catchment data
Delaigue Olivier's avatar
Delaigue Olivier committed
39
40
41
data(L0123001)

## preparation of InputsModel object
42
43
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR4J, DatesR = BasinObs$DatesR, 
                                 Precip = BasinObs$P, PotEvap = BasinObs$E)
Delaigue Olivier's avatar
Delaigue Olivier committed
44
45

## calibration period selection
46
47
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
48
49

## preparation of RunOptions object
50
51
RunOptions <- CreateRunOptions(FUN_MOD = RunModel_GR4J,
                               InputsModel = InputsModel, IndPeriod_Run = Ind_Run)
Delaigue Olivier's avatar
Delaigue Olivier committed
52
53

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

## preparation of CalibOptions object
58
CalibOptions <- CreateCalibOptions(FUN_MOD = RunModel_GR4J, FUN_CALIB = Calibration_Michel)
Delaigue Olivier's avatar
Delaigue Olivier committed
59
60

## calibration
61
62
63
64
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
65
66
67

## simulation
Param <- OutputsCalib$ParamFinalR
68
69
OutputsModel <- RunModel(InputsModel = InputsModel, RunOptions = RunOptions, 
                         Param = Param, FUN = RunModel_GR4J)
Delaigue Olivier's avatar
Delaigue Olivier committed
70
71

## results preview
72
plot_OutputsModel(OutputsModel = OutputsModel, Qobs = BasinObs$Qmm[Ind_Run])
Delaigue Olivier's avatar
Delaigue Olivier committed
73
74

## efficiency criterion: Nash-Sutcliffe Efficiency
75
76
77
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
78
79

## efficiency criterion: Kling-Gupta Efficiency
80
81
82
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
83
84
85
86
87
}
\author{
Laurent Coron (June 2014)
}
\seealso{
88
89
\code{\link{Calibration_Michel}},
         \code{\link{ErrorCrit}}, \code{\link{TransfoParam}},
Delaigue Olivier's avatar
Delaigue Olivier committed
90
         \code{\link{CreateInputsModel}}, \code{\link{CreateRunOptions}}, 
Delaigue Olivier's avatar
Delaigue Olivier committed
91
92
93
         \code{\link{CreateInputsCrit}}, \code{\link{CreateCalibOptions}}.
}