swfscDAS (version 0.6.2)

das_process: Process DAS data

Description

Process DAS data (the output of das_read), including extracting state and condition information for each DAS event

Usage

das_process(x, ...)

# S3 method for character das_process(x, ...)

# S3 method for data.frame das_process(x, ...)

# S3 method for das_dfr das_process( x, days.gap = 20, reset.event = TRUE, reset.effort = TRUE, reset.day = TRUE, add.dtll.sight = TRUE, ... )

Value

A das_df object, which is also a data frame. It consists of the input data frame, i.e. the output of das_read, with the following columns added:

State/conditionColumn nameData source
On/off effortOnEffortB/R and E events
Cruise numberCruiseEvent: B; Column: Data1
Effort modeModeEvent: B; Column: Data2
GMT offset of DateTime dataOffsetGMTEvent: B; Column: Data3
Effort typeEffTypeEvent: R; Column: Data1
Number of sides with observerESWSideEvent: R; Column: Data2
Course (ship direction)CourseEvent: N; Column: Data1
Speed (ship speed, knots)SpdKtEvent: N; Column: Data2
Beaufort sea stateBftEvent: V; Column: Data1
Swell height (ft)SwellHghtEvent: V; Column: Data2
Wind speed (knots)WindSpdKtEvent: V; Column: Data5
Rain/fog/haze codeRainFogEvent: W; Column: Data1
Horizontal sun (clock system)HorizSunEvent: W; Column: Data2
Vertical sun (clock system)VertSunEvent: W; Column: Data3
GlareGlareHorizSun and VertSun
Visibility (nm)VisEvent: W; Column: Data5
Left observerObsLEvent: P; Column: Data1
Data recorderRecEvent: P; Column: Data2
Right observerObsREvent: P; Column: Data3
Independent observerObsIndEvent: P; Column: Data4

OffsetGMT represents the difference in hours between the DateTime data (which should be in local time) and GMT (i.e., UTC).

Internal warning messages are printed with row numbers of the input file (NOT of the output data frame) of unexpected event codes and r events, as well as if there is are potential issues with the number and/or order of R and E events

Arguments

x

an object of class das_dfr, an object that can be coerced to class das_dfr, or a character (filepath) which is first passed to das_read

...

passed to das_read if x is a character. Otherwise ignored

days.gap

numeric of length 1; default is 20. Time gap (in days) used to identify a new cruise in concatenated DAS files, and thus also when state/condition information (cruise number, weather, Bft, Mode, etc) is reset

reset.event

logical; default is TRUE. Indicates if state/condition information (weather, Bft, Mode, etc) should be reset to NA if there is an applicable event with an NA for that state/condition

reset.effort

logical; default is TRUE. Indicates if state/condition information should be reset to NA when beginning a new continuous effort section. See Details section

reset.day

logical; default is TRUE. Indicates if state/condition information should be reset to NA at the beginning of each day. This argument should only be set to FALSE for comparison with older methods, such as REPORT

add.dtll.sight

logical indicating if the DateTime (dt) and latitude and longitude (ll) columns should be added to the sighting events (?, 1, 2, 3, 4, 5, 6, 7, and 8) from the corresponding (immediately preceding) A event

Details

If x is a character, it is assumed to be a filepath and first passed to das_read. This output is then passed to das_process.

DAS data is event-based, meaning most events indicate when a state or weather condition changes. For instance, a 'V' event indicates when one or more sea state viewing conditions (such as Beaufort sea state) change, and these conditions are the same for subsequent events until the next 'V' event. For each state/condition: a new column is created, the state/condition information is extracted from relevant events, and extracted information is propagated to appropriate subsequent rows (events). Thus, each row in the output data frame contains all pertinent state/condition information for that row.

The following assumptions/decisions are made during processing:

  • Event codes are expected to be one of the following: #, *, ?, 1, 2, 3, 4, 5, 6, 7, 8, A, B, C, E, F, k, K, M, N, P, Q, r, R, s, S, t, V, W, g, G, p, X, Y, Z

  • All '#' events (deleted events) are removed

  • r events are converted to R events with non-standard effort; see das_format_pdf for more details

  • An event is considered 'on effort' if it is 1) an R event, 2) a B event immediately preceding an R event, or 3) between corresponding R and E events (not including the E event). The 'EffortDot' column is not used when determining on effort data. Note that effort is reset to 'off effort' at the beginning of a new day.

  • All state/condition information is reset at the beginning of each cruise. New cruises are identified using days.gap.

  • All state/condition information relating to B, R, P, V, N, and W events are reset every time there is a BR event sequence if reset.effort == TRUE, because in WinCruz a BR event sequence should always be a BRPVNW event sequence. An event sequence means that all of the events have the same Lat/Lon/DateTime info, and thus previous values for conditions set during the event sequence should not carry over to any part of the event sequence.

  • 'OffsetGMT' is converted to an integer. Values are expected to be consistent within a day for each cruise, so events will have an OffsetGMT value if there is any B event with the offset data on the same day, whether that event is before or after the B event. Thus, if any date/cruise combinations have multiple OffsetGMT values in the data, then a warning message will be printed and the OffsetGMT values will be all NA (for the entire output).

  • 'Mode' is capitalized, and 'Mode' values of NA are assigned a value of "C"

  • 'EffType' is capitalized, and values of NA are assigned a value of "S"

  • 'ESWsides' represents the number of sides being searched during that effort section - a value of NA (for compatibility with older data) or "F" means 2 sides are being searched, and a value of "H" means 1 side is being searched. ESWsides will be NA for values that are not one of "F", NA, or "H"

  • 'Glare': TRUE if 'HorizSun' is 11, 12 or 1 and 'VertSun' is 2 or 3, or if 'HorizSun' is 12 and 'VertSun' is 1; NA if 'HorizSun' or 'VertSun' is NA; otherwise FALSE

  • Missing values are NA rather than -1

Examples

Run this code
y <- system.file("das_sample.das", package = "swfscDAS")
das_process(y)

y.read <- das_read(y)
das_process(y.read)
das_process(y.read, reset.effort = FALSE)

Run the code above in your browser using DataLab