The chirps package provides access to climate datasets produced by the Climate Hazards Center (CHC), University of California Santa Barbara. Data are read directly from the CHC server. The package returns time series for points and polygons, or the original raster products through the terra package.
| Dataset | Variables | Coverage | Period |
|---|---|---|---|
| CHIRPS v3 (default) | Precipitation | 60°S to 60°N | 1981 to near present |
| CHIRPS v2 | Precipitation | 50°S to 50°N | 1981 to December 2026 (retired) |
| CHIRTS-daily | Tmax, Tmin, RHum, HeatIndex | 60°S to 70°N | 1983 to 2016 |
| CHIRTS-ERA5 | Tmax, Tmin | 60°S to 70°N | 1980 to near present |
Climate indices are out of scope for chirps. The climatrends package computes rainfall, temperature, growing degree days, evapotranspiration and crop sensitive indices, and it takes the output of chirps directly.
get_chirps() returns one row per location and day,
ordered by id and date.
library("chirps")
lonlat = data.frame(lon = c(-55.0281, -54.9857, -55.0714),
lat = c(-2.8094, -2.8756, -3.5279))
dates = c("2017-01-01", "2017-01-31")
dat = get_chirps(lonlat, dates)
head(dat)
A single date returns one day.
day1 = get_chirps(lonlat, "2017-01-15")
CHIRPS v3 has two daily products. type = "rnl" (default)
splits the pentadal totals into days with ERA5, and
type = "sat" uses NASA IMERG.
dat_sat = get_chirps(lonlat, dates, type = "sat")
With sf or SpatVector polygons, each day is
summarised over the cells that touch each polygon. The average is the
default, and operation sets another summary (0 max, 1 min,
2 median, 4 sum, 5 average).
data("tapajos", package = "chirps")
rain_mean = get_chirps(tapajos, dates)
rain_total = get_chirps(tapajos, dates, operation = 4)
get_chirts() works the same way for temperature.
CHIRTS-daily covers 1983 to 2016. For other years, use
product = "CHIRTS-ERA5", which covers maximum and minimum
temperature from 1980 to near present.
tmax = get_chirts(lonlat, c("2010-01-01", "2010-01-31"), var = "Tmax")
tmin = get_chirts(lonlat, c("2024-01-01", "2024-01-31"), var = "Tmin",
product = "CHIRTS-ERA5")
With as.matrix = TRUE, chirps returns
one row per location and one column per day, named “YYYY-MM-DD”. This is
the input that climatrends expects.
library("climatrends")
rain = get_chirps(lonlat, dates, as.matrix = TRUE)
rainfall(rain, day.one = dates[1], span = ncol(rain))
# indices in periods of 7 days
rainfall(rain, day.one = dates[1], span = ncol(rain),
timeseries = TRUE, intervals = 7)
Temperature indices take an array with maximum temperature in the first layer and minimum temperature in the second.
dates = c("2024-01-01", "2024-01-31")
tmax = get_chirts(lonlat, dates, var = "Tmax", product = "CHIRTS-ERA5",
as.matrix = TRUE)
tmin = get_chirts(lonlat, dates, var = "Tmin", product = "CHIRTS-ERA5",
as.matrix = TRUE)
temp = array(c(tmax, tmin), dim = c(dim(tmax), 2),
dimnames = list(NULL, colnames(tmax), NULL))
temperature(temp, day.one = dates[1], span = ncol(tmax))
GDD(temp, day.one = dates[1], span = ncol(tmax), tbase = 10)
precip_indices() remains in chirps as a
simple example of how to compute indices from a chirps data
frame. Use climatrends for analysis.
The *_raw() functions return the CHC files as
SpatRaster objects with one layer per day. Use them for
large areas or custom workflows with terra.
library("terra")
dates = c("2017-11-15", "2017-11-20")
v3 = get_chirps_raw(dates = dates, type = "sat")
# CHIRTS-ERA5, 1980 to near present
tmax = get_chirts_raw(dates = dates, var = "Tmax", product = "CHIRTS-ERA5")
# CHIRTS-daily, 1983 to 2016
tx = get_chirts_raw(dates = c("2010-01-01", "2010-01-10"), var = "Tmax")
Once data are loaded as rasters, the terra functions apply.
pts = vect(lonlat, geom = c("lon", "lat"), crs = "EPSG:4326")
rain = extract(v3, pts)
# crop to an area of interest
v3_crop = crop(v3, ext(-56, -54, -4, -2))
# total rainfall in the period
total = app(v3, sum)
# write to disk
writeRaster(v3, "chirps.tif", overwrite = TRUE)
The CHC server is the default and the recommended source.
server = "ClimateSERV" is kept for backward compatibility.
It serves CHIRPS v2 only, which CHC retires after the December 2026
release, averaged over a small buffer around each point, and it is slow
for more than a few points. ClimateSERV support for CHIRPS may be
removed in a future release. get_esi() and
get_imerg() still use ClimateSERV, as these products are
not on the CHC server. Both will be deprecated in a future release.
CHC blocks addresses that request many files that do not exist. chirps checks the first and last file of each request before reading the rest, and stops with a clear error when a file is missing. Keep requests within the period each product covers.
When using data obtained through this package, please cite the original datasets.
Funk, C., Peterson, P., Harrison, L. et al. (2026). The Climate Hazards Center Infrared Precipitation with Stations, Version 3. Scientific Data, 13, 718. https://doi.org/10.1038/s41597-026-07096-4
CHIRTS-ERA5 Data Repository https://doi.org/10.15780/G2F08J (2025). Data was accessed on [DATE].
Funk C., Peterson P., Landsfeld M., … Michaelsen J. (2015). The climate hazards infrared precipitation with stations—a new environmental record for monitoring extremes. Scientific Data, 2, 150066. https://doi.org/10.1038/sdata.2015.66
Verdin, A., Funk, C., Peterson, P., Landsfeld, M., Tuholske, C., and Grace, K. (2020). Development and validation of the CHIRTS-daily quasi-global high-resolution daily temperature data set. Scientific Data, 7, 303. https://doi.org/10.1038/s41597-020-00643-7