VMS_clean_recs: VMS_clean_recs

View source: R/VMS_clean_recs.R

VMS_clean_recsR Documentation

VMS_clean_recs

Description

This function takes raw VMS data (i.e. a dataframe having sequential coordinates and times) and cleans it.

Usage

VMS_clean_recs(
  df = NULL,
  lat.field = "LATITUDE",
  lon.field = "LONGITUDE",
  objField = "VR_NUMBER",
  timeField = "POSITION_UTC_DATE",
  minDist_m = 50,
  maxBreak_mins = 1440,
  minKnots = NULL,
  maxKnots = NULL
)

Arguments

df

default is NULL. This is the dataframe to be processed. It should have coordinates in decimal degrees and they should be in fields called "LATITUDE" and "LONGITUDE". It also needs a field with the time associated with each position, i.e. the timeField.

lat.field

the default is "LATITUDE". the name of the field holding latitude values (in decimal degrees)

lon.field

the default is "LONGITUDE". the name of the field holding longitude values (in decimal degrees)

objField

default is VR_NUMBER. This is a field identifying which points are associated withe eachother.

timeField

default is POSITION_UTC_DATE. This is the field which will be used to calculate the time differences between records.

minDist_m

the default is 50. This is the minimum distance (m) a vessel must move from it's last position in order for the record to be kept. This should be greater than zero to avoid records for vessels sitting in port.

maxBreak_mins

the default is 1440. This is the maximum time (in mins) that is allowed between positions before a new "trek" is created.

minKnots

default is NULL. This is the minimum vessel speed that should be include in the output

maxKnots

default is NULL. This is the maximum vessel speed that should be include in the output

Value

a dataframe with an additional "trek" column identifying a number of discrete paths for each unique value of objField.

Note

The resultant df will likely have less records than the source. During the cleaning process, values for Latitude and Longitude are rounded from 5 decimal places to 4 (~1m –> 11m resolution), and times are rounded to the nearest 5 minutes. If a field called "UPDATE_DATE" exists, it will be used to "break ties" in the case of duplicate records (i.e. the more recent record will is retained. Additionally, data is grouped into "treks" which can be thought of as discrete forays by a vessel. A new trek occurs when the time between subsequent points for a vessel exceeds maxBreak_mins. If no value is provided, 24 hours (i.e. 1440 minutes) will be used.

Author(s)

Mike McMahon, Mike.McMahon@dfo-mpo.gc.ca

See Also

Other vms: VMS_get_recs()


Maritimes/Mar.utils documentation built on Feb. 12, 2024, 11:38 p.m.