Skip to content

Getters ​

DimensionalData.jl defines consistent methods to retrieve information from objects like DimArray, DimStack, Tuples of Dimension, Dimension, and Lookup.

First, we will define an example DimArray.

julia
using DimensionalData
using DimensionalData.Lookups
x, y = X(10:-1:1), Y(100.0:10:200.0)
(↓ X 10:-1:1,
→ Y 100.0:10.0:200.0)
@ansi
A = rand(x, y)

dims retrieves dimensions from any object that has them.

What makes it so useful is that you can filter which dimensions you want, and specify in what order, using any Dimension, Type{Dimension} or Symbol.

@ansi
dims(A)
dims(A, Y)
dims(A, Y())
dims(A, :Y)
dims(A, (X,))
dims(A, (Y, X))
dims(A, reverse(dims(A)))
dims(A, isregular)

Predicates ​

These always return true or false. With multiple dimensions, false means !all and true means all.

dims and all other methods listed above can use predicates to filter the returned dimensions.

@ansi
issampled(A)
issampled(dims(A))
issampled(A, Y)
issampled(lookup(A, Y))
dims(A, issampled)
otherdims(A, issampled)
lookup(A, issampled)