Prepare Calibration Data from a Folder
prepare_calibration.RdConvience function for preparing GLS logger data for light data calibration. Uses process_folder() in calibration mode to handle a directory of light data. See 'process_folder()' for more details.
Custom settings can be provided using filter_setting_list. For the creation of an empty filter settings template see create_filter_settings_file().
If export_calibration_template is TRUE, it will export an empty calibration sheet using 'calibration_to_wb()'.
Usage
prepare_calibration(
import_directory = NULL,
light_data_list = NULL,
metadata,
all_colony_info,
output_directory,
show_filter_plots = FALSE,
export_calibration_template = TRUE,
filter_setting_list = seatrackRgls::seatrack_settings_list,
overwrite_calibration = FALSE,
stop_on_error = FALSE
)Arguments
- import_directory
Directory containing raw light data files. These are expected to be named in the format
<logger_id>_<year_retrieved>_<logger_model>, e.g.C23_2015_mk4083- light_data_list
A named list of data frames containing light data for each logger/year combination. List names are assumed to be logger serial numbers. If not provided, light data will be loaded from the import directory based on the logger ID and year.
- metadata
A data frame containing calibration data for all loggers or a string providing a filepath to read this data from. This can be from an excel file, CSV file or a directory containing multiple calibration files. This dataframe can consist of a single row per logger/year combination, with the following columns
logger_id,species,colony,date_deployedanddate_retrieved. Providinglogger_modelis strongly advised. These will be automatically split into time windows, using theyear_splitsetting (defaulting to "06-01" in all 'seatrack_settings_list'). Alternatively, custom time windows can be provided by including columnsstart_datetimeandend_datetime, with one time window per row.- all_colony_info
A data frame containing colony information for all loggers (one row per colony). The required columns are
colony,latitude, andlongitude.- output_directory
Directory to save calibration templates and calibration plots. If
show_filter_plotsisTRUE- show_filter_plots
A logical indicating whether to show individual filter plots for the default sun angle. Defaults to
FALSE.- export_calibration_template
When
TRUEwill export a calibration template in excel format. Otherwise returns the calibration template as an R object. Defaults toTRUE.- filter_setting_list
A 'GLSFilterSettingsList' object containing filter settings for loggers or a path to load one using
read_filter_file(). Defaults to 'seatrackRgls::seatrack_settings_list'.- overwrite_calibration
A logical indicating whether to overwrite existing calibration output. Defaults to
FALSE. IfFALSE, if a calibration output directory already exists, the function will skip processing and return.- stop_on_error
A logical indicating whether to stop processing if an error occurs. Defaults to FALSE. If TRUE, if an error occurs during processing of a logger/year combination, the function will stop and return an error message. If FALSE, the function will continue processing remaining logger/year combinations and will print a message indicating which logger/year combinations had errors.