Open
Description
julia> f
HDF5 data file: test.h5
julia> f["a"] = rand(100, 50)
100×50 Array{Float64,2}:
0.260602 0.385837 0.866534 … 0.30788 0.0507932 0.260047
0.891652 0.323088 0.0826012 0.722712 0.0977896 0.471532
0.379407 0.450657 0.873643 0.564537 0.568046 0.884447
0.365355 0.638885 0.64861 0.472992 0.786368 0.195252
0.61823 0.484626 0.358584 0.392733 0.36302 0.608896
0.717485 0.372161 0.710187 … 0.708059 0.923805 0.508474
⋮ ⋱
0.844055 0.142846 0.670188 0.220866 0.12411 0.78967
0.713121 0.191025 0.876949 … 0.835709 0.905816 0.800183
0.47358 0.559134 0.725292 0.176276 0.790019 0.100635
0.644976 0.794425 0.388457 0.309014 0.653796 0.713121
0.837234 0.688704 0.357377 0.870132 0.880849 0.716922
0.253511 0.875848 0.922213 0.730818 0.539947 0.776605
julia> lastindex(f["a"])
5000
julia> f["a"][end]
ERROR: Wrong number of indices supplied, supplied length 1 but expected 2.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] hyperslab(::HDF5Dataset, ::Int64) at /Users/user/.julia/packages/HDF5/T1b9x/src/HDF5.jl:1854
[3] _getindex(::HDF5Dataset, ::Type, ::Int64) at /Users/user/.julia/packages/HDF5/T1b9x/src/HDF5.jl:1775
[4] _getindex(::HDF5Dataset, ::Int64) at /Users/user/.julia/packages/HDF5/T1b9x/src/HDF5.jl:1769
[5] getindex(::HDF5Dataset, ::Int64) at /Users/user/.julia/packages/HDF5/T1b9x/src/HDF5.jl:1759
[6] top-level scope at none:1
julia> eachindex(f["a"])
ERROR: MethodError: no method matching keys(::HDF5Dataset)
Closest candidates are:
keys(::Cmd) at process.jl:639
keys(::Core.SimpleVector) at essentials.jl:603
keys(::BenchmarkGroup) at /Users/user/.julia/packages/BenchmarkTools/eCEpo/src/groups.jl:31
...
Stacktrace:
[1] eachindex(::HDF5Dataset) at ./abstractarray.jl:209
[2] top-level scope at none:1
lastindex and eachindex are both implemented using linear indexing, thus resulting in this error, since HDF5Datasets actually use cartesian indices. Shall I make a PR to redefine firstindex, lastindex and eachindex using cartesian indices? Or is there a function to read a HDF5Dataset at a given linear index?