Note that you DO have to work on LuNGS
today!
Log into LuNGS and run
$>gmtswitch
and then pick item 4, gmt-6.0.2. Confirm that ~/this_gmt
points to the correct directory:
$>ls -lisa ~/this_gmt
We've been dealing a lot with data that, given the nature of this course, has some geospatial meaning. Therefore, it is important to be able to create maps that present the data in space; maybe spiced up with some auxiliary information such as topography, coastlines, national and international boundaries, rivers and so forth. Ideally, these maps would also be aesthetically pleasing and of high enough quality to be used in publications, on posters, slides, etc.
GMT or the Generic Mapping Tools fit the bill. In fact, it does all of the above and provides a range of tools for data processing. From their website:
"Whether Cartesian, geographic, or time-series, GMT can process your data. GMT enables you to explore new ways to analyze data and to build custom displays for drafts, publications, or final presentations. GMT allows unlimited customization via scripting in several languages."
Now here's the deal: GMT is a collection of many
programs / modules that all do certain jobs. You will have to spend a lot of time
working with the man-pages (e.g, $> man gmt
) and/or the
online documentation. This lab is
an attempt to introduce you to the concept of working with GMT; we won't even
get past scratching the surface of GMT's abilities. Consider achieving mastery
of GMT a lifelong journey - there's always some new stuff to learn! Here's an
overview of the existing modules: https://docs.generic-mapping-tools.org/latest/modules.html. You can also access
a list by running:
$>gmt --help
The way this will work is that I'll build an example that you will follow along.
Let's get our feet wet! Download and run this script.
You will see a pretty pixelated map. GMT allows for on the fly downloads of DEMs.
Go to the grdimage
documentation and swap out @earth_relief_01m
for
the highest resolution DEM you can find on the list. Run it again.
Ah! Somewhat better. Now add -I+d
to end of the grdimage call. What does this do (check the documentation!)?
Run it! ... nice! Now decrease the resolution 1 step so that this all runs a bit faster for development. Maybe change the gray colormap for something more colorful?
Some more info on the used arguments:
-R-168.5/-167.75/53.2/53.6 The map region is between -168.5 West, -167.75 East, 53.2 South and 53.6 to the North. Order is obviously important! -JL-168.175/53.4/53.3/53.5/6i Select a Lambert projection, centered on longitude -168.175 and latitude 53.4 and make it 6 inches wide -B Show map boundary -BWSne Only label the west and the southern boundaries -Cgray Use a grayscale colormap.
I don't like the fuzzy bathymetry here and rather not show it as is will distract from the main contents. Let's add a coastline and make the water some color! Add the following line after grdimage:
gmt coast -Swhite -Df -W5p
-Swhite Make the wet areas white -Df Use full resolution quality coastline -W5p make the thickness of the coastline 0.25 points
White and such a thick line are probably not good choices - pick something else!
There are GPS stations on Okmok volcano. Download this file and add them with:
gmt plot okmok.sites -Sc1c -Gblack
-Sc1c Plot circle symbols of 1 cm diameter -Gblack fill the circles black
Maybe a bit large? Change the symbol to triangles and make them smaller (check the plot documentation).
I would like to see these also annotated, so we know the station names:
awk '{print $1,$2,"-"$4}' okmok.sites | gmt text -F+jML+f8p,Helvetica,black
The names are in okmok.sites, the awk
command just reformats things a bit
and pipes the result into gmt text
. The -F
justifies the text to be
vertically in the middle and to the left of the coordinate origin ML
and then
we pick an 8 point font that's called Helvetica and make it black. Change the font parameters to make the names better visible. Check the documentation.
This is pretty nice. Let's plot some velocities on top. I calculated (using CATS) the station velocities from 05/01/2018 to 11/01/2018 and provide them in these files okmok.hori.vels and okmok.vert.vels. Download them and add these commands:
gmt velo okmok.hori.vels -Se.04/0.95 -W0.5p,red -A+p2p+e+gred gmt velo okmok.vert.vels -Se.04/0.95 -W0.5p,black -A+p2p+et+gblack
Play with the numbers to figure out what each of them do, and/or read the documentation. Only tell
me what -Se
does. Feel free to change colors.
We do want to know what the scale of these things is. A simple recipe to add a scalebar is:
gmt velo -Se.04/0.95+f8p,Helvetica,black -W0.5p,red -A+p2p+e+gred <<EOF -167.9 53.225 50 0 5 5 0 50+/-5 mm/yr EOF
What's happening here is that we locate a vector of known length (50) and uncertainty (5) in a
known location and add a label to it. It is instrumental that the -Se
parameters are the
same. If we scale this vector differently, the whole exercise is pointless.
That's it - or you can keep playing! Welcome to GMT 6.0!
At the end set the earth relief resolution to highest again.
okmok.gmt
and resulting okmok.pdf
rg <at> nmt <dot> edu | Last modified: December 04 2019 22:45.