Learn R Programming

climatrends (version 0.1.0)

temperature: Temperature indices

Description

Compute temperature indices over a timespan

Usage

temperature(
  object,
  day.one = NULL,
  span = 150,
  timeseries = FALSE,
  intervals = 5,
  ...
)

Arguments

object

a numeric vector of geographic coordinates (lonlat) or an array with two dimensions containing the temperature data; 1st dimension contains the day temperature and 2nd dimension the night temperature. When lonlat is used, the function makes a call to nasapower::get_power() to fetch and concatenate environmental data from NASA POWER (https://power.larc.nasa.gov/) for the parameters T2M_MAX (Maximum Temperature at 2 m) and T2M_MIN (Minimum Temperature at 2 m)

day.one

a vector of class Date for the starting date to capture the environmental data (YYYY-MM-DD)

span

an integer or a vector with integers for the duration of the timespan to be captured

timeseries

logical, FALSE for a single point time series observation or TRUE for a time series based on intervals

intervals

integer no lower than 5, for the days intervals when timeseries = TRUE

...

additional arguments passed to get_power methods

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

When timeseries = TRUE, an id is created, which is the index for the rownames of the provided object.

References

Aguilar E., et al. (2005). Journal of Geophysical Research, 110(D23), D23107. https://doi.org/10.1029/2005JD006119

Sparks A. H. (2018). Journal of Open Source Software, 3(30), 1035. https://doi.org/10.21105/joss.01035

See Also

Other climatology functions: ETo(), GDD(), rainfall()

Examples

Run this code
# NOT RUN {
# Using local sources
data("modis", package = "climatrends")

day <- as.Date("2013-10-28", format = "%Y-%m-%d")

temperature(modis, 
            day.one = day,
            span = 12)

# }
# NOT RUN {
# Using NASA POWER
library("nasapower")

# random points within bbox(11, 12, 55, 58)
set.seed(123)
lonlat <- data.frame(lon = runif(3, 11, 12),
                     lat = runif(3, 55, 58))

# random dates within 2018-05-15 and 2018-05-2
set.seed(321)
dates <- as.integer(runif(3, 17666, 17670))
dates <- as.Date(dates, origin = "1970-01-01")

# get temperature indices for 40 days after day.one
temperature(lonlat,
            day.one = dates,
            span = 40)

# get temperature indices over a time series
temperature(lonlat,
            day.one = dates,
            span = 40,
            timeseries = TRUE,
            intervals = 5)
# }

Run the code above in your browser using DataLab