Skip to contents

TerraClimate is a monthly climate dataset for global terrestrial surfaces from 1958-2021. This function enables you to extract climate variables from the hosting server provided by the Idaho University for a given coordinate(s) without a need to download the whole raster files in the netCDF format (~100MB per variable for each year) and provide them in a standard data frame format ready to use in your code. It also calculates the bioclimatic variables using the calc_biovars function derivative from the dismo R package.

TerraClimate vs. WorldClim

  • 1958-2021 vs. 1970-2000

  • 14 vs. 7 climate variables

  • ~4 km vs. ~1 km spatial resolution

  • need to calculate vs. pre-calculated 19 bioclimatic variables

Usage

get_terraclimate(
  lat,
  lon,
  from = "1958-01-01",
  to = "2022-12-31",
  clim_vars = NULL,
  month_mask = NULL,
  offline = FALSE,
  data_path = "./data/"
)

Arguments

lat

Vector of Latitude(s) in decimal degree format.

lon

Vector of Longitude(s) in decimal degree format.

from

Start date as a string in the 'YYYY-MM-DD' format.

to

End date as a string in the 'YYYY-MM-DD' format.

clim_vars

List of all climate variables to be imported. Valid list includes: aet, def, pet, ppt, q, soil, srad, swe, tmax, tmin, vap, ws, vpd, and PDSI. Default is NULL for all.

month_mask

A list of all months of interest (e.g., planting season: c(10:12,1:5)). Default is NULL for all.

offline

Extract TerraClimate data from downloaded netCDF files (default is FALSE)

data_path

String contains the directory path where downloaded netCDF files exists (default is './data/')

Value

A list of two data.frame(s) for each pair of coordinates:

  • climate: includes the climate variables (reference).

  • biovars: includes the calculated bioclimatic variables (reference).

References

Abatzoglou, J., Dobrowski, S., Parks, S. et al. TerraClimate, a high-resolution global dataset of monthly climate and climatic water balance from 1958-2015. Sci Data 5, 170191 (2018). doi:10.1038/sdata.2017.191

See also

Author

Khaled Al-Shamaa, k.el-shamaa@cgiar.org

Examples

if (interactive()) {
  # data <- get_terraclimate(36.016, 36.943, 
  #                          '1979-09-01', '2012-06-30', 
  #                          c('ppt', 'tmin', 'tmax'), c(10:12,1:5))
  data <- get_terraclimate(36.016, 36.943, '1979-09-01', '2012-06-30')

  View(data$climate[[1]])

  View(data$biovars[[1]])
}