Skip to contents

Calculation of Maximum daily flow per year.

Usage

calcQJXA(x, ...)

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

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

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

Arguments

x

POSIXt dates, or data.frame with a first column with dates, or OutputsModel produced by airGR::RunModel

...

for S3 method compability

threshold

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

flows

numeric flows in l/s for use with x as a POSIXt

Value

A vector of numeric for x POSIXt or OutputsModel and a data.frame for x data.frame

Examples

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

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

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

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

#! define hydrological years
QJXA <- calcQJXA(x = dates, flows = flows)

#! --- example with the output of the function "RunModel" in the package airGR.
#! --- QJXA is 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)

QJXA <- calcQJXA(x = OutputsModel)