metobs_toolkit.Dataset.sync_observations#
- Dataset.sync_observations(tolerance, verbose=True, _force_resolution_minutes=None, _drop_target_nan_dt=False)[source]#
Simplify and syncronize the observation timestamps.
To simplify the resolution (per station), a tolerance is use to shift timestamps. The tolerance indicates the maximum translation in time that can be applied to an observation.
The sycronisation tries to group stations that have an equal simplified resolution, and syncronize them. The origin of the sycronized timestamps will be set to round hours, round 10-minutes or round-5 minutes if possible given the tolerance.
The observations present in the input file are used.
After syncronization, the IO outliers, missing observations and gaps are recomputed.
- Parameters:
tolerance (Timedelta or str) – The tolerance string or object representing the maximum translation in time. Ex: ‘5min’ is 5 minutes, ‘1h’, is one hour.
verbose (bool, optional) – If True, a dataframe illustrating the mapping from original datetimes to simplified and syncronized is returned. The default is True.
_drop_target_nan_dt (bool, optional) – If record has no target datetime, the datetimes will be listed as Nat. To remove them, set this to True. Default is False.
_force_resolution_minutes (bool, optional) – force the resolution estimate to this frequency in minutes. If None, the frequency is estimated. The default is None.
Note
Keep in mind that this method will overwrite the df, outliersdf, missing timestamps and gaps.
Note
Because the used observations are from the input file, previously coarsend timeresolutions are ignored.
- Returns:
A dataframe containing the original observations with original timestamps and the corresponding target timestamps.
- Return type:
pandas.DataFrame (if verbose is True)