RunModel.Rd 2.27 KB
Newer Older
Delaigue Olivier's avatar
Delaigue Olivier committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
\encoding{UTF-8}
\name{RunModel}
\alias{RunModel}
\title{Run with the provided hydrological model function}
\usage{
RunModel(InputsModel, RunOptions, Param, FUN_MOD)
}
\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{Param}{[numeric] vector of model parameters}

\item{FUN_MOD}{[function] hydrological model function (e.g. RunModel_GR4J, RunModel_CemaNeigeGR4J)}
}
\value{
[list] see \code{\link{RunModel_GR4J}} or \code{\link{RunModel_CemaNeigeGR4J}} for details
}
\description{
21
Function which performs a single model run with the provided function over the selected period.
Delaigue Olivier's avatar
Delaigue Olivier committed
22
23
}
\examples{
24
25
## loading catchment data
library(airGR)
Delaigue Olivier's avatar
Delaigue Olivier committed
26
27
28
data(L0123001)

## preparation of the InputsModel object
29
30
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR4J, DatesR = BasinObs$DatesR, 
                                 Precip = BasinObs$P, PotEvap = BasinObs$E)
Delaigue Olivier's avatar
Delaigue Olivier committed
31
32

## run period selection
33
34
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
35
36

## preparation of the RunOptions object
37
38
RunOptions <- CreateRunOptions(FUN_MOD = RunModel_GR4J,
                               InputsModel = InputsModel, IndPeriod_Run = Ind_Run)
Delaigue Olivier's avatar
Delaigue Olivier committed
39
40

## simulation
41
42
43
Param <- c(734.568, -0.840, 109.809, 1.971)
OutputsModel <- RunModel(InputsModel = InputsModel, RunOptions = RunOptions, Param = Param, 
                         FUN_MOD = RunModel_GR4J)
Delaigue Olivier's avatar
Delaigue Olivier committed
44
45

## results preview
46
plot_OutputsModel(OutputsModel = OutputsModel, Qobs = BasinObs$Qmm[Ind_Run])
Delaigue Olivier's avatar
Delaigue Olivier committed
47
48

## efficiency criterion: Nash-Sutcliffe Efficiency
49
50
51
52
InputsCrit  <- CreateInputsCrit(FUN_CRIT = ErrorCrit_NSE, InputsModel = InputsModel, 
                                RunOptions = RunOptions, Qobs = BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_NSE(InputsCrit = InputsCrit, OutputsModel = OutputsModel)
cat(paste("  Crit  ", OutputsCrit$CritName, "  ", round(OutputsCrit$CritValue, 4), "\\n", sep = ""))
Delaigue Olivier's avatar
Delaigue Olivier committed
53
54
55
56
57
58
59
60
61

}
\author{
Laurent Coron (June 2014)
}
\seealso{
\code{\link{RunModel_GR4J}}, \code{\link{RunModel_CemaNeigeGR4J}}, \code{\link{CreateInputsModel}}, \code{\link{CreateRunOptions}}.
}