Enforce axis constraint in merge function
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start by reproducing the merge(B, A) and sort(M) examples from the issue, then inspect the merge and sort entry points in AxisArrays.jl. The change is complete when a caller can enforce the :time axis as an ascending sort constraint during merge operations, including merges with more than two inputs.
Written by the indexing model from the issue text.
Description
Hello!
I'm wondering if there is a way to easily keep one of the axis as a "sort" axis constraint in merge operations. Here's an example of what is the current behavior:
A = AxisArray(collect(1:11), Axis{:time}(0:0.1:1))
B = AxisArray(collect(12:22), Axis{:time}(1.1:0.1:2.1))
M = merge(B, A) # ideally, I would like to force the time axis to an ascending order
1-dimensional AxisArray{Int64,1,...} with axes:
:time, [1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0 … 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]
And data, a 22-element Array{Int64,1}:
12
13
14
15
16
17
18
19
20
21
⋮
3
4
5
6
7
8
9
10
11
Now, trying sort(M) returns
sort(M)
1-dimensional AxisArray{Int64,1,...} with axes:
:time, [1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0 … 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]
And data, a 22-element Array{Int64,1}:
1
2
3
4
5
6
7
8
9
10
⋮
14
15
16
17
18
19
20
21
22
Hence, the values are sorted, but not the time axis definition.
Ideally, I would like to enforce the :time axis to be the sorting constraint in merge function.
I coded a workaround in a custom merge function which consist of reverting the order of the argument (i.e. merge(B, A) -> merge(A, B)). But I suspect that it only works for 2-input call to merge without a more complex workaround.
Thanks for any help or hint on how it can be done!
- Dominant language
- Julia
- Stars
- 207
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from JuliaArrays/AxisArrays.jl
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
JuliaArrays/AxisArrays.jl#238 ·
-
AbstractAxisArray? Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
JuliaArrays/AxisArrays.jl#237 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
JuliaArrays/AxisArrays.jl#234 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
JuliaArrays/AxisArrays.jl#232 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
JuliaArrays/AxisArrays.jl#230 ·
All issues in JuliaArrays/AxisArrays.jl
Similar issues
-
tagbot-manual
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Sienna-Platform/PowerSystems.jl#1800 ·
-
enhancement good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100