write_puml_code_for_hdf5_metadata#
- mochada_kit.hdf5_metadata_tools.write_puml_code_for_hdf5_metadata(hdf5_file, group_path, output_path, save_json_and_load=True, highlights=None, highlight_style=None)#
Write puml code for the hdf5 metadata to file.
- Parameters:
- hdf5_file
STR
orpathlib.Path
Full path to the hdf5 file containing the metadata to be extracted.
- group_path
STR
orpathlib.Path
Path WITHIN the hdf5 file to the Group where the metadata is located, e.g. “/1/EBSD/Header”.
- output_path
STR
The full path to the filename for the output (WITHOUT an extension).
- save_json_and_load
BOOL
,optional
If True, the extracted metadata will be saved as a .json file and a command will be written into the puml code to load this file. If False, the metadata are not saved as json but just written in full to the puml code file. The default is True.
- highlights
LIST
,DICT
orpython:None
,optional
List of strings giving the path(s) within the hdf5 file of the metadata to be highlighted in the json diagram. For example, [“Phases/1/Lattice Dimensions”, “Phases/1/Phase Name”] would result in those two values being highlighted in the final diagram. These strings will be reformatted in the function to the correct syntax for plantuml. If highlights is a list, highlight_style is ignored, and the default highlight style will be used for all highlights. If a dict is supplied, the keys are the path strings (as above) and the values are strings giving a stereotype to be applied to that highlight e.g. “<<my_stereotype>>”. The stereotypes must be defined in highlight_style, which may not be None, in this case. An empty string as a value results in the default highlight being applied to that element. The default is None.
- highlight_style
STR
orpython:None
,optional
String defining a css style containing the style for one or more bespoke highlights e.g.:
'<style> .h1 { BackGroundColor green FontColor white FontStyle italic } .h2 { BackGroundColor red FontColor white FontStyle bold } </style>'
The above code defines two highlight styles, h1 and h2, which can then be applied as stereotypes <<h1>> and <<h2>>. If highlight_style is not None, highlights must be a dict for the styles to be applied. The default is None.
- hdf5_file