Visualize Mt St Helen with Python and a custom color palette

Evan Bianco of Agile Geoscience wrote a wonderful post on how to use python to import, manipulate, and display digital elevation data for Mt St Helens before and after the infamous 1980 eruption. He also calculated the difference between the two surfaces to calculate the volume that was lost because of the eruption to further showcase Python’s capabilities. I encourage readers to go through the extended version of the exercise by downloading his iPython Notebook and the two data files here and here.

I particularly like Evan’s final visualization (consisting of stacked before eruption, difference, and after eruption surfaces) which he created in Mayavi, a 3D data visualization module for Python. So much so that I am going to piggy back on his work, and show how to import a custom palette in Mayavi, and use it to color one of the surfaces.

The so called “gist_earth” colormap available in Matplotlib and Mayavi is pretty good, but it probably isn’t as good as one of your perceptually balanced colormaps. Any opinion on how good or how bad it is by comparison? I think that I resort to using it because it is easy, and it is just there as a keyword argument, but it also have the look and feel of a topographic map. With that said your surface looks much more vibrant. Keep up the awesome work!

Good question. I was wondering about it too. I confess that if I look at them both without getting too much into the perception corner, I get a more pleasant feeling from the gist_earth. I find it a bit more “earthy” whereas the Linear Lightness could be a touch too vibrant….
Certainly the gist_earth is the best “default” I’ve seen so far.
If I look at it more from the point of view of perception, I see that brownish transition between yellow-green and white as a potential place for perceptual artifacts. I’ll run some of my tests on it and get back to you. Great data, thanks for sharing!

I don’t think so, I just tried it myself. Sometimes the direct download off of Jupyter does not work, but in those cases I just copy the link and paste it in nbviewer and download it from there and it always works.

Blogroll

Meta

Go ahead if you want to use my code, modify it, improve it, for non-commercial AND for commercial use. You are also welcome to download and reuse my media files - unless otherwise stated. With both code and images, please give full and clear credit to Matteo Niccoli as the author and mycarta.wordpress.com as the source.
WordPress bloggers are welcome to reblog my posts. For republishing outside of WordPress or any other request, please e-mail me at: matteo@mycarta.ca