2.7.2. h5pywrappers.scalar.save

save(scalar, scalar_id, write_mode='w-')[source]

Save an HDF5 “scalar” to an HDF5 file as a zero-dimensional HDF5 dataset.

By “scalar”, we mean the single numerical data element from a zero-dimensional HDF5 dataset.

Parameters:
scalarfloat | complex | h5py.Dataset

The HDF5 scalar of interest to save to an HDF5 file.

scalar_idh5pywrappers.obj.ID

The parameter set specifying where to save the HDF5 scalar of interest.

write_mode“w” | “w-” | “a” | “a-”, optional

The write mode upon opening the HDF5 file to which to save the HDF5 scalar of interest: if write_mode is set to "w", then the target HDF5 file is emptied prior to saving the HDF5 scalar of interest; else if write_mode is set to "w-", then the HDF5 scalar of interest is saved unless a file already exists with the target filename, in which case an error is raised and the target HDF5 file is left unmodified; else if write_mode is set to "a-", then the HDF5 scalar of interest is saved unless an HDF5 object already exists at the target HDF5 path of the target HDF5 file, in which case an error is raised and the target HDF5 file is left unmodified; else if write_mode is set to "a", then the HDF5 scalar of interest is saved without emptying the target HDF5 file, replacing any HDF5 object at the target HDF5 path should one exist prior to saving.

Returns: