View source: R/calculate_covariates.R
sum_edc | R Documentation |
Calculate isotropic Sum of Exponentially Decaying Contributions (SEDC) covariates
sum_edc(
from = NULL,
locs = NULL,
locs_id = NULL,
sedc_bandwidth = NULL,
target_fields = NULL,
geom = FALSE
)
from |
|
locs |
sf/SpatVector(1). Locations where the sum of exponentially decaying contributions are calculated. |
locs_id |
character(1). Name of the unique id field in |
sedc_bandwidth |
numeric(1).
Distance at which the source concentration is reduced to
|
target_fields |
character(varying). Field names in characters. |
geom |
FALSE/"sf"/"terra".. Should the function return with geometry?
Default is |
a data.frame (tibble) or SpatVector object with input field names with
a suffix "_sedc"
where the sums of EDC are stored.
Additional attributes are attached for the EDC information.
'attr(result, "sedc_bandwidth")“: the bandwidth where concentration reduces to approximately five percent
'attr(result, "sedc_threshold")“: the threshold distance at which emission source points are excluded beyond that
The function is originally from
chopin
Distance calculation is done with terra functions internally.
Thus, the function internally converts sf objects in
point_*
arguments to terra.
The threshold should be carefully chosen by users.
Insang Song
messier2012integratingamadeus
\insertRefweb_sedctutorial_packageamadeus
set.seed(101)
ncpath <- system.file("gpkg/nc.gpkg", package = "sf")
nc <- terra::vect(ncpath)
nc <- terra::project(nc, "EPSG:5070")
pnt_locs <- terra::centroids(nc, inside = TRUE)
pnt_locs <- pnt_locs[, "NAME"]
pnt_from <- terra::spatSample(nc, 10L)
pnt_from$pid <- seq(1, 10)
pnt_from <- pnt_from[, "pid"]
pnt_from$val1 <- rgamma(10L, 1, 0.05)
pnt_from$val2 <- rgamma(10L, 2, 1)
vals <- c("val1", "val2")
sum_edc(pnt_locs, pnt_from, "NAME", 1e4, vals)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.