Skip to contents

Calculation of QMNAs (annual minimum of mean monthly flows)

Usage

calcQMNA(x, ...)

# S3 method for data.frame
calcQMNA(x, threshold = 0.8, ...)

# S3 method for OutputsModel
calcQMNA(x, ...)

# S3 method for POSIXt
calcQMNA(x, flows, ...)

Arguments

x

either POSIXt dates, or a data.frame with a first column of POSIXt dates and flows in the other columns, or a airGR::OutputsModel which is an output of airGR::RunModel()

...

Arguments passed to the methods calcQMNA

threshold

numeric minimum ratio of available data in a year or a month to take it into account

flows

numeric flows in l/s

Value

numeric a numeric value of QMNA

Examples

#! load data
data(L0123001, package = "airGR")

#! define vector of flows, time step is the day
flows <- BasinObs$Qls / 1000

#! define vector of dates
dates <- BasinObs$DatesR

#! --- example with two vectors for the dates and the flows

QMNA_Obs <- calcQMNA(x = dates, flows = flows)

#! --- example with the output of the function "RunModel" in the package airGR.
#! --- QMNAs are calculated on simulated flows.

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

## run 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 the RunOptions object
RunOptions <- airGR::CreateRunOptions(FUN_MOD = airGR::RunModel_GR4J,
                               InputsModel = InputsModel,
                               IndPeriod_Run = Ind_Run)
#> Warning: model warm up period not defined: default configuration used
#>   the year preceding the run period is used 

## simulation
Param <- c(257.238, 1.012, 88.235, 2.208)
OutputsModel <- airGR::RunModel_GR4J(InputsModel = InputsModel,
                               RunOptions = RunOptions,
                               Param = Param)

QMNA_GR4J <- calcQMNA(x = OutputsModel)