I’ve started to put some thought into where the martian city is to be located. To do that, I need to study a little bit on martian martian topology. It turns out that we have some raw data from the Mars Orbiter Laser Altimeter. Yeah, I know it’s really not raw data… who knows what the MOLA instrumentation spits out, but it’s raw for me.
The data is available in a number of resolutions and is packed neatly enough in files containing signed 16-bit integers… Well, I just needed to put the data into an image format. Easy peasy right? It took me a few tries…
My first attempt was with PHP through its libgd . Unfortunately, i found no easy way to produce a 24-bit greyscale image… so I ended up with something that looked pretty blah. My next stab at it was through Java… the thing about this was… I was too lazy to read up on exactly how to read a signed short from a file, so I tried this:
int msb = inputStream.read();
int lsb = inputStream.read();
int value = msb * 256 + lsb;
As it turned out, this process doesn’t retain the signedness of the 16-bit value… So after digging a little I came up with the right solution:
DataInputStream dataStream = new DataInputStream(inputStream);
int value = dataStream.readShort();
I had to mess with the contrast a little, but in the end I got what i wanted… topology of mars rendered as images… check it out:
This image reminds me a lot of the moon. It’s pretty amazing that the martian atmosphere really doesn’t protect it much from the pocking of meteorite impacts… or at the very least it doesn’t cover it up over time like here on Earth.