Learn R Programming

climdex.pcic (version 0.6-2)

climdex.cdd, climdex.cwd: Maximum Consecutive Wet and Dry Days

Description

These functions compute the climdex indices CDD and CWD.

Usage

climdex.cdd(ci, spells.can.span.years=TRUE)
climdex.cwd(ci, spells.can.span.years=TRUE)

Arguments

ci
Object of type climdexInput.
spells.can.span.years
Whether to allow spells of dry/wet days to span years

Value

  • A vector containing the length of the dry or wet spell for each year.

code

spells.can.span.years

Details

These functions take a climdexInput object as input and compute the climdex indices CDD and CWD. These are:
  • CDD:
{Annual maximum length of dry spell, in days.} CWD:{Annual maximum length of wet spell, in days.}

References

http://cccma.seos.uvic.ca/ETCCDMI/list_27_indices.shtml

See Also

climdexInput.raw, climdexInput.csv, spell.length.max.

Examples

Run this code
## Create a climdexInput object from some data already loaded in and
## ready to go.

## Parse the dates into PCICt.
tmax.dates <- as.PCICt(do.call(paste, ec.1018935.tmax[,c("year",
"jday")]), format="%Y %j", cal="gregorian")
tmin.dates <- as.PCICt(do.call(paste, ec.1018935.tmin[,c("year",
"jday")]), format="%Y %j", cal="gregorian")
prec.dates <- as.PCICt(do.call(paste, ec.1018935.prec[,c("year",
"jday")]), format="%Y %j", cal="gregorian")

## Load the data in.
ci <- climdexInput.raw(ec.1018935.tmax$MAX_TEMP,
ec.1018935.tmin$MIN_TEMP, ec.1018935.prec$ONE_DAY_PRECIPITATION,
tmax.dates, tmin.dates, prec.dates, base.range=c(1971, 2000))

## Create an annual timeseries of the number of consecutive days where
## precipitation was less than 1mm/day.
cdd <- climdex.cdd(ci)

## Create an annual timeseries of the number of consecutive days where
## precipitation was at least 1mm/day.
cwd <- climdex.cwd(ci)

## Print these out for testing purposes.
cdd
cwd

Run the code above in your browser using DataLab