calc_sun {ARUtools} | R Documentation |
Calculate time to sunrise/sunset
Description
Calculate the sunrise/sunset of each sound file for the day of, the day before and the day after to get the nearest sunrise to the recording. Times are calculated using the 'suncalc' package.
Usage
calc_sun(meta_sites, aru_tz = "local")
Arguments
meta_sites |
(Spatial) Data frame. Recording metadata with added
coordinates. Output of |
aru_tz |
Character. Must be either "local" or a timezone listed in
|
Details
Timezones. To ensure that the sunrise/sunset times are calculated
correctly relative to the time of the recording, we need to know the
timezone of the date/time of the recording. If ARUs were calibrated with a
specific timezone before going into the field, that can be specified by
using, for example, aru_tz = "America/Toronto"
. If on the other hand each
ARU was calibrated to whichever timezone was local when it was deployed use
aru_tz = "local"
. The specific timezone will be calculated individually
based on the longitude and latitude of each recording.
Value
Data frame with metadata and added timezone of recording time (tz
),
and time to sunrise/sunset (t2sr
, t2ss
).
Examples
s <- clean_site_index(example_sites_clean,
name_date = c("date_time_start", "date_time_end")
)
m <- clean_metadata(project_files = example_files) |>
add_sites(s)
calc_sun(m)