Skip to contents

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.

Usage

tag2path(tag, likelihood = NULL, interp = FALSE, use_known = TRUE)

Arguments

tag

a GeoPressureR tag object

likelihood

Field of the tag list containing the likelihood map (character). Possible value are map_pressure, map_light, map_pressure_mse, map_pressure_mse, map_pressure_mse, mask_water. Default NA is to take the product of map_pressure and map_light, or if not available, taking the first of the possible values.

interp

the position of the stationary period shorter than interp will 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_id stationary period

  • ind indices of the coordinate in the 2D grid. Useful to retrieve map or graph information.

  • lat Latitude,

  • lon longitude

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)