checkSoundscapeInput {PAMscapes} | R Documentation |
Check Proper Formatting for Soundscape Inputs
Description
Reads and checks data to ensure formatting will work
for other PAMscapes
functions. Will read and check the
formatting of CSV files, or check the formatting of dataframes.
Can also read in MANTA NetCDF files and format the data
appropriately.
Usage
checkSoundscapeInput(
x,
needCols = c("UTC"),
skipCheck = FALSE,
timeBin = NULL,
binFunction = median,
octave = c("original", "tol", "ol"),
label = NULL,
tz = "UTC",
extension = c("nc", "csv")
)
Arguments
x |
a dataframe, path to a CSV file, or path to a MANTA
NetCDF file, or folder containing these. If |
needCols |
names of columns that must be present in |
skipCheck |
logical flag to skip some data checking, recommended
to keep as |
timeBin |
amount of time to bin data by, format can
be "#Unit" e.g. |
binFunction |
summary function to apply to data in each time bin |
octave |
one of "original", "tol", or "ol". If "original" then nothing happens, otherwise data are converted to Octave-leve ("ol") or Third-Octave-Level ("tol") measurements using createOctaveLevel |
label |
optional, if not |
tz |
timezone of the data being loaded, will be converted to UTC after load |
extension |
only used if |
Details
Files created by MANTA and Triton software will be reformatted to have consisitent formatting. The first column will be renamed to "UTC", and columns containing soundscape metrics will be named using the convention "TYPE_FREQUENCY", e.g. "HMD_1", "HMD_2" for Manta hybrid millidecade mesaurements.
Inputs from sources other than MANTA or Triton can be accepted in either "wide" or "long" format. Wide format must follow the conventions above - first column "UTC", other columns named by "TYPE_FREQUENCY" where TYPE is consistent across all columns and FREQUENCY is in Hertz. Long format data must have the following columns:
- "UTC"
- time of the measurement, in UTC timezone
- "type"
- the type of soundscape measurement e.g. PSD or OL, must be the same for all
- "frequency"
- the frequency of the measurement, in Hertz
- "value"
- the soundscape measurement value, usually dB
Value
a dataframe
Author(s)
Taiki Sakai taiki.sakai@noaa.gov
Examples
manta <- checkSoundscapeInput(system.file('extdata/MANTAExampleSmall1.csv', package='PAMscapes'))
str(manta)
ol <- checkSoundscapeInput(system.file('extdata/OLSmall.csv', package='PAMscapes'))
str(ol)
psd <- checkSoundscapeInput(system.file('extdata/PSDSmall.csv', package='PAMscapes'))
str(psd)