calc_sun: Calculate time to sunrise/sunset

View source: R/calc_sun.R

calc_sunR 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.

Usage

calc_sun(meta_sites, aru_tz = "local")

Arguments

meta_sites

(Spatial) Data frame. Recording metadata with added coordinates. Output of 'clean_metadata()' and then 'add_sites()' (with either 'clean_gps()' or 'clean_site_index()').

aru_tz

Character. Must be either "local" or a timezone listed in 'OlsonNames()'. See Details.

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

m <- clean_metadata(project_files = example_files)
s <- clean_site_index(example_sites_clean,
                      col_date = c("date_time_start", "date_time_end"))
m <- add_sites(m, s)
m <- calc_sun(m)


dhope/ARUtools documentation built on Jan. 18, 2024, 5:47 a.m.