larray.Array.to_hdf

Array.to_hdf(self, filepath, key)[source]

Writes array to a HDF file.

A HDF file can contain multiple arrays. The ‘key’ parameter is a unique identifier for the array.

Parameters:
filepath : str

Path where the hdf file has to be written.

key : str or Group

Key (path) of the array within the HDF file (see Notes below).

Notes

Objects stored in a HDF file can be grouped together in HDF groups. If an object ‘my_obj’ is stored in a HDF group ‘my_group’, the key associated with this object is then ‘my_group/my_obj’. Be aware that a HDF group can have subgroups.

Examples

>>> a = ndtest((2, 3))

Save an array

>>> a.to_hdf('test.h5', 'a')          # doctest: +SKIP

Save an array in a specific HDF group

>>> a.to_hdf('test.h5', 'arrays/a')  # doctest: +SKIP