gmt tutorial 2012 - earth &...

15
GMT Tutorial 2012 Sebastian Rost

Upload: others

Post on 27-Jul-2020

16 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: GMT Tutorial 2012 - Earth & Environmenthomepages.see.leeds.ac.uk/.../Lecture_files/GMT/GMT... · The general GMT command structure is: gmt_command (options) > outputfile-Rwest/east/south/north

GMT Tutorial2012

Sebastian Rost

Page 2: GMT Tutorial 2012 - Earth & Environmenthomepages.see.leeds.ac.uk/.../Lecture_files/GMT/GMT... · The general GMT command structure is: gmt_command (options) > outputfile-Rwest/east/south/north

Setup to run GMT

Please check if your ~/.cshrc file contains the following line:

# for GMT4.1set path = ( $path /nfs/see-fs-01_app1/GMT4.1/bin )‏

You can do this by opening this by opening this file using your favourite editor. E.g.:

(earsro-see-gw-01.leeds.ac.uk)37% nedit ~/.cshrc

If you made any changes to your ~/.cshrc file you have to reread it, so that thecomputer knows about the changes. This takes only affect in the current konsolewhere you type the source command.

(earsro-see-gw-01.leeds.ac.uk)38% source ~/.cshrc

Page 3: GMT Tutorial 2012 - Earth & Environmenthomepages.see.leeds.ac.uk/.../Lecture_files/GMT/GMT... · The general GMT command structure is: gmt_command (options) > outputfile-Rwest/east/south/north

Global Seafloor Topography from Satellite Altimetry:

http://www.ngdc.noaa.gov/mgg/image/seafloor.html

Page 4: GMT Tutorial 2012 - Earth & Environmenthomepages.see.leeds.ac.uk/.../Lecture_files/GMT/GMT... · The general GMT command structure is: gmt_command (options) > outputfile-Rwest/east/south/north

DIGITAL GLOBEs (from UC San Diego):

http://topex.ucsd.edu/marine_topo/globe.html

Page 5: GMT Tutorial 2012 - Earth & Environmenthomepages.see.leeds.ac.uk/.../Lecture_files/GMT/GMT... · The general GMT command structure is: gmt_command (options) > outputfile-Rwest/east/south/north

Getting help

(1) DON'T ASK ME

(2) man gmtcommand (e.g. psxy)‏

(3) GMT home-pagehttp://gmt.soest.hawaii.edu/

Page 6: GMT Tutorial 2012 - Earth & Environmenthomepages.see.leeds.ac.uk/.../Lecture_files/GMT/GMT... · The general GMT command structure is: gmt_command (options) > outputfile-Rwest/east/south/north

Please copy the scripts for this tutorial from my webpage

http://homepages.see.leeds.ac.uk/~earsro/gmt_tutorial.html

and the contents of ~earsro/GMT_Tutorial/data to a directory inyour home directory:

(earsro-see-gw-01.leeds.ac.uk)39% cd

(earsro-see-gw-01.leeds.ac.uk)40% cp -r ~earsro/GMT_Tutorial/data .

Page 7: GMT Tutorial 2012 - Earth & Environmenthomepages.see.leeds.ac.uk/.../Lecture_files/GMT/GMT... · The general GMT command structure is: gmt_command (options) > outputfile-Rwest/east/south/north

map_basic.csh

#!/bin/cshpscoast -R-180/180/-70/70 –JM0/14/7 -Ba60g30f15/a30g30f15WSen \-X0.5 -Y2.0 -Dc -S100/100/200 -G100/205/100 -W1/0/255/0 \-P -K >! map1.ps

awk '{print $7,$6}' < data/world_EQ.dat >! eq.xy

psxy eq.xy -R -JM -Sc0.075i -G255/0/0 -W2 -O >> map1.ps

gs -sDEVICE=x11 map1.ps

Page 8: GMT Tutorial 2012 - Earth & Environmenthomepages.see.leeds.ac.uk/.../Lecture_files/GMT/GMT... · The general GMT command structure is: gmt_command (options) > outputfile-Rwest/east/south/north

The general GMT command structure is:

gmt_command (options) > outputfile

-Rwest/east/south/north specifies the region of interest-Jparameters selects the map projection-Btickinfo specifies the tick marks on the map-X shifts plot in X direction-Y shifts plot in Y direction-Dresolution defines the map resolution-Sfill sets painting of 'wet' areas-Gfill set painting of 'dry' areas-Wpen defines which pen to use for drawing-P selects portrait mode (default landscape)‏-O tells GMT to add output to the same plot-K tells GMT that more PS is koming

Page 9: GMT Tutorial 2012 - Earth & Environmenthomepages.see.leeds.ac.uk/.../Lecture_files/GMT/GMT... · The general GMT command structure is: gmt_command (options) > outputfile-Rwest/east/south/north

Adding lines

psxy -R -JX -G255/0/0 -W3/255/255/0 \-L -O -K << END >> $outfile-12.0 49.03.0 49.0 3.0 59.0

