getApi: Calculate the antecedent precipitation index

Description Usage Arguments Details Value Author(s) References Examples

View source: R/getApi.R

Description

The antecedent precipitation index (API) can be used to estimate the moisture conditions of the land surface.

Usage

1
getApi(x, k = 0.9, n = 5, finite = TRUE)

Arguments

x

numeric vector. The precipitation time series used to calculate the API. It is assumed that the time series has a constant frequency and no missing values.

k

real number or numeric vector. The weights to sum up the antecedent precipitation values, see 'Details' below. The elements of k should be in [0,1] for physical consistency.

n

integer. The number of antecedent time steps to consider for the API.

finite

logical. Use a fixed number of previous days (as specified with n), or set an initial API value and recursively calculate the API at time t with the API and precipitation from time t-1?

Details

Value

Numeric vector, i.e. the API time series.

Author(s)

Simon S

References

Kohler, M. A., and R. K. Linsley (1924). "Predicting the runoff from storm rainfall". National Oceanic and Atmospheric Administration Weather Bureau Research Papers No. 34.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## the larger n, the closer are the solutions 
x <- rexp(1000)
api1 <- getApi(x=x,n=10)
api2 <- getApi(x=x,finite=FALSE)

x <- rexp(1000)
api3 <- getApi(x=x,n=300)
api4 <- getApi(x=x,finite=FALSE)

par(mfcol=c(2,1))
plot(x=api1,y=api2)
abline(a=0,b=1,col=2)
plot(x=api3,y=api4)
abline(a=0,b=1,col=2)

## user defined weights
x <- rexp(1000)
k <- 1/(15:1)
api <- getApi(x=x,k=k)

hydro-giub/hydroBE documentation built on Sept. 20, 2019, 9:27 a.m.