Matching continuously measured fluxes with measurement IDs and meta data
Matching continuously measured fluxes with measurement IDs and meta data
Matching a dataframe of continuously measured gas concentration data with measurement metadata from another dataframe. Measurements are paired with their metadata based on datetime. Extra variables in both dataframes are kept in the output.
raw_conc: dataframe of CO2 concentration measured continuously. Has to contain at least a datetime column in ymd_hms format and a gas concentration column as double.
field_record: dataframe recording which measurement happened when. Has to contain at least a column containing the start of each measurement, and any other column identifying the measurements.
datetime_col: datetime column in raw_conc (dmy_hms format)
start_col: start column in field_record (dmy_hms format)
conc_col: concentration column in raw_conc
startcrop: how many seconds should be discarded at the beginning of the measurement
measurement_length: length of the measurement (in seconds) from the start specified in the field_record
ratio_threshold: ratio (number of concentration measurement compared to length of measurement in seconds) below which the data should be flagged as too little
time_diff: time difference (in seconds) between the two datasets. Will be added to the datetime column of the raw_conc dataset. For situations where the time was not synchronized correctly.
Returns
a dataframe with concentration measurements, corresponding datetime, flux ID (f_fluxid), measurements start (f_start) and end (f_end), flags in case of no data or low number of data (f_flag_match), the number of datapoints per measurement (f_n_conc), the ratio of number of datapoints over the length of each measurement in seconds (f_ratio), and any variables present in one of the inputs.