Skip to contents

When updating the labelling file of a tag, we often change only a few stationary periods. To avoid recomputing the entire workflow, this function identifies which stationary periods have been modified and updates only these ones in tag$map_pressure and pressurepath.

Usage

tag_update(
  tag,
  file = glue::glue("./data/tag-label/{tag$param$id}-labeled.csv"),
  known = NULL,
  include_stap_id = NULL,
  quiet = FALSE
)

Arguments

tag

a GeoPressureR tag object.

file

absolute or relative path of the label file.

known

data.frame containing the known positions of the bird (e.g., equipment or retrieval site). The default is to use tag$stap, which assumes that the stap_id has not changed for the known stationary periods.

include_stap_id

vector of stap_id defining which stationary period to model, that is, to compute in the likelihood map and use in the graph. The default is to use the same original value.

quiet

logical to hide messages about the progress

Value

The updated tag object

See also

Other tag: print.tag(), tag_create(), tag_set_map()

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 = 1) |>
    geopressure_map(quiet = TRUE)

  print(tag)

  tag <- tag_update(tag,
    file = "./data/tag-label/18LX-labeled-updated.csv",
    quiet = TRUE
  )

  print(tag)
})
#> 
#> ── GeoPressureR `tag` object for 18LX ──────────────────────────────────────────
#> Note: All green texts are fields of `tag` (i.e., `tag$field`).
#> 
#> ── Parameter param 
#> Run `tag$param` to display full table
#> 
#> ── Sensors data 
#> Manufacturer: soi
#> Date range: 2017-07-27 to 2017-08-09 23:30:00
#>  pressure: 672 datapoints
#>  acceleration: 4,032 datapoints
#>  light: 4,032 datapoints
#>  temperature_external: 2,448 datapoints
#> 
#> ── Stationary periods stap 
#> 5 stationary periods
#>   stap_id               start                 end known_lat known_lon include
#> 1       1 2017-07-26 23:57:30 2017-08-04 19:47:30        NA        NA    TRUE
#> 2       2 2017-08-04 23:17:30 2017-08-05 19:27:30        NA        NA    TRUE
#> 3       3 2017-08-06 02:52:30 2017-08-06 19:12:30        NA        NA    TRUE
#> ...
#> Run `tag$stap` to see full stap table
#> 
#> ── Map 
#>  Extent (W, E, S, N): -16°, 23°, 0°, 50°
#>  Dimensions (lat x lon): 50 x 39 (res. 1°)
#>  Pressure likelihood map_pressure computed!
#> 
#> ── GeoPressureR `tag` object for 18LX ──────────────────────────────────────────
#> Note: All green texts are fields of `tag` (i.e., `tag$field`).
#> 
#> ── Parameter param 
#> Run `tag$param` to display full table
#> 
#> ── Sensors data 
#> Manufacturer: soi
#> Date range: 2017-07-27 to 2017-08-09 23:30:00
#>  pressure: 672 datapoints
#>  acceleration: 4,032 datapoints
#>  light: 4,032 datapoints
#>  temperature_external: 2,448 datapoints
#> 
#> ── Stationary periods stap 
#> 5 stationary periods
#>   stap_id               start                 end known_lat known_lon include
#> 1       1 2017-07-26 23:57:30 2017-08-04 19:47:30        NA        NA    TRUE
#> 2       2 2017-08-04 23:17:30 2017-08-05 19:27:30        NA        NA    TRUE
#> 3       3 2017-08-06 02:52:30 2017-08-06 19:12:30        NA        NA    TRUE
#> ...
#> Run `tag$stap` to see full stap table
#> 
#> ── Map 
#>  Extent (W, E, S, N): -16°, 23°, 0°, 50°
#>  Dimensions (lat x lon): 50 x 39 (res. 1°)
#>  Pressure likelihood map_pressure computed!