-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is At()
Necessary for Symbol
+String
Inputs?
#338
Comments
Yeah, this has been a contentious thing for a while. It initially required
So to answer your question, no it's not totally necesary, but the semantics starts to feel a bit crowded without I have thought about adding a trait somewhere for automatic |
I think that makes some sense, but it definitely causes problems for anyone trying to transition their codebase from AxisArrays. That being said, isn't not having to use Alternatively, given that |
It's worth noting that if symbol keys are automatically wrapped in |
I'm open to working on a change if this will be blocking to use cases elsewhere. But we have to be careful with the syntax as we're trying to do more things than AxisArrays.jl does.
The specific syntax clash is this edge case, which is unlikely to happen very often, but needs handling: julia> using DimensionalData
julia> st = DimStack((a=rand(10), b=falses(10)), (X(Symbol.('a':'j')),))
DimStack with dimensions:
X Categorical Symbol[a, b, …, i, j] ForwardOrdered
and 2 layers:
:a Float64 dims: X (10)
:b Bool dims: X (10)
julia> st[:a]
10-element DimArray{Float64,1} a with dimensions:
X Categorical Symbol[a, b, …, i, j] ForwardOrdered
0.764328
0.810431
0.37886
0.689809
0.368838
0.284454
0.665395
0.326088
0.762186
0.596156
julia> st[At(:a)]
(a = 0.7643275682479944, b = false) |
I may have a solution to this. We can use julia> st.a
10-element DimArray{Float64,1} a with dimensions:
X Categorical Symbol[a, b, …, i, j] ForwardOrdered
0.764328
0.810431
0.37886
0.689809
0.368838
0.284454
0.665395
0.326088
0.762186
0.596156
julia> st[:a]
(a = 0.7643275682479944, b = false) That might even be nice to separate out the syntax a little more anyway - so that |
Definitely like that solution! Sounds like a good idea to me. |
This is going to break a LOT of scripts built on Rasters.jl. I will have to check in with people and see what they think, so it might take a while. |
Let me know what people think when you've talked to them about this. I think this is a good idea, though; in general, transitioning from AxisArrays to DimensionalData should be as smooth as possible, maybe even automatic (as in, we could write a script that takes all code written with AxisArrays and converts it into DimensionalData code). |
Would it make sense to infer, when a string or symbol is passed to
getindex
, that the user probably wantsAt(string)
? Adding this would probably make it easier to transition a bunch of AxisArrays code to use DimensionalData.jl.The text was updated successfully, but these errors were encountered: