python - Error when trying to extend an existing dataset in h5py: ValueError: Unable to set extend dataset (Dimension cannot exceed the existing maximal size -


i trying create resizable dataset in h5py. should simple 1 dimensional array initial values written in it, , updated additional values when available. when 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 error:

valueerror: unable set extend dataset (dimension cannot exceed existing maximal size (new: 120 max: 60))

however, seems providing data or setting shape overrides maxshape , dataset not resizing, message current maximum shape either of data provided or set in shape attribute.

according h5py documentation how should done, , setting maxshape none should provide unlimited extensions, while setting chunks true should enable automatic chunk size determination.

i have tried this, , add data separately:

ds = g2.create_dataset(wf,(100,), maxshape=(none), chunks=true, dtype='i') 

it throws same error, , not sure if setting dimensions incorrectly or if has data type or shape.

the thing i'm doing different use (none,) shape, not (none); making sure give tuple shape. haven't tried without comma.

in [177]: f=h5py.file('test1.h5','w') in [178]: ds = f.create_dataset('name', maxshape=(none,), chunks=true, data=np.arange(10)) in [179]: ds.shape out[179]: (10,) in [180]: ds.resize((20,)) in [181]: ds[:] out[181]: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) in [182]: ds[10:]=np.arange(10,20) in [183]: ds[:] out[183]:  array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,        17, 18, 19]) 

maxshape must tuple. resize not work (none).


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -