compile_aquaMeasure_data: Compiles temperature, dissolved oxygen, and/or salinity data...

View source: R/compile_aquaMeasure_data.R

compile_aquaMeasure_dataR Documentation

Compiles temperature, dissolved oxygen, and/or salinity data from aquaMeasure sensors

Description

Compiles and formats data from aquaMeasure sensors.

Usage

compile_aquaMeasure_data(
  path.aM,
  area.name = "",
  serial.table.aM,
  deployment.range,
  trim = TRUE,
  export.csv = FALSE
)

Arguments

path.aM

File path to the aquaMeasure folder.

area.name

Area where the sensor(s) was deployed.

serial.table.aM

A table with the serial number of each aquaMeasure on the string, in the form "aquaMeasure-xxxxxx" (first column; note the capital "M") and its corresponding depth in the form "2m" (second column).

deployment.range

A dataframe with two columns. The first column holds the deployment date (a Date object, POSIXct object, or character string in the order year, month, day), and the second column holds the retrieval date (a Date object, POSIXct object, or character string in the order year, month, day).

trim

Logical value indicating whether to trim the data to the dates specified in deployment.range. (Note: four hours are added to the retrieval date to account for AST, e.g., in case the sensor was retrieved after 20:00 AST, which is 00:00 UTC the next day.) Default is trim = TRUE.

export.csv

Logical value indicating whether to export the compiled data as a .csv file. If export.csv = TRUE, the compiled data will not be returned to the global environment. Default is export.csv = FALSE.

Details

The raw aquaMeasure data must be saved in a folder named aquaMeasure in .csv or .xlsx format.

Rows with undefined and ... (time not set) values in the Timestamp(UTC) column are filtered out.

Negative Dissolved Oxygen values are converted to NA.

"ERR" values are converted to NA.

A warning message is printed if there are more than 1000 NA values for a given variable.

All columns in are imported as characters to ensure the timestamp is parsed correctly. Timestamp must be saved in excel as a number or a character in the order "ymd IMS p", "Ymd IMS p", "Ymd HM", "Ymd HMS", "dmY HM", or "dmY HMS".

There still may be parsing errors because there are not entries in every column. This should not affect the data compilation. To check, save the spreadsheet with a new name new, delete the column causing the error (likely the "Text" column), re-run the function, and verify that there is no parsing error.

Value

Returns a dataframe or exports a spreadsheet with the data compiled from each of the aquaMeasure sensors. Columns alternate between timestamp (UTC, in the format "Y-m-d H:M:S") and variable value (rounded to three decimal places). Metadata at the top of each column indicates the deployment and retrieval dates, the sensor serial number, the variable and depth of the sensor, and the timezone of the timestamp.

To include the metadata, all values were converted to class character. To manipulate the data, the values must be converted to the appropriate class (e.g., POSIXct for the timestamps and numeric for variable values). This can be done using the function convert_to_tidydata().

Author(s)

Danielle Dempsey

See Also

Other compile: compile_HOBO_data(), compile_all_data(), compile_vemco_data(), read_deployment_log()

Examples

# path to "aquaMeasure" folder
path <- system.file("extdata", package = "strings")
# Sensor and depth at which it was deployed
serial.table <- data.frame("SENSOR" = "aquaMeasure-670364", "DEPTH" = "5m")
# deployment and retrieval dates
deployment <- data.frame("START" = "2019-05-30", "END" = "2019-10-19")

aM_data <- compile_aquaMeasure_data(path.aM =  path,
serial.table.aM = serial.table,
deployment.range = deployment)

Centre-for-Marine-Applied-Research/strings documentation built on Aug. 21, 2023, 8 a.m.