nested_set#

mochada_kit.hdf5_metadata_tools.nested_set(dic, keys, value)#

Turn the “flat” dict which results from using the function get_ds_dictionaries() in h5py.Group.visititems(), iteratively into a nested dict, which is the correct structure for representation in a plantuml json diagram.

Parameters:
dicDICT

On the first pass, an empty dict, which on the first and subsequent passes, is populated with entries.

keysLIST

List of strings which are the result of e.g. “/1/EBSD/Header/Metadata/First”.split(“/”). For each key, if it does not exist in dic, and emtpy dict is added at that key. This continues until the last key has been reached, at which point, the value is assigned.

valueSTR

The value of the metadata at this key.