This function compute the theoretical twilight (i.e., datetime of sunrise and sunset) at given locations and for specific date.
We use the suntools package for this.
By default (solar_dep=0
), the computation return sunrise and sunset. But, it is also possible
to compute different twilights by setting depression angle value greater than 0 (6° for civil,
12° for nautical and 18° for astronomical).
Arguments
- path
a GeoPressureR
path
orpressurepath
data.frame- date
a vector of POSIXt datetime for which sunrise and sunset are computed. Be default, uses the range of
path$date
provided.- solar_dep
a numerical value representing the solar depression angle used to compute sunrise and sunset.
- return_long
logical defining the format of the data.frame returned. If
TRUE
, returns the long format identical totwilight_create()
. IfFALSE
, return the sunrise and sunset as different column, making the data.frame the same size asdate
.
Value
if return_long == TRUE
, a twilight
data.frame (same as twilight_create()
) with
columns:
date
same as inputdate
twilight
date-time of twilightrise
logical indicating sunrise (TRUE
) or sunset (FALSE
).stap_id
same aspath$stap_id
lat
same aspath$lat
lon
same aspath$lon
if return_long == FALSE
, a data.frame with the same size of date
with columns:
date
same as inputdate
sunrise
date-time of sunrisesunset
date-time of sunsetstap_id
same aspath$stap_id
lat
same aspath$lat
lon
same aspath$lon
Examples
path <- data.frame(
stap_id = c(1, 2, 3, 4, 5),
j = c(1L, 1L, 1L, 1L, 1L),
ind = c(1652L, 1603L, 1505L, 1609L, 1463L),
lat = c(48.9, 47.5, 45.5, 41.5, 37.5),
lon = c(17.05, 16.5, 14.5, 16.5, 13.5),
start = as.POSIXct(
c(1501113450, 1501888650, 1501987950, 1502075550, 1502151150),
tzone = "UTC"
),
end = as.POSIXct(c(1501876050, 1501961250, 1502046750, 1502133150, 1502323050), tzone = "UTC"),
include = c(TRUE, TRUE, TRUE, TRUE, TRUE),
known = c(TRUE, FALSE, FALSE, FALSE, FALSE),
interp = c(FALSE, FALSE, FALSE, FALSE, FALSE)
)
twl <- path2twilight(path)