metobs_toolkit.dataset.Dataset.sync_records#

Dataset.sync_records(obstype: str = 'temp', timestamp_shift_tolerance: str | Timedelta = '2min', freq_shift_tolerance: str | Timedelta = '1min', fixed_origin: Timedelta | None = None) None[source]#

Synchronize records of sensor data across stations.

Synchronize records of sensor data across stations (for a specific observation type). This method aligns the sensor data of a specified observation type (obstype) across all stations by resampling the data to a common frequency and ensuring alignment errors of timestamps within specified tolerances.

Parameters:
  • obstype (str, optional) – The observation type to synchronize (e.g., “temp” for temperature). Default is “temp”.

  • timestamp_shift_tolerance (str or pandas.Timedelta, optional) – The maximum allowed time shift tolerance for aligning data during resampling. Default is 2 minutes.

  • freq_shift_tolerance (str or pandas.Timedelta, optional) – The maximum allowed error in simplifying the target frequency. Default is “1min”.

  • fixed_origin (pandas.Timestamp, or None, optional) – A fixed origin timestamp for resampling. If None, the origin is determined automatically. Default is None.

Return type:

None.

Note

In general, this method is a wrapper for Dataset.resample() but making sure that the target frequencies are naturel multiples of each other thus ensuring syncronisation accros stations.

Warning

  • Since the gaps depend on the record’s frequency and origin, all gaps are removed and re-located. All progress in gap(filling) will be lost.

  • Cumulative tolerance errors can be introduced when this method is called multiple times.