
Label the elevation levels of a stationary period from a position
Source:R/tag_label_stapelev.R
tag_label_stapelev.RdRun TRAINSET's automatic stapelev on one stationary period from a script, and return the tag
with its pressure labels replaced.
The residual is the tag pressure minus the ERA5 surface pressure (not normalised) at the position
lat, lon. Each elevation level is a band of ± range hPa around an offset of this residual.
Offsets are initialised on the densest bands in turn, then adjusted to the median residual of
their points (TRAINSET's Initialize and Adjust). Each point is assigned to the nearest level
within its band, and runs of a level shorter than continuity hours become "discard".
As TRAINSET's Apply, it overwrites every non-flight label of the stationary period, including
manual "discard" and "elev_n" labels, and leaves flight labels and stationary periods
unchanged. The proposal is only as good as the position: at a wrong position, the levels and
discards confirm that position.
Usage
tag_label_stapelev(
tag,
stap_id,
lat,
lon,
timeseries = NULL,
n_level = 1,
range = 2,
continuity = 6,
gap = NULL,
discard_solar = "none",
solar_angle = -6,
quiet = FALSE,
...
)Arguments
- tag
a GeoPressureR
tagobject with labels and stationary periods (seetag_label()), beforetag_set_map().- stap_id
stationary period to label.
- lat, lon
position of the stationary period (degrees).
- timeseries
output of
geopressure_timeseries()for this stationary period, withpressure. Default queries it atlat,lon.- n_level
number of elevation levels.
- range
half-width of the band of each level (hPa).
- continuity
minimum duration of a run of points of the same level (hours).
0keeps every run.- gap
largest gap bridged within a run (minutes). Default is the sampling interval.
- discard_solar
"none","day"or"night": points of this part of the day are not assigned to any level.- solar_angle
solar elevation separating day from night (degrees).
- quiet
logical to hide messages.
- ...
arguments passed to
geopressure_timeseries()(e.g.,source).
Value
The tag with the pressure labels of stationary period stap_id replaced by "",
"elev_n" or "discard".
Examples
withr::with_dir(system.file("extdata", package = "GeoPressureR"), {
tag <- tag_create("18LX", quiet = TRUE) |>
tag_label(quiet = TRUE)
})
if (FALSE) { # \dontrun{
tag <- tag_label_stapelev(tag, stap_id = 1, lat = 48.9, lon = 17.05)
table(tag$pressure$label[tag$pressure$stap_id == 1])
} # }