A Dijous 24 Agost 2006 09:23, Engelmann, Bernd va escriure:
> Hello,
> the error below appears within the update iteration, if indexed=1 and
> rows>4999.
> Reason may be the chunksize code in IndexArray.py.
> Is there anything wrong with the code, or is it not implemented
> following the error message ?

No, your code is correct. This bug does not appear in SVN trunk but does in 
branch 1.3. Unfortunately, solving it in 1.3 would be a bit involved and I 
don't want to touch many things on this branch right now (I'm about to 
release 1.3.3 version).

So, your options are using SVN trunk (test units give some warnings, but they 
are not too grave, I'd say), or use the workaround I'm attaching below. In 
fact, the code in this workaround is quite more efficient than yours because 
it only creates an index *once* at the end of the updating process, while in 
your code, it re-creates the index each time that the table buffer fills 
(each 4965 modified rows, in your example).

HTH,

-------------------------------------------------------------------------------------------------------
from tables import *
from numarray import *

file = "/tmp/update_test.h5"
dims = (2,2,2)
indexed = 1
rows = 5000

class Item(IsDescription):
        name = StringCol(16) # 16-character String
        vals = Float32Col(0.0, shape=(dims))

# write
h5 = openFile(file, mode = "w")
group = h5.createGroup("/", 'igroup')
table = h5.createTable(group, "items", Item, "Item",
Filters(complevel=9, complib='zlib'))
row = table.row
for i in xrange(rows):
        row['name'] = "x%d" % (i)
        row['vals'] = ones(dims)
        row.append()
table.flush()
h5.close()

# update
h5 = openFile(file, mode = "a")
table = h5.root.igroup.items
for row in table:
        buf = row['vals']
        buf[0] = 2.2
        row['vals'] = buf
        row.update()

# Create the needed indexes
if indexed:
        table.cols.name.createIndex()

h5.close()
-----------------------------------------------------------------------------------------------

-- 
>0,0<   Francesc Altet     http://www.carabos.com/
V   V   Cárabos Coop. V.   Enjoy Data
 "-"

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Pytables-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to