I have just made a small package available in the General registry: MetaArrays. It provides a generic means of adding additional meta-data to an array, (typically) using a
NamedTuple. (It is perhaps similar in spirit to ImagesMetadata.jl, but takes a slightly different approach). I have found it handy in my own projects, and thought others might as well.
It’s probably easiest to demonstrate with an example (also found in
julia> y = meta(rand(10,10),val1="value1") julia> x = meta(rand(10,10),val2="value2") julia> z = x.*y julia> z.val1 "value1"
The main advantage I find in working with this particular approach is that I can:
1.) Specialize methods over the type of the array, or the type of the particular metadata.
2.) Readily leverage the broadcasting and array tooling for a new array type, without having to think through all of the methods I have to overwrite. I’ve already done that work once, within MetaArrays, and don’t have to re-think through it each time.
Check out the README.md for more details.
I would appreciate any feedback (positive or negative) about the package.