Skip to contents

Find the location of the highest value in the map and return a path data.frame containing the latitude and longitude. interp can be used to interpolate unrealistic position from short stationary period based on the position of the longer ones. The interpolation assumes that the first and last stationary period can be safely estimated from the probability map.

Usage

geopressure_map2path(map, interp = 0, format = "lonlat")

Arguments

map

List of raster containing probability map of each stationary period. The metadata of map needs to include the start and end time of the stationary period .

interp

The position of the stationary period shorter than interp will be replace by a linear average from other position (in days) .

format

One of "lonlat", "ind", "arr.ind". return the path in lon-lat or indices

Value

a data.frame of the position containing latitude (lat), longitude (lon) and the stationary period id (sta_id) as column. Optionally, if indexes were requested, it will be return. You will need to use which.max(as.matrix(raster)) and not which.max(raster) to get the correct location.

Examples

# See `geopressure_prob_map()` for generating pressure_prob
pressure_prob_1 <- readRDS(system.file("extdata/1_pressure/", "18LX_pressure_prob_1.rda",
  package = "GeoPressureR"
))
geopressure_map2path(list(pressure_prob_1))
#>      lon    lat sta_id
#> 1 17.125 48.875      1