addHydrophoneDepth {PAMpal} | R Documentation |
Add Hydrophone Depth Data to an AcousticStudy
Description
Add hydrophone depth to an AcousticStudy or AcousticEvent
Usage
addHydrophoneDepth(x, depth = NULL, depthCol = NULL, thresh = 60, ...)
Arguments
x |
an AcousticStudy to add depth data to |
depth |
a CSV or data frame of depth values to match to data from |
depthCol |
the name of the column containing depth in the dataframe or
database. If left as |
thresh |
maximum time apart in seconds for matching depth to
data, if the closest value is more than |
... |
additional arguments for other methods |
Details
Depth values will be matched to the data
by using data.table's rolling join with roll='nearest'
. After the
join is done, the time difference between the matched rows is checked
and any that are greater than the set threshold are set to NA. This is
done to prevent accidentally matching weird things if an incomplete set
of depth data is provided.
If x
is an AcousticEvent or AcousticStudy,
then depth
can be omitted and will be read from the databases contained
in the files
slot of x
.
Value
the same data as x
, with depth data added. All AcousticEvents will
have depth data added to all detector dataframes as column hpDepth
Author(s)
Taiki Sakai taiki.sakai@noaa.gov
Examples
data(exStudy)
# need to update database file to local directory
db <- system.file('extdata', 'Example.sqlite3', package='PAMpal')
exStudy <- updateFiles(exStudy, db=db, bin=NA, verbose=FALSE)
exStudy <- addHydrophoneDepth(exStudy)
getClickData(exStudy[1])