-12.0 59.0END

Page 10: GMT Tutorial 2012 - Earth & Environmenthomepages.see.leeds.ac.uk/.../Lecture_files/GMT/GMT... · The general GMT command structure is: gmt_command (options) > outputfile-Rwest/east/south/north

Adding text to GMT

pstext -R -JM -N -G0/0/255 -D-0.5/0 -O << stopit >> $outfile-19 50 20 90 4 CM Latitude5 26 20 0 4 CM Longitude 5 67 10 0 4 CM Groovy Map

stopit

There are 3 lines of text instruction, and they are of the format:x y s a f j text stringwhere

x = x location of the text stringy = y location of the text strings = size of text in pointsa = angle of text, in degrees counter clock wisef = font number (type in a terminal window "pstext -L" to see the font options)j = justification (BL = bottom left, TR= top right, CM=center middle, etc)text string = the text to be displayed.

Page 11: GMT Tutorial 2012 - Earth & Environmenthomepages.see.leeds.ac.uk/.../Lecture_files/GMT/GMT... · The general GMT command structure is: gmt_command (options) > outputfile-Rwest/east/south/north

Adding more information

Making colorscales

makecpt -Crainbow -T0/700/50 -Z >! color.cpt# cpt file created by: makecpt -Crainbow -T0/700/50 -Z#COLOR_MODEL = RGB#0 255 0 255 50 164 0 25550 164 0 255 100 73 0 255100 73 0 255 150 0 18 255150 0 18 255 200 0 109 255200 0 109 255 250 0 201 255250 0 201 255 300 0 255 219300 0 255 219 350 0 255 127350 0 255 127 400 0 255 36400 0 255 36 450 54 255 0450 54 255 0 500 146 255 0500 146 255 0 550 237 255 0550 237 255 0 600 255 182 0600 255 182 0 650 255 91 0650 255 91 0 700 255 0 0B 0 0 0F 255 255 255N 128 128 128

Page 12: GMT Tutorial 2012 - Earth & Environmenthomepages.see.leeds.ac.uk/.../Lecture_files/GMT/GMT... · The general GMT command structure is: gmt_command (options) > outputfile-Rwest/east/south/north

The color scale will be written to the file color.cpt and can then be used tocolor the depth of the earthquakes:

awk '{print $7,$6,$8}' < data/world_EQ.dat >! eq.xy

psxy eq.xy -R -JM -Sc0.075i -Ccolor.cpt -W2 -O >> map1.ps

Page 13: GMT Tutorial 2012 - Earth & Environmenthomepages.see.leeds.ac.uk/.../Lecture_files/GMT/GMT... · The general GMT command structure is: gmt_command (options) > outputfile-Rwest/east/south/north

Multiple Plots

#! /bin/cshset output = globe.ps#-------------------------------------------------------------# run the GMT program "pscoast" to make coastlines, and do it # on a globe and let's center it on lat=-10.5 lon=-81 deg, and # the size: R=1.0 inch.#-------------------------------------------------------------

pscoast -R0/360/-90/90 -Jg-80/-10/1.8/0 -G60/210/160 \-S225/250/225 -Dc -Bg30 -W3/0/0/0 -Y8.0 -P >! $output#--------------------------------------------------------------# run ghostscript to plot our postscript output file#-------------------------------------------------------------

gs -sDEVICE=x11 $output

Orthographic Projection -Jg

Page 14: GMT Tutorial 2012 - Earth & Environmenthomepages.see.leeds.ac.uk/.../Lecture_files/GMT/GMT... · The general GMT command structure is: gmt_command (options) > outputfile-Rwest/east/south/north

Adding the new plot

#-------------------------------------------------------------# NEW PLOT!!!!# run pscoast to make the zoom cartesian map, off to the # lower right#-------------------------------------------------------------

pscoast -R-100/-60/-10/20 –JM0/14/7 -G60/210/160 -Dc \-Ba10f10g10WSen -W4/0/0/100 -O -X2.0 -Y-2.0 >> $output

Page 15: GMT Tutorial 2012 - Earth & Environmenthomepages.see.leeds.ac.uk/.../Lecture_files/GMT/GMT... · The general GMT command structure is: gmt_command (options) > outputfile-Rwest/east/south/north

#!/bin/csh# FILE: c.contour0# Purpose: Make a contour map based on the data in the file # osu91a1f_16.grd# GMT progs: pscoast, grdcontour## this is a stripped down version of the GMT example 1 on # the web

# define the output filenameset outfile = contour0.ps

# plot the coast, color the land (-G) w/ light graypscoast -R-180/180/-90/90 -JH0/6i -X1.25i -Y5.5i -Bg30 \-Dc -G200 -P -K >!$outfile

# contour the geoid data set. The -C flag is for contour # intervalgrdcontour data/osu91a1f_16.grd -R -JH -C10 -O >> $outfile

# plot the output filegs -sDEVICE=x11 $outfile

Contouring