A Wednesday 12 January 2011 16:56:25 Frédéric Bastien escrigué:
> Hi,
> 
> I'm trying pytables and I hit a problem: the class
> tables.earray.EArray don't support deepcopy.

It does.  Use the `copy()` method:

http://www.pytables.org/docs/manual/ch04.html#id340646

> I can work around this by manually not doing a deepcopy, but to make
> it safe, I need to know if the file was opened in read mode or
> write/append. If it is opened in read mode, I suppose that it is safe
> to don't do the deepcopy. How can I know if the array is modifiable?

You can check this by looking at the `mode` attribute of the file:

my_earray._v_file.mode

> The other option I see is to create a CArray instead. The problem is
> how to create one that don't fit in memory? My file compressed take
> 43G.

You can also do that if you want (although the EArray venue is 
recommended).  Just create the CArray, and then fill it with data 
chunks.  Something like:

my_carray = h5f.createCArray(..., shape=(200,300,500), ...)
for i in xrange(my_array.shape[0]):
    my_carray[i] = mydata_chunk  # shape for chunk is (300,500)

> The original data is in numpy format in many files. Is ptrepack
> usefull for this?

Definitely.  You can use ptrepack to copy datasets (or hierarchy of 
datasets) from one to file to another.

Hope this helps,

-- 
Francesc Alted

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to