interpolate_over_time#
- movement.filtering.interpolate_over_time(data, method='linear', max_gap=None, print_report=True, **kwargs)[source]#
Fill in NaN values by interpolating over the
time
dimension.This function calls
xarray.DataArray.interpolate_na()
and can pass additional keyword arguments to it, depending on the chosenmethod
. See the xarray documentation for more details.- 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 (see Notes for more information).print_report (bool) – Whether to print a report on the number of NaNs in the dataset before and after interpolation. Default is
True
.**kwargs (dict) – Any
**kwargs
accepted byxarray.DataArray.interpolate_na()
, which in turn passes them verbatim to the underlying interpolation methods.
- Returns:
The data where NaN values have been interpolated over using the parameters provided.
- Return type:
Notes
The
max_gap
parameter differs slightly from that inxarray.DataArray.interpolate_na()
, in which the gap size is defined as the difference between thetime
coordinate values at the first data point after a gap and the last value before a gap.