Professional Documents
Culture Documents
• Fault motion:
• Slip vector, slip angle
• Type of fault
• Magnitude
• Intensity
Learning outcomes
3
ti
ti
ti
ti
ti
ti
GMT main page and versions
The main page of GMT: https://www.generic-mapping-tools.org
4
Downloading GMT
Get GMT from GitHub: https://github.com/GenericMappingTools/gmt/releases/tag/6.4.0
5
Installing GMT
Installing GMT: https://github.com/GenericMappingTools/gmt/blob/master/INSTALL.md
Accessing GMT
7
fi
fi
fi
fi
Accessing GMT
Example
8
fi
Type gmt to check if you can access it
9
Type gmt —version to check v6.4.0
10
Type gmt - - help to see GMT modules
11
Documentation on GMT
Documentation on GMT: https://www.generic-mapping-tools.org/documentation/
Learning outcomes
By the end of this lesson, you will be able to:
1. Know the basic informa on on Generic Mapping Tools (GMT)
2. Understand why we need to learn GMT, by going through examples
3. Download, install and access GMT; get help and documenta on
4. Know basic GMT commands and applica ons
5. Familiarize with some GMT exercises
6. Understand the u lity of GMT to plot loca on map, plate
boundaries, and earthquake data (loca on, depth, magnitude, etc).
13
ti
ti
ti
ti
ti
ti
GMT modules
Modules: https://docs.generic-mapping-tools.org/latest/modules.html
In computer software, a module has a speci c function and is an extension to a main program
98 core modules
main program; use this along with module name 51 supplementary modules
gmt -- help
for a list of all modules & description
gmt coast
gmt basemap
14
fi
GMT modules
Modules: https://docs.generic-mapping-tools.org/latest/modules.html
15
GMT modules
Modules: https://docs.generic-mapping-tools.org/latest/modules.html
16
Getting data into & out of GMT
cat data_ le | gmt psxy -Rw/e/s/n -Jxw/yh -Sa0.1 -P > le1.ps
Displays
redirection
piping Plot lines, polygons, and symbols in 2-D
>> to append
fi
fi
Essential GMT Commands
syntax gmt coast -R -J -B
module name
module options
Essential GMT Commands
syntax gmt coast -R -J -B
module name
module options
gmt begin
gmt coast -R -J -B
gmt end
The common GMT Commands
Mercator
The common GMT Commands
Example:
gmt basemap -R0/1/0/1 -JX8.5i/11i -Ba1f1/a1f1NSEW -P >myFile.ps
This will create a new le myFile.ps to plot a map over the Region 0-1 in the x and 0-1 in the y
with an X-Y projection over 8.5inches in x and 11 inches in y in Portrait mode
fi
The common GMT Commands
Learning outcomes
25
ti
ti
ti
ti
ti
ti
GMT learning tips
1. Use command line (PowerShell or Visual Studio Code) to familiarize GMT syntax
2. Test the GMT Tutorial scripts on your command line and visualize the output
Example scripts are readily available at
https://docs.generic-mapping-tools.org/latest/tutorial/
3. Later use shell script along with GMT commands to automate instead of copy-paste
GMT Tutorial Sessions 1- 4
Scripts are available at: https://docs.generic-mapping-tools.org/latest/tutorial/session-1.html
These exercises are for GMT 6 modern version only
1-4
Preparations before running the rst script
1. GMT should be properly and fully installed.
2. GMT executables should be in the executable path (in .bashrc or similar shell le)
3. You should be able to type gmt in your terminal and it should display the GMT splash screen with version
number and the top-level command options.
fi
fi
To run the rst script
• Create a sub-directory called ES665A_exercises, cd into that directory, and run the commands there.
• It is recommended that you place all the GMT (and UNIX) commands in a shell script le and make it
executable.
• Start the script with the line #!/usr/bin/env bash or #!/usr/bin/env csh, depending on the shell.
• All the examples in the GMT Tutorial session assumes you are running the Bourne Again shell, bash.
• Making a script executable is accomplished using the chmod command, e.g., the script gure_1.sh is
made executable with “chmod +x gure_1.sh”.
• Please cd into the directory exercise.
The +x parameter is used to add the x permission which is the symbol for the execute or run (./)permission.
fi
fi
fi
fi
A few essential commands
1. Redirection
Most GMT modules read their input from the terminal (called stdin) or from les, and write their output
to the terminal (called stdout). To use les instead one can use redirection:
2. Piping (|)
Sometimes we want to use the output from one module as input to another module. This is achieved with
pipes:
Examples:
gmt module data_*.txt operates on all les starting with “data_” and ending in “.txt”.
gmt module line_?.txt works on all les starting with “line_” followed by any single character and ending in
“.txt”.
fi
fi
fi
Some GMT exercises
Exercise1a:
gmt begin GMT_exe_1a
gmt basemap -R10/70/-3/8 -JX4i/3i -B -B+glightred+t“ES665A_LP_ g1a”
gmt end show
fi
Some GMT exercises
Exercise1a:
gmt begin GMT_exe_1a
gmt basemap -R10/70/-3/8 -JX4i/3i -B -B+glightred+t“ES665A_LP_ g1a”
gmt end show
fi
fi
Some GMT exercises
Exercise1b:
gmt begin GMT_exe_1b
gmt basemap -R10/70/-3/8 -JX4i/3i -B -B+gdarkblue+t"ES665A_LP_ g1b"
gmt end show
fi
fi
Some GMT exercises
Exercise2: Logarithmic plot
• Try to create a basemap for a log–log plot.
• We have no data set yet but we will imagine that the raw x data range from 5 to 9600 and that y ranges
from 10^20 to 10^24.
One of -W, -G, -S must be selected. Our rst coastline example is from Central America:
3 modules are used: makecpt, coast, plot Coast module is used to plot continents,
countries, shorelines, rivers and borders
What is coast module and how to use it? (syntax)
-S is used to select the symbol type and size (E.g., c for circle, a for star etc.)
GMT exercises
gmt begin GMT_tut_9
gmt makecpt -Cred,green,blue -T0,100,300,10000
gmt coast -R130/150/35/50 -JM6i -B -Ggray
gmt plot @tut_quakes.ngdc -Wfaint -i4,3,5,6+s0.1 -Scc -C
gmt end show
63
ti
ti
ti
ti
ti
Thank you!