continuity_ratio: Calculates the continuity ratio of a set of precipitation...

Description Usage Arguments Value Note References Examples

View source: R/continuity_ratio.R

Description

Calculates the continuity ratio of a set of precipitation measured or generated data in several sites as defined by Wilks, 1998 (see reference link)

Usage

1
continuity_ratio(data, lag = 0, valmin = 0.5)

Arguments

data

containing daily precipitation time series for several gauges (one gauge time series per column)

lag

numeric lag (expressed as number of days) used for computation for "cross" continuity ratio and joint probability of prercipitation (no)occurrence.

valmin

threshold precipitation value [mm] for wet/dry day indicator. If precipitation is lower than valmin, day is considered dry. Default is 0.5 mm.

Value

A list containing the following matrices:

continuity_ratio : lag-day lagged continuity ratio ,

occurrence : joint probability of lag-day lagged precipitation occurrence

nooccurrence : joint probability of lag-day lagged no precipitation occurrence.

nooccurrence_occurrence : joint probability of lag-day lagged no precipitation and precipitation occurrence respectively.

occurrence_nooccurrence : joint probability of lag-day lagged precipitation and no precipitation occurrence respectively.

probability_continuity_ratio: lag-day lagged ratio about precipitation probability contitioned to no precipitation/preciitation occurrence in the other site

Note

If lag==0 the function returns the continuity ratio and joint probability as described by Wilks, 1998. Otherwise the precipitation values for each couple of rain gauges are taken with lag-day lag.

References

see the following URL references: http://onlinelibrary.wiley.com/doi/10.1002/joc.2305/abstract and http://www.sciencedirect.com/science/article/pii/S0022169498001863

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
data(trentino)

year_min <- 1961
year_max <- 1990
origin <- paste(year_min,1,1,sep="-")

period <- PRECIPITATION$year>=year_min & PRECIPITATION$year<=year_max
station <- names(PRECIPITATION)[!(names(PRECIPITATION) %in% c("day","month","year"))]
prec_mes <- PRECIPITATION[period,station]  

## removing nonworking stations (e.g. time series with NA)
accepted <- array(TRUE,length(names(prec_mes)))
names(accepted) <- names(prec_mes)
for (it in names(prec_mes)) {
		 accepted[it]  <- (length(which(!is.na(prec_mes[,it])))==length(prec_mes[,it]))
}

prec_mes <- prec_mes[,accepted]
## the dateset is reduced!!! 
prec_mes <- prec_mes[,1:2]

continuity_ratio <-continuity_ratio(data=prec_mes,lag=0,valmin=0.5)
continuity_ratio1 <-continuity_ratio(data=prec_mes,lag=-1,valmin=0.5)

RMAWGEN documentation built on Dec. 12, 2019, 9:07 a.m.