Skip to content
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

Make Metadata a type parameter of YAXArray #370

Merged
merged 2 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Cubes/Cubes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ It can wrap normal arrays or, more typically DiskArrays.

$(FIELDS)
"""
struct YAXArray{T,N,A<:AbstractArray{T,N}, D} <: AbstractDimArray{T,N,D,A}
struct YAXArray{T,N,A<:AbstractArray{T,N}, D, Me} <: AbstractDimArray{T,N,D,A}
"`Tuple` of Dimensions containing the Axes of the Cube"
axes::D
"length(axes)-dimensional array which holds the data, this can be a lazy DiskArray"
data::A
"Metadata properties describing the content of the data"
properties::Dict{String}
properties::Me
"Representation of the chunking of the data"
chunks::GridChunks{N}
"Cleaner objects to track which objects to tidy up when the YAXArray goes out of scope"
Expand All @@ -120,7 +120,7 @@ struct YAXArray{T,N,A<:AbstractArray{T,N}, D} <: AbstractDimArray{T,N,D,A}
throw(ArgumentError("Can not construct YAXArray, supplied chunk dimension is $(ndims(chunks)) while the number of dims is $(length(axes))"))
else
axes = DD.format(axes, data)
return new{eltype(data),ndims(data),typeof(data),typeof(axes)}(
return new{eltype(data),ndims(data),typeof(data),typeof(axes), typeof(properties)}(
axes,
data,
properties,
Expand Down
10 changes: 5 additions & 5 deletions test/dimarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ end
@test r.data == a2.data .+ reshape(a3.data,(4,1,5))


x = Dim{:axis1}(1:10)
yax = DimArray(rand(10), x)
r = mapslices(sum, yax, dims=:axis1)
@test r.data[] == sum(yax.data)
# x = Dim{:axis1}(1:10)
# yax = DimArray(rand(10), x)
# r = mapslices(sum, yax, dims=:axis1)
# @test r.data[] == sum(yax.data)

#I am not sure, whether this is an actual use case
# and whether we would like to support the mix of symbol and string axisnames.
@test_broken mapslices(sum, yax, dims="axis1")
# @test_broken mapslices(sum, yax, dims="axis1")
end

@testitem "Moving Window DimArray" begin
Expand Down
Loading