Hi,
I have some code that collects arrays of doubles from several different
processors in a parallel environment, then writes the whole set to one
big file as a single array. Each processor i has an array of size
(6,ni), where the ni = n1, n2, n3... are all different. In PyTables
1.3.1, I accomplished this with
...
atom = tables.Atom(dtype='Float64',shape=(7,0))
earray = f.createEArray(f.root,'particles',atom,'Float64',
filters = filter)
...
earray.append(parts)
The attached program old.py has a working simplified example. I tried to
modify this for PyTables 2.1 by doing
...
atom = tables.Float64Atom(shape=(7,0))
earray = f.createEArray(f.root,'particles',atom,(7,0),
filters = filter)
...
as contained in the attached program new.py, but I get:
---------------------------------
HDF5-DIAG: Error detected in HDF5 (1.8.1) thread 0:
#000: H5Tarray.c line 346 in H5Tarray_create1(): zero-sized dimension
specified
major: Invalid arguments to
routine
minor: Bad
value
HDF5-DIAG: Error detected in HDF5 (1.8.1) thread
0:
#000: H5Pdcpl.c line 2097 in H5Pset_fill_value(): not a
datatype
major: Invalid arguments to
routine
minor: Inappropriate
type
Traceback (most recent call
last):
File "new.py", line 23, in
<module>
write_particles("test.h5")
File "new.py", line 16, in
write_particles
filters =
filter)
---------------------------------
Can anyone help me? I must be missing something simple.
Thanks,
Jim Amundson
#!/usr/bin/env python
# This version works with PyTables 1.3.1
import numarray
import tables
def get_fake_data(processor):
lengths = [2,5,3,4] # arbitrary set of lengths
data = numarray.ones((7,lengths[processor]),'d')*processor
return data
def write_particles(filename,compress_level=1):
f = tables.openFile(filename,mode = "w")
filter = tables.Filters(complevel=compress_level)
atom = tables.Atom(dtype='Float64',shape=(7,0))
earray = f.createEArray(f.root,'particles',atom,'Float64',
filters = filter)
for proc in xrange(0,4):
parts = get_fake_data(proc)
if parts.shape[1] > 0:
earray.append(parts)
f.close()
write_particles("test.h5")
#!/usr/bin/env python
# This version needs to work with PyTables 2.1
import numpy
import tables
def get_fake_data(processor):
lengths = [2,5,3,4] # arbitrary set of lengths
data = numarray.ones((7,lengths[processor]),'d')*processor
return data
def write_particles(filename,compress_level=1):
f = tables.openFile(filename,mode = "w")
filter = tables.Filters(complevel=compress_level)
atom = tables.Float64Atom(shape=(7,0))
earray = f.createEArray(f.root,'particles',atom,(7,0),
filters = filter)
for proc in xrange(0,4):
parts = get_fake_data(proc)
if parts.shape[1] > 0:
earray.append(parts)
f.close()
write_particles("test.h5")
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users