time_series.smooth

  • Computes the moving average of a time-series

Calling Sequence

import gravity_toolkit.time_series
smth = gravity_toolkit.time_series.smooth(t_in, d_in, HFWTH=6)

Source code

gravity_toolkit.time_series.smooth(t_in, d_in, HFWTH=6, MOVING=False, DATA_ERR=0, WEIGHT=0, STDEV=0, CONF=0)[source]

Computes the moving average of a time-series

  1. centered moving average

  2. 13-month Loess filter [71]

  3. 13-month Loess filter weighted and outputs for all dates

Parameters:
t_in: float

input time array

d_in: float

input data array

HFWTH: int

half-width of the moving average

MOVING: bool, default False

calculates centered moving average using mean of window

WEIGHT: smoothing algorithm that backward models dates before

half-width and forward models dates after half-width

  • 0: use unweighted Loess filter

  • 1: use linear weights with Loess filter

  • 2: use gaussian weights with Loess filter

DATA_ERR: float or list

input error for known and equal errors

STDEV: float, default 0

Standard deviation of output error

CONF: float, default 0

Confidence interval of output error

Returns:
time: float

time after removing start and end half-windows

data: float

smoothed time-series

season: float

seasonal component calculated by the Loess filter

annual: float

annual component calculated by the Loess filter

semiann: float

semi-annual component calculated by the Loess filter

trend: float

instantaneous trend calculated by the Loess filter

error: float

estimated error of the instantaneous trend

noise: float

noise component after removing the Loess trend and seasonal components

reduce: float

original time series after removing start and end half-windows