Time Series Utilities

The following utilities are designed to simplify common data analysis tasks for time series data. While most are thin wrappers around existing Julia functions, they ensure proper handling of metadata and dimensions.

Most of the utilities operate on the time dimension by default, but you can specify other dimensions using the dim or query parameter.

Statistics

Missing docstring.

Missing docstring for tstat. Check Documenter's build log for details.

SPEDAS.tmeanFunction
tmean(x; dim=nothing, query=nothing)

Calculate the arithmetic mean of x along the dim dimension.

It returns a value if x is a vector along the dim dimension, otherwise returns a DimArray with the specified dimension dropped.

If dim is not specified, it defaults to the query dimension (dimension of type TimeDim by default).

source

https://github.com/JuliaLang/julia/issues/54542

source
SPEDAS.tmedianFunction
tmedian(x; dim=nothing, query=nothing)

Calculate the median of x along the dim dimension.

It returns a value if x is a vector along the dim dimension, otherwise returns a DimArray with the specified dimension dropped.

If dim is not specified, it defaults to the query dimension (dimension of type TimeDim by default).

source
SPEDAS.tsumFunction
tsum(x; dim=nothing, query=nothing)

Calculate the sum of x along the dim dimension.

It returns a value if x is a vector along the dim dimension, otherwise returns a DimArray with the specified dimension dropped.

If dim is not specified, it defaults to the query dimension (dimension of type TimeDim by default).

source
SPEDAS.tvarFunction
tvar(x; dim=nothing, query=nothing)

Calculate the variance of x along the dim dimension.

It returns a value if x is a vector along the dim dimension, otherwise returns a DimArray with the specified dimension dropped.

If dim is not specified, it defaults to the query dimension (dimension of type TimeDim by default).

source
SPEDAS.tstdFunction
tstd(x; dim=nothing, query=nothing)

Calculate the standard deviation of x along the dim dimension.

It returns a value if x is a vector along the dim dimension, otherwise returns a DimArray with the specified dimension dropped.

If dim is not specified, it defaults to the query dimension (dimension of type TimeDim by default).

source
SPEDAS.tsemFunction
tsem(x; dim=nothing, query=nothing)

Calculate the standard error of the mean of x along the dim dimension.

It returns a value if x is a vector along the dim dimension, otherwise returns a DimArray with the specified dimension dropped.

If dim is not specified, it defaults to the query dimension (dimension of type TimeDim by default).

source

Arithmetic

SPEDAS.tcrossFunction
tcross(x, y; dims=TimeDim, stack=nothing)

Compute the cross product of two (arrays of) vectors along the dims dimension.

References:

  • https://docs.xarray.dev/en/stable/generated/xarray.cross.html
source
SPEDAS.tdotFunction
tdot(x, y; dims=TimeDim)

Dot product of two arrays x and y along the dims dimension.

source
SPEDAS.tsubtractFunction
tsubtract(x, f=nanmedian; dims=timedim(x))

Subtract a statistic (default function f: nanmedian) along dimensions (default: time dimension) from x.

source

Time-Domain Operations

SPEDAS.tclipFunction
tclip(d, t0, t1; query=nothing, sort=false)

Clip a dimension or DimArray to a time range [t0, t1].

For unordered dimensions, the dimension should be sorted before clipping (see tsort).

source
SPEDAS.tviewFunction
tview(d, t0, t1)

View a dimension or DimArray in time range [t0, t1].

source
SPEDAS.tshiftFunction
tshift(x; dim=TimeDim, t0=nothing, new_dim=nothing)

Shift the dim of x by t0.

source