airdas_effort: Summarize AirDAS effort

View source: R/airdas_effort.R

airdas_effortR Documentation

Summarize AirDAS effort

Description

Chop AirDAS data into effort segments

Usage

airdas_effort(x, ...)

## S3 method for class 'data.frame'
airdas_effort(x, ...)

## S3 method for class 'airdas_df'
airdas_effort(
  x,
  method = c("condition", "equallength", "section"),
  conditions = NULL,
  distance.method = c("greatcircle", "lawofcosines", "haversine", "vincenty"),
  num.cores = NULL,
  angle.min = 12,
  bft.max = 5,
  ...
)

Arguments

x

airdas_df object; output from airdas_process, or a data frame that can be coerced to a airdas_df object

...

arguments passed to the chopping function specified using method, such as seg.km or seg.min.km

method

character; method to use to chop AirDAS data into effort segments Can be "condition", "equallength", "section", or any partial match thereof (case sensitive)

conditions

character vector of names of conditions to include in segdata output. These values must be column names from the output of airdas_process, e.g. 'Bft', 'CCover', etc. The default is NULL, in which case all relevant conditions will be included. If method == "condition", then these also are the conditions which trigger segment chopping when they change.

distance.method

character; method to use to calculate distance between lat/lon coordinates. Can be "greatcircle", "lawofcosines", "haversine", "vincenty", or any partial match thereof (case sensitive). Default is "greatcircle"

num.cores

Number of CPUs to over which to distribute computations. Defaults to NULL, which uses one fewer than the number of cores reported by detectCores Using 1 core likely will be faster for smaller datasets

angle.min

passed to airdas_sight

bft.max

numeric; the maximum Beaufort (column 'Bft') for which to mark a sighting as TRUE in 'included' (see Details). Default is 5.

Details

This is the top-level function for chopping processed AirDAS data into modeling segments (henceforth 'segments'), and assigning sightings and related information (e.g., weather conditions) to each segment. This function returns data frames with all relevant information for the effort segments and associated sightings ('segdata' and 'sightinfo', respectively). Before chopping, the AirDAS data is filtered for events (rows) where either the 'OnEffort' column is TRUE or the 'Event' column is "E" or "O". In other words, the data is filtered for continuous effort sections (henceforth 'effort sections'), where effort sections run from "T"/"R" to "E"/"O" events (inclusive), and then passed to the chopping function specified using method. All on effort events must not have NA Lat or Lon values; note Lat/Lon values for 1 events were 'filled in' in airdas_process.

The following chopping methods are currently available: "condition", "equallength", and "section". When using the "condition" method, effort sections are chopped into segments every time a condition specified in conditions changes, thereby ensuring that the conditions are consistent across the entire segment. See airdas_chop_condition for more details about this method, including arguments that must be passed to it via ....

The "equallength" method consists of chopping effort sections into equal-length segments of length seg.km, and doing a weighted average of the conditions for the length of that segment. See airdas_chop_equallength for more details about this method, including arguments that must be passed to it via ....

The "section" method involves 'chopping' the effort into continuous effort sections, i.e. each continuous effort section is a single effort segment. See airdas_chop_section for more details about this method.

The distance between the lat/lon points of subsequent events is calculated using the method specified in distance.method. If "greatcircle", distance_greatcircle is used, while distance is used otherwise. See airdas_sight for how the sightings are processed.

The sightinfo data frame includes the column 'included', which is used in airdas_effort_sight when summarizing the number of sightings and animals for selected species. airdas_effort_sight is a separate function to allow users to personalize the 'included' values as desired for their specific analysis. By default, i.e. in the output of this function, 'included' is TRUE if: the sighting was a standard sighting (see airdas_sight) and in a Beaufort sea state less than or equal to 'btf.max'.

Value

List of three data frames:

  • segdata: one row for every segment, and columns for information including unique segment number, event code that started the associated continuous effort section, the starting and ending line of the segment in the DAS file (stlin, endlin), start/end/midpoint coordinates(lat1/lon1, lat2/lon2, and mlat/mlon, respectively), the start/end/midpoint date/time of the segment (DateTime1, DateTime2, and mDateTime, respectively; mDateTime is the average of DateTime1 and DateTime2), segment length (dist), and conditions (e.g. Beaufort)

  • sightinfo: details for all sightings in x, including: the unique segment number it is associated with, segment mid points (lat/lon), the 'included' column described in the Details section, and the output information described in airdas_sight

  • randpicks: see airdas_chop_equallength. NULL if using "condition" method.

Examples

y <- system.file("airdas_sample.das", package = "swfscAirDAS")
y.proc <- airdas_process(y)

airdas_effort(
  y.proc, method = "condition", conditions = "Bft", seg.min.km = 0.05, 
  num.cores = 1
)

y.rand <- system.file("airdas_sample_randpicks.csv", package = "swfscAirDAS")
airdas_effort(
  y.proc, method = "equallength", conditions = c("Bft", "CCover"), 
  seg.km = 3, randpicks.load = y.rand, num.cores = 1
)

airdas_effort(y.proc, method = "section", num.cores = 1)


swfscAirDAS documentation built on Aug. 9, 2023, 1:06 a.m.