Skip to contents

The calculate_covariates() function extracts values at point locations from a SpatRaster or SpatVector object returned from process_covariates(). calculate_covariates() and the underlying source-specific covariate functions have been designed to operate on the processed objects. To avoid errors, do not edit the processed SpatRaster or SpatVector objects before passing to calculate_covariates().

Usage

calculate_covariates(
  covariate = c("modis", "koppen-geiger", "koeppen-geiger", "koppen", "koeppen", "geos",
    "dummies", "gmted", "sedac_groads", "groads", "roads", "ecoregions", "ecoregion",
    "hms", "smoke", "gmted", "narr", "geos", "sedac_population", "population", "nlcd",
    "merra", "merra2", "gridmet", "terraclimate", "tri", "nei"),
  from,
  locs,
  locs_id = "site_id",
  ...
)

Arguments

covariate

character(1). Covariate type.

from

character. Single or multiple from strings.

locs

sf/SpatVector. Unique locations. Should include a unique identifier field named locs_id

locs_id

character(1). Name of unique identifier. Default is "site_id".

...

Arguments passed to each covariate calculation function.

Value

Calculated covariates as a data.frame or SpatVector object

Note

covariate argument value is converted to lowercase.

See also

Author

Insang Song

Examples

## NOTE: Example is wrapped in `\dontrun{}` as function requires a large
##       amount of data which is not included in the package.
if (FALSE) { # \dontrun{
loc <- data.frame(id = "001", lon = -78.90, lat = 35.97)
calculate_covariates(
  covariate = "narr",
  from = narr, # derived from process_covariates() example
  locs = loc,
  locs_id = "id",
  geom = FALSE
)
} # }