
Estimate one location per stationary period from twilight times
Source:R/geolight_fit_location.R
geolight_fit_location.RdFor each stationary period (stap_id) with usable twilight
events, estimate a single longitude, latitude, and effective zenith angle by
minimizing the squared spherical distance to the corresponding iso-zenith
small circles.
Each twilight defines a small circle on the Earth: the set of locations at a fixed angular distance (zenith angle) from the subsolar point at that time. The fitted location is the point that is, in a least-squares sense, closest to all those circles simultaneously.
Usage
geolight_fit_location(
tag,
fitted_location_duration = Inf,
extent = NULL,
zenith_init = 96,
zenith_bounds = c(60, 120),
compute_known = FALSE,
quiet = FALSE
)Arguments
- tag
A GeoPressureR tag object containing
tag$twilightandtag$stap.- fitted_location_duration
Minimum duration (in days) of stationary period(s) eligible to be used as a fitted location from twilight times. Default is
Inf(disabled).- extent
Numeric vector
c(W, E, S, N)in degrees (longitude west/east, latitude south/north).- zenith_init
Initial zenith angle (degrees).
- zenith_bounds
Numeric vector of length 2 giving zenith bounds (degrees).
- compute_known
Logical; if FALSE, known stationary periods are copied from
tag$stap(rather than being estimated).- quiet
Logical; if TRUE, suppress informative messages.
Value
A path data.frame derived from tag$stap with added columns:
lon, lat, zenith. Rows where fitting was not possible remain NA.
Examples
withr::with_dir(system.file("extdata", package = "GeoPressureR"), {
tag <- tag_create("18LX", quiet = TRUE) |>
tag_label(quiet = TRUE) |>
twilight_create() |>
twilight_label_read()
})
tag <- tag_stap_daily(tag, quiet = TRUE)
path <- geolight_fit_location(tag, fitted_location_duration = 5, quiet = TRUE)