next up previous contents index
Next: 10.4 GMAP, Plotting epicentres Up: 10. Plotting epicenters Previous: 10.2 W_EMAP, Version Windows   Contents   Index

10.3 MAPG, a simple automatic GMT map

The program can make a standard GMT plot of epicenters, stations and fault plane solutions. The input can be standard input from a file, data base or index file. All scaling is done automatically Both standard s-files and compact files can be input. If the program is started without argument, it will ask for input data and whether stations and/or fault plane solutions should be plotted. The program uses the standard SEIGMT program to prepare the data for GMT and the stations plotted are therefore the stations found in the input data and not all possible stations in the area. The program can also be started with input on the prompt line, but then only with input from a file like

mapg select.out

With input from the prompt line there is also more options like

mapg select.out f s

which will plot fault plane solutions and stations. All options are:

s: plot stations as triangles

S: ------------- with station code above

f: plot fault plane solutions, size scaled with magnitude

F: -------------, fixed scale

m: plot epicenter symbol with constant size, default is proportional to to magnitude

The output is a PostScript file and a script file mapg.gmt. The script file can be used to do modifications to the plot that is not possible with the program. Some modifications are obvious but others require knowledge of GMT. On Linux, the file can be executed by command 'source mapg.gmt'. On windows, rename file to e.g. m.bat and execute by typing 'm'. Do not use name mapg.bat since the program would no longer run by using the mapg command, only the script if started from directory with the script.

Some parameters for the program is set in SEISAN.DEF:

PLOT_PS_COMMAND: The command used for displaying the ps file, usully GhostScript. GMT_GRIDFILE: The GMT grid file used. A reasonably detailed world file is found at

The map projection is hardwired to Mercator. The maximum horizontal size is 17 cm. The horizontal size will be reduced if the vertical size is more than 1.5 times the horizontal size. The minimum lat-lon division is 0.25 deg. The title is hardwired to Epicenters, can be changed in script.

The program uses latest version of GMT.

An example run is

c:\seismo\WOR>mapg select.out s F
 1990 1213 1109 19.8 LE 60.328   5.167  0.0F BER  6 1.3 0.9CBER
 1995  822 0141  6.2 L  60.389   2.597 30.3  TES 13 0.7 2.3LTES 2.7CTES 2.2LNAO
 1995 1120 0401 59.1 L  60.052   5.402  1.5  TES 12 0.5 2.0LTES 2.3CTES 2.1LNAO
 1996  6 6 0648 30.4 L  62.636   5.050 15.0  TES 13 0.9 2.9LTES 3.0CTES 3.0LNAO
 1996  6 7 1325 29.2 L  59.846   5.130 12.0F TES 12 0.6 1.9LTES 2.2CTES 2.0LNAO
 1996  625 0337 32.9 L  61.587   3.496 15.2  TES 31 1.0 3.2LTES 3.0CTES 3.2LNAO
 1996  7 5 0220 46.5 L  61.287   4.829  8.0  TES 10 0.4 2.0LTES 2.2CTES 1.9LNAO
 1996  713 0556 46.0 L  61.419   3.872 12.2  TES  9 0.5 1.5LTES 2.1CTES 1.6WBER
 1996  718 0946 51.4 L  60.158   2.070 15.0  TES  9 1.1 1.8LTES 2.5CTES 2.1WBER
 1996  726 0742 12.0 L  61.756   2.316 20.8  TES  9 0.4 1.8LTES 2.4CTES 2.0WBER
 1997  812 0814 24.1 L  59.818   6.646 12.0F TES 14 0.6 2.8LTES 2.7CTES 3.4LNAO
 1999  529 0031 43.6 L  62.201   4.587 15.0F TES 32 0.7 3.9LTES 3.2CTES 3.8LNAO
 2000  2 1 1242 20.2 L  61.606   4.693  0.0  TES 13 0.7 2.3LTES 2.1CTES 2.3LNAO
 2000  210 0617 57.4 L  61.760   4.539  6.0F TES 20 0.7 3.6LTES 2.9CTES 3.3WBER
 2000  210 1740  7.2 L  61.847   4.414  2.4  TES 16 0.7 3.0LTES 2.5CTES 3.0LNAO
 2002  411 1316 27.9 LE 58.202   6.203  0.0F BER  7 0.9 1.8LBER 2.0CBER
 2004  5 2 1924 53.9 L  59.893   6.271  5.0F TES 16 0.9 1.5LTES 1.3CTES 2.0LNAO
 2004  511 0050 47.7 L  60.017   5.305  7.0F TES 16 0.7 1.8LTES 1.7CTES 2.3LNAO
 2004  7 5 1809 36.9 L  57.505   7.139 15.0FFDNK  5 1.0 2.2LDNK 1.9CDNK
