interpolate_over_time#

movement.filtering.interpolate_over_time(data, method='linear', max_gap=None, print_report=True)[source]#

Fill in NaN values by interpolating over the time dimension.

This method uses xarray.DataArray.interpolate_na() under the hood and passes the method and max_gap parameters to it. See the xarray documentation for more details on these parameters.

Parameters:
  • data (xarray.DataArray) – The input data to be interpolated.

  • method (str) – String indicating which method to use for interpolation. Default is linear.

  • max_gap (int, optional) – Maximum size of gap, a continuous sequence of missing observations (represented as NaNs), to fill. The default value is None (no limit). Gap size is defined as the number of consecutive NaNs.

  • print_report (bool) – Whether to print a report on the number of NaNs in the dataset before and after interpolation. Default is True.

Returns:

The data where NaN values have been interpolated over using the parameters provided.

Return type:

xarray.DataArray

Notes

The max_gap parameter differs slightly from that in xarray.DataArray.interpolate_na(), in which the gap size is defined as the difference between the time coordinate values at the first data point after a gap and the last value before a gap.