PrepGR {airGRteaching}R Documentation

Creation of the inputs required to run the CalGR and SimGR functions

Description

Creation of the inputs required to run the CalGR and SimGR functions

Usage

PrepGR(ObsDF = NULL, DatesR = NULL, Precip = NULL, PotEvap = NULL,
       Qobs = NULL, TempMean = NULL,
       ZInputs = NULL, HypsoData = NULL, NLayers = 5,
       HydroModel, CemaNeige = FALSE)

Arguments

ObsDF

(optional) [data.frame] data.frame of dates, total precipitation, potential evapotranspiration, observed discharges and mean air temperature (only if CemaNeige is used) (variables must be in this order; see below for the units)

DatesR

(optional) [POSIXt] vector of dates required to create the GR and CemaNeige (if used) models inputs. Time zone must be defined as "UTC"

Precip

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

PotEvap

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

Qobs

(optional) [numeric] time series of observed discharges [mm/time step]

TempMean

(optional) [numeric] time series of mean air temperature [°C], required to create the CemaNeige model inputs

ZInputs

(optional) [numeric] real giving the mean elevation of the Precip and TempMean series (before extrapolation) [m], possibly used to create the CemaNeige (if used) model 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 (if used)

NLayers

(optional) [numeric] integer giving the number of elevation layers requested [-], required to create CemaNeige (if used) model inputs

HydroModel

[character] name of the hydrological model (must be one of "GR1A", "GR2M", "GR4J", "GR5J", "GR6J", "GR4H" or "GR5H")

CemaNeige

[boolean] option indicating whether CemaNeige should be activated (only available for hourly or daily models, when HydroModel is equal to any of "GR4J", "GR5J", "GR6J", "GR4H" or "GR5H"). See details

Details

If the ObsDF argument is provided, DatesR, Precip, PotEvap, Qobs and TempMean are not necessary, and vice-versa. If one variable is provided in ObsDF and also separately, then only the data included in ObsDF are used.

If the CemaNeige argument is set to TRUE, the default version of CemaNeige is used (i.e. without the Linear Hysteresis, see the details part in CreateRunOptions).

The PrepGR function can be used even if no observed discharges are available. In this case, it is necessary to provide observed discharges time series equal to NA: this means that either the ObsDF observed discharges column or the Qobs arguments, depending on the format of data you provide, must be provided and filled with NAs.

Value

[list] object of class PrepGR containing the data required to evaluate the model outputs:

InputsModel

[list] object of class InputsModel containing the data required to evaluate the model outputs (see: CreateInputsModel outputs)

Qobs

[numeric] time series of observed discharges [mm/time step]

HydroModel

[character] name of the function of the hydrological model used

Author(s)

Olivier Delaigue

See Also

airGRteaching plot and dyplot functions to display static and dynamic plots

airGR CreateInputsModel function

Examples

library(airGRteaching)

## data.frame of observed data
data(L0123001, package = "airGR")
BasinObs2 <- BasinObs[, c("DatesR", "P", "E", "Qmm", "T")]

## Preparation of observed data for modelling when inputs set by using a data.frame
PREP <- PrepGR(ObsDF = BasinObs2, HydroModel = "GR4J", CemaNeige = FALSE)


## Structure of PrepGR object
str(PREP)

## Static plot of observed time series
plot(PREP)

## Dynamic plot of observed time series
dyplot(PREP)


## Preparation of observed data for modelling when inputs set by using independant vectors
PREP <- PrepGR(DatesR = BasinObs2$DatesR, Precip = BasinObs2$P,
               PotEvap = BasinObs2$E, Qobs = BasinObs2$Qmm,
               HydroModel = "GR4J", CemaNeige = FALSE)


## Preparation of observed data for an ungauged catchment (i.e. no observed discharge available)
## Observed discharge set to NA in the Qobs argument
##   or in the 4th column of the data.frame if the ObsDF argument is used
PREP <- PrepGR(DatesR = BasinObs2$DatesR, Precip = BasinObs2$P,
               PotEvap = BasinObs2$E, Qobs = NA,
               HydroModel = "GR4J", CemaNeige = FALSE)

[Package airGRteaching version 0.2.11 Index]