Find the position of the highest value in a map, typically most probable value in a likelihood map.
Note that this path is the most likely, considering only the observation model and ignoring the
movement model. Prefer to use graph_most_likely() for the most realistic path accounting for
flight duration.
interp can be used to interpolate unrealistic position from short stationary periods based on
the position of the longer ones. In order to preserve a reference to the grid, the interpolation
is only performed at the centre of the grid cell (defined by the likelihood map). Note also
that it is not possible to interpolate the first and last stationary period.
Arguments
- tag
a GeoPressureR
tagobject- likelihood
Field of the
taglist containing the likelihood map (character). Possible value aremap_pressure,map_light,map_pressure_mse,map_pressure_mse,map_pressure_mse,mask_water. DefaultNAis to take the product ofmap_pressureandmap_light, or if not available, taking the first of the possible values.- interp
the position of the stationary period shorter than
interpwill be replace by a linear average from other position accounting for flight duration (in days).- use_known
If true, enforce the known position in the path created. The known positions are approximated to the map resolution in order to corresponds to integer index.
Value
A path data.frame
stap_idstationary periodindindices of the coordinate in the 2D grid. Useful to retrieve map or graph information.latLatitude,lonlongitude
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 = 2
) |>
geopressure_map(quiet = TRUE)
})
# Extract a path from pressure map
path <- tag2path(tag)
plot_path(path)
# Short stationary periods (e.g. 1 day) can be unreliably
# estimated, so interpolating them is often better
path <- tag2path(tag, interp = 1)
plot_path(path)
