twilight_create: Estimate twilights from light data

View source: R/twilight_create.R

twilight_createR Documentation

Estimate twilights from light data

Description

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.

Usage

twilight_create(tag, twl_thr = NULL, twl_offset = NULL, transform_light = TRUE)

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 if stap_id is present in light.

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)

plot(tag, type = "twilight")


Rafnuss/GeoPressureR documentation built on April 17, 2025, 12:58 p.m.