CreateInputsModel.Rd 4.95 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{CreateInputsModel}
\alias{CreateInputsModel}
6
7


Delaigue Olivier's avatar
Delaigue Olivier committed
8
\title{Creation of the InputsModel object required to the RunModel functions}
9
10


Delaigue Olivier's avatar
Delaigue Olivier committed
11
\usage{
12
13
CreateInputsModel(FUN_MOD, DatesR, Precip, PrecipScale = TRUE, PotEvap = NULL,
  TempMean = NULL, TempMin = NULL, TempMax = NULL, ZInputs = NULL, HypsoData = NULL,
14
  NLayers = 5, verbose = TRUE)
Delaigue Olivier's avatar
Delaigue Olivier committed
15
}
16
17


Delaigue Olivier's avatar
Delaigue Olivier committed
18
\arguments{
19
\item{FUN_MOD}{[function] hydrological model function (e.g. \code{RunModel_GR4J}, \code{RunModel_CemaNeigeGR4J})}
Delaigue Olivier's avatar
Delaigue Olivier committed
20

21
\item{DatesR}{[POSIXt] vector of dates required to create the GR model and CemaNeige module inputs}
Delaigue Olivier's avatar
Delaigue Olivier committed
22

23
\item{Precip}{[numeric] time series of total precipitation (catchment average) [mm/time step], required to create the GR model and CemaNeige module inputs}
Delaigue Olivier's avatar
Delaigue Olivier committed
24

25
26
\item{PrecipScale}{(optional) [boolean] indicating if the mean of the precipitation interpolated on the elevation layers must be kept or not, required to create CemaNeige module inputs, default = \code{TRUE} (the mean of the precipitation is kept to the original value)}

27
\item{PotEvap}{[numeric] time series of potential evapotranspiration (catchment average) [mm/time step], required to create the GR model inputs}
Delaigue Olivier's avatar
Delaigue Olivier committed
28

29
\item{TempMean}{(optional) [numeric] time series of mean air temperature [°C], required to create the CemaNeige module inputs}
Delaigue Olivier's avatar
Delaigue Olivier committed
30

31
\item{TempMin}{(optional) [numeric] time series of min air temperature [°C], possibly used to create the CemaNeige module inputs}
Delaigue Olivier's avatar
Delaigue Olivier committed
32

33
\item{TempMax}{(optional) [numeric] time series of max air temperature [°C], possibly used to create the CemaNeige module inputs}
Delaigue Olivier's avatar
Delaigue Olivier committed
34

35
\item{ZInputs}{(optional) [numeric] real giving the mean elevation of the Precip and Temp series (before extrapolation) [m], possibly used to create the CemaNeige module inputs}
Delaigue Olivier's avatar
Delaigue Olivier committed
36

37
\item{HypsoData}{(optional) [numeric] vector of 101 reals: min, q01 to q99 and max of catchment elevation distribution [m], if not defined a single elevation is used for CemaNeige}
Delaigue Olivier's avatar
Delaigue Olivier committed
38

39
\item{NLayers}{(optional) [numeric] integer giving the number of elevation layers requested [-], required to create CemaNeige module inputs, default=5}
Delaigue Olivier's avatar
Delaigue Olivier committed
40

41
\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
42
}
43
44


Delaigue Olivier's avatar
Delaigue Olivier committed
45
46
47
48
\value{
[list] object of class \emph{InputsModel} containing the data required to evaluate the model outputs; it can include the following:
         \tabular{ll}{
         \emph{$DatesR              }  \tab   [POSIXlt] vector of dates \cr
49
50
51
         \emph{$Precip              }  \tab   [numeric] time series of total precipitation (catchment average) [mm/time step] \cr
         \emph{$PotEvap             }  \tab   [numeric] time series of potential evapotranspiration (catchment average) [mm/time step], \cr\tab defined if FUN_MOD includes GR4H, GR4J, GR5J, GR6J, GR2M or GR1A \cr \cr
         \emph{$LayerPrecip         }  \tab   [list] list of time series of precipitation (layer average) [mm/time step], \cr\tab defined if  \code{FUN_MOD} includes CemaNeige \cr \cr
52
53
         \emph{$LayerTempMean       }  \tab   [list] list of time series of mean air temperature (layer average) [°C], \cr\tab defined if  \code{FUN_MOD} includes CemaNeige \cr \cr
         \emph{$LayerFracSolidPrecip}  \tab   [list] list of time series of solid precipitation fraction (layer average) [-], \cr\tab defined if  \code{FUN_MOD} includes CemaNeige \cr \cr
Delaigue Olivier's avatar
Delaigue Olivier committed
54
55
         }
}
56
57


Delaigue Olivier's avatar
Delaigue Olivier committed
58
\description{
59
Creation of the \emph{InputsModel} object required to the \code{RunModel*} functions.
Delaigue Olivier's avatar
Delaigue Olivier committed
60
}
61
62


Delaigue Olivier's avatar
Delaigue Olivier committed
63
\details{
64
Users wanting to use \code{FUN_MOD} functions that are not included in 
Delaigue Olivier's avatar
Delaigue Olivier committed
65
66
the package must create their own InputsModel object accordingly.
}
67
68


Delaigue Olivier's avatar
Delaigue Olivier committed
69
\examples{
70
library(airGR)
unknown's avatar
unknown committed
71
72

## loading catchment data
Delaigue Olivier's avatar
Delaigue Olivier committed
73
74
75
data(L0123001)

## preparation of the InputsModel object
76
77
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR4J, DatesR = BasinObs$DatesR, 
                                 Precip = BasinObs$P, PotEvap = BasinObs$E)
Delaigue Olivier's avatar
Delaigue Olivier committed
78
79

## run period selection
80
81
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
82
83

## preparation of the RunOptions object
84
85
RunOptions <- CreateRunOptions(FUN_MOD = RunModel_GR4J,
                               InputsModel = InputsModel, IndPeriod_Run = Ind_Run)
Delaigue Olivier's avatar
Delaigue Olivier committed
86
87

## simulation
88
89
90
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
91
92

## results preview
93
plot(OutputsModel, Qobs = BasinObs$Qmm[Ind_Run])
Delaigue Olivier's avatar
Delaigue Olivier committed
94
95

## efficiency criterion: Nash-Sutcliffe Efficiency
96
97
98
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
99
100

}
101
102


Delaigue Olivier's avatar
Delaigue Olivier committed
103
\author{
104
Laurent Coron
Delaigue Olivier's avatar
Delaigue Olivier committed
105
}
106
107


Delaigue Olivier's avatar
Delaigue Olivier committed
108
\seealso{
109
\code{\link{RunModel}}, \code{\link{CreateRunOptions}}, \code{\link{CreateInputsCrit}}, \code{\link{CreateCalibOptions}}, \code{\link{DataAltiExtrapolation_Valery}}
Delaigue Olivier's avatar
Delaigue Olivier committed
110
111
}