Skip to contents

Compute, for each twilight of tag, the solar zenith angle at the position of its stationary period on path, and flag the twilights outside the calibrated zenith range. These are the twilights that make a stationary period orange in plot_twl_calib(tag, path), and the ones whose light likelihood is low at that position.

Usage

twilight_check(tag, path, warning_ci = 0.95)

Arguments

tag

a GeoPressureR tag object with twilights and a twilight calibration (see geolight_map_calibrate()).

path

a GeoPressureR path or pressurepath data.frame with stap_id, lat and lon. The first row of each stap_id is used.

warning_ci

Width of the symmetric confidence interval used to flag staps with twilights outside the calibrated range (e.g., 0.95 for 2.5%/97.5%).

Value

tag$twilight with the columns

  • include: FALSE for discarded or incomplete twilights.

  • zenith: solar zenith angle at the position of the stationary period (degrees), NA during flights or when the stationary period has no position.

  • outside_ci: zenith is outside the warning_ci interval of the calibrated density.

The interval (degrees) is returned in the attribute zenith_ci.

Examples

withr::with_dir(system.file("extdata", package = "GeoPressureR"), {
  tag <- tag_create("18LX", quiet = TRUE) |>
    tag_label(quiet = TRUE) |>
    tag_set_map(
      extent = c(-16, 23, 0, 50),
      scale = 4,
      known = data.frame(stap_id = 1, known_lon = 17.05, known_lat = 48.9)
    ) |>
    twilight_create() |>
    twilight_label_read() |>
    geolight_map_calibrate(quiet = TRUE)
})

path <- data.frame(stap_id = tag$stap$stap_id, lat = 48.9, lon = 17.05)
twl <- twilight_check(tag, path)
twl[which(twl$outside_ci & twl$include), ]
#>               twilight  rise stap_id label include   zenith outside_ci
#> 24 2017-08-05 03:30:00  TRUE       2     2    TRUE 90.52907       TRUE
#> 25 2017-08-06 03:35:00  TRUE       3     3    TRUE 89.82708       TRUE
#> 26 2017-08-07 03:40:00  TRUE       4     4    TRUE 89.36955       TRUE
#> 12 2017-08-07 18:15:00 FALSE       4     4    TRUE 89.46993       TRUE
#> 27 2017-08-08 03:55:00  TRUE       5     5    TRUE 87.50355       TRUE
#> 28 2017-08-09 04:10:00  TRUE       5     5    TRUE 85.49019       TRUE
#> 14 2017-08-09 18:15:00 FALSE       5     5    TRUE 89.88499       TRUE