Open Qfl3x opened 1 year ago
Yes, that is a problem and I would also expect a dataset with the variables a, b, c and the dimensions Dim_2, Dim_3. Currently I think we can achieve this behaviour by broadcasting the mapslices on the values of the ds.cubes OrderedDict and then stitching everything together to a new Dataset. See the MWE below The only question for me is, what should we do if one of the cubes of the dataset do not have the dimension that are used in the mapslices? I would expect that this is going to apply the mapslices on the cubes with the sliced dimension and to skip the cubes without the sliced dimension.
julia> a = YAXArray((RangeAxis("X",1:10), RangeAxis("Y", 1:20)), rand(10,20));
julia> ds = Dataset(;a, b=a)
YAXArray Dataset
Dimensions:
X Axis with 10 Elements from 1 to 10
Y Axis with 20 Elements from 1 to 20
Variables: a b
julia> Dataset(;(;zip(keys(ds.cubes), mapslices.(mean, values(ds.cubes); dims=Ref(:X)))...)...)
YAXArray Dataset
Dimensions:
Y Axis with 20 Elements from 1 to 20
Variables: a b
Running
mapslices
on a Dataset should return another Dataset, instead it returns an odd cube:I expect a dataset to be returned with the correct variables, instead I get this cube:
In addition to the following warning: