airGR (version 1.3.2.23)

CreateInputsModel: Creation of the InputsModel object required to the RunModel functions

Description

Creation of the InputsModel object required to the RunModel* functions.

Usage

CreateInputsModel(FUN_MOD, DatesR, Precip, PrecipScale = TRUE, PotEvap = NULL,
  TempMean = NULL, TempMin = NULL, TempMax = NULL, ZInputs = NULL, HypsoData = NULL,
  NLayers = 5, verbose = TRUE)

Arguments

FUN_MOD

[function] hydrological model function (e.g. RunModel_GR4J, RunModel_CemaNeigeGR4J)

DatesR

[POSIXt] vector of dates required to create the GR model and CemaNeige module inputs

Precip

[numeric] time series of total precipitation (catchment average) [mm/time step], required to create the GR model and CemaNeige module inputs

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 = TRUE (the mean of the precipitation is kept to the original value)

PotEvap

[numeric] time series of potential evapotranspiration (catchment average) [mm/time step], required to create the GR model inputs

TempMean

(optional) [numeric] time series of mean air temperature [<U+00B0>C], required to create the CemaNeige module inputs

TempMin

(optional) [numeric] time series of min air temperature [<U+00B0>C], possibly used to create the CemaNeige module inputs

TempMax

(optional) [numeric] time series of max air temperature [<U+00B0>C], possibly used to create the CemaNeige module inputs

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

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

NLayers

(optional) [numeric] integer giving the number of elevation layers requested [-], required to create CemaNeige module inputs, default=5

verbose

(optional) [boolean] boolean indicating if the function is run in verbose mode or not, default = TRUE

Value

[list] object of class InputsModel containing the data required to evaluate the model outputs; it can include the following:

$DatesR [POSIXlt] vector of dates
$Precip [numeric] time series of total precipitation (catchment average) [mm/time step]
$PotEvap [numeric] time series of potential evapotranspiration (catchment average) [mm/time step],
defined if FUN_MOD includes GR4H, GR4J, GR5J, GR6J, GR2M or GR1A
$LayerPrecip
[list] list of time series of precipitation (layer average) [mm/time step],
defined if FUN_MOD includes CemaNeige
$LayerTempMean [list] list of time series of mean air temperature (layer average) [<U+00B0>C],
defined if FUN_MOD includes CemaNeige
$LayerFracSolidPrecip
[list] list of time series of solid precipitation fraction (layer average) [-],
defined if FUN_MOD includes CemaNeige

Details

Users wanting to use FUN_MOD functions that are not included in the package must create their own InputsModel object accordingly. Please note that if CemaNeige is used, and ZInputs is different than HypsoData, then precipitation and temperature are interpolated with the DataAltiExtrapolation_Valery function.

See Also

RunModel, CreateRunOptions, CreateInputsCrit, CreateCalibOptions, DataAltiExtrapolation_Valery

Examples

Run this code
# NOT RUN {
library(airGR)

## loading catchment data
data(L0123001)

## preparation of the InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR4J, DatesR = BasinObs$DatesR, 
                                 Precip = BasinObs$P, PotEvap = BasinObs$E)

## run period selection
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"))

## preparation of the RunOptions object
RunOptions <- CreateRunOptions(FUN_MOD = RunModel_GR4J,
                               InputsModel = InputsModel, IndPeriod_Run = Ind_Run)

## simulation
Param <- c(X1 = 734.568, X2 = -0.840, X3 = 109.809, X4 = 1.971)
OutputsModel <- RunModel(InputsModel = InputsModel, RunOptions = RunOptions, Param = Param, 
                         FUN_MOD = RunModel_GR4J)

## results preview
plot(OutputsModel, Qobs = BasinObs$Qmm[Ind_Run])

## efficiency criterion: Nash-Sutcliffe Efficiency
InputsCrit  <- CreateInputsCrit(FUN_CRIT = ErrorCrit_NSE, InputsModel = InputsModel, 
                                RunOptions = RunOptions, Obs = BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_NSE(InputsCrit = InputsCrit, OutputsModel = OutputsModel)
# }

Run the code above in your browser using DataLab