matchEnvData,AcousticEvent-method {PAMpal} | R Documentation |
Match Environmental Data to an AcousticStudy Object
Description
Extracts all variables from a netcdf file matching Longitude, Latitude, and UTC coordinates of the start of each AcousticEvent object. Matched values are stored in the "ancillary" slot of each event
Usage
## S4 method for signature 'AcousticEvent'
matchEnvData(
data,
nc = NULL,
var = NULL,
buffer = c(0, 0, 0),
FUN = c(mean),
fileName = NULL,
progress = TRUE,
depth = 0,
...
)
## S4 method for signature 'AcousticStudy'
matchEnvData(
data,
nc = NULL,
var = NULL,
buffer = c(0, 0, 0),
FUN = c(mean),
fileName = NULL,
progress = TRUE,
depth = 0,
...
)
Arguments
data |
an AcousticStudy or AcousticEvent object that must have GPS data added to it using the addGps functions |
nc |
name of a netcdf file, ERDDAP dataset id, or an edinfo object |
var |
(optional) vector of variable names |
buffer |
vector of Longitude, Latitude, and Time (seconds) to buffer around each datapoint. All values within the buffer will be used to report the mean, median, and standard deviation |
FUN |
a vector or list of functions to apply to the data. Default is to apply mean, median, and standard deviation calculations |
fileName |
(optional) file name to save downloaded nc file to. If not provided,
then no nc files will be stored, instead small temporary files will be downloaded
and then deleted. This can be much faster, but means that the data will need to be
downloaded again in the future. If |
progress |
logical flag to show progress bar |
depth |
depth values (meters) to use for matching, overrides any |
... |
other parameters to pass to ncToData |
Value
original data object with environmental data added to the ancillary
slot
of each event. Complete data will be stored in ancillary(data)$environmental
,
and the mean of each downloaded variable will be stored in ancillary(data)$measures
so that it can be exported for modeling. For each event the coordinates associated with
the earliest UTC value in that event are used to match
Author(s)
Taiki Sakai taiki.sakai@noaa.gov
Examples
data(exStudy)
nc <- system.file('extdata', 'sst.nc', package='PAMmisc')
# suppressing warnings because nc coordinates dont align with this data,
# function warns of possible coordinate mismatch
exStudy <- suppressWarnings(matchEnvData(exStudy, nc=nc, progress=FALSE))
str(ancillary(exStudy[[1]])$environmental)
ancillary(exStudy[[1]])$measures