
Compute exact astronomical twilights from a path (positions and dates)
Source: R/path2twilight.R
path2twilight.RdThis function computes 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 returns 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
pathorpressurepathdata.frame- date
a vector of POSIXt datetime for which sunrise and sunset are computed. Be default, uses the range of
path$dateprovided.- 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:
datesame as inputdatetwilightdate-time of twilightriselogical indicating sunrise (TRUE) or sunset (FALSE).stap_idsame aspath$stap_idlatsame aspath$latlonsame aspath$lon
if return_long == FALSE, a data.frame with the same size of date with columns:
datesame as inputdatesunrisedate-time of sunrisesunsetdate-time of sunsetstap_idsame aspath$stap_idlatsame aspath$latlonsame aspath$lon
See also
Other path:
ind2path(),
path2edge(),
path2elevation(),
plot_path(),
tag2path()
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)