h5rdmtoolbox.wrapper.core.Group.create_from_yaml

h5rdmtoolbox.wrapper.core.Group.create_from_yaml#

Group.create_from_yaml(yaml_filename, num_dtype=None)[source]#

creates groups, datasets and attributes defined in a yaml file. Creation is performed relative to the current group level.

If a num_dtype is provided, all numerical datasets are created with this dtype.

An example YAML file content could look like this:

>>> title: 'Title of the file'
>>> contact: '0000-1234-1234-1234'
>>> grp:
>>>   attrs:
>>>     comment: test
>>> grp/subgrp/y:
>>>   data: 2
>>>   overwrite: True
>>>   attrs:
>>>     units: 'm/s'
>>> grp/subgrp:
>>>   attrs:
>>>     comment: This is a group comment
>>>   velocity:
>>>     data: [3.4, 1.1]
>>>     overwrite: True
>>>     attrs:
>>>       units: 'm/s'

Examples

>>> with h5tbx.File('test.h5', 'w') as h5:
>>>     h5.create_from_yaml('test.yaml')