I am trying to create a resizable dataset in h5py. It should be a simple one dimensional array with some initial values written in it, and then updated with additional values when they are available. When I try this:
ds = g2.create_dataset(wf, maxshape=(None), chunks=True, data=values)
size = ds.shape[0] + len(values)
ds.resize(size, axis=0)
I get this error:
ValueError: Unable to set extend dataset (Dimension cannot exceed the existing maximal size (new: 120 max: 60))
However, it seems that providing data or setting the shape overrides the maxshape and the dataset is not resizing, with the message that the current maximum shape is either that of data initially provided or set in the shape attribute.
According to the h5py documentation this is exactly how it should be done, and setting the maxshape to None should provide the unlimited extensions, while setting the chunks to True should enable automatic chunk size determination.
I have also tried something like this, and add data separately:
ds = g2.create_dataset(wf,(100,), maxshape=(None), chunks=True, dtype='i')
It throws the same error, and by now I am not sure if I am setting dimensions incorrectly or if it has anything to do with the data type or shape.