|
From: John H. <jdh...@ac...> - 2005-09-09 20:07:48
|
>>>>> "Joost" == Joost van Evert <ph...@gm...> writes:
Joost> is it possible to use compression while storing
Joost> numarray/Numeric objects?
Sure
In [35]: s = rand(10000)
In [36]: file('uncompressed.dat', 'wb').write(s.tostring())
In [37]: ls -l uncompressed.dat
-rw-r--r-- 1 jdhunter jdhunter 80000 2005-09-09 15:04 uncompressed.dat
In [38]: gzip.open('compressed.dat', 'wb').write(s.tostring())
In [39]: ls -l compressed.dat
-rw-r--r-- 1 jdhunter jdhunter 41393 2005-09-09 15:04 compressed.dat
Compression ration for more regular data will be better.
JDH
|