GMT GMT stands for "Generic Mapping Tools." It is a set of UNIX tools for making map plots that was written by Paul Wessel and Walter Smith. This software is in the public domain and is still maintained by Wessel and Smith. The lastest update (Version 3.3.6) was released on October 17, 2000. There is a GMT website at "imina.soest.hawaii.edu/gmt" that contains links to manuals and tutorials for the programs. I have printed out the main manual (136 pages) and the tutorial (33 pages) and put them into a binder in the Barnyard. Unfortunately, I have generally found these manuals to be pretty worthless both for learning how to use GMT and as a reference to learn about specific commands. Once you have learned a little bit about how to use GMT, it's better to use the online manuals as your primary reference. You can access these at the UNIX command level by simply entering: man pscoast man psxy etc. Unfortunately, GMT is not a very "user friendly" program. If you are unfamiliar with some of the features of the UNIX environment like piping output, etc., you may find it fairly intiminating at first. However, it is extremely powerful in the number of things that it can do and the time spent learning how it works will not be wasted as you will become familiar with many useful UNIX tools. GMT is capable of producing very nice maps and plots. Let's start with an example. You will ALWAYS want to run GMT as a UNIX script: ------------------------------------------------------------- (do.gmt1) #!/bin/csh pscoast -R0/360/-90/90 -JQ180/6i -B60g30 -P -Dc -G200 >! map.ps ---------------------------------------------------------------------- In this case, we begin with "#!/bin/csh" to invoke the C-shell environment. The script will run without this, but it is probably safest to always go into C-shell because all of the example GMT scripts do this. Presumably in some cases it may make a difference. Next we enter "pscoast" which is the GMT program that draws coastlines. This program has various options that, in UNIX style, are invoked with a dash and a letter on the same line (e.g. -P, -Dc, etc.). The output of the program is directed to the Postscript file "map.ps". Note that we use ">!" instead of ">" to avoid getting an error message if map.ps already exists; we will overwrite any existing map.ps file. Now, let us examine the arguments: -R0/360/-90/90 This sets lon1=0, lon2=360, lat1=-90, lat2=90 Note that we could have written this with a space between the "R" and the zero ("0") immediately following. Most people leave this space out to more easily separate the different commands. -JQ180/6i This specifies the map projection to be cylindrical equidistant (a simple linear scaling of lat/lon). The center meridian is set to 180 degrees; the plot width is set to 6 inches (the "i" means inches). A very large number of different map projections are available! -B60g30 This sets the labeled lat/lon lines to 60 degree intervals and the unlabeled lines to 30 degree intervals -P Specifies "portrait" mode so that the plot is not rotated by 90 degrees as in "landscape" mode (default). -Dc Sets the resolution of the coastline to "c" for crude. This is all that is required for a small map of the whole globe. For larger maps or closeups, higher resolution will be required. The available options are: (f)ull, (h)igh, (i)ntermediate, (l)ow and (c)rude. Note that the full resolution files require over 55Mb of data and provide great detail. This generally should only be used for extreme close ups. Default is (l)ow resolution. -G200 Specifies the grayshade level for the continent shading from 0 (black) to 255 (white). These nonintuitive units are a Postscript convention! How might we improve on this plot? The plot is not centered on the page because the default position for the lower left corner is at x=1inch, y=1inch. We can change this by specifying the x and y positions directly: -X1.2i -Y4i Set the lower left corner to 1.2 inches from the left edge and 4 inches from the bottom. We may decide that we don't want lat/lon lines drawn on the plot so we remove the "g30" from the -B command: -B60 label lat/lon every 60 degrees We may prefer a smaller font. We can do this with a different program which we run before calling pscoast: gmtset ANOT_FONT_SIZE 10 The resulting script is: ----------------------------------------------------------------- (do.gmt2) #!/bin/csh gmtset ANOT_FONT_SIZE 10 pscoast -R0/360/-90/90 -JQ180/6i -B60 -P -Dc -G200 \ -X1.2i -Y4i >! map.ps -------------------------------------------------------------------------- Note that we used a backslash (\) to indicate that the line continues to the next line. In this way we can avoid making our lines too long. Next, suppose we have a file containing the coordinates of some seismic stations which we wish to plot on this map. The file is called station.list and its first five lines are: 9.02920 38.76560 2442 AAE 42.63900 74.49400 1645 AAK 37.93040 58.11890 678 ABKT 51.88370 -176.68440 116 ADK -13.90930 -171.77730 706 AFI Here is a script that will plot these points on our map: ------------------------------------------------------------------ (do.gmt3) #!/bin/csh gmtset ANOT_FONT_SIZE 10 pscoast -R0/360/-90/90 -JQ180/6i -B60 -P -Dc -G200 \ -X1.2i -Y4i -K >! map.ps psxy -O -R -JQ180/6i -St0.06i -G0 -: station.list >> map.ps --------------------------------------------------------------------------- The first part of the script is the same as before, except that the -K is necessary to tell GMT to keep the Postscript file open (i.e., don't do a "showpage") so that more can be added to the file. Next, we use "psxy" to read and plot the x-y points from file station.list. We use ">>" to append the output onto the end of the map.ps file. Note that ">" or ">!" would not work here. The arguments of psxy are as follows: -O Indicates that this is a overlay onto an existing Postscript file to avoid the initializations at the beginning of the file. -R Sets the plot boundaries (defaults to those set by pscoast) -JQ180/6i Sets the map projection (according to the manual, this should work without the 180/6i but I did not find this to be true). -St0.06i Plots xy points as (t)riangles of 0.06 inch width. Other options are (c)ircle, (d)iamond, (s)quare, (i)nverted triangle, (x)cross, and (v)ector. In the case of the vector, the direction and length are also read from the file (see manual). -G0 Set fill parameter to 0 (black). This will fill in the triangles. The number varies from 0 (black) to 255 (white). Alternatively, color can be specified as the Postscript red/blue/green values, e.g., "G255/0/0" for red. -: This tells the program that the data are to be read as y-x pairs. The default is x-y, or (long,lat) in our case. For seismology this option is very useful because coordinates are usually given as lat+lon rather than the other way around. Note that the program automatically converts the longitude convention of the data points (-180 to 180) to the longitude convention of the map (0 to 360). This is a nice feature of GMT. Next, let's try a different map projection, plot the points in red, and add a title: -------------------------------------------------------------- (do.gmt4) #!/bin/csh gmtset ANOT_FONT_SIZE 10 pscoast -R-180/180/-90/90 -JH0/6i -Bg0:."IRIS FARM stations": \ -P -Dc -G150 -X1.2i -Y4i -K >! map.ps psxy -O -R -JH -St0.06i -G255/0/0 -: station.list >> map.ps ----------------------------------------------------------------------- The changed commands are as follows: -JH0/6i Invokes the equal-area Hammer projection with 6 inch width -Bg0:."IRIS FARM stations": The 0 results in no grid lines or labels The title is set off with :." and ": (weird!) -G255/0/0 Define the fill for the xy plot as red=255, green=0, blue=0 To my taste, the title is way too big. This can be changed using the gmtset HEADER_FONT_SIZE command (see below). Next, let's look at a closeup of these stations in southern California: --------------------------------------------------------------- (do.gmt5) #!/bin/csh gmtset HEADER_FONT_SIZE 20 gmtset ANOT_FONT_SIZE 10 pscoast -R-121/-114/32/37 -JM6i -B1g1:."IRIS FARM stations": \ -P -Di -I1 -I2 -I3 -N1 -N2 -G255/200/200 -X1.2i -Y4i -K >! map.ps psxy -O -R -JM -St0.06i -G0 -: station.list >> map.ps ----------------------------------------------------------------------- Changes are: gmtset HEADER_FONT_SIZE 20 Set font size for title to 20 -R-121/-114/32/37 Set lon1,lon2,lat1,lat2 to S. California -JM6i Use Mercator projection, width = 6 inches -B1g1:."IRIS FARM stations": Label and draw grid lines every 1 degree Use same title -I1 Plot permanent major rives -I2 Plot additional major rivers -I3 Plot additional rivers -N1 Plot national boundaries -N2 Plot state boundaries within the Americas -G255/200/200 Fill land areas with red=255, green=200, blue=200 Next, let's add lines that show the traces of mapped faults in southern California. For this, we use a file called "calif.flts" that has the following format: 370.0000 99.0000 -115.5496 32.9312 -115.5419 32.9142 -115.5358 32.9029 -115.5276 32.8890 370.0000 99.0000 -115.9218 32.9916 -115.9096 32.9849 -115.8936 32.9745 -115.8729 32.9655 -115.8398 32.9498 -115.8216 32.9410 -115.7983 32.9295 -115.7796 32.9228 370.0000 99.0000 -115.8391 33.0127 -115.8205 33.0069 -115.8017 33.0015 -115.7892 32.9973 etc. The faults are defined as (lon,lat) pairs. A value of (370,99) is used to separate the different faults. To plot these faults on our map of the southern California stations, we can use the psxy command a second time: ---------------------------------------------------------------(do.gmt6) #!/bin/csh gmtset HEADER_FONT_SIZE 20 gmtset ANOT_FONT_SIZE 10 pscoast -R-121/-114/32/37 -JM6i -B1:."IRIS FARM stations": \ -P -Di -I1 -I2 -I3 -N1 -N2 -G255/200/200 -X1.2i -Y4i -K >! map.ps psxy -O -R -JM -M'370' -W8/255/0/0 calif.flts -K >> map.ps psxy -O -R -JM -St0.15i -G0/0/255 -: station.list >> map.ps ----------------------------------------------------------------------- Changes are: -B1:."IRIS FARM stations": We removed the g0 so we don't plot grid lines which might get confused with the faults We plot the faults using: psxy -O -R -JM -M'370' -W8/255/0/0 calif.flts -K >> map.ps In this command, we use the -M option to flag the segment boundaries -M'370' lines starting with '370' mark segment boundaries: Without this command the plot would look like a mess because lines would be drawn to the (370,99) points. -W8/255/0/0 This draws the line with linewidth=8 (thicker than normal) and color red=255, green=0, blue=0 Note that we do not need the -: option because the points are already given as (lon,lat). We plot the stations last so that they will go on top of the faults. We change the symbol size and the color: -St0.15i plot triangles 0.15 inches high -G0/0/255 plot with red=0, green=0, blue=255 Note that -K is needed on every command except the last; -O is needed on every command except the first. (Are there really no faults in eastern southern California?)