Skip to content

Nested Dictionaries #1187

@DanDeepPhase

Description

@DanDeepPhase

My mental model of HDF5s is as a folder structure, where related data is grouped together, and buried in a nested / hierarchical format. Currently the read functions deliver a flat dictionary, and the hierarchy is held in strings as opposed to structure. The alternative which matches my mental model is to read an HDF5 in as a nested dictionary, where the value of a key is a datatype if the key refers to a datatype, and the value is a dictionary if the key refers to a group.

So for an HDF5 like:

📂 h5file
├─ 🔢 B
└─ 📂 groupA
       ├─ 🔢 A1
       └─ 🔢 A2

The current read generates:

Dict(
   "B" => Bval
   "groupA/A1" => A1val
   "groupA/A2" => A2val
)

And I'd prefer an option to read_nested as:

Dict(
   "B" => Bval
   "groupA" => Dict(
          "A1" => A1val
          "A2" => A2val
         )
)

I've written this code locally (plus corresponding write_nested. Would it be reasonable to include it here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions