Learn R Programming

ClimMobTools (version 0.2-7)

temperature: Temperature indices

Description

Compute temperature indices over a timespan

Usage

temperature(object, day.one = NULL, span = NULL, index = NULL, ...)

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/)

day.one

a vector of class 'Date' for the starting date to capture the environmental data

span

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

index

optional, a character or a vector with characters for the indices to be computed. All indices are given by default

...

additional arguments passed to methods

Value

A dataframe with selected indices. Options are:

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)

Examples

Run this code
# NOT RUN {
library("ClimMobTools")
library("nasapower")

# random geographic locations around bbox(11, 12, 55, 58)
lonlat <- data.frame(lon = runif(10, 11, 12),
                     lat = runif(10, 55, 58))

# random planting dates around 2018-05-15 and 2018-05-20
pdates <- as.integer(runif(10, 17666, 17670))
pdates <- as.Date(pdates, origin = "1970-01-01")

# get temperature indices for the first 40 days
temperature(lonlat,
            day.one = pdates,
            span = 40)
# }

Run the code above in your browser using DataLab