Hi Brad,
2010/7/20 Brad Buran <bbu...@cns.nyu.edu>
> Is there a relatively simple, straightforward way to take an existing
> EArray and change it's dtype and/or filters? In pseudocode:
>
> f = tables.openFile('test.h5', 'w')
> f.createEArray('/', 'test_array', tables.Float64Atom(), (0,))
> f.root.test_array.append(arange(32))
> f.root.test_array.atom = tables.Float32Atom() # convert all the data to
> np.float32
> f.root.test_array.filters = tables.Filters(complevel=9) # compress the data
>
> Obviously the above code doesn't work, but I was wondering if there's an
> efficient way to do the compression/datatype conversion in-place, or if I
> need to create a new array and copy the data over.
>
No. In order to change fundamental properties like datatype or filters, you
always have to do that by explicitly *copying* the datasets.
For changing the filters properties, you can do this easily by calling the
`copy()` method and passing an appropriate `Filters` instance in the
`filters` parameter.
For changing the data type, you will have to manually create a new dataset
(`EArray` in your case) with the desired new type and then copy the contents
with a loop.
--
Francesc Alted
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users