rdtools.filtering.hampel_filter

rdtools.filtering.hampel_filter(series, k='14d', t0=3)

Hampel outlier designed for use after the aggregation step in the RdTools trend analysis workflows, but broadly applicable.

Parameters:
  • series (pandas.Series) -- daily normalized time series

  • k (int or time offset string e.g. 'd', default 14d) -- size of window including the sample; 14d is equal to 7 days on either side of value

  • t0 (int, default 3) -- Threshold value, defaults to 3 sigma Pearson's rule.

Returns:

Boolean Series of whether the given measurement is within t0 sigma of the rolling median. False points indicate outliers to be excluded.

Return type:

pandas.Series