12  Twilight label

Tip

Delete this block when you have read!

If you don’t have light data, delete this file!

  • These scripts should be adapted based on your project, but the same script should run for all your tags. You can always check the original version online.
  • Make sure you’ve read the GeoPressureManual, in particular the twilight labeling instructions, before running this script
  • Nothing is saved at the end of the script and it is meant to be like that. Only twilight label file and config.yml should be edited. Use 10-geopressuretemplate.R for the final run.
id <- "18LX"

knitr::opts_knit$set(root.dir = here::here())
library(GeoPressureR)
library(ggplot2)

12.1 Create tag

Make sure you have already created the label file with the “1-label.qmd” script.

tag <- do.call(
  tag_create,
  c(list(id = id, quiet = TRUE), geopressuretemplate_config(id)$tag_create)
) |>
  tag_label(quiet = TRUE) |>
  tag_set_map(
    extent = config::get("tag_set_map", id)$extent,
    scale = config::get("tag_set_map", id)$scale,
    known = config::get("tag_set_map", id)$known
  )

12.2 Create Twilight

Generate the twilight automatically. Check that twl_offset allows for night/day being centered on the figure, otherwise edit accordingly

tag <- twilight_create(
  tag,
  twl_offset = config::get("twilight_create", id)$twl_offset
)
Warning: ! 1 twilights are set at midnight (relative to `twl_offset`).
i There is likely a problem with `twl_offset = -0.0327003999197384`.
plot(tag, type = "twilight")

12.3 Annotate twilight in GeoLightViz

geolightviz(tag)

12.4 Compute likelihood map

tag <- twilight_label_read(tag)
tag <- geolight_map(
  tag,
  twl_calib_adjust = config::get("geolight_map", id)$twl_calib_adjust,
  twl_llp = config::get("geolight_map", id)$twl_llp,
  fitted_location_duration = config::get(
    "geolight_map",
    id
  )$fitted_location_duration
)
i Calibrate zenith angle
v Calibrate zenith angle [14ms]
i Compute twilight likelihood maps
v Compute twilight likelihood maps [2.6s]
i Aggregate twilight likelihood maps per stationary periods
v Aggregate twilight likelihood maps per stationary periods [6ms]

twl_calib_adjust, fitted_location_duration and twl_llp can generally be left to default, but can be modified in config.yml if needed.

12.5 Check

12.5.1 Check calibration

plot_twl_calib(tag)

12.5.2 Check light map

plot(tag, type = "map_light")

12.5.3 Check with pressure and trajectory

geopressureviz(tag)