Shtevie Posted December 4, 2014 Share Posted December 4, 2014 Hi! I am attempting to display and plot information contained within .img files from the MOLA MEGDRs in an sdl/opengl application of my own design. I'm getting curious results . . . I'm able to distinguish some obvious land forms, the Tharsis bulge, hellas, valles marineris, etc so I know I'm mapping x, y coordinates correctly against long/lat. However, when I attempt to plot topographical data, (the actual values in the .img file at a given location) those features are mired with noise. As it stands, I'm able to switch between the various megt, mega, megr, and megc .img files, convert their values to color information, but they all display noise with varying amounts of landforms barely distinguishable. I'm wondering if I'm suppose to be combining the data from these separate .img files in some way to extract a desired gradient of topographical data, or if I'm suppose to be applying some moduli or some other mathematical ritual? I'm fairly sure my IO is encoding properly. The .lbl files were helpful to a point, but haven't help me solve this! Please help! Link to comment Share on other sites More sharing options...
Susie Slavney Posted December 4, 2014 Share Posted December 4, 2014 You do not need to combine the files. First, be sure you understand the difference between megt (topography), mega (areoid), megr (planetary radius) and megc (counts). The one you probably want is megt, topography; the others will not look like anything interesting. The label tells you the data are stored as 16-bit most-significant-byte-first (big-endian) integers. They are signed integers, by the way. Hmm, if you were treating them as unsigned, that might account for the noise you're seeing. Another idea: if you're on a Windows machine you're probably reading them as least-sig-byte-first integers, so you need to swap the bytes. You don't need to apply any math. The values are already in meters, ranging from -8208 to 21249 for the whole data set (it will be slightly different for individual tiles). Link to comment Share on other sites More sharing options...
Shtevie Posted December 4, 2014 Author Share Posted December 4, 2014 It works now! I was indeed encoding as unsigned. I feel so silly now . . . Thanks a ton! you're the best! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now