sidpy.hdf.hdf_utilsΒΆ

Simple yet handy HDF5 utilities, independent of the data model

Created on Tue Nov 3 21:14:25 2015

@author: Suhas Somnath, Chris Smith

Functions

copy_attributes

Copy attributes from one h5object to another

copy_dataset

Copies the provided HDF5 dataset to the provided destination.

copy_linked_objects

Recursively copies datasets linked to the source h5 object to the destination h5 object that are in different HDF5 files.

find_dataset

Uses visit() to find all datasets with the desired name

get_attr

Returns the attribute from the h5py object

get_attributes

Returns attribute associated with some DataSet.

get_auxiliary_datasets

Returns auxiliary dataset objects associated with some DataSet through its attributes.

get_h5_obj_refs

Given a list of H5 references and a list of names, this method returns H5 objects corresponding to the names

h5_group_to_dict

Reads a hdf5 group into a nested dictionary

is_editable_h5

Returns True if the file containing the provided h5 object is in w or r+ modes

lazy_load_array

Loads the provided object as a dask array (h5py.Dataset or numpy.ndarray)

link_h5_obj_as_alias

Creates Dataset attributes that contain references to other Dataset Objects.

link_h5_objects_as_attrs

Creates Dataset attributes that contain references to other Dataset Objects.

print_tree

Simple function to recursively print the contents of a hdf5 group

validate_h5_objs_in_same_h5_file

Checks if the provided objects are in the same HDF5 file.

write_book_keeping_attrs

Writes basic bookkeeping and posterity related attributes to groups created using sidpy such as machine id, version, timestamp.

write_dict_to_h5_group

If the provided metadata parameter is a non-empty dictionary, this function will create a HDF5 group called group_name within the provided h5_group and write the contents of metadata into the newly created group :param h5_group: Parent group to write metadata into :type h5_group: h5py.Group :param metadata: Dictionary that needs to be written into the group :type metadata: dict :param group_name: Name of the group to write attributes into :type group_name: str

write_simple_attrs

Writes attributes to a h5py object