Skip to contents

For each observation in `obs_df`, finds the nearest model prediction in `model_df` within `tolerance_secs`. Guarantees that each observation is paired with at most one model prediction.

Usage

align_by_time(model_df, obs_df, tolerance_secs = 3600)

Arguments

model_df

data.frame containing model predictions with a `time` column (POSIXct) and `value` or `model` column.

obs_df

data.frame containing observations with a `time` column (POSIXct) and `value` or `obvs` column.

tolerance_secs

maximum allowable time difference in seconds between paired observation and model prediction.

Value

data.frame with aligned rows containing model and observation columns, where each observation corresponds to exactly one model prediction.