Closed bjarthur closed 1 year ago
just do time = ...
as before, instead of Ti = ...
, it should work.
nope. i tried that earlier, just didn't show it. here it is:
julia> DIM[
time = DD.Between( Date("2022-01-01"), Date("2022-01-10")),
lon=DD.Between(1,2),
Variable = At("var2")
]
┌ Warning: (Dim{:time},) dims were not found in object
└ @ DimensionalData.Dimensions /groups/scicompsoft/home/arthurb/.julia/packages/DimensionalData/pS9IE/src/Dimensions/primitives.jl:659
30×2×15 DimArray{Float64,3} with dimensions:
Dim{:Ti} Sampled{DateTime} DateTime[2022-01-01T00:00:00, …, 2022-01-30T00:00:00] ForwardOrdered Irregular Points,
Dim{:lon} Sampled{Float64} 1.0:1.0:2.0 ForwardOrdered Regular Points,
Dim{:lat} Sampled{Float64} 1.0:0.2857142857142857:5.0 ForwardOrdered Regular Points
and reference dimensions:
Dim{:Variable} Categorical{String} String["var2"] ForwardOrdered
[:, :, 1]
1.0 2.0
2022-01-01T00:00:00 0.104654 0.878094
2022-01-02T00:00:00 0.689001 0.678357
2022-01-03T00:00:00 0.478613 0.257777
2022-01-04T00:00:00 0.369591 0.190209
2022-01-05T00:00:00 0.0477685 0.136863
2022-01-06T00:00:00 0.118754 0.949264
2022-01-07T00:00:00 0.147424 0.309887
2022-01-08T00:00:00 0.820518 0.0952518
2022-01-09T00:00:00 0.988964 0.264022
2022-01-10T00:00:00 0.134161 0.0722799
2022-01-11T00:00:00 0.629499 0.868076
2022-01-12T00:00:00 0.0221451 0.342178
2022-01-13T00:00:00 0.970437 0.964414
2022-01-14T00:00:00 0.111773 0.926125
2022-01-15T00:00:00 0.495118 0.333009
2022-01-16T00:00:00 0.445825 0.941374
2022-01-17T00:00:00 0.652199 0.276319
2022-01-18T00:00:00 0.127384 0.864917
2022-01-19T00:00:00 0.0961752 0.181921
2022-01-20T00:00:00 0.759085 0.229129
2022-01-21T00:00:00 0.492247 0.23813
2022-01-22T00:00:00 0.408099 0.0883392
2022-01-23T00:00:00 0.246613 0.257849
2022-01-24T00:00:00 0.717849 0.0755125
2022-01-25T00:00:00 0.835873 0.945049
2022-01-26T00:00:00 0.295243 0.325043
2022-01-27T00:00:00 0.77659 0.744565
2022-01-28T00:00:00 0.240221 0.863562
2022-01-29T00:00:00 0.0579734 0.419663
2022-01-30T00:00:00 0.17626 0.07056
[and 14 more slices...]
it looks like you need to do DateTime(your_date)
.
i'm not sure what you mean. can you please elaborate?
you did notice the warning?
┌ Warning: (Ti,) dims were not found in object
└ @ DimensionalData.Dimensions /groups/scicompsoft/home/arthurb/.julia/packages/DimensionalData/pS9IE/src/Dimensions/primitives.jl:659
if changing Date
to DateTime
in the indexing is what you meant, it doesn't work:
julia> DIM[
Ti = DD.Between( DateTime("2022-01-01"), DateTime("2022-01-10")),
lon=DD.Between(1,2),
Variable = At("var2")
]
┌ Warning: (Ti,) dims were not found in object
└ @ DimensionalData.Dimensions /groups/scicompsoft/home/arthurb/.julia/packages/DimensionalData/pS9IE/src/Dimensions/primitives.jl:659
30×2×15 DimArray{Float64,3} with dimensions:
Dim{:Ti} Sampled{DateTime} DateTime[2022-01-01T00:00:00, …, 2022-01-30T00:00:00] ForwardOrdered Irregular Points,
Dim{:lon} Sampled{Float64} 1.0:1.0:2.0 ForwardOrdered Regular Points,
Dim{:lat} Sampled{Float64} 1.0:0.2857142857142857:5.0 ForwardOrdered Regular Points
and reference dimensions:
Dim{:Variable} Categorical{String} String["var2"] ForwardOrdered
[:, :, 1]
1.0 2.0
2022-01-01T00:00:00 0.104654 0.878094
2022-01-02T00:00:00 0.689001 0.678357
2022-01-03T00:00:00 0.478613 0.257777
2022-01-04T00:00:00 0.369591 0.190209
2022-01-05T00:00:00 0.0477685 0.136863
2022-01-06T00:00:00 0.118754 0.949264
2022-01-07T00:00:00 0.147424 0.309887
2022-01-08T00:00:00 0.820518 0.0952518
2022-01-09T00:00:00 0.988964 0.264022
2022-01-10T00:00:00 0.134161 0.0722799
2022-01-11T00:00:00 0.629499 0.868076
2022-01-12T00:00:00 0.0221451 0.342178
2022-01-13T00:00:00 0.970437 0.964414
2022-01-14T00:00:00 0.111773 0.926125
2022-01-15T00:00:00 0.495118 0.333009
2022-01-16T00:00:00 0.445825 0.941374
2022-01-17T00:00:00 0.652199 0.276319
2022-01-18T00:00:00 0.127384 0.864917
2022-01-19T00:00:00 0.0961752 0.181921
2022-01-20T00:00:00 0.759085 0.229129
2022-01-21T00:00:00 0.492247 0.23813
2022-01-22T00:00:00 0.408099 0.0883392
2022-01-23T00:00:00 0.246613 0.257849
2022-01-24T00:00:00 0.717849 0.0755125
2022-01-25T00:00:00 0.835873 0.945049
2022-01-26T00:00:00 0.295243 0.325043
2022-01-27T00:00:00 0.77659 0.744565
2022-01-28T00:00:00 0.240221 0.863562
2022-01-29T00:00:00 0.0579734 0.419663
2022-01-30T00:00:00 0.17626 0.07056
[and 14 more slices...]
ahh, now I see. Ok, your are in the DimensionalData.jl realm. So you need to checkout the docs there. Either way, the issue is that now the full name has changed to Dim{:Ti}, so you need to use that, according to the docs. Hence, your example works with
DIM[
Dim{:Ti}(DD.Between( Date("2022-01-01"), Date("2022-01-10"))),
lon=DD.Between(1,2),
Variable = At("var2")
]
by the way, I updated the docs already with all your previous feedback, hopefully it will be useful for others as well. This Ti, Time, time
thing is really annoying at the moment, https://github.com/rafaqz/DimensionalData.jl/issues/499,
thanks! i'm sure others will appreciate updated docs too.
following along in the docs again about how indexing in YAXarrays is fragile so convert to a DimArray first, everything works fine:
but if i then save the original YAXarray to a NetCDF file, load it back in, and convert again to DimArray, then the
time
index is changed toTi
and i cannot index into that dimension:the output is 30x2x15 which is smaller that 30×10×15×2 but it should be 10x2x15. so it successfully indexed into
lon
andVariable
but notTi
.hope i'm not doing something stupid again. thanks!