growing.season.length: Flexible GSL function

Description Usage Arguments Details Value See Also Examples

View source: R/climdex.r

Description

This function computes the growing season length (GSL) given the input, which is allowed to vary considerably from the ETCCDI definitions.

Usage

1
2
3
growing.season.length(daily.mean.temp, date.factor, dates, northern.hemisphere,
  min.length = 6, t.thresh = 5, gsl.mode = c("GSL", "GSL_first",
  "GSL_max", "GSL_sum"))

Arguments

daily.mean.temp

Timeseries of daily mean temperature (in degrees C), padded out to end on a year boundary (ie: starts on January 1st of some year, ends on December 31st).

date.factor

Factor of the same length as daily.mean.temp that divides the timeseries up into years of data.

dates

The corresponding series of dates.

northern.hemisphere

Whether the data is from the northern hemisphere.

min.length

The minimum number of days above or below the threshold temperature that defines the start or end of a growing season.

t.thresh

The temperature threshold for being considered part of a growing season (in degrees C).

gsl.mode

The growing season length mode (ETCCDI mode is "GSL").

Details

This function is the function used to implement climdex.gsl. It's designed to be flexible to allow for experimentation and testing of new thresholds and methods.

If you need to use this code for experimentation in the southern hemisphere, you'll need to rip off the climdex.gsl code to rotate the year around so that July 1st is treated as January 1st.

See climdex.gsl for more information on what gsl.mode does.

Value

A vector containing the number of days in the growing season for each year.

See Also

climdex.gsl, climdexInput.csv.

Examples

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

## 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 growing season length in days.
gsl <- growing.season.length(ci@data$tavg, ci@date.factors$annual, ci@dates,
                             ci@northern.hemisphere, gsl.mode="GSL") *
       ci@namasks$annual$tavg

## Print these out for testing purposes.
gsl

Example output

Loading required package: PCICt
1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 
  NA  344   NA   NA  330   NA  283  315  320  339  309  310  317  269  355  324 
1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 
 287   NA   NA  305  330  282  361  270  329   NA   NA  336   NA  338  341  349 
1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 
  NA  349   NA   NA  330  315  360  339  362  319  359   NA  322   NA 

climdex.pcic documentation built on March 26, 2020, 7:17 p.m.