HDF5.jl
HDF5.jl copied to clipboard
It seems h5info is not implemented: is there an alternative?
It seems h5info is not implemented: is there an alternative? Similarly h5disp ... I do appreciate this package: it is very useful!
h5info as in the matlab function https://www.mathworks.com/help/matlab/ref/h5info.html ?
Sorry: I made an incorrect assumption that h5info available in Matlab is a built-in function of HDF5. So, is there something like this available in this package?
Does HDF5.show_tree satisfy your needs?
From test/plain.jl
# Make an interesting file tree
hfile = h5open(fn, "w")
# file level
hfile["version"] = 1.0
attributes(hfile)["creator"] = "HDF5.jl"
# group level
create_group(hfile, "inner")
attributes(hfile["inner"])["dirty"] = true
# dataset level
hfile["inner/data"] = collect(-5:5)
attributes(hfile["inner/data"])["mode"] = 1
# non-trivial committed datatype
# TODO: print more datatype information
tmeta = HDF5.Datatype(HDF5.h5t_create(HDF5.H5T_COMPOUND, sizeof(Int) + sizeof(Float64)))
HDF5.h5t_insert(tmeta, "scale", 0, HDF5.hdf5_type_id(Int))
HDF5.h5t_insert(tmeta, "bias", sizeof(Int), HDF5.hdf5_type_id(Float64))
tstr = datatype("fixed")
t = HDF5.Datatype(HDF5.h5t_create(HDF5.H5T_COMPOUND, sizeof(tmeta) + sizeof(tstr)))
HDF5.h5t_insert(t, "meta", 0, tmeta)
HDF5.h5t_insert(t, "type", sizeof(tmeta), tstr)
commit_datatype(hfile, "dtype", t)
# Example run
julia> HDF5.show_tree(hfile)
🗂️ HDF5.File: (read-write) C:\Users\Mus\AppData\Local\Temp\jl_TU1f7TtXWt
├─ 🏷️ creator
├─ 📄 dtype
├─ 📂 inner
│ ├─ 🏷️ dirty
│ └─ 🔢 data
│ └─ 🏷️ mode
└─ 🔢 version
I am like a child in a candy store! This is fantastic. This function should be well documented, it could well be a selling point that will seal the deal for someone who's interested in this package. At the moment I can't find it in the documentation.
Good point, we should definitely advertise this more and document it. At the same time this is the default method for show so it should show up transparently.
HDF5.show_tree is the implementation for the default 3-argument show method since v0.14. (#725)
That being said, a summary function like h5info that returns a Dict or NamedTuple data structure could still be useful and should be implementable.
I think the default show addresses most of the relevant issues. If tweaks are required, please open another issue.