Skip to content

Repository files navigation

AISanalyze

status

R-CMD-check

DOI

Documentation

License: MIT

Documentation

A complete step-by-step workflow is available in the User guide.

📖 Full documentation, tutorials and function reference: https://remip48.github.io/AISanalyze/

Overview

AISanalyze is an R package providing a fast and reproducible workflow for preprocessing Automatic Identification System (AIS) vessel tracking data for environmental and ecological research. It streamlines common preprocessing tasks through a small set of user-friendly functions, including vessel trajectory reconstruction, GPS correction, interpolation, and the extraction of vessel positions around target locations or time periods.

The package emphasizes computational efficiency and reproducibility, allowing large AIS datasets to be prepared for downstream analyses in seconds to minutes. Its main functionalities include:

  • estimating vessel travel distance, time, and speed;
  • correcting GPS errors and delays;
  • identifying AIS base stations and aircraft;
  • interpolating vessel positions;
  • extracting vessel positions around target locations and times;
  • retrieving vessel characteristics (ship type, length, width, draught, IMO number, and vessel name).

Installation

# install.packages("remotes")
remotes::install_github("remip48/AISanalyze")

Main functions

Function Description
AIStravel() Estimate travelled distance, time and speed
AISidentify_stations_aircraft() Identify AIS stations and aircraft
AIScorrect_speed() Correct GPS errors and delays
AISinterpolate() Interpolate vessel positions
AISextract() Extract vessels around target locations
AISinfos() Estimate vessel characteristics

Example

library(AISanalyze)
data("ais")
data("point_to_extract")

## define the Unix time (seconds since 1970-01-01)
ais$timestamp <- as.numeric(lubridate::ymd_hms(ais$datetime)))
point_to_extract$timestamp <- as.numeric(lubridate::ymd_hm(point_to_extract$datetime)))

results <- ais |>
  AIStravel(nb_cores = 4) |> # estimate travelled speed, distance, time
  AISidentify_stations_aircraft() |> 
  dplyr::filter(!station & !high_speed) |> # remove stations and aircrafts
  AIScorrect_speed(nb_cores = 4) |> # correct speed
  AISinterpolate(., # interpolate AIS data
                 type_interpolation = "maximum_gap_seconds",
                 maximum_gap_seconds = 60,
                 nb_cores = 4) |>
  AISextract(data = point_to_extract, # extract around your points
             search_into_radius_m = 10000,
             nb_cores = 4)
# done!

Performance

Total execution time to complete the example workflow with 100 points to extract and 4 CPU cores:

AIS dataset size 100,000 points 1,000,000 points 2,500,000 points
Time 14 sec 68 sec 146 sec

Citation

If you use AISanalyze, please cite:

Pigeault R., Ruser A., Ramírez-Martínez N.C., Geelhoed S.C.V., Haelters J., Nachtsheim D.A., Schaffeld T., Sveegaard S., Siebert U., Gilles A. (2024). Maritime traffic alters distribution of the harbour porpoise in the North Sea. Marine Pollution Bulletin. 208: 116925. DOI: 10.1016/j.marpolbul.2024.116925

citation("AISanalyze")

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Whether you would like to report a bug, suggest a new feature, or contribute code or documentation, please read our CONTRIBUTING.md guide to get started.

Support

Please use the GitHub issue tracker to report bugs, request features, or ask questions. For other enquiries, you may also contact the package author directly.

About

Efficient tools for correcting, interpolating and analyzing Automatic Identification System (AIS) vessel tracking data

Topics

Resources

Code of conduct

Contributing

Stars

9 stars

Watchers

4 watching

Forks

Releases

Used by

Contributors

Languages