Using Generic Mapping Tool (Basics)

Generic Mapping Tool (GMT) is an open-source collection of commands for processing and displaying 2D or 3D datasets. It also has features like rasterization, filtering and other image processing operations.

Here, we will see how can we use it to make high resolution publishable quality plots. It is very simple as it only involves few commands to get the control of the plot. In total, GMT only has about 80 commands so it is really simple to learn.

It can be downloaded from the GMT website 

#!/bin/bash
IN1=Photo1.tif
IN2=1995_2016_M_5_8.dat
cpl=GMT_globe.cpt
output=first_gmt_map.ps
echo "Output file is $output"
rm -f ${output}

# Define map characteristics
proj="-JM4.5i" # Mercator projection
minlon=119
maxlon=124
minlat=17
maxlat=26
bounds="-R$minlon/$maxlon/$minlat/$maxlat"
annot="-B1"

open="-K -V -P -Xc -Yc"
add="-O -K -V"
close="-O -V"

grdimage $IN1 $proj $annot $bounds -C$cpl $open > $output
psscale -D13/10/10/0.5v -C$cpl -B3000:"Altitude in meters":/:mts: $add >> $output

psmeca $IN2 $proj $bounds -Sa.7c/0/0 -G0 -C -N $close >> $output

gs $output #requires the pre-installed ghostview or ghostscipt

For running this script, simply save it in any file and make the file executable and run it.

Screen Shot 2016-11-11 at 1.54.34 PM.png

Screen Shot 2016-11-11 at 2.04.17 PM.png

4 thoughts on “Using Generic Mapping Tool (Basics)”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s