Removes poor quality data based on twilight heuristics. Allows for quick screening of data containing "false" twilights.
stk_screen_twl(df, threshold = 1.5, dips = 3, step = 100, filter = FALSE)
A skytrackr data frame.
A twilight threshold (default = 1.5).
The allowed number of interruptions during a daylight profile below the twilight threshold before flagging as a poor quality "suspect" day.
A threshold of the allowed step change in illuminance values between the twilight value and the preceding one. Large jumps and the lack of a smooth transition suggest a false twilight (bird leaving a dark nest site long after or long before dawn or dusk).
Logical if to return data prefiltered, removing all poor quality days or false twilight ones (default = FALSE)
A skytrackr data frame with poor twilight quality days removed and dusk and dawn timings marked (data is returned as a long format, not a wide format).
# set demo values artificially low as a demonstration
library(dplyr)
#>
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#>
#> filter, lag
#> The following objects are masked from ‘package:base’:
#>
#> intersect, setdiff, setequal, union
df <- cc876 |>
mutate(
value = ifelse(
date_time > "2021-08-15 05:00:00" & date_time < "2021-08-15 12:00:00",
0.1,
value)
)
# screen values and remove them (filter = TRUE)
df <- df |> stk_screen_twl(filter = TRUE)