Process all light position files in a folder
process_folder.RdGiven an import directory containing light data files this function processes all light data files in the folder. It applies calibration data, filter settings, colony info, and extra metadata as needed for each logger/year combination found in the folder using 'process_logger_year()' In calibration mode, it can export a combined calibration data file for all processed loggers. If not in calibration mode, it exports processed position data, filtering summaries, and twilight estimates for each logger/year combination.
Usage
process_folder(
import_directory = NULL,
calibration_data,
all_colony_info,
light_data_list = NULL,
filter_setting_list = seatrackRgls::seatrack_settings_list,
extra_metadata = NULL,
show_filter_plots = FALSE,
output_dir = NULL,
calibration_mode = TRUE,
export_calibration_template = TRUE,
overwrite_calibration = FALSE,
do_seasonal_calibration = NULL,
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- calibration_data
A data frame containing metadata/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. In calibration mode, this dataframe can consist of a single row per logger/year combination. In calibration mode, the minimum required columns are
logger_id,species,colony,date_deployedanddate_retrieved. Providinglogger_modelis strongly advised. If not in calibration mode, the data frame is expected to be in the format output by running this function in calibration mode.- all_colony_info
A data frame containing colony information for all loggers (one row per colony). The required columns are
colony,latitude, andlongitude.- 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.
- filter_setting_list
A 'GLSFilterSettingsList' object containing filter settings for loggers or a path to load one using 'read_filter_file()'. Defaults to 'seatrack_settings_list'.
- extra_metadata
Optional data frame containing extra metadata for loggers. This must have the column
logger_idto join extra metadata. Ayear_retrievedcolumn can also be provided to join based on a combination of logger and which session this is.- show_filter_plots
A logical indicating whether to show filter plots. Defaults to
FALSE.- output_dir
An optional directory path to save processed outputs. Defaults to
NULL.- calibration_mode
A logical indicating whether to run in calibration mode. Defaults to
TRUE. IfTRUE, the function can export or return a combined calibration data file for all logger/year combinations. IfFALSE, the function exports processed position data, filtering summaries, and twilight estimates for each logger/year combination.- export_calibration_template
A logical indicating whether to export an excel calibration template. Defaults to
TRUE. IfFALSE, the calibration template is returned.- 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.- do_seasonal_calibration
A logical indicating whether to perform seasonal calibration. Defaults to NULL, which uses the filter_settings_list.
- 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.