View source: R/get_detections.R
get_detection_area_ts | R Documentation |
This function extends get_detection_area_sum
to calculate how the total area sampled by receivers changes through time.
get_detection_area_ts(
xy,
detection_range = 425,
coastline = NULL,
scale = 1/(1000^2),
plot = TRUE,
verbose = TRUE,
cl = NULL,
varlist = NULL,
...
)
xy , detection_range , coastline , scale |
Arguments required to calculate the total area surveyed by receivers (at each time point) via |
plot |
A logical input that defines whether or not to plot a time series of the total area sampled by receivers. |
verbose |
A logical input that defines whether or not to print messages to the console to relay function progress. |
cl , varlist |
(optional) Parallelisation options. |
... |
Additional arguments, passed to |
The function returns a dataframe with, for each date (‘date’) from the time of the first receiver's deployment to the time of the last receiver's retrieval, the number of receivers operational on that date (‘n’) and the total area sampled (‘receiver_area’). If plot = TRUE
, the function also returns a plot of the area sampled by receivers through time.
Edward Lavender
#### Define SpatialPointsDataFrame with receiver locations and deployment dates
proj_wgs84 <- sp::CRS(SRS_string = "EPSG:4326")
proj_utm <- sp::CRS(SRS_string = "EPSG:32629")
xy <- sp::SpatialPoints(
dat_moorings[, c("receiver_long", "receiver_lat")],
proj_wgs84
)
xy <- sp::spTransform(xy, proj_utm)
xy <- sp::SpatialPointsDataFrame(xy, data = dat_moorings)
#### Example (1): Implement function with default arguments
dat <- get_detection_area_ts(xy)
#### Example (2): Adjust detection range, include coastline and use parallel processing
# For areas with complex coastline, this will reduce the speed of the algorithm
# So we will also supply a cluster to improve the computation time.
if (flapper_run_parallel) {
dat <- get_detection_area_ts(xy,
detection_range = 500,
coastline = dat_coast,
cl = parallel::makeCluster(2L),
varlist = "dat_coast"
)
}
#### Example (3) Hide or customise the plot
dat <- get_detection_area_ts(xy, plot = FALSE)
dat <-
get_detection_area_ts(xy,
pretty_axis_args =
list(
axis = list(
list(format = "%b-%y"),
list()
)
),
xlab = "Time (month-year)",
ylab = expression(paste("Area (", m^2, ")")),
type = "l"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.