Learn R Programming

WES (version 1.0.0)

get_esi_data: Get Evaporative Stress Index (ESI) data

Description

This function takes information of where and when a set of environmental samples were collected and retrieves the Evaporative Stress Index (ESI) for those locations and times. For more information about ESI, see description HERE. Data come from the Climate Hazards Center InfraRed Precipitation with Station data (CHIRPS) via the chirps R package. Additionally, the optional intervals argument specifies a set of intervals over which the function will calculate the average ESI for the previous X number of days for each location.

Usage

get_esi_data(lon, lat, dates, intervals = NULL)

Value

data.frame

Arguments

lon

A numeric vector giving the longitude of the sampling sites in Decimal Degrees.

lat

A numeric vector giving the latitude of the sampling sites in Decimal Degrees.

dates

A character or date vector of dates giving the date when each sample was collected (format is YYYY-MM-DD)

intervals

An integer vector giving a set of time intervals over which to calculate the average ESI. Default is NULL where the interval is 0 (returns the ESI value at time t). If intervals=3 then the average ESI over the preceding 3 days is returned.

Examples

Run this code
# \donttest{

tmp <- get_esi_data(lon = c(-54.9857, -52.9857),
                    lat = c(-5.9094, -25.8756),
                    dates = c("2020-06-01", "2020-10-31"),
                    intervals = c(5,10,20))

head(tmp)

# }

Run the code above in your browser using DataLab