This function calibrate values of sensor (microclimatic records) using the myClim object sensor$calibration parameters provided by mc_prep_calib_load(). Microclimatic records are changed and myClim object parameter sensor$metadata@calibrated is set to TRUE. It isn't allowed to calibrate sensor multiple times.

mc_prep_calib(data, localities = NULL, sensors = NULL)

Arguments

data

myClim object in Raw-format or Agg-format having calibration data in metadata slot sensor$calibration

localities

vector of locality_ids where to perform calibration, if NULL, then calibrate sensors on all localities (default NULL)

sensors

vector of sensor names where to perform calibration see names(mc_data_sensors); if NULL, then calibrate all sensors having calibration parameters loaded (default NULL)

Value

same myClim object as input but with calibrated sensor values.

Details

This function performs calibration itself. It uses the calibration values (cor_factor, cor_slope) stored in myClim object sensor metadata sensor calibration loaded with mc_prep_calib_load(). As it is possible to have multiple calibration values for one sensor in time (re-calibration after some time) different calibration values can be applied based on the calibration time. Older microclimatic records then first calibration datetime available are calibrated anyway (in case sensor was calibrated ex-post) with the first calibration parameters available.

This function is not designed for moisture_raw calibration (conversion to volumetric water content) for this use mc_calc_vwc()

Only sensors with real value type can be calibrated. see mc_data_sensors()