10.4 MAPG, a simple automatic GMT map

The program can make a standard GMT plot of epicenters, stations, ray traces and fault plane solutions. The input can be standard input from a file, data base or index file. All scaling is done automaticallyi. 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. A size can be added to m like m 0.5 to make symbols 0.5 cm.

l: Plot locality names.

L: Plot localitY NAMEs with a symbol. The name of the geographic locations file is given in SEISAN.DEF with GMT_LOCALITY_FILE.

r: plot rays.

The rays are generated from the stations in the S-files. Only stations with given phases are used and only with given weights so e.g. all P-phase rays can be plotted. The epicenter coordinates are taken from the S-files and the station coordinates from the STATION0.HYP. The additional question is:

Enter phases to use for ray paths, one per line, terminate with enter Only the chars given will be used so entring e.g. P, all P-type phases will be used

P

Minimum output weight for phase-stat to be used, enter for non zero weight phases

When using the r-option, epicenters are always plotted, also epicenters without rays. Stations are only plotted if s or S options is used and only the stations used are plotted. The map outline is adjusted to include all stations used. The ray paths in GMT format are stored in file mapg.ray.

The output is a PostScript file mapg.ps 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. In Windows, a free software pstopdf and be used to convert to PDF so the command could be the following commands put into a BAT file.

pstopdf -i

figure.pdf

GMT_GRIDFILE: The GMT grid file used. A reasonably detailed world file is found at
ftp://ftp.geo.uib.no/pub/seismo/SOFTWARE/GMTEXAMPLES/DATA/newbathy.grd

GMT_LOCALITY_FILE, see above. Format is the same as otjher locations files in SEISAN. Latitude, longitude and name, 2f12.3,a

MAP_LAT_BORDER and MAP_LON_BORDER, the same a sfor EPIMAP, distance to map center (deg) when only one epicenter.

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 t.out r

  Options, by interactive input or as arguments
  The first argument is filenme so e.g. mapg select.out f l

  s: plot stations as triangles
  S: --------- with station code above
  f: plot fault plane solutions, size proportional with magnitude
  F  --------------------------, size constant
  m: plot epicenter symbol with constant size, default is proportional to magintude
  l: plot localities names
  L: plot localities with names and symbols
  r: plot rays

 Enter phases to use for ray paths, one per line, terminate with enter
 Only the chars given will be used so entring e.g. P, all P-type phases will be used
P
S

 Minimum output weight for phase-stat to be used, enter for non zero weight phases

 1996 0606 0648 27.2 L  62.916   4.491 34.3  BER  6 .30 3.2LBER 2.6CBER 3.0LNAO
 1996 0606 0648 35.5 L  62.658   5.449 0.00  BER  9 3.3 3.1LBER         3.0LNAO
 1996  6 6  649  2.8 L  60.678   3.180 15.0  BER  6 5.8 2.1LBER 2.6WBER 3.0LNAO
 1996 0607 1325 37.3 L  60.899   4.782 12.0F BER  3 6.2 3.4LBER
 1996  6 7 1325 37.3 L  60.899   4.782 12.0F BER  3 6.2 3.4LBER
 1996 0625 0337 33.6 R  61.595   3.730 0.00  BER 12 .20 4.9CBER         3.2LNAO
 1996  625  337 38.9JL  61.476   3.952 1.60  BER  9 1.9 3.4LBER 2.7SBER 3.2LNAO
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:                              7
 Number of events with fault plane solution:     3
  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           7
 Number of events with location           7
Lattitude range to use    59.0   63.3
Longitude range to use     2.4    8.0
Grid size in lat and lon:   1.00  2.00

c:\seismo\WOR>pstopdf -i mapg.ps -o figure.pdf

c:\seismo\WOR>figure.pdf

 Number of events in input file or data base           7
 Number of rays generated     36
 Number of stations used for rays    10
 File with ray paths is mapg.ray
 File with stations used for rays is gmtstxy.out
 Output of events in input file with location: mapg.out
 Output of postscript file with map: mapg.ps
 Output of gmt script: mapg.gmt

c:\seismo\WOR>

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. An example plot is seen in Figure 10.4.

Figure 10.4: An example GMT plot
\begin{figure}
\centerline{\includegraphics[width=0.9\linewidth]{fig/mapg}}
\end{figure}

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


REM   
REM   Set font, size and color of title
REM   
gmt gmtset  FONT_TITLE = 14p,Helvetica,black                                                                                                                                                            
REM   
REM   Cut out desired area from grid file, area is 1.500/7.600/57.00/63.100            
REM   
gmt grdcut c:\a\gmt\newbathy.grd -R1.500/7.600/57.00/63.100             -Gmapg.grid                                                                                                                     
REM   
REM   Make color table, global colors
REM   
gmt makecpt -Cglobe -T-8500/8500/50 -Z > mapg.cpt                                                                                                                                                       
REM   
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
REM   
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 >mapg.ps                                                              
REM   
REM    Compute directional gradients from a grid
REM   
gmt grdgradient mapg.grid -Nt1 -A225 -Gmapg.gradient                                                                                                                                                    
REM   
REM   Make the map
REM   
gmt grdimage -JM60.05/4.55/07c -R1.500/7.600/57.00/63.100             mapg.grid  -Imapg.gradient  -O -K  -Cmapg.cpt >> mapg.ps                                                                          
REM   
REM   Plot coast line
REM   
gmt pscoast -JM60.05/4.55/07c -B -R1.500/7.600/57.00/63.100             -Dh -N1/1.00p,- -K -O -W >> mapg.ps                                                                                             
REM   
REM   Plot epicenters, size proportinal to magnitude
REM   
gmt psxy gmtxy.out -R -J -Sc -G200/0/0 -W0.3 -O -K >> mapg.ps                                                                                                                                           
REM   
REM   Plot stations, blue triangles, size 0.4
REM   
gmt psxy gmtstxy.out -R -J -St0.4 -Gblue -W1 -O -K >> mapg.ps                                                                                                                                           
REM   
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
REM   
gmt psmeca psmeca.out -R -J -V -Sa1.0/-1 -M -P -O >> mapg.ps                                                                                                                                            
REM   
REM   
REM   
REM   Plot map on screen
REM   
gswin32 mapg.ps

In Linux REM is replaced by #.

Peter Voss : Fri Nov 12 10:33:10 UTC 2021