Skip to content

Commit

Permalink
Up DimensionalData
Browse files Browse the repository at this point in the history
  • Loading branch information
meggart committed Aug 16, 2022
1 parent 1990d8f commit 6fb91d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/axisarrays/dimensionaldata.jl
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
using .DimensionalData: DimensionalArray, DimensionalData, data, Dim, metadata
using .DimensionalData: DimArray, DimensionalData, data, Dim, metadata

_dname(::DimensionalData.Dim{N}) where N = N
dimname(x::DimensionalArray, i) = _dname(DimensionalData.dims(x)[i])
dimname(x::DimArray, i) = _dname(DimensionalData.dims(x)[i])


dimvals(x::DimensionalArray,i) = DimensionalData.dims(x)[i].val
dimvals(x::DimArray,i) = DimensionalData.dims(x)[i].val

getdata(x::DimensionalArray) = data(x)
getdata(x::DimArray) = data(x)

getattributes(x::DimensionalArray) = metadata(x)
getattributes(x::DimArray) = metadata(x)

function yaxcreate(::Type{<:DimensionalArray},data,dnames,dvals,atts)
function yaxcreate(::Type{<:DimArray},data,dnames,dvals,atts)
d = ntuple(ndims(data)) do i
Dim{Symbol(dnames[i])}(dvals[i])
end
DimensionalArray(data,d,metadata = atts)
DimArray(data,d,metadata = atts)
end
4 changes: 2 additions & 2 deletions test/arrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ end

@testset "DimensionalData" begin
using DimensionalData
d = yaxconvert(DimensionalArray,M())
@test d isa DimensionalArray
d = yaxconvert(DimArray,M())
@test d isa DimArray
@test getdata(d) == reshape(1:12,3,4)
@test YAXArrayBase.dimnames(d) == (:x, :y)
@test dimvals(d,1) == 0.5:1.0:2.5
Expand Down

2 comments on commit 6fb91d7

@meggart
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/66347

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.0 -m "<description of version>" 6fb91d7dee2921201fb411d906f4bfba24dcae0b
git push origin v0.6.0

Please sign in to comment.