deafrica_tools.temporal.temporal_statistics

deafrica_tools.temporal.temporal_statistics(da, stats)

Calculate various generic summary statistics on any timeseries.

This function uses the hdstats temporal library: https://github.com/daleroberts/hdstats/blob/master/hdstats/ts.pyx

last modified June 2020

Parameters
  • da (xarray.DataArray) – DataArray should contain a 3D time series.

  • stats (list) –

    list of temporal statistics to calculate. Options include:

    • ’discordance’ =

    • ’f_std’ = std of discrete fourier transform coefficients, returns

      three layers: f_std_n1, f_std_n2, f_std_n3

    • ’f_mean’ = mean of discrete fourier transform coefficients, returns

      three layers: f_mean_n1, f_mean_n2, f_mean_n3

    • ’f_median’ = median of discrete fourier transform coefficients, returns

      three layers: f_median_n1, f_median_n2, f_median_n3

    • ’mean_change’ = mean of discrete difference along time dimension

    • ’median_change’ = median of discrete difference along time dimension

    • ’abs_change’ = mean of absolute discrete difference along time dimension

    • ’complexity’ =

    • ’central_diff’ =

    • ’num_peaks’The number of peaks in the timeseries, defined with a local

      window of size 10. NOTE: This statistic is very slow

Returns

Dataset containing variables for the selected temporal statistics

Return type

xarray.Dataset