diff --git a/src/LookupArrays/lookup_arrays.jl b/src/LookupArrays/lookup_arrays.jl index 8f69df85c..5541bd910 100644 --- a/src/LookupArrays/lookup_arrays.jl +++ b/src/LookupArrays/lookup_arrays.jl @@ -260,15 +260,15 @@ y = Y(Sampled([1, 4, 7, 10]; span=Regular(3), sampling=Intervals(Start()))) A = ones(x, y) # output -5×4 DimArray{Float64,2} with dimensions:  - X Sampled{Int64} 100:-20:20 ReverseOrdered Regular Intervals, - Y Sampled{Int64} Int64[1, 4, 7, 10] ForwardOrdered Regular Intervals - 1 4 7 10 - 100 1.0 1.0 1.0 1.0 - 80 1.0 1.0 1.0 1.0 - 60 1.0 1.0 1.0 1.0 - 40 1.0 1.0 1.0 1.0 - 20 1.0 1.0 1.0 1.0 +5×4 DimArray{Float64,2} with dimensions: + X Sampled{Int64} 100:-20:20 ReverseOrdered Regular Intervals, + Y Sampled{Int64} Int64[1, 4, 7, 10] ForwardOrdered Regular Intervals + 1 4 7 10 + 100 1.0 1.0 1.0 1.0 + 80 1.0 1.0 1.0 1.0 + 60 1.0 1.0 1.0 1.0 + 40 1.0 1.0 1.0 1.0 + 20 1.0 1.0 1.0 1.0 ``` """ struct Sampled{T,A<:AbstractVector{T},O,Sp,Sa,M} <: AbstractSampled{T,O,Sp,Sa} diff --git a/src/LookupArrays/selector.jl b/src/LookupArrays/selector.jl index 971040b07..092501d16 100644 --- a/src/LookupArrays/selector.jl +++ b/src/LookupArrays/selector.jl @@ -415,11 +415,11 @@ A[X(Between(15, 25)), Y(Between(4, 6.5))] # output -1×2 DimArray{Int64,2} with dimensions:  - X Sampled{Int64} 20:10:20 ForwardOrdered Regular Points, - Y Sampled{Int64} 5:6 ForwardOrdered Regular Points - 5 6 - 20 4 5 +1×2 DimArray{Int64,2} with dimensions: + X Sampled{Int64} 20:10:20 ForwardOrdered Regular Points, + Y Sampled{Int64} 5:6 ForwardOrdered Regular Points + 5 6 + 20 4 5 ``` """ struct Between{T<:Union{<:AbstractVector{<:Tuple{Any,Any}},Tuple{Any,Any},Nothing}} <: ArraySelector{T} @@ -667,11 +667,11 @@ A = DimArray([1 2 3; 4 5 6], (X(10:10:20), Y(5:7))) A[X(Touches(15, 25)), Y(Touches(4, 6.5))] # output -1×2 DimArray{Int64,2} with dimensions:  - X Sampled{Int64} 20:10:20 ForwardOrdered Regular Points, - Y Sampled{Int64} 5:6 ForwardOrdered Regular Points - 5 6 - 20 4 5 +1×2 DimArray{Int64,2} with dimensions: + X Sampled{Int64} 20:10:20 ForwardOrdered Regular Points, + Y Sampled{Int64} 5:6 ForwardOrdered Regular Points + 5 6 + 20 4 5 ``` """ struct Touches{T<:Union{<:AbstractVector{<:Tuple{Any,Any}},Tuple{Any,Any},Nothing,Extents.Extent}} <: ArraySelector{T} @@ -840,11 +840,11 @@ A[X(Where(x -> x > 15)), Y(Where(x -> x in (19, 21)))] # output -1×2 DimArray{Int64,2} with dimensions:  - X Sampled{Int64} Int64[20] ForwardOrdered Regular Points, - Y Sampled{Int64} Int64[19, 21] ForwardOrdered Regular Points - 19 21 - 20 4 6 +1×2 DimArray{Int64,2} with dimensions: + X Sampled{Int64} Int64[20] ForwardOrdered Regular Points, + Y Sampled{Int64} Int64[19, 21] ForwardOrdered Regular Points + 19 21 + 20 4 6 ``` """ struct Where{T} <: ArraySelector{T} @@ -877,12 +877,12 @@ A[X=All(At(10.0), At(50.0)), Ti=All(1u"s"..10u"s", 90u"s"..100u"s")] # output -2×4 DimArray{Int64,2} with dimensions:  - X Sampled{Float64} Float64[10.0, 50.0] ForwardOrdered Regular Points, - Ti Sampled{Quantity{Int64, 𝐓, Unitful.FreeUnits{(s,), 𝐓, nothing}}} Quantity{Int64, 𝐓, Unitful.FreeUnits{(s,), 𝐓, nothing}}[1 s, 6 s, 91 s, 96 s] ForwardOrdered Regular Points - 1 s 6 s 91 s 96 s - 10.0 1 2 19 20 - 50.0 3 6 57 60 +2×4 DimArray{Int64,2} with dimensions: + X Sampled{Float64} Float64[10.0, 50.0] ForwardOrdered Regular Points, + Ti Sampled{Quantity{Int64, 𝐓, Unitful.FreeUnits{(s,), 𝐓, nothing}}} Quantity{Int64, 𝐓, Unitful.FreeUnits{(s,), 𝐓, nothing}}[1 s, 6 s, 91 s, 96 s] ForwardOrdered Regular Points + 1 s 6 s 91 s 96 s + 10.0 1 2 19 20 + 50.0 3 6 57 60 ``` """ struct All{S<:Tuple{Vararg{SelectorOrInterval}}} <: Selector{S} diff --git a/src/set.jl b/src/set.jl index ed1333536..df4092e60 100644 --- a/src/set.jl +++ b/src/set.jl @@ -39,64 +39,64 @@ DimensionalData julia> da = DimArray(zeros(3, 4), (custom=10.0:010.0:30.0, Z=-20:010.0:10.0)); julia> set(da, ones(3, 4)) -3×4 DimArray{Float64,2} with dimensions:  - Dim{:custom} Sampled{Float64} 10.0:10.0:30.0 ForwardOrdered Regular Points, - Z Sampled{Float64} -20.0:10.0:10.0 ForwardOrdered Regular Points - -20.0 -10.0 0.0 10.0 - 10.0 1.0 1.0 1.0 1.0 - 20.0 1.0 1.0 1.0 1.0 - 30.0 1.0 1.0 1.0 1.0 +3×4 DimArray{Float64,2} with dimensions: + Dim{:custom} Sampled{Float64} 10.0:10.0:30.0 ForwardOrdered Regular Points, + Z Sampled{Float64} -20.0:10.0:10.0 ForwardOrdered Regular Points + -20.0 -10.0 0.0 10.0 + 10.0 1.0 1.0 1.0 1.0 + 20.0 1.0 1.0 1.0 1.0 + 30.0 1.0 1.0 1.0 1.0 ``` Change the `Dimension` wrapper type: ```jldoctest set julia> set(da, :Z => Ti, :custom => Z) -3×4 DimArray{Float64,2} with dimensions:  - Z Sampled{Float64} 10.0:10.0:30.0 ForwardOrdered Regular Points, - Ti Sampled{Float64} -20.0:10.0:10.0 ForwardOrdered Regular Points - -20.0 -10.0 0.0 10.0 - 10.0 0.0 0.0 0.0 0.0 - 20.0 0.0 0.0 0.0 0.0 - 30.0 0.0 0.0 0.0 0.0 +3×4 DimArray{Float64,2} with dimensions: + Z Sampled{Float64} 10.0:10.0:30.0 ForwardOrdered Regular Points, + Ti Sampled{Float64} -20.0:10.0:10.0 ForwardOrdered Regular Points + -20.0 -10.0 0.0 10.0 + 10.0 0.0 0.0 0.0 0.0 + 20.0 0.0 0.0 0.0 0.0 + 30.0 0.0 0.0 0.0 0.0 ``` Change the lookup `Vector`: ```jldoctest set julia> set(da, Z => [:a, :b, :c, :d], :custom => [4, 5, 6]) -3×4 DimArray{Float64,2} with dimensions:  - Dim{:custom} Sampled{Int64} Int64[4, 5, 6] ForwardOrdered Regular Points, - Z Sampled{Symbol} Symbol[:a, :b, :c, :d] ForwardOrdered Regular Points - :a :b :c :d - 4 0.0 0.0 0.0 0.0 - 5 0.0 0.0 0.0 0.0 - 6 0.0 0.0 0.0 0.0 +3×4 DimArray{Float64,2} with dimensions: + Dim{:custom} Sampled{Int64} Int64[4, 5, 6] ForwardOrdered Regular Points, + Z Sampled{Symbol} Symbol[:a, :b, :c, :d] ForwardOrdered Regular Points + :a :b :c :d + 4 0.0 0.0 0.0 0.0 + 5 0.0 0.0 0.0 0.0 + 6 0.0 0.0 0.0 0.0 ``` Change the `LookupArray` type: ```jldoctest set julia> set(da, Z=DD.NoLookup(), custom=DD.Sampled()) -3×4 DimArray{Float64,2} with dimensions:  - Dim{:custom} Sampled{Float64} 10.0:10.0:30.0 ForwardOrdered Regular Points, - Z - 10.0 0.0 0.0 0.0 0.0 - 20.0 0.0 0.0 0.0 0.0 - 30.0 0.0 0.0 0.0 0.0 +3×4 DimArray{Float64,2} with dimensions: + Dim{:custom} Sampled{Float64} 10.0:10.0:30.0 ForwardOrdered Regular Points, + Z + 10.0 0.0 0.0 0.0 0.0 + 20.0 0.0 0.0 0.0 0.0 + 30.0 0.0 0.0 0.0 0.0 ``` Change the `Sampling` trait: ```jldoctest set julia> set(da, :custom => DD.Irregular(10, 12), Z => DD.Regular(9.9)) -3×4 DimArray{Float64,2} with dimensions:  - Dim{:custom} Sampled{Float64} 10.0:10.0:30.0 ForwardOrdered Irregular Points, - Z Sampled{Float64} -20.0:10.0:10.0 ForwardOrdered Regular Points - -20.0 -10.0 0.0 10.0 - 10.0 0.0 0.0 0.0 0.0 - 20.0 0.0 0.0 0.0 0.0 - 30.0 0.0 0.0 0.0 0.0 +3×4 DimArray{Float64,2} with dimensions: + Dim{:custom} Sampled{Float64} 10.0:10.0:30.0 ForwardOrdered Irregular Points, + Z Sampled{Float64} -20.0:10.0:10.0 ForwardOrdered Regular Points + -20.0 -10.0 0.0 10.0 + 10.0 0.0 0.0 0.0 0.0 + 20.0 0.0 0.0 0.0 0.0 + 30.0 0.0 0.0 0.0 0.0 ``` """ function set end