Ok, does not work here... Probably my compilation is messed up... I'll check if it was correctly compiled correctly with zip support...

Thanks,

Fabio

On 3/28/06, Francesc Altet <[EMAIL PROTECTED]> wrote:
Hi Fabio,

A Dilluns 27 Març 2006 20:47, Fabio Zadrozny va escriure:
> I'm trying to put compression in a single EArray, where I'm trying to store
> a string (actually, a byte-array, with the contents of a bitmap). That
> object is in: texture._imageData
>
> The code I'm using is below. Without setting any compression, my file ends
> up with 6 MB (and if I pass a zip later, it ends up with 600 k, so, it
> appears no compression is in effect), and with the code below it ends using
> the same space, when it should be much closer to 600k, as that image is the
> thing that eats most space in the file.

I don't know what is happening in your setup, but the next code works
just fine for me:

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

file = openFile("/tmp/test-zlib6.h5", 'w')
textureGroup = file.createGroup(file.root, "textureGroup")
filters = Filters(complevel=6)
texture = strings.array(['a']*1000)
atom = StringAtom(shape=(0,), length=1)
array = file.createEArray(textureGroup, 'imageData', atom, "Image Data",
                          filters = filters, expectedrows = len(texture))
for i in range(1000):
    array.append(texture)
file.close()
---------------------------------

Without compression, the created file is:

-rw-r--r-- 1 faltet faltet 1049960 2006-03-28 11:39 /tmp/test.h5

so, 1 MB is size. With a compression level of 6:

-rw-r--r-- 1 faltet faltet   62352 2006-03-28 11:40 /tmp/test-zlib6.h5

so, 62 KB. Compressing the original uncompressed file:

$ gzip < /tmp/test.h5 > /tmp/test.h5.gz

-rw-r--r-- 1 faltet faltet   10279 2006-03-28 11:39 /tmp/test.h5.gz

it is 10 KB. 62 KB is a little more than 10 KB, but this is completely
normal because of the metadata and info about data chunks in the HDF5
file.

BTW, this not related with your question, but why are using strings
atoms instead of UInt8 atoms? Both takes the same space I think, but
I'd say that the later would be more efficient in PyTables contexts.

Cheers,

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


Reply via email to