View source: R/compile_HOBO_data.R
compile_HOBO_data | R Documentation |
Compiles and formats data from HOBO and TidbiT sensors.
compile_HOBO_data(
path.HOBO,
area.name = "",
serial.table.HOBO,
deployment.range,
trim = TRUE,
rm.DST = FALSE,
correct.DO = FALSE,
Sal = NULL,
method = "garcia-gordon",
export.csv = FALSE
)
path.HOBO |
File path to the Hobo folder. All of the excel files in the Hobo folder will be compiled. The name of each file must be the serial number of the sensor, and the excel files must be in either .csv or .xlsx format. The timestamp columns must be in the order "ymd IMS p", "Ymd IMS p", "Ymd HM", "Ymd HMS", "dmY HM", or "dmY HMS". |
area.name |
Area where the sensor(s) was deployed. |
serial.table.HOBO |
A table with the serial number of each HOBO and TidBiT sensor on the string, in the form "HOBO-xxxxxxxx" or "TidbiT-xxxxxxxx" (first column) and corresponding depth at which it was deployed 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 |
rm.DST |
Option to remove daylight savings time. Here, daylight savings
is as defined for Nova Scotia, Canada (begins in March and end in
November). Only works for 2015 - 2021. It is strongly recommended that the
data is in the correct timezone before using this function, and that the
default |
correct.DO |
Logical value. If If |
Sal |
A single value of salinity (psu), used to calculate the salinity correction factor for dissolved oxygen. |
method |
Equation to use to calculate dissolved oxygen solubility.
Options are |
export.csv |
Logical value indicating whether to export the compiled
data as a .csv file. If |
The raw HOBO and TidBiT data must be saved in a folder named Hobo in .csv or .xlsx format.
All columns are read in 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".
Dissolved oxygen can be corrected for salinity using equation 32 in Benson
and Krause. See ?apply_salinity_correction
for more detail.
CMAR NOTES: Data should be exported from the Hobo software in GMT+00 as a csv file so that the timestamp is in UTC.
If exported as a .xlsx file, the timestamp accounts for daylight savings
time (this seems to be a bug in the HOBO software).
compile_HOBO_data()
can convert .xlsx files to true UTC by setting
rm.DST = TRUE
. This will subtract 1 hour from each datetime that
occurs during daylight savings.
The functions used to convert to true UTC are
convert_HOBO_datetime_to_true_UTC()
and dates_to_fix()
, which
are NOT exported to the strings
package (i.e., they are only used
internally).
convert_HOBO_datetime_to_true_UTC()
identifies which datetimes are
during daylight savings by creating two additional columns: ADT_force
= force_tz(TIMESTAMP, tzone = "America/Halifax")
, and
DAYLIGHT_SAVINGS = dst(ADT_force)
. Where DAYLIGHT_SAVINGS ==
TRUE
, the TIMESTAMP
is shifted back by 1 hour.
This leaves apparent duplicates for the hour of 1 am on the day that
daylight savings ends. dates_to_fix()
identifies these n
observations (e.g. 1:00, 1:15, 1:30, 1:45, 1:00, 1:15, 1:30, 1:45), and
shifts the first n/2
back by one hour (e.g. 00:00, 00:15, 00:30,
00:45, 1:00, 1:15, 1:30, 1:45).The function is hard-coded 2015 - 2021.
If for some reason, there is an ODD number of duplicates, the function might break.
Returns a dataframe or exports a spreadsheet with the data compiled from each of the HOBO and TidbiT sensors. Columns alternate between timestamp (in the format "Y-m-d H:M:S") and temperature value (rounded to three decimal places). Metadata at the top of each column indicates the deployment and retrieval dates, the sensor serial number, the depth of the sensor, the temperature units, 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 temperature values). This can be done using the function
convert_to_tidydata()
.
Danielle Dempsey
Other compile:
compile_all_data()
,
compile_aquaMeasure_data()
,
compile_vemco_data()
,
read_deployment_log()
# path to "Hobo" folder
path <- system.file("extdata", package = "strings")
# Sensor and depth at which it was deployed
serial.table <- data.frame("SENSOR" = "HOBO-10755220", "DEPTH" = "2m")
# deployment and retrieval dates
deployment <- data.frame("START" = "2019-05-30", "END" = "2019-10-19")
hobo_data <- compile_HOBO_data(path.HOBO = path,
serial.table.HOBO = serial.table,
deployment.range = deployment)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.