This function estimate twilight (i.e., datetime of sunrise and sunset) by searching for the first
and last light of the day which is defined by the light exceeds or
falls below the light threshold twl_thr
.
Arguments
- tag
a GeoPressureR
tag
object- twl_thr
Light threshold that defines twilight. By default (
NULL
), it uses the smallest value of light (i.e, first and last light of day).- twl_offset
Shift of the middle of the night compared to 00:00 UTC (in hours). If not provided, it uses the middle of all nights.
- transform_light
logical to use a log transformation of light
Value
a tag
list containing a new data.frame twilight
with columns:
twilight
(date-time of twilight)rise
(logical) indicating sunrise (TRUE
) or sunset (FALSE
).stap_id
ifstap_id
is present inlight
.
See also
GeoPressureManual , TwGeos::findTwilights()
Other geolight:
geolight_map()
,
twilight_label_read()
,
twilight_label_write()
Examples
withr::with_dir(system.file("extdata", package = "GeoPressureR"), {
tag <- tag_create("18LX", quiet = TRUE) |> tag_label(quiet = TRUE)
})
# Create twilight data.frame
tag <- twilight_create(tag)
str(tag$twilight)
#> 'data.frame': 28 obs. of 3 variables:
#> $ twilight: POSIXct, format: "2017-07-27 03:05:00" "2017-07-27 18:30:00" ...
#> $ rise : logi TRUE FALSE TRUE FALSE TRUE FALSE ...
#> $ stap_id : num 1 1 1 1 1 1 1 1 1 1 ...
plot(tag, type = "twilight")