Thanks.
Now, I found the same file size

Didier

2009/6/26 Francesc Alted <fal...@pytables.org>

> A Friday 26 June 2009 17:44:48 Didier Roissé escrigué:
> > Hello,
> > I created a HDF5 file containing an array with the following dimension
> > (5000,1). I notice a big difference file size between the array creation
> > with createCArray and createEArray.
> > For creation of the table with createCArray, i use this script :
> >
> > h5ft=openFile('test_carray.h5','w')
> > ca=h5ft.createCArray(h5ft.root,"foo",Float32Col(),(5000,1),"carray test")
> > for ii in range(5000):
> >   ca[ii][0]=1.0
>
> Here is culprit.  When assigning to a PyTables object, always specify the
> indexes in one shot.  For example, replace the above line by:
>
>  ca[ii,0]=1.0
>
> and you are done.  Or you can avoid the last index completely too:
>
>  ca[ii]=1.0
>
> as the input is broadcasted to the affected index.
>
> What was happening here is that ca[ii] returns the element ii of the CArray
> as
> a (temporary) NumPy array, and when you do ca[ii][0]=1.0, you are modifying
> that NumPy array, not the value on disk.
>
> Hope that helps,
>
> --
> Francesc Alted
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Pytables-users mailing list
> Pytables-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pytables-users
>
------------------------------------------------------------------------------
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to