471,119 Members | 1,391 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,119 software developers and data experts.

reading binary data written in C

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

Mar 22 '06 #1
2 1123
On 2006-03-22, Sheldon <sh******@gmail.com> wrote:
I have a script that I want to use to read some binary lon and lat data
that was written with a C program.


http://www.python.org/doc/current/li...le-struct.html

--
Grant Edwards grante Yow! UH-OH!! We're out
at of AUTOMOBILE PARTS and
visi.com RUBBER GOODS!
Mar 22 '06 #2
Thanks,

I later discovered that it was a big edian binary as well.

Sheldon

Mar 22 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by nightflyer | last post: by
3 posts views Thread by Tanuki | last post: by
8 posts views Thread by Yeow | last post: by
3 posts views Thread by Matt Laver | last post: by
1 post views Thread by Jn Sveinsson | last post: by
7 posts views Thread by John Dann | last post: by
3 posts views Thread by The Cool Giraffe | last post: by
13 posts views Thread by swetha | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.