itsh5py.save#
- itsh5py.save(hdf, data, compress=(True, 5), packer=<function pack_dataset>, *args, **kwargs)[source]#
Adds keys of given dict as groups and values as datasets to the given hdf-file (by string or object) or group object. Iterative dicts are supported.
The dict can have the attrs key containing a dict of key, value pairs which are added as root level attributes to the hdf file. Those must be scalar, else exceptions will occur.
*args and **kwargs will be passed to the h5py.File constructor.
- Parameters
hdf (string, Path) – Path to File
data (dict) – The dictionary containing only string or tuple keys and data values or dicts as above again.
packer (callable) – Callable gets hdfobject, key, value as input. hdfobject is considered to be either a h5py.File or a h5py.Group. key is the name of the dataset. value is the dataset to be packed and accepted by h5py. Defaults to pack_dataset()
compress (tuple) – Try to compress arrays, use carefully. If on, gzip mode is used in every case. Defaults to (False, 0). When (True,…) the second element specifies the level from 0-9, see h5py doc.
- Returns
hdf – Path to new file
- Return type
string