CreateInputsModel.Rd 5.1 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
\value{
[list] object of class \emph{InputsModel} containing the data required to evaluate the model outputs; it can include the following:
47
48
49
50
  \tabular{ll}{
    \emph{$DatesR              } \tab [POSIXlt] vector of dates \cr
    \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
51
52
    \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
    \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
53
    \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 
65
66
the package must create their own InputsModel object accordingly. \cr
Please note that if CemaNeige is used, and \code{ZInputs} is different than \code{HypsoData}, then precipitation and temperature are interpolated with the \code{DataAltiExtrapolation_Valery} function.
Delaigue Olivier's avatar
Delaigue Olivier committed
67
}
68
69


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

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

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

## run period selection
81
82
Ind_Run <- seq(which(format(BasinObs$DatesR, format = "\%Y-\%m-\%d")=="1990-01-01"), 
               which(format(BasinObs$DatesR, format = "\%Y-\%m-\%d")=="1999-12-31"))
Delaigue Olivier's avatar
Delaigue Olivier committed
83
84

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

## simulation
89
Param <- c(X1 = 734.568, X2 = -0.840, X3 = 109.809, X4 = 1.971)
90
91
OutputsModel <- RunModel(InputsModel = InputsModel, RunOptions = RunOptions, Param = Param, 
                         FUN_MOD = RunModel_GR4J)
Delaigue Olivier's avatar
Delaigue Olivier committed
92
93

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

## efficiency criterion: Nash-Sutcliffe Efficiency
97
InputsCrit  <- CreateInputsCrit(FUN_CRIT = ErrorCrit_NSE, InputsModel = InputsModel, 
98
                                RunOptions = RunOptions, Obs = BasinObs$Qmm[Ind_Run], varObs = "Q")
99
OutputsCrit <- ErrorCrit_NSE(InputsCrit = InputsCrit, OutputsModel = OutputsModel)
Delaigue Olivier's avatar
Delaigue Olivier committed
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
110
\code{\link{RunModel}}, \code{\link{CreateRunOptions}}, \code{\link{CreateInputsCrit}},
\code{\link{CreateCalibOptions}}, \code{\link{DataAltiExtrapolation_Valery}}
Delaigue Olivier's avatar
Delaigue Olivier committed
111
}