An open API service indexing awesome lists of open source software.

https://github.com/knapply/maritime

Tools and Routines for Maritime Data ⚓ 🚢 ⛵ 🛥️
https://github.com/knapply/maritime

Last synced: over 1 year ago
JSON representation

Tools and Routines for Maritime Data ⚓ 🚢 ⛵ 🛥️

Awesome Lists containing this project

README

          

---
title: "`{maritime}` ⚓ 🚢 ⛵ 🛥️"
output:
github_document:
html_preview: true
toc: true
toc_depth: 2
html_document:
keep_md: yes
always_allow_html: yes
editor_options:
chunk_output_type: console
---

```{r, echo=FALSE}
knitr::opts_chunk$set(
# collapse = TRUE,
fig.align = "center",
comment = "#>",
fig.path = "man/figures/",
message = FALSE,
warning = FALSE
)
options(width = 150)
```

[![R build status](https://github.com/knapply/maritime/workflows/R-CMD-check/badge.svg)](https://github.com/knapply/maritime/actions?workflow=R-CMD-check)
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/knapply/maritime?branch=master&svg=true)](https://ci.appveyor.com/project/knapply/maritime)
[![Travis-CI Build Status](https://travis-ci.org/knapply/maritime.svg?branch=master)](https://travis-ci.org/knapply/maritime)
[![Codecov test coverage](https://codecov.io/gh/knapply/maritime/branch/master/graph/badge.svg)](https://codecov.io/gh/knapply/maritime?branch=master)
[![Lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
[![GitHub last commit](https://img.shields.io/github/last-commit/knapply/maritime.svg)](https://github.com/knapply/maritime/commits/master)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Depends](https://img.shields.io/badge/Depends-GNU_R>=3.6-blue.svg)](https://www.r-project.org/)
[![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/knapply/maritime.svg)](https://github.com/knapply/maritime)
[![Gitter](https://badges.gitter.im/maritime/community.svg)](https://gitter.im/maritime/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![HitCount](http://hits.dwyl.io/knapply/maritime.svg)](http://hits.dwyl.io/knapply/maritime)

# Introduction

Tools and routines for `{maritime}` data.

* [ ] High-performance AIS decoding routines.
+ built on [Kurt Schwehr](https://twitter.com/kurtschwehr)'s [__libais__](https://github.com/schwehr/libais)
* [ ] Seavision API wrapper
* [ ] ?

# Installation

You'll need a C++ compiler. If you're using Windows, that means [Rtools](https://cran.r-project.org/bin/windows/Rtools/).

```{r, eval=FALSE}
if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes")
remotes::install_github("knapply/maritime")
```

# Usage

```{r}
library(maritime)
```

# AIS Sentence (AIVDM/AIVDO) Decoding

## Status

* [x] Automatic sentence validation and line normalization
* Message Types:
+ [x] `ais_msgs$msg_1_2_3`
+ [x] `ais_msgs$msg_4_11`
+ [x] `ais_msgs$msg_5`
+ [ ] `ais_msgs$msg_6`
+ [x] `ais_msgs$msg_7_13`
+ [ ] `ais_msgs$msg_8`
+ [x] `ais_msgs$msg_9`
+ [x] `ais_msgs$msg_10`
+ [x] `ais_msgs$msg_11`
+ [x] `ais_msgs$msg_12`
+ [x] `ais_msgs$msg_14`
+ [x] `ais_msgs$msg_15`
+ [x] `ais_msgs$msg_16`
+ [x] `ais_msgs$msg_17`
+ [x] `ais_msgs$msg_18`
+ [x] `ais_msgs$msg_19`
+ [x] `ais_msgs$msg_20`
+ [x] `ais_msgs$msg_21`
+ [x] `ais_msgs$msg_22`
+ [x] `ais_msgs$msg_23`
+ [x] `ais_msgs$msg_24`
+ [x] `ais_msgs$msg_25`
+ [x] `ais_msgs$msg_26`
+ [x] `ais_msgs$msg_27`

```{r}
nmea_file <- "inst/example-data/big-files/20200131.log"
paste(round(file.size(nmea_file) / 1e9, 2L), "GB")
readLines(nmea_file, n = 20) # real world data, in all its terrible glory
```

```{r}
ais_decode_filter(msgs = nmea_file, msg_type = ais_msgs$msg_1_2_3)
```

```{r}
ais_decode_df(msgs = nmea_file)
```

## Performance

```{r}
bench::mark(
`ais_decode_list()` = decoded_list <- ais_decode_list(
nmea_file, as_tibble = FALSE, as_sf = FALSE, verbose = FALSE
)
)
```

```{r}
lapply(decoded_list, tibble::as_tibble)
```

# Credits

* AIS decoding routines are built on top of [Kurt Schwehr](https://twitter.com/kurtschwehr)'s [__libais__](https://github.com/schwehr/libais).