Given a dataframe with longitude and latitude coordinates, extracts rainfall and temperature data from Worldclim. Rasters are downloaded if not provided.
get_climate_vars(data, vars = NULL, output = c("monthly", "annual")) aggregate_clim(cl, funs = c("mean", "quantile"), probs = c(0.05, 0.95)) annualize_clim(cl)
data | Dataframe with columns |
---|---|
vars | Vector of climate variables to be extracted; see Details. |
output | Either 'monthly' (default), or 'annual', in which case the |
cl | Output of |
funs | For |
probs | For |
The climate variables are any of the Worldclim 2.0 variables, including "tmin","tmax","tavg","prec","srad","wind","vapr". Also allowed is 'pet', which will be extracted from the Zomer PET database (see get_zomer_pet
).
# NOT RUN { # First set the path to where WorldClim layers will be downloaded, # and if extracting PET, where you downloaded the Zomer PET database # see ?get_zomer_pet options(worldclimpath="/path/to/worldclim") res <- get_climate_vars(data=data.frame(longitude=150, latitude=-33), vars=c("tmin","bio")) # To extract PET, first set the path to where the layers were downloaded options(zomerpetpath="c:/data/zomer") res <- get_climate_vars(data=data.frame(longitude=150, latitude=-33), vars=c("pet","tavg")) # By default all monthly values are returned, use annualize to get annual # averages (or total in case of MAP): annualize(res) # ... or simply use output="annual" res <- get_climate_vars(data=data.frame(longitude=150, latitude=-33), vars=c("pet","tavg"), output="annual") # }