Introduccin al GMT (Generic Mapping
Tools)
Por: Cristobal Condori
Lima-2016
Generic Mapping Tools
(GMT)
Pgina oficial:
http://gmt.soest.hawaii.edu/
Tutoriales:
http://gmt.soest.hawaii.edu/doc/5.1.0/Gallery.html
Qu es GMT?
El GMT es un programa gratuito y de
cdigo abierto para generar imgenes a
partir de un conjunto de datos
geogrficos y cartesianas.
Qu es GMT?
Funciona en plataformas de: Windows,
Mac y Linux.
Lenguaje de programacin: GMT/fortran,
GMT/Python y GMT/Matlab,
Instalacin
A) Versiones recientes de Ubuntu/Debian ya vienen con repositorios de GMT
gmt
B) https://www.soest.hawaii.edu/gmt/gmt/gmt_install_form.html
gedit .bashrc
#GMT
export GMTHOME=/xxx/xxx/xxxx
export PATH=$PATH:$GMTHOME/bin
source .bashrc
Parmetros de formato (GMT defaults)
#!/bin/bash
# COMENTARIOS
#VARIABLES
gmtset.......
GMTSET: define el aspecto general del
mapa, por ejemplo, tamao de la hoja,
unidades, etc.
Lneas de comando
gmtset ANOT_FONT 2 ANOT_FONT_SIZE 16
gmtset PAPER_MEDIA A4
gmtset PAGE_ORIENTATION portrait
Script GMT
psbasemap
psbasemap -R-85/-65/-20/0 -JM15c -Ba5g2 -Xc -Yc -V > map.ps
-R-85/-65/-20/0: -Rmin.lon./max.lon/min.lat./max.lat
-JM15c: Proyeccin y tamao del mapa. -JM es
Mercator y 15c es el ancho total del mapa en cm.
-Ba5g2: Etiquetado en los ejes del mapa cada 5
grados de Lat. y Lon. y dibuja el grillado (celdas)
cada 2 grados.
-Xc -Yc: Ubicacin de la figura en el papel.
-V: Muestra los errores generados durante la
ejecucin del script.
> map.ps: Salida del archivo (postscript).
Proyeccin -J
Script GMT
pscoast
pscoast -R-85/-65/-20/0 -JM15c -Ba5g2 -Dh -N1 -W1,brown
-G245/245/200 -S140/235/255 -Xc -Yc -V -P > map.ps
-Dh: Define la resolucin.
-N: Muestra los lmites de frontera de
pases, departamentos y martimas.
-W1,brown: Ancho y color de las lneas de
costa.
-G245/245/200: Define el color (tierra) de
los continentes.
-S140/235/255: Define el color (agua)
de los ocanos, ros y lagos.
-P: Orientacin de pgina de la figura
Prcticas
Mapa Ssmico
S1a_Plot_Sismos_Peru.gmt
S1b_Plot_Sismos_Peru_Color_Bar.gmt
Perfil Ssmico
S2_Perfil_Sismico.gmt
Mapa Topogrfico
S3_Mapa_Topografico.gmt
Mapa de Mecanismos Focales
S4_Mecanismos_Focales.gmt
Script 1: Mapa Ssmico
psxy
#!/bin/bash
#Scrip para generar mapa con distribucin de sismos
#Autor: C. Condori
#Ciencias de la Tierra Slida CTS
gmtset MEASURE_UNIT cm
gmtset ANOT_FONT_SIZE 10
gmtset LABEL_FONT_SIZE 10
gmtset HEADER_FONT_SIZE 10
gmtset TICK_LENGTH 0.1
gmtset FRAME_PEN 3.25
gmtset BASEMAP_TYPE FANCY
gmtset WANT_EURO_FONT TRUE
gmtset PLOT_DEGREE_FORMAT -D
gmtset DOTS_PR_INCH 300
gmtset PAGE_ORIENTATION landscape
name=Mapa_Sismico_del_Peru2
titulo="MAPA SSMICO DEL PER"
fig=$name.ps
Rplot=-R/-84/-68/-20/00
psbasemap $Rplot -JM15.5 -Ba2f2WSen:".$titulo": -P -Xc -Yc -V
-K > $fig
pscoast -R -J -Dh -W1p,black -N1/1p,black -Slightblue
-Glightbrown -A20 -Tf-70/-2/1/2 -Lf-75.0/-19/-20.00/300 -V -O -K
-P >> $fig
Script 1: Mapa Ssmico
psxy
#Departamentos Per
awk '{print $1, $2}' deptos.dat | psxy -R -J -M -W0.1p,black,_ -O
-P -K >> $fig
#Fosa, Dorsal de Nazca y Fractura de Mendaa
psxy Fosa.gmt -R -J -M -Sf0.8c/0.15clt:0.8c -W2/255/255/255
-G255/255/255 -V -O -P -K >> $fig
psxy Mendana.gmt -R -J -M -W1p,white,_ -O -K >> $fig
psxy Nazca.gmt -R -J -M -W1p,white,_ -O -K >> $fig
#plotear sismos
cat Catalogo_NEIC-1906_2016.txt | awk '{if ($5 <= 60) print
$4,$3,$6*0.03,$5 }' > superficiales.gmt
psxy superficiales.gmt -R -J -Sc -W0.01 -G255/0/0 -W0.01 -V -O
-K >> $fig
cat Catalogo_NEIC-1906_2016.txt | awk '{if ($5>=60.1 &&
$5<=300) print $4,$3,$6*0.03,$5}' > intermedios.gmt
psxy intermedios.gmt -R -J -Sc -W0.01 -G0/255/0 -W0.01 -V -O -K
>> $fig
cat Catalogo_NEIC-1906_2016.txt | awk '{if ($5 >= 300.1) print
$4,$3,$6*0.03,$5 }' > profundos.gmt
psxy profundos.gmt -R -J -Sc -W0.01 -G0/0/255 -W0.01 -V -O -K
>> $fig
Script 1: Mapa Ssmico
psxy
#Leyenda
# G is vertical gap, V is vertical line, N sets # of columns,
D draws horizontal line.
# H is header, L is label, S is symbol, T is paragraph text,
M is map scale.
pslegend <<END -Dx2.7/0/2.5/4.0/RB -J -R -F
-Glightyellow -O >> $fig
G 0.2c
H 10 1 Magnitud
G 0.2
N1
S 0.35c c 0.12c red 0.4p 0.3i 4.0
G 0.1
S 0.35c c 0.15c red 0.4p 0.3i 5.0
G 0.1
S 0.35c c 0.18c red 0.4p 0.3i 6.0
G 0.1
S 0.35c c 0.21c red 0.4p 0.3i 7.0
G 0.1
S 0.35c c 0.24c red 0.4p 0.3i 8.0
G 0.1
END
# Muestra la Figura
Script 1: Mapa Ssmico
psxy
#plotear sismos
cat Catalogo_NEIC-1906_2016.txt | awk
'{ print $4,$3,$5*-1,$6 }' > tmp.txt
makecpt -T-700/0/5 -Z -Crainbow >
depth.cpt
psxy tmp.txt -R -J -Sc0.2c -W3
-Cdepth.cpt -V -O -K >> $fig
psscale -Cdepth.cpt -D6.5i/3.3i/4i/0.25iv
-Ba50:"Profundidad (Km)": -V -O >> $fig
Script 2: Perfil Ssmico
pscoupe
Script 2: Perfil Ssmico
#Puntos iniciales del perfil
project -C-80.73/-10.3 -E-65.84/-7.20 -G.5 -Dd -Q > track4
#extrae valores de la tomopgrafia
grdtrack track4 -GETOPO1_Bed_g_gmt4.grd | awk '{print $3, $4 }' > track4.d
#grafica el pefil de la topografia
psxy -R0/1400/-7000/5500 -JX5.3i/0.5i track4.d -W1p -X5 -Y8
-Ba0f0:,km:/a2000f1000:.Profile_AA::Elevation::,:Wne -K -V > profile_D.ps
#Texto
echo -40 8000 16 0 0 5 SW | pstext -R -JX -V -N -O -K >> profile_D.ps
echo 1400 8000 16 0 0 5 NE | pstext -R -JX -V -N -O -K >> profile_D.ps
#Perfil de Sismos
awk '{print $1, $2, $4*-1}' superficiales.gmt | pscoupe -JX5.3i/2i -R0/1400/-700/0 -N
-Ba100f50:"Distance"::,:/a100f50:"Depth"::,:WSne -Aa-80.73/-10.3/-65.84/-7.20/90/100/0/-60 -sc0.1
-Gred -L1 -X0.0 -Y-5.1 -P -O -K >> profile_D.ps
awk '{print $1, $2, $4*-1}' intermedios.gmt | pscoupe -R -JX -N -Aa-80.73/-10.3/-65.84/7.20/90/100/0/-300 -sc0.1 -Ggreen -L1 -P -O -K >> profile_D.ps
awk '{print $1, $2, $4*-1}' profundos.gmt | pscoupe -R -JX -N -Aa-80.73/-10.3/-65.84/7.20/90/100/0/-700 -sc0.1 -Gblue -L1 -P -O >> profile_D.ps
rm Aa-*
ps2pdf profile_D.ps
gv profile_D.ps
Script 3: Mapa Topogrfico
grdimage
CPT color para topografa y batimetra
http://soliton.vm.bytemark.co.uk/pub/cpt-city/
grdgradient ETOPO1_Bed_g_gmt4.grd -A305
-GSAmshadow.grd -Nt -V
grdimage ETOPO1_Bed_g_gmt4.grd $Rplot -JM17c
-Ba2f2WSen -Celevation.cpt -K -P > $fig
grdview -R -J ETOPO1_Bed_g_gmt4.grd -B02hg04h
-Jz0.0005c -E180/090 -Qi250 -Celevation.cpt
-ISAmshadow.grd -P -V -K >> $fig
psscale -Celevation.cpt -D8/-1/10/0.5h -B2000/:METROS: -O
-P -K >> $fig
pscoast -R -J -Dh -W1/0/0/255 -N1/0.03c -W0.03c/0/0/0 -A20
-O -Tf-70/-2/1/2 -Lf-70.0/-19.5/-20.00/300 -P -V >> $fig
# Muestra la Figura
gv $fig
Script 4: Mecanismos Focales
psmeca
http://www.globalcmt.org/CMTsearch.html
#plotear mecanismos focales
psmeca mecaperu.txt -V -O -R -JM -W1 -L -Gred
-D000/60 -Sd.60/-1/0 -K >> $fig
psmeca mecaperu.txt -V -O -R -JM -W1 -L -Ggreen
-D60.1/300 -Sd.60/-1/0 -K >> $fig
psmeca mecaperu.txt -V -O -R -JM -W1 -L -Gblue
-D300.1/700 -Sd.60/-1/0 >> $fig
# Muestra la Figura
gv $fig
ps2pdf Mapa_Meca_Peru.ps