YAXArrays.jl icon indicating copy to clipboard operation
YAXArrays.jl copied to clipboard

mapCube of Dataset gives NamedTuple in inner function

Open felixcremer opened this issue 2 years ago • 0 comments

When I run a mapCube on a Dataset I would expect, that the mapCube function would loop over the different data cubes in the data set as long as they would have the InDims axes. When I run the mapCube function on a Dataset, I get a NamedTuple for the input instead.

I am not sure, whether this is a misconception from my side or whether this is a change in behavior, because it is untested.

This is related to #206.

The following is a code snippet to reproduce the problem:

    x,y = (RangeAxis("x",1:4), RangeAxis("y", 1:5))
    zs = [RangeAxis("z_$i", 1:6) for i in 1:3]
    a1 = YAXArray([x,y,zs[1]], rand(4,5,6))
    a2 = YAXArray([x,zs[2],y], rand(4,6,5))
    a3 = YAXArray([x,y, zs[3]], rand(4,5,6))
    ds = Dataset(;a1,a2,a3)
        indims = InDims("x")
        outdims = OutDims("x")
        r = mapCube(ds, indims=indims, outdims=outdims) do xout, x1
            #@show xout, x1
            @show typeof(xout)
            @show typeof(x1)
            xout .= x1 .+ 4
        end

felixcremer avatar Dec 14 '22 16:12 felixcremer