It's a veritable cornucopia of magical mini modules for binding custom indexing, named dimensions, and metadata to different structures in Julia. For now it's not registered because most of the modules should be fleshed out into proper packages at some point.
Syntax map
indices
: literal mapping to an arrays memory indiceskeys
: representative keys relevant to a dimension. For example, a time dimension may have keys composed of seconds.axis
: the axis that belongs to to a certain dimension. This may be the same asindices
or be a subtype ofAbstractAxis
, including keys and indices together.dim
: returns the dimension corresponding to a given dimension name.units
: if appropriate returns a Unitful type
This provides a predictable syntax for users that want to consistently access a certain dimension. For example, the following would be relevant to an array with a time dimension:
time_indices
: indices for the array corresponding to the time dimension (e.g.,Base.OneTo(10)
for anArray
where the time dimension is ten elements in length).time_keys
: time specific unites along the time dimension (e.g.,Second(1):Second(1):Second(10)
for ten seconds along the time dimension)time_axis
: if using anAxisIndicesArray
and the previous examples this could beAxis(Second(1):Second(1):Second(10), Base.OneTo(10))
.timedim
: if using aNamedDimsArray
with the names(:height, :width, :time)
then this would return 3.time_units
: If instead ofSecond
the Unitful representations
is used for seconds, thens
will be returned.
Producing the previously described time relevant methods involves two steps.
- Create a method that identifies the
Symbol
corresponding to time, which in this case isis_time(x::Symbol) = x === :time
- Generate the methods,
@defdim time is_time
Note: The current method requires this Base.@pure is_time(x::Symbol) = x === :time
for the @defdim
macro to result in methods that are type inferable.
TODO: need to document and test. beginnings are in "src/data_format.jl"