reading binary data written in C

Sheldon shejo284 at gmail.com
Wed Mar 22 10:01:05 EST 2006


Hi,

I have a script that I want to use to read some binary lon and lat data
that was written with a C program. My script looks like this:

lat = open(lat_file,'rb').read()
lat = Numeric.fromstring(lat)
print len(lat)
print lat[0]

Results:
1476225
-995001790

Or using the Float typecode:
Results:
1476225
-1419.82055664
**************************

Now the length of the string is good, a 1215*1215 array in vector form.
But the lat data is wrong.
I have tried different type codes but nothing gives me a lat that is
within [+90,-90] degrees.
Does anyone know what is going on here?

Thanks,
Sheldon




More information about the Python-list mailing list