H5py: purpose of empty/null datasets?


While reading the h5py docs, I came upon a discussion about creating empty (or null) datasets. (There is also mention of empty/null attributes, but of less interest.) Ref: Creating and Reading Empty (or Null) datasets and attributes. Per the doc, an empty dataset is “a dataset with an associated type, but no data, and no shape”.

From my testing, it appears, you can’t modify the shape or add data to the dataset. Is that correct?

If so, what is the purpose of an empty/null dataset?


Originally a “null” dataset (i.e., a dataset that has H5S_NULL dataspace) was added for the netCDF-4 C library implementation. The purpose of an empty dataset was to hold attributes.

As with any other creation properties, it cannot be changed after the dataset was created; therefore, data cannot be added later.


OK, thanks. It helps to understand the use case.