handle_greenhouse: Get weather data from the greenhouses at CKA in 'chillR'...

handle_greenhouseR Documentation

Get weather data from the greenhouses at CKA in chillR format

Description

This function is to handle weather data obtained from the greenhouses located in Campus Klein Altendorf. For now, this works for input files stored as '.xls' or '.xlsx' format

Usage

handle_greenhouse(
  path_data,
  time_step = "hourly",
  vars = c("Temp", "Humidity", "CO2"),
  check_data = T,
  n_hours = 24,
  threshold = 10,
  fix_data = T,
  na_strings = c("FAULT", "")
)

Arguments

path_data

Character string. This is the directory in which the data is stored. It is important to note that the file must have either '.xls' or '.xlsx' extension

time_step

Character string. This is the time step in which the data must be retrieved. It has two options; 'hourly' (the default) and 'daily'

vars

Character string. Variables that must be retrieved by the function. In general, the options are 'Temperatures', 'Humidity', and 'CO2 concentration'. Regarding 'Temperatures', the options differed depending on the time_step parameter. For time_step = 'daily', the options are 'Tmean', 'Tmin', and 'Tmax'

check_data

Boolean parameter to check the observations for inconsistencies. Unfortunately, the dataloggers in the greenhouses often define missing records as 0. This makes exremely complicated to know if one record was actually 0 or missing. This check for that inconsistency by comparing the temperature at a given hour 'x' with the mean for the previous hours (defined by the n_hours). If this difference is greater than a given threshold (i.e. threshold) the record is corrected to NA

n_hours

Numeric input. This is the number of previous hours used to compute the mean and to check for inconsistencies. Default is set to 24 hours

threshold

Numeric input. This is the limit to define whether the record was a true observation or not. Default is set to 10 celsius degree since greenhouse temperatures are controlled

fix_data

Boolean parameter. If fix_data = TRUE, fill in the missing hours by the function interpolate_gaps_hourly from chillR

na_strings

Character vector of strings to interpret as missing values. By default, handle_greenhouse treats the word 'FAULT' and blank cells as missing data.

Note

In the 'daily' mode, this function can returns the variables 'Tmin', 'Tmean' and 'Tmax'. In contrast, under the 'hourly' mode, it can returns the mean temperature for each hour as 'Temp'

Examples

# As each user has different path for the folder this example is not running until "#"
# is removed

# path <- "C:/Users/...../...."

# handle_greenhouse(path_data = path, time_step = "daily", vars = c("Tmin", "Tmax"),
#                   check_data = T, n_hours = 12, threshold = 5, fix_data = T)


EduardoFernandezC/dormancyR documentation built on Aug. 24, 2022, 7:21 a.m.