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. Data is cleaned by removing records that are no more than minDist_m from the previous position. Additionally, resultant 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, which by default is 24 hours (1440 mins).

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,
  speedField = "calc",
  dropOrphans = T
)

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(1440 minutes corresponds with 24 hours) . 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(also see speedField)

maxKnots

default is NULL. This is the maximum vessel speed that should be include in the output (also see speedField)

speedField

default is "calc". Valid values are "calc" or any field that exists within your df

dropOrphans

default is TRUE. VMS data is primarily used for tracks, but during the filtering process, it's possible to end up with singular positions. By default, these lone positions will be discarded.

Value

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

Note

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.

Author(s)

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

See Also

Other vms: VMS_get_recs()


Maritimes/Mar.utils documentation built on April 5, 2025, 1:47 p.m.