I’m pleased to announce the registration of AbstractMetaArrays.jl
, a Julia package that provides a flexible framework for creating arrays enriched with metadata. The package should become available in the General registry after the standard waiting period.
Overview
AbstractMetaArrays.jl
introduces a new abstract type that extends Julia’s array capabilities by allowing arrays to carry additional metadata (metadata
) and, optionally, column-specific metadata (colmetadata
). This is particularly useful in scientific computing domains like micromagnetics and photonics, where contextual information (e.g., units, coordinate systems, physical properties, normalization factors) is essential.
The original motivation for this package was the need to:
- Maintain Dimensional Context: Perform computations on normalized data while retaining information about original units and normalization factors within the same array structure, facilitating accurate visualization and comparison of results.
- Handle Diverse Coordinate Systems: Manage and compare datasets using different conventions (e.g., geocentric vs. geodetic coordinates) without the overhead of continuous conversions, by embedding coordinate system information directly into the array metadata.
but I couldn’t find an existing package that could easily do that out of the box.
Key Features
- Metadata Integration: Attach arbitrary metadata to arrays without compromising performance.
- Column Metadata Support: Explicit support for
colmetadata
inStructArrays
andStaticArrays
(SVector{S}
andMVector{S}
). - DataAPI.jl Compatibility: Extends the existing metadata functions from
DataAPI.jl
, ensuring seamless integration with Julia’s data ecosystem. - Customizable Behavior: Define how metadata propagates through array operations using traits:
ColMetadataTrait
: Indicates if the implementation supportscolmetadata
, independent of the underlying data type.MetadataStyle
andColMetadataStyle
: Control the reading and writing access tometadata
andcolmetadata
.
Utilities
The package also provides:
SimpleMetaArray
: A straightforward implementation of a concrete type for quick adoption.create_metaarray
: A utility function to easily generate new concrete metadata arrays tailored to specific needs in a format compatible withDataAPI.jl
specifics.
Additional examples of concrete implementations with different read/write access on metadata are provided in test/datastructuretest.jl
. These are primarily used for testing metadata access using the trait system but could be helpful for anyone planning to create their own concrete implementation.
Contributions and Feedback
Contributions are welcome! If you encounter any issues or have suggestions for improvements, feel free to open an issue or submit a pull request on GitHub.
I’m looking forward to seeing how the community utilizes AbstractMetaArrays.jl
in their projects.