Creating shaded relief maps or combination colorized/shaded relief maps with MOLA data is easy to do with the Generic Mapping Tools (GMT).
This article will go into the details of taking some MOLA gridded data that has already been converted into the netCDF format that GMT uses, and creating a nice shaded relief map appropriately color-coded by elevation.
We'll first just create a color-coded map, and then put on the shaded relief. The first thing that we need to do is create a color palette file for our map. Let's say that I have a netCDF MOLA gridded data file called mola.grd. GMT provides a program called grd2cpt which will read in a .grd file and create a color palette file that other GMT programs can use. The grd2cpt program has a number of nice options, but the first time through, I usually just run with the defaults like so:
grd2cpt mola.grd -C/home/rbeyer/.gmt/color.cpt -V -Z > mola.cpt
Here's the detailed breakdown:
grd2cptmola.grd.grd file. The grd2cpt program reads this file and performs a mapping of the data through a cumulative distribution function so that the colors are histogram equalized. If you are only going to want to make a map from a small portion of this grid, then use the -R option for grd2cpt, so that its algorithm for distributing the colors only operates on the height ranges in your area.-C/home/rbeyer/color.cpt/home/rbeyer/color.cpt, you can use it this way. Not specifying the -C option will give you a default rainbow color scheme (ugh!). See this article for advice on color schemes.-V-Z> mola.cptNow that we have that color palette file we can make our first map. Which can be done with the following:
grdimage mola.grd -Cmola.cpt -JI305/7i -Bf1a2 -R301/310/-17/-12 -V > mola_map.ps
grdimagemola.grd-Cmola.cpt-JI305/7i-Ji and -JI specify a sinusoidal projection. The difference is how grdimage interprets the scale parameter after the slash. Make sure you understand the difference, and use the one you mean. I almost always use the uppercase version.-Bf1a2-R301/310/-17/-12-V> mola_map.psmola_map.ps.
This should give you a map in mola_map.ps that is color-coded by elevation. Often, I only want to concentrate on
a narrow range of elevations with my colors. So you may want to go back to the color palette creation step and experiment with
the -L option to grd2cpt to restrict the colors to a particular range of elevations.
The map is kind of incomplete, without a scale bar, who knows what those colors mean? So let's add a scale bar to this map.
To do this, we'll have to re-make our map. GMT writes its output to PostScript so that you can chain various GMT programs together to draw more things on one map. So to make the above map with a scale bar, do the following (your browser may wrap the lines):
grdimage mola.grd -Cmola.cpt -JI305/7i -Bf1a2 -R301/310/-17/-12 -V -K > mola_map_sb.ps
psscale -D3.5i/-0.5i/3i/0.2ih -Cmola.cpt -B500/:"Elevation (m)": -O -V >> mola_map_sb.ps
That's right, we run two GMT programs in a row. The first one, grdimage, draws the map and puts the color-coded elevations on the map. The second one, psscale, draws the scale bar on the map. You may notice that there is something different about the way we ran grdimage this time. We added the -K option. PostScript files have a very definite beginning and end, and normally GMT puts them both in. However, specifying the -K tells the grdimage program not to put the end in, so that other GMT programs can write into the file. So after running the above grdimage program, the mola_map_sb.ps file isn't complete, and some viewers may even refuse to display it (rightly so). Running psscale like we do, will put the appropriate end markers in when it is done.
So here are the details on psscale:
psscale-D3.5i/-0.5i/3i/0.2ih-Cmola.cpt-B500/:"Elevation (m)":-O-K in the program above.-V>> mola_map_sb.ps
If you used the -L option to grd2cpt, you may want to consider using the -E option with
psscale.
Using colors to help understand the elevations is good, but adding a little shaded relief based on the elevations would also be helpful.
We'll do that by using the -I option on grdimage that takes an intensity file, which we'll have to create
with the GMT program grdgradient, like so:
grdgradient mola.grd -Gmola.int -A0/270 -Ne0.6
grdgradientgrdimage's -I option.mola.grd -Gmola.intmola.grd grid file as input and will
write its output to the grid file mola.int. This is a netCDF .grd file too, but I use the .int extension to remind me that it contains intensity values.-A0/270-Ne0.6grdimage needs these intensities to be between -1 and +1, we need to use this option to normalize the data. There are a few different normalization schemes that you can use (this one uses the Laplace distribution with an amplitude of 0.6). Again, what works best for one area may not work for another. Play with this until you find something that you like.
Okay, now we have an intensity file that we can incorporate into our map. The sequence is the same as before, but this time using the
-I option for grdimage:
grdimage mola.grd -Cmola.cpt -Imola.int -JI305/7i -Bf1a2 -R301/310/-17/-12 -V -K > mola_map_shade.ps
psscale -D3.5i/-0.5i/3i/0.2ih -Cmola.cpt -B500/:"Elevation (m)": -O -V >> mola_map_shade.ps
If you use an intensity file with grdgradient you may want to look into using the -I option
with psscale.
These examples should show you how to create a colorized, shaded relief map from MOLA data. Of course, this kind of thing can serve as a basis for doing a whole lot more. You may want to add contours by running grdcontour between grdimage and psscale, or adding markers with psxy. There are lots of possibilities.
Comments
shaded relief maps with positive and negative elevations
Great cookbook. One problem I've encountered making shaded relief maps is that grdgradient seems to have issues with MOLA data that includes both positive and negative elevation values (Mars elevations fall in the range of about -9 km to 22 km). A discontinuity appears in shaded relief maps at the zero elevation countour. To get around this, one solution is to use grdmath to add 10,000 to all elevation values.