
Chris Barker writes:
"Paul F. Dubois" wrote:
y=array([1,2,3], '1') y array([1, 2, 3],'1') y.astype(Int32) array([1, 2, 3],'i')
Actually, this is exactly NOT what I want to do. In this case, each 1 byte interger was converted to a 4byte integer, of the same VALUE. What I want is to convert each SET of four bytes into a SINGLE 4 byte integer as it:
a = array([1,2,3,4],'1') a = fromstring(a.tostring(),Int32) a array([67305985],'i')
A brut force way would be to do the transformation yourself :-)
bits=array([1,256,256*256,256*256*256]) sum(array([1,2,3,4])*bits) 67305985
So you need to reshape your array into (?,4) and multiply by bits. And regarding your numpyio question, you can also read characters, which are then put into an array by itself. It seems you have a very messy file format (but the data world is never easy) HTH, __Janko -- Institut fuer Meereskunde phone: 49-431-597 3989 Dept. Theoretical Oceanography fax : 49-431-565876 Duesternbrooker Weg 20 email: jhauser@ifm.uni-kiel.de 24105 Kiel, Germany