Rafnuss / GeoPressureR

Global positioning by atmospheric pressure
https://raphaelnussbaumer.com/GeoPressureR
GNU General Public License v3.0
7 stars 1 forks source link

Simplified workflow #69

Closed Rafnuss closed 1 year ago

Rafnuss commented 1 year ago

Aiming for a compact worflows, with variable that follow each other.

Read tag data

Short version:

tag <- tag_create("18LX")

Detailed version:

tag <- tag_create(id = "18LX",
                directory = glue::glue("data/raw-tag/{id}/"),
                pressure_file = "*.pressure",
                light_file = "*.glf",
                acceleration_file = "*.acceleration",
                crop_start = "2017-06-20",
                crop_end = "2018-05-02")

Define stationary period with label file

tag <- tag_label(tag)

Details version:

# create the label file.
tag <- tag_label_auto(tag, min_duration = 30)

# Write the label
tag_label_write(tag,
                file = glue::glue("data/tag-labels/{tag$id}.csv"))

# Read file
tag <- tag_label_read(tag,
                      file = glue::glue("data/tag-labels/{tag$id}-labeled.csv"))

# Compute stap from label
tag <- tag_label_stap(tag)

Define geography

Short version:

tag <- tag_setmap(tag, extent = c(-16, 23, 0, 50))

Detailed version:

tag <- tag_setmap(tag,
                       extent = c(-16, 23, 0, 50),
                       scale = 4,
                       include_stap_id = NA,
                       include_min_duration = 5,
                       known = data.frame(
                         stap_id = c(1, 4),
                         known_lon = c( 17.05, 17.05),
                         known_lat = c(48.9, 48.9)
                       ))

Pressure

Short version:

tag <- geopressure_map(tag)

Detailed version:

tag <- geopressure_map_mismatch(tag
                                max_sample = 250,
                                margin = 30,
                                timeout = 60 * 5,
                                workers = 90)

tag <- geopressure_map_likelihood(tag,
                                  sd = 1,
                                  thr_mask = 0.9,
                                  log_linear_pooling_weight = \(n) log(n)/n )

Light

Detailed version:

tag <- twilight_create(tag) |>
  twilight_label_read()

tag <-  geolight_map(tag)

Detailed version:

# Create twilight 
tag <- twilight_create(tag)

# Write twilight label
twilight_lable_write(tag)

# Read twilight label
tag <- twilight_label_read(tag)

# Compute likelihood map
tag <-  geolight_map(tag)

Graph

graph <- graph_create(tag) |>
  graph_add_movement()

map_marginal <- graph_marginal(graph)
path_mostl_likely <- graph_most_likely(graph)
path_simulation <- graph_simulation(graph)

Wind

tag_wind_download(tag)

graph <- graph_add_wind(graph) |>
   graph_add_movement(bird = bird_create("scientific name"))

Pressurepath

pressurepath <- pressurepath_create(tag, path = tag2path(tag))

Update Labeling

tag <- tag_stap(tag)

tag <- tag_stap(tag, extent = c(-16, 23, 0, 50), scale = 1) |>
  geopressure_map()

gpts <- geostap2path(tag) |>
  geopressure_timeseries(tag)

update <- tag_label_update(file = "data/1_labels/18LX-labeled-modif.csv",
                 tag
                 gpts)