temperature {climatrends} | R Documentation |
Temperature indices
Description
Methods to compute temperature indices over a time series
Usage
temperature(object, ...)
## Default S3 method:
temperature(object, tmin, ..., timeseries = FALSE)
## S3 method for class 'data.frame'
temperature(object, day.one, span = NULL, ..., timeseries = FALSE)
## S3 method for class 'array'
temperature(object, day.one, span = NULL, ..., timeseries = FALSE)
## S3 method for class 'sf'
temperature(
object,
day.one,
span = NULL,
...,
timeseries = FALSE,
as.sf = TRUE
)
Arguments
object |
a numeric vector with the maximum temperature,
or a data.frame with geographical coordinates (lonlat),
or an object of class |
... |
additional arguments passed to methods. See details |
tmin |
a numeric vector with the minimum temperature |
timeseries |
logical, |
day.one |
a vector of class |
span |
an integer or a vector with integers (optional if last.day is given) for the length of the time series to be captured |
as.sf |
logical, to return an object of class 'sf' |
Details
Additional arguments:
intervals
: an integer (no lower than 5), for the days intervals when
timeseries = TRUE
last.day
: optional to span, an object of class Date
or
any other object that can be coerced to Date
(e.g. integer, character
YYYY-MM-DD) for the last day of the time series. For data.frame
, array
and sf
methods
dates
: a character (or Date or numeric) vector for the dates of tmax and tmin
in the default
method
data.from
: character for the source of remote data. Current remote source
is: 'nasapower'
pars
: character vector for the temperature data to be fetched. If
data.from
is 'nasapower', the temperature can be adjusted to 2 m, the default,
c("T2M_MAX", "T2M_MIN") or 10 m c("T10M_MAX", "T10M_MIN")
days.before
: optional, an integer for the number of days before
day.one to be included in the timespan.
# S3 Methods
The array
method assumes that object contains climate data available
in your R section; this requires an array with two dimensions, 1st dimension
contains the day temperature and 2nd dimension the night temperature,
see help("temp_dat", package = "climatrends") for an example on input structure.
The data.frame
and the sf
methods assumes that the climate data
will be fetched from a remote (cloud) source that be adjusted using the argument
data.from.
When timeseries = TRUE, an id is created, which is the index for the rownames of the inputted object.
Value
A dataframe with temperature indices:
maxDT |
maximun day temperature (degree Celsius) |
minDT |
minimum day temperature (degree Celsius) |
maxNT |
maximun night temperature (degree Celsius) |
minNT |
minimum night temperature (degree Celsius) |
DTR |
diurnal temperature range (mean difference between DT and NT (degree Celsius)) |
SU |
summer days, number of days with maximum temperature > 30 (degree Celsius) |
TR |
tropical nights, number of nights with maximum temperature > 25 (degree Celsius) |
CFD |
consecutive frosty days, number of days with temperature bellow 0 degree Celsius |
WSDI |
maximum warm spell duration, consecutive days with temperature > 90th percentile |
CSDI |
maximum cold spell duration, consecutive nights with temperature < 10th percentile |
T10p |
the 10th percentile of night tempeture (degree Celsius) |
T90p |
the 90th percentile of day tempeture (degree Celsius) |
References
Aguilar E., et al. (2005). Journal of Geophysical Research, 110(D23), D23107. doi:10.1029/2005JD006119
See Also
Other temperature functions:
ETo()
,
GDD()
,
crop_sensitive()
Examples
# the default method
data("innlandet", package = "climatrends")
# a single temporal observation
temperature(innlandet$tmax, innlandet$tmin)
# return as timeseries with 30-day intervals
temperature(innlandet$tmax,
innlandet$tmin,
dates = innlandet$dates,
timeseries = TRUE,
intervals = 30)
#####################################################
# array method
data("temp_dat", package = "climatrends")
temperature(temp_dat,
day.one = "2013-10-28",
span = 12)