das_process {swfscDAS} | R Documentation |
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 class 'character'
das_process(x, ...)
## S3 method for class 'data.frame'
das_process(x, ...)
## S3 method for class 'das_dfr'
das_process(
x,
days.gap = 20,
reset.event = TRUE,
reset.effort = TRUE,
reset.day = TRUE,
add.dtll.sight = TRUE,
...
)
Arguments
x |
an object of class |
... |
passed to |
days.gap |
numeric of length 1; default is |
reset.event |
logical; default is |
reset.effort |
logical; default is |
reset.day |
logical; default is |
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 detailsAn 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 beNA
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' isNA
; otherwiseFALSE
Missing values are
NA
rather than-1
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/condition | Column name | Data source |
On/off effort | OnEffort | B/R and E events |
Cruise number | Cruise | Event: B; Column: Data1 |
Effort mode | Mode | Event: B; Column: Data2 |
GMT offset of DateTime data | OffsetGMT | Event: B; Column: Data3 |
Effort type | EffType | Event: R; Column: Data1 |
Number of sides with observer | ESWSide | Event: R; Column: Data2 |
Course (ship direction) | Course | Event: N; Column: Data1 |
Speed (ship speed, knots) | SpdKt | Event: N; Column: Data2 |
Beaufort sea state | Bft | Event: V; Column: Data1 |
Swell height (ft) | SwellHght | Event: V; Column: Data2 |
Wind speed (knots) | WindSpdKt | Event: V; Column: Data5 |
Rain/fog/haze code | RainFog | Event: W; Column: Data1 |
Horizontal sun (clock system) | HorizSun | Event: W; Column: Data2 |
Vertical sun (clock system) | VertSun | Event: W; Column: Data3 |
Glare | Glare | HorizSun and VertSun |
Visibility (nm) | Vis | Event: W; Column: Data5 |
Left observer | ObsL | Event: P; Column: Data1 |
Data recorder | Rec | Event: P; Column: Data2 |
Right observer | ObsR | Event: P; Column: Data3 |
Independent observer | ObsInd | Event: 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
Examples
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)