ECSAS.create.transects: Create transect lines from ECSAS watches

View source: R/ECSAS.create.transects.R

ECSAS.create.transectsR Documentation

Create transect lines from ECSAS watches

Description

This function aggregates consecutive ECSAS watches into transects.

Usage

ECSAS.create.transects(
  dat,
  angle.thresh = NULL,
  max.lag = 10,
  ignore_empty_dir = FALSE,
  debug = FALSE,
  CRS = NULL,
  debug.watch = NULL
)

Arguments

dat

a dataframe of ECSAS watches (1 row per watch).

angle.thresh

(default 90 degrees) changes in direction of more than this are considered to start new transects (currently not implemented)

max.lag

(default 10 minutes) the maximum time lag allowed between consecutive watches to be considered part of the same transect. Watches are sorted by ObserverName, PlatformName, Date, and StartTime and time lag is computed as StartTime(this_watch) - EndTime(previous_watch).

ignore_empty_dir

logical (default FALSE) should watches with a PlatformDir that is either empty or "no direction" (ie. 1 - see table lkpDirections in database), be be allowed. If TRUE, then any such watch is assumed to be heading in the same direction as the previous one.

debug

logical (default FALSE), should the debugger, base::browser(), be used

CRS

if not null, the output coordinate system will be set CRS via sp::spTransform

debug.watch

watchid to stop at in for loop if debug is true

Details

Combine watches in dat into transects and return a SpatialLinesDataFrame. A transect is defined as all consecutive watches by the same observer on the same vessel in the same direction on the same day.

Rows in dat must contain at least columns named ObserverName, PlatformDir, PlatformName, Date, StartTime, EndTime, LatStart, LongStart, LatEnd, LongEnd as returned by ECSAS.extract().

Watches are sorted by ObserverName, PlatformName, Date, and StartTime, and thus any errors in these will result in erroneous transects.

LatEnd and LongEnd are only necessary for the last watch in each transect to provide it's endpoint. If either is NA, the end point will be projected along a loxodrome starting at the watch start location in the direction of PlatformDir (or PlatformDirDeg if it exists), based on PlatformSpeed (in knots), and ObsLen (in minutes). If PlatformDirDeg or PlatformDir is missing or "no direction" and ignore_empty_dir is TRUE, then the point is projected to the north. If either of PlatformSpeed or ObsLen is missing then an error is produced.

Author

Dave Fifield

See Also

ECSAS.extract


RoyChristian/ECSASconnect documentation built on April 28, 2024, 2:14 a.m.