Amount of dry/wet days in a time series
dwdays.RdGiven a daily time series (usually precipitation), this function computes the average amount of wet/dry days in each month.
Usage
dwdays(x, ...)
# S3 method for default
dwdays(x, thr=0, type="wet", na.rm=TRUE, ... )
# S3 method for data.frame
dwdays(x, thr=0, type="wet", na.rm=TRUE,
dates=1, date.fmt="%Y-%m-%d", verbose=TRUE,...)
# S3 method for matrix
dwdays(x, thr=0, type="wet", na.rm=TRUE,
dates=1, date.fmt="%Y-%m-%d", verbose=TRUE,...)Arguments
- x
zoo, data.frame or matrix object, usually with daily time series of precipitation.
Measurements at several gauging stations can be stored in a data.frame of matrix object, and in that case, each column ofxrepresent the time series measured in each gauging station, and the column names ofxhave to correspond to the ID of each station (starting by a letter).- thr
numeric. Value of daily precipitation used as threshold for classifying a day as dry/wet or not. Days with a precipitation value larger to
thrare classified as wet days, whereas precipitation values lower tothrare classified as dry days.- type
character, indicating if the daily values have to be classified as dry or wet days. It works linked to the values specified in
thr. Valid values are: wet, dry.- na.rm
Logical. Should missing values be removed before counting?
- dates
numeric, factor or Date object indicating how to obtain the dates
Ifdatesis a number (default), it indicates the index of the column inxthat stores the dates
Ifdatesis a factor, it is converted into Date class, using the date format specified bydate.fmt
Ifdatesis already of Date class, the code verifies that the number of days indatesbe equal to the number of element inx- date.fmt
character indicating the format in which the dates are stored in dates, e.g. %Y-%m-%d. See
formatinas.Date.
ONLY required whenclass(dates)=="factor"orclass(dates)=="numeric".- verbose
logical; if TRUE, progress messages are printed
- ...
further arguments passed to or from other methods.
Author
Mauricio Zambrano-Bigiarini, mzb.devel@gmail
Examples
## Loading the SanMartino precipitation data
data(SanMartinoPPts)
x <- SanMartinoPPts
## Average amount of wet days in each month (for this example, this means days
## with precipitation larger than 0.1mm)
dwdays(x, thr=0.1)