rafaqz / DimensionalData.jl

Named dimensions and indexing for julia arrays and other data
https://rafaqz.github.io/DimensionalData.jl/stable/
MIT License
269 stars 37 forks source link

add `AutoVal` struct so keywords can be incorporated later #570

Closed rafaqz closed 8 months ago

rafaqz commented 8 months ago

This PR adds an AutoVal object pretty much like AutoLookup but isn't an AbstractArray.

The point of this is for easy syntax - to let a function manipulate the contents of a Dimension at some stage after its construction, with the option to provide keywords at the time of construction. Otherwise separate input of keywords for each dimension is needed, which is clunky.

For example: Rasters.jl will use this in dimension value detection from file names. You can do

Ti(Int; sampling=Intervals(Start()))

and it knows to pass those keywords to the lookup after parsing strings from the filenames for each slice to Int.

I'm sure it will be useful for other similar use cases.

codecov-commenter commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (40acc86) 88.03% compared to head (ee68aa7) 87.70%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #570 +/- ## ========================================== - Coverage 88.03% 87.70% -0.33% ========================================== Files 40 37 -3 Lines 3384 3367 -17 ========================================== - Hits 2979 2953 -26 - Misses 405 414 +9 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.