GMT python wrappers
While there are other, more sophisticated python interfaces for the Generic Mapping Tools (GMT) around, we found it simplest to write our own, script based interface. The hc and larry modules, as well as the SEATREE GUI use thegmtPlotter class for geographic plots. gmtPlotter.py implements a very simple wrapper approach that issues command-line calls which can be echoed to the shell.
A simple python example for how to use tgmtPlotter to make a PNG plot showing global land outlines and plate boundaries is
import sys, os from gmtPlotter import * # get the gmtPlotter class verbose=3 # verbosity # # get a plotter instance # myPlotter = GMTPlotter(verbose,"","/tmp/","","") # # set the projection # myPlotter.setMapProjection(GMTProjection("H",180,"",7,"")) # # set the region # myPlotter.setPlotRange(0, 360, -90, 90) # # coast line settings myPlotter.setCoastlineResolution("l") myPlotter.setCoastlineMaskArea(8000) # # myPlotter.setAnnotation("g60/g30") # # PS output # outfile="out.ps" # output file # # create the plot myPlotter.initPSFile(outfile) myPlotter.drawCoastline(solid=12) # draw land mass and coast lines myPlotter.drawPlateBoundaries() myPlotter.closePSFile() # done
Note that neither SEATREE nor the gmtPlotter class make full use of GMT's capabilities. If you are merely interested in mapping, you might wish to check the iGMT web page. iGMT is a Tcl/Tk? GUI interface for GMT script generation.