Learn R Programming

airGR (version 1.0.15.2)

CreateCalibOptions: Creation of the CalibOptions object required but the Calibration functions

Description

Creation of the CalibOptions object required by the Calibration* functions.

Usage

CreateCalibOptions(FUN_MOD, FUN_CALIB = Calibration_Michel,
  FUN_TRANSFO = NULL, FixedParam = NULL,
  SearchRanges = NULL, StartParamList = NULL,
  StartParamDistrib = NULL)

Arguments

FUN_MOD

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

FUN_CALIB

(optional) [function] calibration algorithm function (e.g. Calibration_Michel), default = Calibration_Michel

FUN_TRANSFO

(optional) [function] model parameters transformation function, if the FUN_MOD used is native in the package, FUN_TRANSFO is automatically defined

FixedParam

(optional) [numeric] vector giving the values set for the non-optimised parameter values (NParam columns, 1 line) Example:

NA NA 3.34 ... NA
SearchRanges

(optional) [numeric] matrix giving the ranges of real parameters (NParam columns, 2 lines) Example:

[X1] [X2] [X3] [...] [Xi]
[1,] 0 -1 0 ... 0.0
[2,] 3000 +1 100 ... 3.0
StartParamList

(optional) [numeric] matrix of parameter sets used for grid-screening calibration procedure (values in columns, sets in line) Example:

[X1] [X2] [X3] [...] [Xi]
[set1] 800 -0.7 25 ... 1.0
[set2] 1000 -0.5 22 ... 1.1
[...] ... ... ... ... ...
[set n] 200 -0.3 17 ... 1.0
StartParamDistrib

(optional) [numeric] matrix of parameter values used for grid-screening calibration procedure (values in columns, percentiles in line) Example:

[X1] [X2] [X3] [...] [Xi]
[value1] 800 -0.7 25 ... 1.0
[value2] 1000 NA 50 ... 1.2
[value3] 1200 NA NA ... 1.6

Value

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

$FixedParam [numeric] vector giving the values to allocate to non-optimised parameter values
$SearchRanges [numeric] matrix giving the ranges of raw parameters
$StartParamList [numeric] matrix of parameter sets used for grid-screening calibration procedure
$StartParamDistrib [numeric] matrix of parameter values used for grid-screening calibration procedure

Details

Users wanting to use FUN_MOD, FUN_CALIB or FUN_TRANSFO functions that are not included in the package must create their own CalibOptions object accordingly.

See Also

Calibration, RunModel

Examples

Run this code
# NOT RUN {
library(airGR)

## loading catchment data
data(L0123001)

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

## calibration period selection
Ind_Run <- seq(which(format(BasinObs$DatesR, format = "%d/%m/%Y")=="01/01/1990"), 
               which(format(BasinObs$DatesR, format = "%d/%m/%Y")=="31/12/1999"))

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

## calibration criterion: preparation of the InputsCrit object
InputsCrit <- CreateInputsCrit(FUN_CRIT = ErrorCrit_NSE, InputsModel = InputsModel, 
                               RunOptions = RunOptions, Qobs = BasinObs$Qmm[Ind_Run])

## preparation of CalibOptions object
CalibOptions <- CreateCalibOptions(FUN_MOD = RunModel_GR4J, FUN_CALIB = Calibration_Michel)

## calibration
OutputsCalib <- Calibration(InputsModel = InputsModel, RunOptions = RunOptions,
                            InputsCrit = InputsCrit, CalibOptions = CalibOptions,
                            FUN_MOD = RunModel_GR4J, FUN_CRIT = ErrorCrit_NSE, 
                            FUN_CALIB = Calibration_Michel)

## simulation
Param <- OutputsCalib$ParamFinalR
OutputsModel <- RunModel(InputsModel = InputsModel, RunOptions = RunOptions, 
                         Param = Param, FUN = 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, Qobs = BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_NSE(InputsCrit = InputsCrit, OutputsModel = OutputsModel)

## efficiency criterion: Kling-Gupta Efficiency
InputsCrit  <- CreateInputsCrit(FUN_CRIT = ErrorCrit_KGE, InputsModel = InputsModel, 
                                RunOptions = RunOptions, Qobs = BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_KGE(InputsCrit = InputsCrit, OutputsModel = OutputsModel)

# }

Run the code above in your browser using DataLab