Академический Документы
Профессиональный Документы
Культура Документы
T
0
2
4
6
8
10
l
o
g
1
0
(a) (b)
(c) (d) (e)
Text, labels, legend placement
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 129 / 177
GMT Generalities
PostScript Plotting - Base maps with coastlines, rivers,
and borders
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 130 / 177
GMT Generalities
Is your GMT installed ?
Tape in the terminal
pscoast
Path conguration - add to your /.bashrc
#gmt variables
export NETCDFHOME=/usr/lib
export GMTHOME=/usr/lib/gmt
export PATH=$PATH:$GMTHOME/bin
source .bashrc
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 131 / 177
GMT Generalities
Figure Plotting
18 commands for plotting
psxy, psxyz, psbasemap, pscoast, pstext,
cmd [options] > mygure.ps
tape cmd for help
Layering - calling several commands
cmd1 -K > mygure.ps
cmd2 -O -K mygure.ps
cmd3 -O -K mygure.ps
cmd4 -O mygure.ps
K: continue (keep)
O: overlay
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 132 / 177
GMT Generalities
GMT cake
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 133 / 177
GMT Generalities
Plotting - continuation
Usual compulsory parameters
-R Region Rw/e/s/n
-J proJection linear/logarithmic, polar, cylindrical, Mollweide,
-B Bound. annot.
pscoast -R-180/180/-89/89 -JW20c -Gblack -P > test.ps
pscoast -R-180/180/-89/89 -JW20c -Gblack -Bg30/g15 -P > test.ps
Useful trick
R=` minmax -I0.01/0.01 `
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 134 / 177
GMT Generalities
Conguration les
general: /path/to/gmt/gmtdefaults
personal: /.gmtdefaults
gmtdefaults [-D | -L]
changing a parameter: gmtset (e.g. gmtset PAPER MEDIA A4+)
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 135 / 177
GMT Generalities
Plotting - nishing
Convert ps le to something more useful
ps2raster mygure.ps (convertion to jpg)
ps2raster -Tf mygure.ps (convertion to pdf)
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 136 / 177
GMT Sismicity map
Creation de cartes et de gures : GMT
4
Creation de cartes et de gures : GMT
Generalities
Sismicity map
Histogram
Seaoor age
Oceanic heat ux
Hawaiian ridge
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 137 / 177
GMT Sismicity map
Seismicity the last 7 days
Get your data - USGS
wget http://neic.usgs.gov/neis/gis/bulletin.asc -O
quakes.dat
use minmax
Create your executable script
Start editing
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 138 / 177
GMT Sismicity map
Seismicity the last 7 days
Get ready - denitions
Tell that we are going to use bash
#!/bin/bash
Set GMT parameters
input="quakes.dat"
psfile="map seismicity.ps"
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 139 / 177
GMT Sismicity map
Seismicity the last 7 days
First step - plot world map with continents: use pscoast
Choose your projection: -Jx0.1cd
man awk
psxy -R -J -Gred -Wthin -Sc -O -K $psle
Range -Rxmin/xmax/ymin/ymax
ProJection -JX20c/10c
Boundary -Ba1g1:"Magnitude":/a10f5:"Nb of
earthquaques":WSne
-Ggray -Lthin -P
Alltogether
awk -F, IF NR>1 {print $?}$inputdata pshistogram
-Ba1g1:Magnitude:/a10f5:Nb of earthquaques:WSne -R?/?/?/? -JX20c/10c
-Ggray -Lthin -W? -P > $psle
Dont forget to replace question marks !
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 146 / 177
GMT Seaoor age
Creation de cartes et de gures : GMT
4
Creation de cartes et de gures : GMT
Generalities
Sismicity map
Histogram
Seaoor age
Oceanic heat ux
Hawaiian ridge
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 147 / 177
GMT Seaoor age
Seaoor age map
0 20 40 60 80 100 120 140 160 180 200 220 240 260
Seafloor Age [my]
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 148 / 177
GMT Seaoor age
Seaoor age map
Get your data from EarthByte
use wget or click strategy
http://www.earthbyte.org/Resources/agegrid2008.html
unzip your le
bunzip2
bzip2 -d
Start editing
General rules to keep in mind when writing a script
hash tag #
dene variables
#!/bin/bash -e
input="myinputfile.xyz.coarse"
xyz2grd
Reading a grdle and making a color palette le
grd2cpt
Creating colored image from a 2-D grd le
grdimage
Plotting land-masses, water-masses, coastlines, borders, and rivers
pscoast
Creating colorscale for your map
psscale
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 152 / 177
GMT Seaoor age
Seaoor age map
xyz2grd
Mandatory parameters
-O - Overlay
-O - Overlay
All must be redirected to PostScript le
Its the last step no -K option !
psscale -D10c/-0.5c/20c/0.2ch -B20:Seaoor Age [my]: -Cage.cpt -O $psle
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 157 / 177
GMT Seaoor age
Seaoor age map - Finishing
Converting your PostScript le into a pdf le
ps2raster -A -Tf $psle
Tell the world that your map was created
echo $psle created
Cleaning
rm -f *.ps
Run your script
./make map seaoorage.sh
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 158 / 177
GMT Seaoor age
Seaoor age map - coarse data
0 20 40 60 80 100 120 140 160 180 200 220 240 260 280
Seafloor Age [my]
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 159 / 177
GMT Seaoor age
Seaoor age map - full data cover
0 20 40 60 80 100 120 140 160 180 200 220 240 260
Seafloor Age [my]
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 160 / 177
GMT Oceanic heat ux
Creation de cartes et de gures : GMT
4
Creation de cartes et de gures : GMT
Generalities
Sismicity map
Histogram
Seaoor age
Oceanic heat ux
Hawaiian ridge
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 161 / 177
GMT Oceanic heat ux
Oceanic heat ow
Lets compute and plot the oceanic heat ow
The heat ux q
q =
490
grdmath
Use a color palette le
Will be downloaded
Creating colored image from a 2-D grd le
grdimage
Plotting land-masses, water-masses, coastlines, borders, and rivers
pscoast
Creating colorscale for your map
psscale
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 163 / 177
GMT Oceanic heat ux
Lets start
Create your executable script
Start editing
Tell that we are going to use bash
#!/bin/bash -e
Set GMT parameters
a
= 490
1
a
Division
1 age.grd DIV
Square root
SQRT
Multiplication
490 MUL
Is equal to your new grd le
= flux.grd
grdmath 1 age.grd DIV SQRT 490 MUL = ux.grd
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 165 / 177
GMT Oceanic heat ux
Oceanic heat ow
Download a color palette le - ux.cpt
wget goo.gl/CpvN4
grdimage ux.grd -R-180/180/-90/90 -JW20c -Cux.cpt -Ya3c -P -K
> $psle
pscoast -R -J -Bg30/g15 -Dc -Gblack -P -O -K $psle
psscale -D10c/-0.5c/20c/0.2ch -C -L -B:Heat ux [mW
m@+-2@+]: -Cux.cpt -O $psle
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 166 / 177
GMT Oceanic heat ux
Oceanic heat ow - Finishing
Convert to pdf
ps2raster -Tf $psle
Tell the world that your map was created
echo map $psle created
Run your script and look at results
./make hf.sh
evince map heat ux.pdf
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 167 / 177
GMT Oceanic heat ux
Oceanic heat ow
47 60 80 100 120 140 220 320 5000
Heat flux [mW m
2
]
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 168 / 177
GMT Hawaiian ridge
Creation de cartes et de gures : GMT
4
Creation de cartes et de gures : GMT
Generalities
Sismicity map
Histogram
Seaoor age
Oceanic heat ux
Hawaiian ridge
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 169 / 177
GMT Hawaiian ridge
3D mesh plot of Hawaiian topography - GMT example
Making complicated images
with GMT - Lets plot 2 layer
perspective plot
1
6
4
1
6
2
1
6
0
1
5
8
1
5
6
1
5
4
1
5
2
1
5
0
1
8
2
0
2
2
2
4
2
0
2
4
T
o
p
o
(
k
m
)
Hawaiian Ridge
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 170 / 177
GMT Hawaiian ridge
Hawaiian ridge - Step by step
Show contours of the geoid
grdcontour
Show Hawaiian islads
pscoast
Show topography in 3D
grdview
Add title for your gure
pstext
0
0
4
4
4
8
8
12
1
2
1
6
4
1
6
2
1
6
0
1
5
8
1
5
6
1
5
4
1
5
2
1
5
0
1
8
2
0
2
2
2
4
2
0
2
4
T
o
p
o
(
k
m
)
Hawaiian Ridge
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 171 / 177
GMT Hawaiian ridge
Lets start
Get your data and extract them
wget http://goo.gl/aq1ne
#!/bin/bash -e
psfile="map topo.ps"
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 172 / 177
GMT Hawaiian ridge
Hawaiian ridge
grdcontour
Mandatory parameters
grdle
-K - Keep open
All must be redirected to PostScript le
grdcontour HI geoid4.nc -Jm1c -E60/30 -R195/210/18/25 -C1 -A4 -G10c
-K -P -X2.5c -Y2.5c > $psle
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 173 / 177
GMT Hawaiian ridge
Hawaiian ridge
pscoast - Plot Hawaiian islands
You already know . . .
Dont forget to set your viewpoint
Add a north-pointing map rose
-T-151/19.5/2.5c
pscoast -J -R -E60/30 -B2/2NEsw -Gblack -O -K -T-151/19.5/2.5c $psle
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 174 / 177
GMT Hawaiian ridge
Hawaiian ridge
grdview - Plot topography
Mandatory parameters
topole
-J - Projection
1
6
4
1
6
2
1
6
0
1
5
8
1
5
6
1
5
4
1
5
2
1
5
0
1
8
2
0
2
2
2
4
2
0
2
4
T
o
p
o
(
k
m
)
Hawaiian Ridge
M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne 2011 177 / 177