Creation of an InputsModel object for a airGRiwrm network

# S3 method for class 'GRiwrm'
CreateInputsModel(
  x,
  DatesR,
  Precip = NULL,
  PotEvap = NULL,
  Qinf = NULL,
  Qobs = NULL,
  Qmin = NULL,
  Qrelease = NULL,
  PrecipScale = TRUE,
  TempMean = NULL,
  TempMin = NULL,
  TempMax = NULL,
  ZInputs = NULL,
  HypsoData = NULL,
  NLayers = 5,
  IsHyst = FALSE,
  FUN_REGUL = NULL,
  ...
)

Arguments

x

[GRiwrm object] diagram of the semi-distributed model (See CreateGRiwrm)

DatesR

POSIXt vector of dates

Precip

(optional) matrix or data.frame of numeric containing precipitation in [mm per time step]. Column names correspond to node IDs

PotEvap

(optional) matrix or data.frame of numeric containing potential evaporation [mm per time step]. Column names correspond to node IDs

Qinf

(optional) matrix or data.frame of numeric containing observed flows. It must be provided only for nodes of type "Direct injection" and "Diversion". See CreateGRiwrm for details about these node types. Unit is [mm per time step] for nodes with an area, and [m3 per time step] for nodes with area=NA. Column names correspond to node IDs. Negative flows are abstracted from the model and positive flows are injected to the model

Qobs

(deprecated) use Qinf instead

Qmin

(optional) matrix or data.frame of numeric containing minimum flows to let downstream of a node with a Diversion [m3 per time step]. Default is zero. Column names correspond to node IDs

Qrelease

(optional) matrix or data.frame of numeric containing release flows by nodes using the model RunModel_Reservoir [m3 per time step]

PrecipScale

(optional) named vector of logical 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)

TempMean

(optional) matrix or data.frame of time series of mean air temperature [°C], required to create the CemaNeige module inputs

TempMin

(optional) matrix or data.frame of time series of minimum air temperature [°C], possibly used to create the CemaNeige module inputs

TempMax

(optional) matrix or data.frame of time series of maximum air temperature [°C], possibly used to create the CemaNeige module inputs

ZInputs

(optional) named vector of numeric giving the mean elevation of the Precip and Temp series (before extrapolation) [m], possibly used to create the CemaNeige module input

HypsoData

(optional) matrix or data.frame containing 101 numeric rows: min, q01 to q99 and max of catchment elevation distribution [m], if not defined a single elevation is used for CemaNeige

NLayers

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

IsHyst

logical boolean indicating if the hysteresis version of CemaNeige is used. See details of airGR::CreateRunOptions.

FUN_REGUL

List of functions for local regulation (See details)

...

used for compatibility with S3 methods

Value

A GRiwrmInputsModel object which is a list of InputsModel objects created by airGR::CreateInputsModel with one item per modeled sub-catchment.

Details

Meteorological data are needed for the nodes of the network that represent a catchment simulated by a rainfall-runoff model. Instead of airGR::CreateInputsModel that has numeric vector as time series inputs, this function uses matrix or data.frame with the id of the sub-catchment as column names. For single values (ZInputs or NLayers), the function requires named vector with the id of the sub-catchment as name item. If an argument is optional, only the column or the named item has to be provided.

See airGR::CreateInputsModel documentation for details concerning each input.

Number of rows of Precip, PotEvap, Qinf, Qmin, Qrelease, TempMean, TempMin, TempMax must be the same of the length of DatesR (each row corresponds to a time step defined in DatesR).

For examples of use see topics RunModel.GRiwrmInputsModel, RunModel_Reservoir, and RunModel.Supervisor.

For example of use of Direct Injection nodes, see vignettes "V03_Open-loop_influenced_flow" and "V04_Closed-loop_regulated_withdrawal".

For example of use of Diversion nodes, see example in RunModel.GRiwrmInputsModel topic and vignette "V06_Modelling_regulated_diversion".

The FUN_REGUL parameter

FUN_REGUL argument is a named list of function that modify the node InputsModel before sending it to the node's model. This feature is useful for modifying data such as InputsModel$Qdiv or InputsModel$Qrelease giving simulated flows already available from upstream nodes. Each item of the list has a name corresponding to the node on which the function is applied. Each function must follow this interface: function(InputsModel, RunOptions, OutputsModel, env) where the arguments are:

  • InputsModel, the InputsModel object of the current node

  • RunOptions, the RunOptions object of the current node

  • OutputsModel, the GRiwrmOutputsModel object of the upstream and sibling nodes that have been already computed when the computation of the current node occurs

  • env, the environment of the RunModel.GRiwrmInputsModel function

The functions embedded in FUN_REGUL should all return the argument InputsModel after calculation.