Function Repository Resource:

TimeSeriesEnsemble

Source Notebook

Transform a long time series into an ensemble of segments with aligned starts

Contributed by: Ting Sun

ResourceFunction["TimeSeriesEnsemble"][ts,dt]

transforms ts into an ensemble TemporalData of multiple paths of window size dt aligned at the start of ts.

ResourceFunction["TimeSeriesEnsemble"][ts,dt,f]

threads the function f pathwise for the ensemble TemporalData.

Details

ResourceFunction["TimeSeriesEnsemble"] is used to synthesize a long time series into a shorter window for further processing (e.g. in climatology).

Examples

Basic Examples (4) 

Make an annual ensemble from a longterm series of air temperature records:

In[1]:=
data = AirTemperatureData[{{2012, 1, 1}, {2020, 12, 31}, "Day"}];
In[2]:=
enYear = ResourceFunction["TimeSeriesEnsemble"][data, "Year"]
Out[2]=

Decompose the ensemble into its components:

In[3]:=
enYear["Components"]
Out[3]=

Get the annual cycle of climatology by calculating median values of each day:

In[4]:=
enYearMedian = ResourceFunction["TimeSeriesEnsemble"][data, "Year", Median] // Quiet
Out[4]=

Show the multi-year climatology of air temperature along with individual annual dynamics:

In[5]:=
DateListPlot[{enYear, enYearMedian}, PlotStyle -> {Directive[Gray, Thin], Directive[Red, Medium]}]
Out[5]=

Publisher

Ting Sun

Version History

  • 1.0.0 – 12 July 2021

Related Resources

License Information