API Reference
SPEDAS.SPEDAS
TimeseriesUtilities.TimeseriesUtilities
SPEDAS.DEFAULTS
SPEDAS.TPlot.Debouncer
SPEDAS.TPlot.DualAxisData
SPEDAS.TPlot.DualPlot
SPEDAS.TPlot.FunctionPlot
SPEDAS.TPlot.LinesPlot
SPEDAS.TPlot.MultiPlot
SPEDAS.TPlot.PanelPlot
SPEDAS.TPlot.SpecPlot
SpaceDataModel.AbstractCoordinateSystem
SpaceDataModel.AbstractCoordinateVector
SpaceDataModel.AbstractDataVariable
SpaceDataModel.DataSet
SpaceDataModel.DataSet
SpaceDataModel.DataSet
SpaceDataModel.Instrument
SpaceDataModel.Instrument
SpaceDataModel.Instrument
SpaceDataModel.LDataSet
SpaceDataModel.LDataSet
SpaceDataModel.NoMetadata
SpaceDataModel.Project
SpaceDataModel.Project
TimeseriesUtilities.DiffQ
Base.:∘
MakieCore.convert_arguments
SPEDAS.B_x3_error
SPEDAS.ConstantThicknessApproach
SPEDAS.ConstantVelocityApproach
SPEDAS.ConstantVelocityApproach
SPEDAS.DiscontinuityAnalyzer
SPEDAS.TPlot.add_labels!
SPEDAS.TPlot.add_labels!
SPEDAS.TPlot.add_legend!
SPEDAS.TPlot.add_legend!
SPEDAS.TPlot.auto_figure_size
SPEDAS.TPlot.default_orientation
SPEDAS.TPlot.dualplot
SPEDAS.TPlot.dualplot
SPEDAS.TPlot.dualplot!
SPEDAS.TPlot.format_datetime
SPEDAS.TPlot.functionplot
SPEDAS.TPlot.functionplot
SPEDAS.TPlot.functionplot!
SPEDAS.TPlot.functionplot!
SPEDAS.TPlot.linesplot
SPEDAS.TPlot.linesplot
SPEDAS.TPlot.linesplot!
SPEDAS.TPlot.make_secondary_axis!
SPEDAS.TPlot.multiplot
SPEDAS.TPlot.multiplot
SPEDAS.TPlot.multiplot!
SPEDAS.TPlot.multiplot!
SPEDAS.TPlot.panelplot
SPEDAS.TPlot.panelplot!
SPEDAS.TPlot.plot_attributes
SPEDAS.TPlot.plotfunc
SPEDAS.TPlot.plotfunc!
SPEDAS.TPlot.plottype_attributes
SPEDAS.TPlot.set_if_equal!
SPEDAS.TPlot.specplot
SPEDAS.TPlot.specplot
SPEDAS.TPlot.specplot!
SPEDAS.TPlot.specplot!
SPEDAS.TPlot.spectrogram_y_values
SPEDAS.TPlot.tlines!
SPEDAS.TPlot.tplot
SPEDAS.TPlot.tplot_panel
SPEDAS.TPlot.tplot_panel!
SPEDAS.TPlot.tplot_panel_s!
SPEDAS.TPlot.transform
SPEDAS.TPlot.transform_pipeline
SPEDAS.TPlot.x2t
SPEDAS._linear_binedges
SPEDAS.amap
SPEDAS.angle
SPEDAS.binedges
SPEDAS.check_mva_eigen
SPEDAS.cotrans
SPEDAS.cotrans
SPEDAS.current_density
SPEDAS.dimarrayify
SPEDAS.ensure_nxm
SPEDAS.fac_mat
SPEDAS.fill_gaps
SPEDAS.find_continuous_timeranges
SPEDAS.interpolate_nans
SPEDAS.lingradest
SPEDAS.lingradest
SPEDAS.lingradest
SPEDAS.lingradest
SPEDAS.m2nV
SPEDAS.mva
SPEDAS.mva_eigen
SPEDAS.nt2ds
SPEDAS.phase_factor
SPEDAS.polarization
SPEDAS.polarization
SPEDAS.position_tensor
SPEDAS.pspectrum
SPEDAS.reciprocal_vector
SPEDAS.reciprocal_vector
SPEDAS.reciprocal_vector
SPEDAS.reciprocal_vectors
SPEDAS.resample
SPEDAS.rotate
SPEDAS.set_coord
SPEDAS.smooth_spectral_matrix
SPEDAS.smooth_spectral_matrix!
SPEDAS.spectral_matrix
SPEDAS.spectral_matrix
SPEDAS.tetrahedron_quality
SPEDAS.tinterp
SPEDAS.tinterp
SPEDAS.tinterp_nans
SPEDAS.tresample
SPEDAS.tstack
SPEDAS.tsync
SPEDAS.twavpol
SPEDAS.wave_normal_angle
SPEDAS.wavpol
SPEDAS.wpol_helicity
SPEDAS.ys
SPEDAS.Δφij
SPEDAS.ω2f
SpaceDataModel._getfield
SpaceDataModel.abbr
SpaceDataModel.getcsys
SpaceDataModel.is_doy
TimeseriesUtilities.common_timerange
TimeseriesUtilities.dimnum
TimeseriesUtilities.dropna
TimeseriesUtilities.find_outliers
TimeseriesUtilities.find_outliers_mean
TimeseriesUtilities.find_outliers_median
TimeseriesUtilities.groupby_dynamic
TimeseriesUtilities.interpolate_outliers!
TimeseriesUtilities.oproj
TimeseriesUtilities.proj
TimeseriesUtilities.rectify
TimeseriesUtilities.replace_outliers
TimeseriesUtilities.replace_outliers!
TimeseriesUtilities.replace_outliers!
TimeseriesUtilities.smooth
TimeseriesUtilities.sproj
TimeseriesUtilities.tclip
TimeseriesUtilities.tclips
TimeseriesUtilities.tcross
TimeseriesUtilities.tderiv
TimeseriesUtilities.tdot
TimeseriesUtilities.tfilter
TimeseriesUtilities.tgroupby
TimeseriesUtilities.time_grid
TimeseriesUtilities.timerange
TimeseriesUtilities.times
TimeseriesUtilities.tmask
TimeseriesUtilities.tmask!
TimeseriesUtilities.tmaximum
TimeseriesUtilities.tmean
TimeseriesUtilities.tmedian
TimeseriesUtilities.tminimum
TimeseriesUtilities.tnorm
TimeseriesUtilities.tnorm_combine
TimeseriesUtilities.toproj
TimeseriesUtilities.tproj
TimeseriesUtilities.tselect
TimeseriesUtilities.tsem
TimeseriesUtilities.tshift
TimeseriesUtilities.tsort
TimeseriesUtilities.tsplit
TimeseriesUtilities.tsproj
TimeseriesUtilities.tstat
TimeseriesUtilities.tstd
TimeseriesUtilities.tsubtract
TimeseriesUtilities.tsum
TimeseriesUtilities.tvar
TimeseriesUtilities.tview
TimeseriesUtilities.unwrap
TimeseriesUtilities.window_bf_sizes
SPEDAS.@load_project_config
SpaceDataModel.@get
SpaceDataModel.@getfield
Data Model
SpaceDataModel.AbstractCoordinateSystem
— TypeAbstractCoordinateSystem
Base abstract type for all coordinate system implementations.
SpaceDataModel.AbstractCoordinateVector
— TypeAbstractCoordinateVector
Base abstract type to represent coordinates in a coordinate systems.
SpaceDataModel.AbstractDataVariable
— TypeA variable v
of a type derived from AbstractDataVariable
should at least implement:
Base.parent(v)
: the parent array of the variable
Optional:
times(v)
: the timestamps of the variableunits(v)
: the units of the variablemeta(v)
: the metadata of the variablename(v)
: the name of the variable
SpaceDataModel.DataSet
— TypeDataSet <: AbstractDataSet
A concrete dataset with a name, data (parameters), and metadata.
SpaceDataModel.DataSet
— MethodConstruct a DataSet
from a name and data, with optional metadata.
SpaceDataModel.DataSet
— MethodDataSet(ld::LDataSet; kwargs...)
Create a concrete DataSet
from a Dataset template with specified data.
See also: LDataSet
SpaceDataModel.Instrument
— TypeInstrument <: AbstractInstrument
Fields
name
: The name of the instrumentmetadata
: Additional metadatadatasets
: Collection of datasets
SpaceDataModel.Instrument
— MethodConstruct an Instrument
from a dictionary.
SpaceDataModel.Instrument
— Methodkeyword-based constructor
SpaceDataModel.LDataSet
— TypeLDataSet <: AbstractDataSet
A template for generating datasets with parameterized naming patterns.
Fields
format
: Format string pattern for the dataset namedata
: Dictionary of variable patternsmetadata
: Additional metadata
Examples
using SPEDAS.MMS
# Access FPI dataset specification
lds = mms.datasets.fpi_moms
# Create a concrete dataset with specific parameters
ds = DataSet(lds; probe=1, data_rate="fast", data_type="des")
The format string and variable patterns use placeholders like {probe}
, {data_rate}
, which are replaced with actual values when creating a concrete DataSet
.
SpaceDataModel.LDataSet
— MethodConstruct a LDataSet
from a dictionary.
SpaceDataModel.NoMetadata
— TypeNoMetadata
Indicates an object has no metadata. But unlike using nothing
, get
, keys
and haskey
will still work on it, get
always returning the fallback argument. keys
returns ()
while haskey
always returns false
.
SpaceDataModel.Project
— TypeProject <: AbstractProject
A representation of a project or mission containing instruments and datasets.
Fields
name
: The name of the projectmetadata
: Additional metadatainstruments
: Collection of instrumentsdatasets
: Collection of datasets
SpaceDataModel.Project
— Methodkeyword-based constructor
Base.:∘
— MethodCreate a new product with the composed function
SpaceDataModel._getfield
— Function_getfield(v, name, default)
Return the field from a composite v
for the given name
, or the given default
if no field is present.
See also: getfield
.
SpaceDataModel.abbr
— Methodabbr(p)
Get the abbreviation (abbr) of p
.
SpaceDataModel.getcsys
— Methodgetcsys(x)
Get the coordinate system of x
.
If x
is a instance of AbstractCoordinateSystem
, return x
itself. If x
is a type of AbstractCoordinateSystem
, return an instance of the coordinate system, i.e. x()
.
This is a generic function, packages should extend it for their own types.
SpaceDataModel.is_doy
— MethodCheck if a string is in Day of Year format (YYYY-DDD).
SpaceDataModel.@get
— Macro@get(collection, key, default)
Short-circuiting version of get
. See also @something
.
SpaceDataModel.@getfield
— MacroShort-circuiting version of _getfield
.
Coordinate Transformations
See GeoCotrans.jl and IRBEM.jl for more details.
SPEDAS.cotrans
— Functioncotrans(A, in, out)
cotrans(A, out; in=get_coord(A))
Transform the data to the out
coordinate system from the in
coordinate system.
This function automatically choose between Julia's GeoCotrans
(if available) and Fortran's IRBEM
implementation.
References:
- IRBEM-LIB: compute magnetic coordinates and perform coordinate conversions (Documentation, IRBEM.jl)
- SPEDAS Cotrans
TPlot
SPEDAS.TPlot.Debouncer
— TypeDebouncer
A struct that creates a debounced version of a function f
.
The debounced function will only execute after a specified delay
(in seconds) of inactivity. If called again before the delay expires, the timer
resets.
SPEDAS.TPlot.DualAxisData
— TypeDualAxisData(data1, data2; meta=nothing)
A type for handling dual-axis data where each field represents data for a different axis. The first field is plotted against the left y-axis and the second field against the right y-axis.
Fields
data1
: Data for the left y-axisdata2
: Data for the right y-axismetadata
: Metadata for the data (e.g., title)
SPEDAS.TPlot.DualPlot
— TypeDualPlot
is the plot type associated with plotting function dualplot
. Check the docstring for dualplot
for further information.
SPEDAS.TPlot.FunctionPlot
— TypeFunctionPlot
is the plot type associated with plotting function functionplot
. Check the docstring for functionplot
for further information.
SPEDAS.TPlot.LinesPlot
— TypeLinesPlot
is the plot type associated with plotting function linesplot
. Check the docstring for linesplot
for further information.
SPEDAS.TPlot.MultiPlot
— TypeMultiPlot
is the plot type associated with plotting function multiplot
. Check the docstring for multiplot
for further information.
SPEDAS.TPlot.PanelPlot
— TypePanelPlot
is the plot type associated with plotting function panelplot
. Check the docstring for panelplot
for further information.
SPEDAS.TPlot.SpecPlot
— TypeSpecPlot
is the plot type associated with plotting function specplot
. Check the docstring for specplot
for further information.
MakieCore.convert_arguments
— MethodConvert the vector of vectors into a single vector of curves
SPEDAS.TPlot.add_labels!
— FunctionAdd labels to a figure, automatically searching for blocks to label.
Notes
- https://github.com/brendanjohnharris/Foresight.jl/blob/main/src/Layouts.jl#L2
SPEDAS.TPlot.add_labels!
— MethodAdd labels to a grid of layouts
Notes
- See
tag_facet
inegg
for reference
SPEDAS.TPlot.add_legend!
— MethodOnly add legend when the axis contains multiple labels
SPEDAS.TPlot.add_legend!
— MethodOnly add legend when the axis contains multiple labels
SPEDAS.TPlot.auto_figure_size
— Methodauto_figure_size(tas)
Calculate an appropriate figure size based on the number of plots in the list. Returns a tuple of (width, height) in pixels.
SPEDAS.TPlot.default_orientation
— MethodGet the default orientation for a legend based on the position
SPEDAS.TPlot.dualplot
— FunctionNo docstring defined.
Plot type
The plot type alias for the dualplot
function is DualPlot
.
Attributes
color2
= (Makie.wong_colors())[end - 1]
— No docs available.
linestyle2
= :dash
— No docs available.
marker2
= :rect
— No docs available.
plotfunc
= scatterlines!
— No docs available.
SPEDAS.TPlot.dualplot!
— Functiondualplot!
is the mutating variant of plotting function dualplot
. Check the docstring for dualplot
for further information.
SPEDAS.TPlot.dualplot
— MethodSetup the panel with both primary and secondary y-axes
SPEDAS.TPlot.format_datetime
— MethodFormat datetime ticks with time on top and date on bottom.
SPEDAS.TPlot.functionplot
— FunctionNo docstring defined.
Plot type
The plot type alias for the functionplot
function is FunctionPlot
.
Attributes
plotfunc
= tplot_panel!
— No docs available.
SPEDAS.TPlot.functionplot!
— Functionfunctionplot!
is the mutating variant of plotting function functionplot
. Check the docstring for functionplot
for further information.
SPEDAS.TPlot.functionplot!
— Methodfunctionplot!(ax, f, tmin, tmax; kwargs...)
Interactive plot of a function f
on ax
for a time range from tmin
to tmax
SPEDAS.TPlot.functionplot
— Methodfunctionplot(gp, f, tmin, tmax; kwargs...)
Interactively plot a function over a time range on a grid position
SPEDAS.TPlot.linesplot
— FunctionNo docstring defined.
Plot type
The plot type alias for the linesplot
function is LinesPlot
.
Attributes
labels
= nothing
— No docs available.
SPEDAS.TPlot.linesplot!
— Functionlinesplot!
is the mutating variant of plotting function linesplot
. Check the docstring for linesplot
for further information.
SPEDAS.TPlot.linesplot
— Methodlinesplot(gp, ta)
Plot a multivariate time series on a panel
SPEDAS.TPlot.make_secondary_axis!
— MethodCreate and configure a secondary y-axis
SPEDAS.TPlot.multiplot
— FunctionNo docstring defined.
Plot type
The plot type alias for the multiplot
function is MultiPlot
.
Attributes
plotfunc
= plot!
— No docs available.
SPEDAS.TPlot.multiplot!
— Functionmultiplot!
is the mutating variant of plotting function multiplot
. Check the docstring for multiplot
for further information.
SPEDAS.TPlot.multiplot!
— Methodmultiplot!(ax, fs, t0, t1; plotfunc=plot2spec, kwargs...)
Specialized multiplot function for functionplot
. Merge specs before plotting so as to cycle through them.
SPEDAS.TPlot.multiplot
— Methodmultiplot(gp, tas::MultiPlottable, args...; axis=(;), kwargs...)
Setup the panel on a position and plot multiple time series on it
SPEDAS.TPlot.panelplot
— FunctionNo docstring defined.
Plot type
The plot type alias for the panelplot
function is PanelPlot
.
Attributes
cycle
= [:color]
— No docs available.
plot
= (;)
— No docs available.
plotfunc
= plot!
— No docs available.
SPEDAS.TPlot.panelplot!
— Functionpanelplot!
is the mutating variant of plotting function panelplot
. Check the docstring for panelplot
for further information.
SPEDAS.TPlot.plot_attributes
— MethodPlot attributes for a time array (axis + labels)
SPEDAS.TPlot.plotfunc
— FunctionDetermine the plotting function for a given data type. Extend this for custom data types to integrate with the plotting system.
SPEDAS.TPlot.plotfunc!
— FunctionDetermine the plotting function for a given data type. Extend this for custom data types to integrate with the plotting system.
SPEDAS.TPlot.plottype_attributes
— MethodPlot attributes for a time array (labels)
SPEDAS.TPlot.set_if_equal!
— MethodSet an attribute if all values are equal and non-empty
SPEDAS.TPlot.specplot
— FunctionNo docstring defined.
Plot type
The plot type alias for the specplot
function is SpecPlot
.
Attributes
SPEDAS.TPlot.specplot!
— Functionspecplot!
is the mutating variant of plotting function specplot
. Check the docstring for specplot
for further information.
SPEDAS.TPlot.specplot!
— MethodPlot heatmap of a time series on the same axis
SPEDAS.TPlot.specplot
— Methodspecplot(gp, ta)
Plot a spectrogram on a panel
SPEDAS.TPlot.spectrogram_y_values
— Methodspectrogram_y_values(ta; check=false, center=false, transform=identity)
Get y-axis values from a spectrogram array. Can return either bin centers or edges. By default, return bin edges for better compatibility.
Arguments
check
: If true, check if values are constant along timecenter
: If true, return bin centers instead of edgestransform
: Optional transform function for edge calculation (e.g., log for logarithmic bins)
Reference: Makie.edges
SPEDAS.TPlot.tlines!
— MethodAdd vertical lines to a plot
SPEDAS.TPlot.tplot
— Methodtplot(f, tas; legend=(; position=Right()), link_xaxes=true, link_yaxes=false, rowgap=5, transform=transform_pipeline, kwargs...)
Lay out multiple time series across different panels (rows) on one Figure / GridPosition f
If legend
is nothing
, no legend will be added to the plot. Otherwise, legend
can be a NamedTuple
containing options for legend placement and styling. By default, the time series are transformed via transform_pipeline
, which is extensible via transform
.
See also: tplot_panel
, transform_pipeline
, transform
SPEDAS.TPlot.tplot_panel!
— Methodtplot_panel!(ax, args...; kwargs...)
Generic entry point for adding plots to an existing axis ax
.
Transforms the arguments to appropriate types and calls the plotting function. Dispatches to appropriate implementation based on the plotting trait of the transformed arguments.
SPEDAS.TPlot.tplot_panel
— Methodtplot_panel(gp, args...; kwargs...)
Generic entry point for plotting different types of data on a grid position gp
.
Transforms the arguments to appropriate types and calls the plotting function. Dispatches to appropriate implementation based on the plotting trait of the transformed arguments.
SPEDAS.TPlot.tplot_panel_s!
— Methodtplot_panel_s!(ax::Axis, data; kwargs...)
Plot data on an axis.
SPEDAS.TPlot.transform
— Methodtransform(args...; kwargs...)
Transform data into plottable format (e.g., DimArray
).
Extend with transform(x::MyType)
for custom types.
SPEDAS.TPlot.transform_pipeline
— Methodtransform_pipeline(x)
Transform data for plotting with the following pipeline:
- Custom transformations (
transform(x)
) - String ->
SpeasyProduct
See also: transform
SPEDAS.TPlot.x2t
— MethodConvert x to DateTime
Reference:
- https://docs.makie.org/dev/explanations/dim-converts#Makie.DateTimeConversion
- https://github.com/MakieOrg/Makie.jl/issues/442
- https://github.com/MakieOrg/Makie.jl/blob/master/src/dim-converts/dates-integration.jl
SPEDAS
SPEDAS.SPEDAS
— ModuleJulia-based Space Physics Environment Data Analysis Software
See the Documentation for more information.
SPEDAS.DEFAULTS
— ConstantSPEDAS.DEFAULTS
A global constant that holds default parameters:
add_title::Bool
defaults tofalse
.add_colorbar::Bool
defaults totrue
.delay
: in seconds, the time interval between updates. Default is 0.25.resample::Int
: the number of points to resample to. Default is 6070.
SPEDAS.B_x3_error
— MethodCalculate the composite statistical error estimate for ⟨B·x₃⟩: |Δ⟨B·x₃⟩| = √(λ₃/(M-1) + (Δφ₃₂⟨B⟩·x₂)² + (Δφ₃₁⟨B⟩·x₁)²)
Parameters:
- λ₁, λ₂, λ₃: eigenvalues in descending order
- M: number of samples
- B: mean magnetic field vector
- x₁, x₂, x₃: eigenvectors
SPEDAS.ConstantThicknessApproach
— MethodConstant Thickness Approach (CTA) for determining boundary normal and velocity. Based on the method described in Haaland et al., Annales Geophysicae, 2004.
SPEDAS.ConstantVelocityApproach
— MethodConstantVelocityApproach(positions, times, durations)
Given durations
of the boundary crossings, calculate the thickness of the boundary
SPEDAS.ConstantVelocityApproach
— MethodCVA(positions, times)
Constant Velocity Approach (CVA) for determining boundary normal and velocity. Solve timing equation: $D * m = Δts$
Parameters:
- positions: Positions of 4 spacecraft (4×3 array)
- times: Times of boundary crossing for each spacecraft
SPEDAS.DiscontinuityAnalyzer
— FunctionDiscontinuity Analyzer (DA) for analyzing properties of discontinuities using multi-spacecraft measurements.
SPEDAS._linear_binedges
— Method_linear_binedges(centers)
Calculate bin edges assuming linear spacing.
SPEDAS.amap
— Methodamap(f, a, b)
Apply a function f
to the intersection of a
and b
.
https://github.com/rafaqz/DimensionalData.jl/issues/914
SPEDAS.angle
— MethodReturn the angle between two vectors.
SPEDAS.binedges
— Methodbinedges(centers; transform=identity)
Calculate bin edges from bin centers.
- For linear spacing, edges are placed halfway between centers.
- For transformed spacing, edges are placed halfway between transformed centers.
Arguments
transform
: Function to transform the space (e.g., log for logarithmic spacing)
Example
centers = [1.0, 2.0, 3.0]
edges = binedges(centers) # Returns [0.5, 1.5, 2.5, 3.5]
edges = binedges(centers, transform=log) # Returns edges in log space
SPEDAS.check_mva_eigen
— Methodcheck_mva_eigen(F; r=5, verbose=false)
Check the quality of the MVA result.
If λ₁ ≥ λ₂ ≥ λ₃ are 3 eigenvalues of the constructed matrix M, then a good indicator of nice fitting LMN coordinate system should have λ₂ / λ₃ > r.
SPEDAS.cotrans
— Methodcotrans(A, in, out)
cotrans(A, out; in=get_coord(A))
Transform the data to the out
coordinate system from the in
coordinate system.
This function automatically choose between Julia's GeoCotrans
(if available) and Fortran's IRBEM
implementation.
References:
- IRBEM-LIB: compute magnetic coordinates and perform coordinate conversions (Documentation, IRBEM.jl)
- SPEDAS Cotrans
SPEDAS.current_density
— Methodcurrent_density(B, V)
Calculate the current density time series from the magnetic field (B) and plasma velocity (V) time series.
Assume 1-D structure along the z-direction. Remember to transform the coordinates of B and V first (e.g. using mva
SPEDAS.dimarrayify
— Methoddimarrayify(x)
Convert x
or values of x
to DimArray(s)
.
SPEDAS.ensure_nxm
— MethodTransform matrix-like A
to n×m
shape
SPEDAS.fac_mat
— Methodfac_mat(vec::AbstractVector; xref=[1.0, 0.0, 0.0])
Generates a field-aligned coordinate (FAC) transformation matrix for a vector.
Arguments
vec
: A 3-element vector representing the magnetic field
SPEDAS.fill_gaps
— Methodfill_gaps(times, data; resolution, margin)
Given a sorted vector of time stamps times
and corresponding data values
, this function inserts missing time stamps with a value of NaN
if the gap between consecutive time stamps is larger than resolution + margin
.
- If the gap is only slightly larger (within
margin
of the resolution), no gap is inserted. - The function supports numeric times or DateTime (with appropriate resolution types).
Arguments
times
: Sorted vector of time stamps.resolution
: The expected time difference between consecutive time stamps.margin
: Allowed deviation fromresolution
before inserting missing time stamps.
Returns
A tuple (full_times, full_values)
where:
full_times
is a vector containing all time stamps (original and inserted).full_values
is a vector of data values withNaN
for inserted gaps.
References
- https://pyspedas.readthedocs.io/en/latest/modules/pytplot/tplotmath/degap.html
SPEDAS.find_continuous_timeranges
— Methodfind_continuous_timeranges(x, max_dt)
Find continuous time ranges for x
(e.g. times or DimArray
). max_dt
is the maximum time gap between consecutive times.
SPEDAS.interpolate_nans
— Methodinterpolate_nans(da; interp=LinearInterpolation)
Interpolate only the NaN values in da
along the specified dimension dims
. Non-NaN values are preserved exactly as they are.
The default interpolation method interp
is LinearInterpolation
.
SPEDAS.lingradest
— Methodlingradest(
Bx1, Bx2, Bx3, Bx4,
By1, By2, By3, By4,
Bz1, Bz2, Bz3, Bz4,
R1, R2, R3, R4
)
SPEDAS-argument-compatible version of lingradest.
SPEDAS.lingradest
— Methodlingradest(B1, B2, B3, B4, R1, R2, R3, R4)
Compute spatial derivatives such as grad, div, curl and curvature using reciprocal vector technique (linear interpolation).
Arguments
B1, B2, B3, B4
: 3-element vectors giving magnetic field measurements at each probeR1, R2, R3, R4
: 3-element vectors giving the probe positions
Returns
A named tuple containing: • Rbary: Barycenter position • Bbc: Magnetic field at the barycenter • Bmag: Magnetic field magnitude at the barycenter • LGBx, LGBy, LGBz: Linear gradient estimators for each component • LD: Linear divergence estimator • LCB: Linear curl estimator • curvature: Field‐line curvature vector • R_c: Field‐line curvature radius
References
Based on the method of Chanteur (ISSI, 1998, Ch. 11).
SPEDAS.lingradest
— Methodlingradest(B1::AbstractDimArray, args...)
Method for handling dimensional arrays. Takes AbstractDimArray
inputs with a time dimension and returns a DimStack
containing all computed quantities.
SPEDAS.lingradest
— Methodlingradest(B1::MatrixLike, args...)
Vectorized method for simplified usage. Returns a StructArray
containing the results.
SPEDAS.m2nV
— MethodConvert slowness vector $𝐦 = 𝐧/V$ to normal vector and velocity
SPEDAS.mva
— Functionmva(V, B=V; kwargs...)
Rotate a timeseries V
into the LMN coordinates based on the reference field B
.
Arguments
V
: The timeseries data to be transformed, where each column represents a componentB
: The reference field used to determine the minimum variance directions, where each column represents a component
SPEDAS.mva_eigen
— Methodmva_eigen(B::AbstractMatrix; sort=(;), check=false) -> F::Eigen
Perform minimum variance analysis, returning Eigen
factorization object F
which contains the eigenvalues in F.values
and the eigenvectors in the columns of the matrix F.vectors
.
Set check=true
to check the reliability of the result.
The k
th eigenvector can be obtained from the slice F.vectors[:, k]
.
SPEDAS.nt2ds
— Methodnt2ds(nt_arr, dim; fields=propertynames(first(nt_arr)))
Convert a NamedTuple array to a DimStack of DimArrays.
SPEDAS.phase_factor
— MethodPhase factor exp (i φ)
satisfies the following equation
$\exp (4 i φ) = \exp (-2 i γ)$
where
$γ = \arctan (2 Re(𝐮)^𝐓 Im(𝐮) /(Re(𝐮)^2-Im(𝐮)^2))$
SPEDAS.polarization
— Methodpolarization(S0, S1, S2, S3)
polarization(S::StokesVector)
Compute the degree of polarization (p) from Stoke parameters or a Stokes vector.
Reference
SPEDAS.polarization
— Methodpolarization(S)
Compute the degree of polarization (DOP) p^2
from spectral matrix S
.
\[\begin{aligned} p^2 &= 1-\frac{(tr 𝐒)^2-(tr 𝐒^2)}{(tr 𝐒)^2-n^{-1}(tr 𝐒)^2} \\ &= \frac{n(tr 𝐒^2)-(tr 𝐒)^2}{(n-1)(tr 𝐒)^2} \end{aligned}\]
SPEDAS.position_tensor
— Method\[𝐑 = ∑_α (𝐫_α-𝐫_b) (𝐫_α-𝐫_b)' = ∑_α 𝐫_α 𝐫_α'-𝐫_b 𝐫_b'\]
with $𝐫_b = ∑_α 𝐫_α / N$ and N
is the number of positions.
References
- Paschmann and Daly [2] Paschmann & Daly, 2008. Section 4.7
SPEDAS.pspectrum
— Methodpspectrum(x::AbstractDimArray, spec::Spectrogram)
pspectrum(x::AbstractDimArray; nfft=256, noverlap=128, window=hamming)
Compute the power spectrum (time-frequency representation) of a time series using the short-time Fourier transform.
Returns a DimArray
with frequency and original time dimensions.
See also: DSP.Spectrogram
, DSP.stft
Reference
SPEDAS.reciprocal_vector
— Methodreciprocal_vector(rα, rβ, rγ, rλ)
Compute the reciprocal vector $𝒌_α$ for a vertex of a tetrahedron given the position vectors of all vertices.
The vertices (α, β, γ, λ) must form a cyclic permutation of (1, 2, 3, 4).
SPEDAS.reciprocal_vector
— Methodreciprocal_vector(rα, r0s::AbstractVector{<:AbstractVector})
Generalised reciprocal vector for N != 4
\[𝐪_α = 𝐑^{-1} 𝐫_α\]
See also: reciprocal_vector
, position_tensor
SPEDAS.reciprocal_vector
— Methodreciprocal_vector(r_βα, r_βγ, r_βλ)
Compute the reciprocal vector $𝒌_α$ for a vertex of a tetrahedron given the relative position vectors.
\[𝒌_α = \frac{𝐫_{βγ} × 𝐫_{βλ}}{𝐫_{βα} ⋅ (𝐫_{βγ} × 𝐫_{βλ})}\]
where $𝐫_{αβ} = r_β - r_α$ are relative position vectors.
References
- Multi-spacecraft analysis methods revisited : 4.3 Properties of reciprocal vectors
SPEDAS.reciprocal_vectors
— MethodCompute the set of reciprocal vectors {$𝒌_α$}, which is also called the reciprocal base of the tetrahedron.
See also: reciprocal_vector
SPEDAS.resample
— Methodresample(arr, n=DEFAULTS.resample; dim=1, verbose=false)
Resample an array along the dimension dim
to n
points. If the original length is less than or equal to n
, the original array is returned unchanged.
SPEDAS.rotate
— Methodrotate(ts::AbstractMatrix, mat::AbstractMatrix)
Coordinate-aware transformation of vector/matrix by rotation matrix(s) mat(s)
. Assume ts
is a matrix of shape (n, 3).
SPEDAS.set_coord
— MethodSet the coordinate system.
Updates legend names and axis labels if they include the coordinate system. Also updates the dimension name if it contains the coordinate system.
Reference:
- https://pyspedas.readthedocs.io/en/latest/modules/pytplot/dataattgetterssetters.html#set_coords
SPEDAS.smooth_spectral_matrix!
— Methodsmooth_spectral_matrix!(S_smooth, S, aa)
In-place version of smooth_spectral_matrix
that writes results to a pre-allocated array.
SPEDAS.smooth_spectral_matrix
— Methodsmooth_spectral_matrix(S, aa)
Smooth the spectral matrix $S(f)$ by applying a weighted average over frequency. The smoothing uses a symmetric window aa
(for example, a Hamming window) of length M.
Arguments
S
: Spectral matrix array of size $N_{freq}, n, n$ where n is the number of components.aa
: Weighting vector of length M.
SPEDAS.spectral_matrix
— Methodspectral_matrix(Xf)
Compute the spectral matrix $S$ defined by
\[S_{ij}(f) = X_i(f) X_j^*(f),\]
where $X_i(f)$=Xf[f, i]
is the FFT of the i-th component and * denotes complex conjugation.
SPEDAS.spectral_matrix
— Methodspectral_matrix(X, window)
Compute the spectral matrix $S(f)$ given the time series data X
.
Returns a 3-D array of size $N_{freq}, n, n$, where $N_{freq} = \lfloor N/2 \rfloor$ and n
is the dimensionality (number of components).
Arguments
X
: Matrix where each column is a component of the multivariate time series, or a vector of vectors.window
: A window function (optional). If not provided, a rectangular window (no windowing) is used.
SPEDAS.tetrahedron_quality
— MethodCalculate tetrahedron quality factors
SPEDAS.tinterp
— Methodtinterp(A, t; interp=LinearInterpolation)
Interpolate time series A
at time point(s) t
using interp
(default: LinearInterpolation
) method. Returns interpolated value for single time point or DimArray for multiple time points.
See DataInterpolations.jl
for available interpolation methods.
Examples
# Interpolate at a single time point
tinterp(time_series, DateTime("2023-01-01T12:00:00"))
# Interpolate at multiple time points using cubic spline interpolation
new_times = DateTime("2023-01-01"):Hour(1):DateTime("2023-01-02")
tinterp(time_series, new_times; interp = CubicSpline)
SPEDAS.tinterp
— Methodtinterp(A, B; interp=LinearInterpolation)
Interpolate A
to times in B
SPEDAS.tinterp_nans
— Methodtinterp_nans(da::AbstractDimArray; query=timeDimType, kwargs...)
Interpolate only the NaN values in da
along the specified dimensions query
. Non-NaN values are preserved exactly as they are.
See also interpolate_nans
SPEDAS.tresample
— Functiontresample(da::DimArray, n=DEFAULTS.resample; dimtype=Ti)
Resample a DimArray specifically along its dimension of type dimtype
to n
points. Throws an error if no dimension of type dimtype
is found in the array.
SPEDAS.tstack
— Methodtstack(vectors::AbstractVector{<:AbstractVector{T}})
Stack a time series of vectors
into a matrix.
By default, each row in the output matrix represents a time point from the input vector of vectors.
SPEDAS.tsync
— Methodtsync(A, Bs...)
Synchronize multiple time series to have the same time points.
This function aligns the time series Bs...
to match the time points of A
by:
- Finding the common time range between all input time series
- Extracting the subset of
A
within this common range - Interpolating each series in
Bs...
to match the time points of the subset ofA
Returns a tuple containing the synchronized time series, with the first element being the subset of A
and subsequent elements being the interpolated versions of Bs...
.
Examples
A_sync, B_sync, C_sync = tsync(A, B, C)
See also: tinterp
, common_timerange
SPEDAS.twavpol
— Methodtwavpol(x)
A convenience wrapper around wavpol
that works with DimensionalData arrays.
It automatically extracts the time dimension and returns the results as a DimStack with properly labeled dimensions.
SPEDAS.wave_normal_angle
— MethodWave normal angle is the angle between (wnx, wny) and the vertical |wnz| Use the imaginary parts of off-diagonals. Define:$A = Im(S₁₂), B = Im(S₁₃), C = Im(S₂₃)$
SPEDAS.wavpol
— Methodwavpol(X, fs=1; nfft=256, noverlap=div(nfft, 2), smooth_t=_smooth_t(nfft), smooth_f=hamming(3), nbuffers=Threads.nthreads())
Perform polarization analysis of n
-component time series data.
For each FFT window (with specified overlap), the routine:
- Applies a time-domain window function and computes the FFT to construct the spectral matrix $S(f)$
- Applies frequency smoothing using a window function
- Computes wave parameters: power, degree of polarization, wave normal angle, ellipticity, and helicity
The analysis assumes the data are in a right-handed, field-aligned coordinate system (with Z along the ambient magnetic field).
Arguments
X
: Matrix where each column is a component of the multivariate time seriesfs
: Sampling frequency (default: 1)
Keywords
nfft
: Number of points for FFT (default: 256)noverlap
: Number of overlapping points between windows (default: nfft÷2)smooth_t
: Time domain window function (default: Hann window)smooth_f
: Frequency domain smoothing window (default: 3-point Hamming window)nbuffers
: Number of pre-allocated buffers for parallel processing (default: number of threads)
Returns
A named tuple containing:
indices
: Time indices for each FFT windowfreqs
: Frequency arraypower
: Power spectral density, normalized by frequency bin width and window functiondegpol
: Degree of polarization [0,1]waveangle
: Wave normal angle [0,π/2]ellipticity
: Wave ellipticity [-1,1], negative for left-hand polarizedhelicity
: Wave helicity
See also: polarization
, wave_normal_angle
, wpol_helicity
SPEDAS.wpol_helicity
— Methodwpol_helicity(S, waveangle)
Compute helicity and ellipticity for a single frequency.
Arguments
S
: Spectral matrix for a single frequency, size (3,3)waveangle
: Wave normal angle for this frequency
Returns
helicity
: Average helicity across the three componentsellipticity
: Average ellipticity across the three components
SPEDAS.ys
— Methodpermutedims is needed for series
in Makie
SPEDAS.Δφij
— MethodΔφij(λᵢ, λⱼ, λ₃, M)
Calculate the phase error between components i and j according to: |Δφᵢⱼ| = |Δφⱼᵢ| = √(λ₃/(M-1) * (λᵢ + λⱼ - λ₃)/(λᵢ - λⱼ)²)
Parameters:
- λᵢ: eigenvalue i
- λⱼ: eigenvalue j
- λ₃: smallest eigenvalue (λ₃)
- M: number of samples
SPEDAS.ω2f
— MethodConvert angular frequency to frequency
Reference: https://www.wikiwand.com/en/articles/Angular_frequency
SPEDAS.@load_project_config
— Macro@load_project_config(file)
Load configuration from a file and export all key-value pairs as constants. The macro evaluates in the calling module's context.
Timeseries Utilities
TimeseriesUtilities.TimeseriesUtilities
— ModuleTimeseriesUtilities
A collection of utilities to simplify common time series analysis.
From data cleaning to arithmetic operations (e.g. linear algebra) to common time series operations (e.g. resampling, filtering).
Data Cleaning
Query
(Windowed) Statistics
Algebra
Time-Domain Operations
Time-Frequency Domain Operations
TimeseriesUtilities.DiffQ
— TypeDiffQ(v, t; dim=1)
Difference quotient of v
with respect to t
.
To avoid undefined behavior for division by Date/DateTime, we convert the time difference to a Unitful.Quantity
if eltype(v)
is not a Unitful.Quantity
.
TimeseriesUtilities.common_timerange
— Methodcommon_timerange(x1, xs...)
Get the common time range (intersection) across multiple arrays. If there is no overlap, returns nothing.
TimeseriesUtilities.dimnum
— Functiondimnum(x, query)
Get the number(s) of Dimension(s) as ordered in the dimensions of an object.
Extend the function for custom type x
. By default, we fall back to DimensionalData.dimnum
.
TimeseriesUtilities.dropna
— Methoddropna(A; dim=nothing)
dropna(A::AbstractDimArray; dim=nothing, query=nothing)
Remove slices containing NaN values along along the dim
dimension.
TimeseriesUtilities.find_outliers
— Methodfind_outliers(A, [method, window]; dim = 1, kw...)
Find outliers in data A
along the specified dim
dimension.
Returns a Boolean array whose elements are true when an outlier is detected in the corresponding element of A
.
The default method
is :median
(other option is :mean
), which uses the median absolute deviation (MAD) to detect outliers. When the length of A
is greater than 256, it uses a moving window
of size 16.
See also: find_outliers_median
, find_outliers_mean
, isoutlier - MATLAB
TimeseriesUtilities.find_outliers_mean
— Methodfind_outliers_mean(x::AbstractVector, window; threshold = 3)
Find outliers that are defined as elements more than three standard deviations from the mean.
This method is faster but less robust than find_outliers_median
.
TimeseriesUtilities.find_outliers_median
— Methodfind_outliers_median(x, window; threshold=3)
Find outliers that are defined as elements more than threshold=3
times the scaled median absolute deviation (MAD) from the median.
When window
is set to a integer, a moving window of that size is used to compute local MAD. Otherwise, global statistics are used.
References
TimeseriesUtilities.groupby_dynamic
— FunctionGroup x
into windows based on every
and period
.
TimeseriesUtilities.interpolate_outliers!
— Methodinterpolate_outliers!(x, t, outliers)
Interpolate outliers in x
using interpolation of neighboring non-outlier values.
TimeseriesUtilities.oproj
— MethodVector rejection
TimeseriesUtilities.proj
— MethodTimeseriesUtilities.rectify
— MethodRectify the time step of a DimArray
to be uniform.
TimeseriesUtilities.replace_outliers!
— Methodreplace_outliers!(A, s, [find_method, window]; kwargs...)
Finds outliers in A
and replaces them with s
(by default: NaN).
See also: find_outliers
, filloutliers - MATLAB
TimeseriesUtilities.replace_outliers!
— Methodreplace_outliers!(A, method, [find_method, window]; kwargs...)
replace_outliers!(A, method, outliers; kwargs...)
Replaces outliers in A
with values determined by the specified method
.
Outliers can be detected using find_outliers
with optional find_method
and window
parameters or specified directly as a Boolean array outliers
.
method
can be one of the following:
:linear
: Linear interpolation of neighboring, nonoutlier values:previous
: Previous nonoutlier value:next
: Next nonoutlier value:nearest
: Nearest nonoutlier value
See also: filloutliers - MATLAB
TimeseriesUtilities.replace_outliers
— Methodreplace_outliers(A; args...; kw...)
Non-mutable version of replace_outliers!
.
TimeseriesUtilities.smooth
— Methodsmooth(da::AbstractDimArray, window; dim=Ti, suffix="_smoothed", kwargs...)
Smooths a time series by computing a moving average over a sliding window.
The size of the sliding window
can be either:
Quantity
: A time duration that will be converted to number of samples based on data resolutionInteger
: Number of samples directly
Arguments
dims=Ti
: Dimension along which to perform smoothing (default: time dimension)suffix="_smoothed"
: Suffix to append to the variable name in outputkwargs...
: Additional arguments passed toRollingWindowArrays.rolling
TimeseriesUtilities.sproj
— MethodScalar projection
TimeseriesUtilities.tclip
— Methodtclip(A, t0, t1; query=nothing, sort=false)
Clip a Dimension
or DimArray
A
to a time range [t0, t1]
.
For unordered dimensions, the dimension should be sorted before clipping (see tsort
).
TimeseriesUtilities.tclips
— Methodtclips(xs...; trange=common_timerange(xs...))
Clip multiple arrays to a common time range trange
.
If trange
is not provided, automatically finds the common time range across all input arrays.
TimeseriesUtilities.tcross
— Methodtcross(x, y; dim = nothing, query=nothing)
Compute the cross product of two (arrays of) vectors along the specified dimension dim
or query
.
References:
- https://docs.xarray.dev/en/stable/generated/xarray.cross.html
TimeseriesUtilities.tderiv
— Methodtderiv(A, times; dim=1)
tderiv(A; dim = nothing, query = nothing)
Compute the time derivative of A
. Set lazy=true
for lazy evaluation.
See also: deriv_data - PySPEDAS
TimeseriesUtilities.tdot
— Methodtdot(x, y; dim=nothing, query=nothing)
Dot product of two arrays x
and y
along the dim
dimension.
TimeseriesUtilities.tfilter
— Functiontfilter(da, Wn1, Wn2=samplingrate(da) / 2; designmethod=nothing)
By default, the max frequency corresponding to the Nyquist frequency is used.
References
- https://docs.juliadsp.org/stable/filters/
- https://www.mathworks.com/help/signal/ref/filtfilt.html
- https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.filtfilt.html
Issues
- DSP.jl and Unitful.jl: https://github.com/JuliaDSP/DSP.jl/issues/431
TimeseriesUtilities.tgroupby
— Methodtgroupby(x, every, period = every, start_by = :window)
Group x
into windows based on every
and period
.
TimeseriesUtilities.time_grid
— Methodtime_grid(x, dt)
Create a time grid from the minimum to maximum time in x
with the step size dt
.
Examples
# Create hourly time grid
time_grid(x, Hour(1))
time_grid(x, 1u"hr")
# Create 1-s intervals
time_grid(x, Second(1))
time_grid(x, 1u"second")
time_grid(x, 1u"Hz")
TimeseriesUtilities.timerange
— Methodtimerange(times)
timerange(x1, xs...)
Get the time range (minimum and maximum) of time series data.
For a single argument, returns a tuple (tmin, tmax)
containing the minimum and maximum times. For multiple arguments, returns the common time range (intersection) across all arrays - equivalent to common_timerange(x1, xs...)
.
Examples
# Single time series
times = [1, 2, 3, 4, 5]
timerange(times) # (1, 5)
# Multiple time series - find common range
x1_times = [1, 2, 3, 4]
x2_times = [2, 3, 4, 5]
timerange(x1_times, x2_times) # (2, 4)
See also: common_timerange
, tminimum
, tmaximum
TimeseriesUtilities.times
— MethodReturns the time indices of x
.
TimeseriesUtilities.tmask!
— Methodtmask!(da, t0, t1)
tmask!(da, it::Interval)
tmask!(da, its)
Mask all data values within the specified time range(s) (t0, t1)
/ it
/ its
with NaN.
TimeseriesUtilities.tmask
— Methodtmask(da, args...; kwargs...)
Non-mutable version of tmask!
. See also tmask!
.
TimeseriesUtilities.tmaximum
— Functiontmaximum(x)
Get the maximum timestamp of x
.
TimeseriesUtilities.tmean
— Methodtmean(x, [dt]; dim=nothing, query=nothing)
Calculate the arithmetic mean of x
along the dim
dimension, optionally grouped by dt
.
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).
TimeseriesUtilities.tmedian
— Methodtmedian(x, [dt]; dim=nothing, query=nothing)
Calculate the median of x
along the dim
dimension, optionally grouped by dt
.
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).
TimeseriesUtilities.tminimum
— Functiontminimum(x)
Get the minimum timestamp of x
.
TimeseriesUtilities.tnorm
— Methodtnorm(A; dim=nothing, query=nothing)
Compute the norm of each slice in A
along the specified dimension dim
or query
.
See also: tnorm_combine
TimeseriesUtilities.tnorm_combine
— Methodtnorm_combine(x; dim=nothing, name=:magnitude)
Calculate the norm of each slice along query
dimension and combine it with the original components.
TimeseriesUtilities.toproj
— Methodtoproj(A, B; dim=nothing, query=nothing)
Compute vector rejection (orthogonal projection) of array A
from B
along specified dimension dim
or query
.
TimeseriesUtilities.tproj
— Methodtproj(A, B; dim=nothing, query=nothing)
Compute vector projection of A
onto B
along specified dimension dim
or query
.
TimeseriesUtilities.tselect
— Methodtselect(A, t, [δt]; query=nothing)
Select the value of A
closest to time t
within the time range [t-δt, t+δt]
.
Similar to DimensionalData.Dimensions.Lookups.At
but choose the closest value and return missing
if the time range is empty.
TimeseriesUtilities.tsem
— Methodtsem(x, [dt]; dim=nothing, query=nothing)
Calculate the standard error of the mean of x
along the dim
dimension, optionally grouped by dt
.
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).
TimeseriesUtilities.tshift
— Functiontshift(x; dim=TimeDim, t0=nothing, new_dim=nothing)
Shift the dim
of x
by t0
.
TimeseriesUtilities.tsort
— Methodtsort(A; query=nothing, rev=false)
Sort a DimArray
A
along the query
dimension.
TimeseriesUtilities.tsplit
— Functiontsplit(da::AbstractDimArray, dim=Ti)
Splits up data along dimension dim
.
TimeseriesUtilities.tsproj
— Methodtsproj(A, B; dim=nothing, query=nothing)
Compute scalar projection of A
onto B
along specified dimension dim
or query
.
TimeseriesUtilities.tstat
— Functiontstat(f, x, [dt]; dim = nothing)
Calculate the statistic f
of x
along the dim
dimension, optionally grouped by dt
.
See also: groupby_dynamic
TimeseriesUtilities.tstd
— Methodtstd(x, [dt]; dim=nothing, query=nothing)
Calculate the standard deviation of x
along the dim
dimension, optionally grouped by dt
.
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).
TimeseriesUtilities.tsubtract
— Functiontsubtract(x, f=nanmedian; dims=timedim(x))
Subtract a statistic (default function f
: nanmedian
) along dimensions (default: time dimension) from x
.
TimeseriesUtilities.tsum
— Methodtsum(x, [dt]; dim=nothing, query=nothing)
Calculate the sum of x
along the dim
dimension, optionally grouped by dt
.
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).
TimeseriesUtilities.tvar
— Methodtvar(x, [dt]; dim=nothing, query=nothing)
Calculate the variance of x
along the dim
dimension, optionally grouped by dt
.
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).
TimeseriesUtilities.tview
— Methodtview(d, t0, t1)
View a dimension or DimArray
in time range [t0, t1]
.
TimeseriesUtilities.unwrap
— Methodunwrap(x)
Return the innermost object of the wrapped object x
with similar behavior as x
(e.g. same size, same type, etc.)
TimeseriesUtilities.window_bf_sizes
— Methodwindow_bf_sizes(window)
Converts a window specification to backward and forward window sizes.
When window is a positive integer scalar, the window is centered about the current element and contains window-1 neighboring elements. If window is even, then the window is centered about the current and previous elements.