How to create NULL dataspace using H5Py

Problem

I was trying to write a HDF5 file using the H5Py package. What I wanted to create was a HDF5 dataset whose dataspace is NULL. This is what I wanted (when dumped by h5dump):

DATASPACE  NULL
DATA {
}

I could not find any input parameters to the create_dataset call that could achieve this. The closest was by passing an empty tuple to the shape parameter.

However, that created a dataset with this structure:

DATASPACE  SCALAR
DATA {
(0): NULL
}

Solution

It turns out that the H5Py had no support to create a NULL dataspace! Thankfully, support for this had just been added to v2.7 as mentioned here.

I used the latest version of H5Py and was able to create a dataset with NULL dataspace. This is done by passing None to the shape parameter.

Tried with: Ubuntu 14.04

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s