Skip to contents

This function plots the stacked calibration histogram and fitted density. If a path is provided, it instead plots the solar zenith angle histogram derived from tag$twilight and the path, with the calibration density overlaid.

Usage

plot_twl_calib(x, path = NULL, warning_ci = 0.95, plot_plotly = TRUE, ...)

plot_twl_calib_path(tag, path, warning_ci = 0.9973, plot_plotly = TRUE)

Arguments

x

a GeoPressureR twl_calib object or a tag object with calibration.

path

a GeoPressureR path or pressurepath data.frame. If provided, plot the path-based calibration diagnostic instead of the stacked calibration histogram.

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%).

plot_plotly

logical to use plotly.

...

unused

tag

a GeoPressureR tag object with twilight calibration (used by plot_twl_calib_path()).

Value

a ggplot or ggplotly object

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 = 5,
      known = data.frame(
        stap_id = 1,
        known_lon = 17.05,
        known_lat = 48.9
      )
    ) |>
    twilight_create() |>
    twilight_label_read() |>
    geolight_map_calibrate()
})
#>  Calibrate zenith angle
#>  Calibrate zenith angle [8ms]
#> 

# Histogram + kernel density
plot_twl_calib(tag)
# With fitted location duration of 5 days minimum tag <- geolight_map_calibrate(tag, fitted_location_duration = 5) #> Calibrate zenith angle #> Calibrate zenith angle [8ms] #> # Path-based diagnostic (uses tag$twilight) path <- tag$stap[, c("stap_id", "start", "end")] path$lon <- ifelse(is.na(tag$stap$known_lon), 0, tag$stap$known_lon) path$lat <- ifelse(is.na(tag$stap$known_lat), 0, tag$stap$known_lat) plot_twl_calib(tag, path = path, plot_plotly = FALSE) #> Warning: Some twilight calibration angles in stap 2 fall outside the hard bounds (60, #> 120). #> → These values will be ignored for calibration. #> Warning: Some twilight calibration angles in stap 3 fall outside the hard bounds (60, #> 120). #> → These values will be ignored for calibration. #> Warning: Some twilight calibration angles in stap 4 fall outside the hard bounds (60, #> 120). #> → These values will be ignored for calibration. #> Warning: Some twilight calibration angles in stap 5 fall outside the hard bounds (60, #> 120). #> → These values will be ignored for calibration.