(1) Contour mapsΒΆ

We want to create two contour maps of the low order geoid using the Hammer equal area projection. Our gridded data file is called osu91a1f_16.nc and contains a global 1 by 1 gridded geoid (we will see how to make gridded files later). We would like to show one map centered on Greenwich and one centered on the dateline. Positive contours should be drawn with a solid pen and negative contours with a dashed pen. Annotations should occur for every 50 m contour level, and both contour maps should show the continents in light brown in the background. This is how it is done:

#!/usr/bin/env bash
#		GMT EXAMPLE 01
#
# Purpose:	Make two contour maps based on the data in the file osu91a1f_16.nc
# GMT modules:	set, subplot, grdcontour, coast
#
gmt begin ex01
	gmt set MAP_GRID_CROSS_SIZE_PRIMARY 0 FONT_ANNOT_PRIMARY 10p
	gmt subplot begin 2x1 -A -M0.5c -Blrtb -Bafg -T"Low Order Geoid" -Fs16c/0 -Rg -JH16c
		gmt coast -JH? -Glightbrown -Slightblue -c0,0
		gmt grdcontour @osu91a1f_16.nc -C10 -A50+f7p -Gd10c -Ln -Wcthinnest,- -Wathin,- -T+d8p/2p+l
		gmt grdcontour @osu91a1f_16.nc -C10 -A50+f7p -Gd10c -LP -T+d8p/2p+l

		gmt coast -JH0/? -Glightbrown -Slightblue -c1,0
		gmt grdcontour @osu91a1f_16.nc -C10 -A50+f7p -Gd10c -Ln -Wcthinnest,- -Wathin,- -T+d8p/2p
		gmt grdcontour @osu91a1f_16.nc -C10 -A50+f7p -Gd10c -LP -T+d8p/2p
	gmt subplot end
gmt end show

The first command sets up a 2 by 1 subplot layout. The subplot determines the size of what map can fit so we use ? when specifying map widths in the commands below. This initial setup is followed by two sequences of coast, grdcontour, grdcontour. They differ in that the first is centered on Greenwich; the second on the dateline. We use the limit option (-L) in grdcontour to select negative contours only and plot those with a dashed pen, then positive contours only and draw with a solid pen [Default]. The -T option causes tick marks pointing in the downhill direction to be drawn on the innermost, closed contours. For the upper panel we also added - and + to the local lows and highs. The labeling of the two plots with a) and b) is automatically done by subplot. You can find this illustration as

../_images/ex01.png

Contour maps of gridded data.