series⚓︎
Time series management and processing.
DACycleSeries
⚓︎
Bases: StatPrint
Container for time series of a statistic across one DA cycle.
Four attributes, each an ndarray:
.ffor forecast , shape(Ko+1,)+item_shape.afor analysis , shape(Ko+1,)+item_shape.sfor smoothed , shape(Ko+1,)+item_shape.ifor integrational , shape(K +1,)+item_shape
.i covers every model time step, including the ones between observations.
The name fits three synonyms: integrational (steps taken by the model
integrator), intermediate (between analysis times), intervening
(between obs times).
If store_i=False, .i has shape (1,)+item_shape — only the
most-recently-written step is kept (ring buffer of size 1).
Use direct attribute access::
stat.f[ko] = val
stat.a[ko] = val
stat.i[k] = val # or stat.i[0] when store_i=False
Note
If a series only pertains to analysis times, pass store_f=False.
a
⚓︎
Analysis — shape (Ko+1,)+item_shape. Always present.
f
⚓︎
Forecast — shape (Ko+1,)+item_shape. Absent when store_f=False.
gm
⚓︎
Geometric-mean scalar time series.
i
⚓︎
Integrational — shape (K+1,)+item_shape. Always present
(ring buffer of 1 when store_i=False).
m
⚓︎
Mean-field scalar time series.
ma
⚓︎
Mean-absolute scalar time series.
ms
⚓︎
Mean-square scalar time series.
rms
⚓︎
Root-mean-square scalar time series.
s
⚓︎
Smoothed — shape (Ko+1,)+item_shape. Absent when store_s=False.
__getitem__(key)
⚓︎
Read via (k, ko, sub) tuple — used internally by liveplotting.
__init__(K, Ko, item_shape, store_i, store_s, store_f=True, **kwargs)
⚓︎
Construct object.
item_shape: shape of an item in the series.store_i: if False: only the current value is stored in.i.store_f: if False:.fis not created (analysis-only stats).kwargs: passed on to ndarrays.
RollingArray
⚓︎
ND-Array that implements "leftward rolling" along axis 0.
Used for data that gets plotted in sliding graphs.
StatPrint
⚓︎
Bases: YamlRepr
Mixin that pretty-prints stats objects via YAML.
auto_cov(xx, nlags=4, zero_mean=False, corr=False)
⚓︎
Auto covariance function, computed along axis 0.
nlags: max lag (offset) for which to compute acf.corr: normalize acf byacf[0]so as to return auto-CORRELATION.
With corr=True, this is identical to
statsmodels.tsa.stattools.acf(xx,True,nlags)
estimate_corr_length(xx)
⚓︎
Estimate the correlation length of a time series.
For explanation, see mods.LA.homogeneous_1D_cov.
Also note that, for exponential corr function, as assumed here,
fit_acf_by_AR1(acf_empir, nlags=None)
⚓︎
Fit an empirical auto cov function (ACF) by that of an AR1 process.
acf_empir: auto-corr/cov-function.nlags: length of ACF to use in AR(1) fitting
mean_with_conf(xx)
⚓︎
Compute the mean of a 1d iterable xx.
Also provide confidence of mean, as estimated from its correlation-corrected variance.