How to open sub-directory of HDF5 file in Julia?

I want to open sub-directory of HDF5 file in Julia?


For example- how can i open "Coordinates" folder using HDF5.jl?

A “subdirectory” is called a “group” in HDF5. See the HDF5 documentation on opening groups.

1 Like

What should i type in terminal to open that group?

Coordinates is not a group. That is an attribute. See either attrs or attributes.

1 Like

What attribute contains? How to open it?

julia> data = h5open("data.h5", "r")
🗂️ HDF5.File: (read-only) data.h5
└─ 🏷️ Coordinates

julia> attrs(data)
AttributeDict of HDF5.Group: / (file: data.h5) with 1 attribute:
  "Coordinates" => [12, 75]

julia> attrs(data)["Coordinates"]
2-element Vector{Int64}:
 12
 75

Or with attributes:

julia> attributes(data)
🗂️ Attributes of HDF5.File: (read-only) data.h5
└─ 🏷️ Coordinates

julia> attributes(data)["Coordinates"]
🏷️ HDF5.Attribute: Coordinates

julia> attributes(data)["Coordinates"][]
2-element Vector{Int64}:
 12
 75

julia> read(attributes(data)["Coordinates"])
2-element Vector{Int64}:
 12
 75
2 Likes