interpolate_over_time#
- movement.filtering.interpolate_over_time(data, method='linear', max_gap=None, print_report=False, **kwargs)[source]#
Fill in NaN values by interpolating over the
timedimension.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 (
DataArray) – The input data to be interpolated.method (
Union[Literal['linear','nearest','zero','slinear','quadratic','cubic','quintic','polynomial'],Literal['barycentric','krogh','pchip','spline','akima','makima'],Literal['linear','nearest','slinear','cubic','quintic','pchip']]) – String indicating which method to use for interpolation. Default islinear.max_gap (
int|None) – Maximum size of gap, a continuous sequence of missing observations (represented as NaNs), to fill. The default value isNone(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 isFalse.**kwargs (
Any) – Any**kwargsaccepted 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_gapparameter differs slightly from that inxarray.DataArray.interpolate_na(), in which the gap size is defined as the difference between thetimecoordinate values at the first data point after a gap and the last value before a gap.