End of s-file
Grid file to use: c:\a\gmt\newbathy.grd
  Nordic input file
  Return to use largest magnitude, or enter magnitude order (e.g. CLBSW)
  scale: size = mag * scale (for example 0.01)
 Input file is Nordic.
 Number of events:                             19
 Number of events with fault plane solution:     6
  epicenter location input file for GMT psxy/psxyz: gmtxy.out/gmtxyz.out
  epicenter locations with day counter from first event gmtdays.out
  station location input file for GMT psxy: gmtstxy.out
  time and magnitude to be used with GMT psxy: gmttime.out
  travel path input file for GMT psxy (option -M): gmtpath.out
  Coordinates are given as longitude - latitude
  input file for psmeca (Aki and Richards convention): psmeca.out

 Number of events in input file          19
 Number of events with location          19
Lattitude range to use    57.0   63.1
Longitude range to use     1.5    7.6
Grid size in lat and lon:   2.00  2.00
psmeca: Number of records read: 6

 Number of events in input file or data base          19
 Output of events in input file with location: mapg.out
 Output of postscript file with map:
 Output of gmt script: mapg.gmt

Most of the output is self explanatory. Only events with locations are used so number of events plotted might be different from number of events in input file. The events used are output in mapg.out. The plot is seen in Figure 10.4.

Figure 10.4: The GMT plot from the run above

The script file (Windows) corresponding to the above run is:

REM   Set font, size and color of title
gmt gmtset  FONT_TITLE = 14p,Helvetica,black                                                                                                                                                            
REM   Cut out desired area from grid file, area is 1.500/7.600/57.00/63.100            
gmt grdcut c:\a\gmt\newbathy.grd -R1.500/7.600/57.00/63.100             -Gmapg.grid                                                                                                                     
REM   Make color table, global colors
gmt makecpt -Cglobe -T-8500/8500/50 -Z > mapg.cpt                                                                                                                                                       
REM   Plot base map, midpoint is 60.05/4.55/         horizontal size in cm is 07
REM   Longitude and latitude grids are:    2.00   2.00
gmt psbasemap -Bxa002.00g002.00 -Bya002.00g002.00 -B+t"Epicenters" -JM60.05/4.55/07c -R1.500/7.600/57.00/63.100             -K -P >                                                              
REM    Compute directional gradients from a grid
gmt grdgradient mapg.grid -Nt1 -A225 -Gmapg.gradient                                                                                                                                                    
REM   Make the map
gmt grdimage -JM60.05/4.55/07c -R1.500/7.600/57.00/63.100             mapg.grid  -Imapg.gradient  -O -K  -Cmapg.cpt >>                                                                          
REM   Plot coast line
gmt pscoast -JM60.05/4.55/07c -B -R1.500/7.600/57.00/63.100             -Dh -N1/1.00p,- -K -O -W >>                                                                                             
REM   Plot epicenters, size proportinal to magnitude
gmt psxy gmtxy.out -R -J -Sc -G200/0/0 -W0.3 -O -K >>                                                                                                                                           
REM   Plot stations, blue triangles, size 0.4
gmt psxy gmtstxy.out -R -J -St0.4 -Gblue -W1 -O -K >>                                                                                                                                           
REM   Plot fault plane solutions, -1 to avoid date on top of
REM   of fps, 1.0 is size proportinal to magnitude, to make 
REM   fixed size, add parameter -M
gmt psmeca psmeca.out -R -J -V -Sa1.0/-1 -M -P -O >>                                                                                                                                            
REM   Plot map on screen

In Linux REM is replaced by #.

next up previous contents index
Next: 10.4 GMAP, Plotting epicentres Up: 10. Plotting epicenters Previous: 10.2 W_EMAP, Version Windows   Contents   Index
Peter Voss : Tue Jul 2 07:59:27 UTC 2019