JuliaDataCubes / JuliaDataCubes/YAXArrays.jl

mapslices on a Dataset returns a wrong cube

Open
#232 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
132
Forks
25
PR merge metrics
No merged PRs in 30d

Description

Running mapslices on a Dataset should return another Dataset, instead it returns an odd cube:

using YAXArrays

a = YAXArray(ones(10,10,10))
b = YAXArray(ones(10,10,10))
c = YAXArray(ones(10,10,10))

axes = Dict(:Dim_1 => a.axes[1], :Dim_2 => a.axes[2], :Dim_3 => a.axes[3])

dataset = Dataset(Dict(:a => a, :b => b, :c => c), test_axes, Dict("test" => "test"))

slice = mapslices(mean, dataset; dims="Dim_1")

println(slice)

I expect a dataset to be returned with the correct variables, instead I get this cube:

YAXArray with the following dimensions
OutAxis1            Axis with 10 Elements from 1 to 10
Dim_2               Axis with 10 Elements from 1 to 10
Dim_3               Axis with 10 Elements from 1 to 10
Total size: 7.81 KB

In addition to the following warning:

[ Info: Found multiple matching axes for output dimension 1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the mapslices(mean, dataset; dims="Dim_1") example from the issue and inspect the Dataset and mapslices entry points involved. The fix is complete when the operation returns a Dataset with the expected variables and dimensions without the multiple-matching-axes warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.