ErrorCrit_NSE: Error criterion based on the NSE formula

View source: R/ErrorCrit_NSE.R

ErrorCrit_NSER Documentation

Error criterion based on the NSE formula

Description

Function which computes an error criterion based on the NSE formula proposed by Nash & Sutcliffe (1970).

Usage

ErrorCrit_NSE(InputsCrit, OutputsModel, warnings = TRUE, verbose = TRUE)

Arguments

InputsCrit

[object of class InputsCrit] see CreateInputsCrit for details

OutputsModel

[object of class OutputsModel] see RunModel_GR4J or RunModel_CemaNeigeGR4J for details

warnings

(optional) [boolean] boolean indicating if the warning messages are shown, default = TRUE

verbose

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

Details

In addition to the criterion value, the function outputs include a multiplier (-1 or +1) which allows the use of the function for model calibration: the product CritValue \times Multiplier is the criterion to be minimised (Multiplier = -1 for NSE).

Value

[list] list containing the function outputs organised as follows:

$CritValue [numeric] value of the criterion
$CritName [character] name of the criterion
$CritBestValue [numeric] theoretical best criterion value
$Multiplier [numeric] integer indicating whether the criterion is indeed an error (+1) or an efficiency (-1)
$Ind_notcomputed [numeric] indices of the time steps where InputsCrit$BoolCrit = FALSE or no data is available

Author(s)

Laurent Coron, Olivier Delaigue

References

Nash, J. E. and Sutcliffe, J. V. (1970). River flow forecasting through conceptual models. Part 1 - A discussion of principles. Journal of Hydrology, 10(3), 282-290, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/0022-1694(70)90255-6")}.

See Also

ErrorCrit_RMSE, ErrorCrit_KGE, ErrorCrit_KGE2

Examples

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 = RunModel_GR4J)

## 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)

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

## efficiency criterion: Kling-Gupta Efficiency above a threshold (quant. 75 %)
BoolCrit <- BasinObs$Qmm[Ind_Run] >= quantile(BasinObs$Qmm[Ind_Run], 0.75, na.rm = TRUE)
InputsCrit <- CreateInputsCrit(FUN_CRIT = ErrorCrit_NSE, InputsModel = InputsModel,
                               RunOptions = RunOptions, Obs = BasinObs$Qmm[Ind_Run],
                               BoolCrit = BoolCrit)
OutputsCrit <- ErrorCrit_NSE(InputsCrit = InputsCrit, OutputsModel = OutputsModel)

airGR documentation built on Oct. 26, 2023, 9:07 a.m.