Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lazily view hierarchies on disk #7

Open
bjarthur opened this issue Nov 1, 2020 · 1 comment
Open

lazily view hierarchies on disk #7

bjarthur opened this issue Nov 1, 2020 · 1 comment

Comments

@bjarthur
Copy link

bjarthur commented Nov 1, 2020

JLD2.jl, MAT.jl, HDF5.jl, and maybe others could benefit from being composed with REPLTreeViews.jl. how hard would it be to add support for say fid=h5open(...); @iview fid. i could help with this if you gave me a tip on where to start.

@jmert
Copy link

jmert commented Nov 1, 2020

It looks like for HDF5.jl, getting the names printed out in a tree is relatively easy (assuming the functions in JuliaIO/HDF5.jl#725), but with only a couple minutes' reading of code here I don't see how to print the data contents (since HDF5 Datasets are also nodes for any attached attributes):

using HDF5
import TreeViews

let H5Trees = Union{HDF5.File,HDF5.Dataset,HDF5.Group,HDF5.Attributes}
    TreeViews.hastreeview(::H5Trees) = true
    TreeViews.numberofnodes(o::H5Trees) = length(HDF5._tree_children(o, true)[1])
    TreeViews.nodelabel(io::IO, o::H5Trees, i::Integer, ::MIME"text/plain") = print(io, HDF5._tree_children(o, true)[1][i])
    TreeViews.treenode(o::H5Trees, i::Integer) = HDF5._tree_children(o, true)[2][i]
end

using REPLTreeViews
julia> hfile = h5open("/tmp/test_file.h5")

julia> @ishow hfile
HDF5.File
 ▶  creator
 ▶  description
 ▶  R
 ▶  fields
 ▼  pixels_left
    ▼  HDF5.Group
       ▶  description
       ▼  dec
         [ ] HDF5.Dataset
            
       ▶  order
       ▶  ra
       ▶  type
 ▶  pixels_right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants