CreateInputsModel.Rd 4.88 KB
Newer Older
Delaigue Olivier's avatar
Delaigue Olivier committed
1
2
3
4
5
\encoding{UTF-8}
\name{CreateInputsModel}
\alias{CreateInputsModel}
\title{Creation of the InputsModel object required to the RunModel functions}
\usage{
6
7
CreateInputsModel(FUN_MOD, DatesR, Precip, PrecipScale = TRUE, PotEvap = NULL,
  TempMean = NULL, TempMin = NULL, TempMax = NULL, ZInputs = NULL, HypsoData = NULL,
8
  NLayers = 5, verbose = TRUE)
Delaigue Olivier's avatar
Delaigue Olivier committed
9
10
}
\arguments{
11
\item{FUN_MOD}{[function] hydrological model function (e.g. \code{RunModel_GR4J}, \code{RunModel_CemaNeigeGR4J})}
Delaigue Olivier's avatar
Delaigue Olivier committed
12

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

\item{Precip}{[numeric] time series of total precipitation (catchment average) [mm], required to create the GR model and CemaNeige module inputs}

17
18
\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)}

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

21
\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
22

23
\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
24

25
\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
26

27
\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
28

29
\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
30

31
\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
32

33
\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
34
35
36
37
38
39
40
}
\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
         \emph{$Precip              }  \tab   [numeric] time series of total precipitation (catchment average) [mm] \cr
         \emph{$PotEvap             }  \tab   [numeric] time series of potential evapotranspiration (catchment average) [mm], \cr\tab defined if FUN_MOD includes GR4H, GR4J, GR5J, GR6J, GR2M or GR1A \cr \cr
41
42
43
         \emph{$LayerPrecip         }  \tab   [list] list of time series of precipitation (layer average) [mm], \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
         \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
44
45
46
47
48
49
         }
}
\description{
Creation of the InputsModel object required to the RunModel functions.
}
\details{
50
Users wanting to use  \code{FUN_MOD} functions that are not included in 
Delaigue Olivier's avatar
Delaigue Olivier committed
51
52
53
the package must create their own InputsModel object accordingly.
}
\examples{
54
library(airGR)
unknown's avatar
unknown committed
55
56

## loading catchment data
Delaigue Olivier's avatar
Delaigue Olivier committed
57
58
59
data(L0123001)

## preparation of the InputsModel object
60
61
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR4J, DatesR = BasinObs$DatesR, 
                                 Precip = BasinObs$P, PotEvap = BasinObs$E)
Delaigue Olivier's avatar
Delaigue Olivier committed
62
63

## run period selection
64
65
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
66
67

## preparation of the RunOptions object
68
69
RunOptions <- CreateRunOptions(FUN_MOD = RunModel_GR4J,
                               InputsModel = InputsModel, IndPeriod_Run = Ind_Run)
Delaigue Olivier's avatar
Delaigue Olivier committed
70
71

## simulation
72
73
74
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
75
76

## results preview
77
plot(OutputsModel, Qobs = BasinObs$Qmm[Ind_Run])
Delaigue Olivier's avatar
Delaigue Olivier committed
78
79

## efficiency criterion: Nash-Sutcliffe Efficiency
80
81
82
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
83
84
85
86
87
88

}
\author{
Laurent Coron (June 2014)
}
\seealso{
89
\code{\link{RunModel}}, \code{\link{CreateRunOptions}}, \code{\link{CreateInputsCrit}}, \code{\link{CreateCalibOptions}}, \code{\link{DataAltiExtrapolation_Valery}}
Delaigue Olivier's avatar
Delaigue Olivier committed
90
91
}