(4) A 3-D perspective mesh plot

This example will illustrate how to make a fairly complicated composite figure. We need a subset of the ETOPO5 bathymetry [1] and Geosat geoid data sets which we have extracted from the global data grids using grdcut and access those files here as remote files on the GMT data server. We would like to show a 2-layer perspective plot where layer one shows a contour map of the marine geoid with the location of the Hawaiian islands superposed, and a second layer showing the 3-D mesh plot of the topography. We also add an arrow pointing north and some text. The first part of this script shows how to do it:

#!/usr/bin/env bash
#		GMT EXAMPLE 04
#
# Purpose:	3-D mesh and color plot of Hawaiian topography and geoid
# GMT modules:	grdcontour, grdimage, grdview, basemap, coast, text, makecpt
# Unix progs:	echo, rm
#
gmt begin
	gmt figure ex04
	gmt makecpt -C255,100 -T-10/10/10 -N
	gmt grdcontour @HI_geoid_04.nc -R195/210/18/25 -Jm1c -p60/30 -C1 -A5+o -Gd10c
	gmt coast -p -B2 -BNEsw -Gblack -TdjBR+o0.3c+w3c+l
	gmt grdview @HI_topo_04.nc -R195/210/18/25/-6/4 -Jz0.8c -p -C -N-6+glightgray -Qsm -B2 -Bz2+l"Topo (km)" \
		-BneswZ+t"H@#awaiian@# R@#idge@#" -Y5c --FONT_TITLE=50p,ZapfChancery-MediumItalic --MAP_TITLE_OFFSET=-3.5c

	gmt figure ex04c
	gmt grdimage @HI_geoid_04.nc -I+a0+nt0.75 -R195/210/18/25 -JM15c -p60/30 -C@geoid_04.cpt
	gmt coast -p -B2 -BNEsw -Gblack
	gmt basemap -p -TdjBR+o0.3c+w3c+l --COLOR_BACKGROUND=red --FONT=red --MAP_TICK_PEN_PRIMARY=thinner,red
	gmt colorbar -p240/30 -DJBC+o0/1c+w13c/0.75c+h -C@geoid_04.cpt -I -Bx2+l"Geoid (m)"
	gmt grdview @HI_topo_04.nc -I+a0+nt0.75 -R195/210/18/25/-6/4 -JZ8c -p60/30 -C@topo_04.cpt \
		-N-6+glightgray -Qc100 -B2 -Bz2+l"Topo (km)" -Y5c -BneswZ+t"H@#awaiian@# R@#idge@#" \
		--FONT_TITLE=50p,ZapfChancery-MediumItalic --MAP_TITLE_OFFSET=-3.5c
gmt end show

The purpose of the CPT zero.cpt is to have the positive topography mesh painted light gray (the remainder is white). The left side of Figure shows the complete illustration.

../_images/ex04.png

3-D perspective mesh plot (left) and colored version (right).

The second part of the script shows how to make the color version of this figure that was printed in our first article in EOS Trans. AGU (8 October 1991). Using grdview one can choose to either plot a mesh surface (left) or a color-coded surface (right). We have also added artificial illumination from a light-source due north, which is simulated by computing the gradient of the surface grid in that direction though the grdgradient program. We choose to use the -Qc option in grdview to achieve a high degree of smoothness. Here, we select 100 dpi since that will be the resolution of our final raster (The EOS raster was 300 dpi). Note that the size of the resulting output file is directly dependent on the square of the dpi chosen for the scanline conversion and how well the resulting image compresses. A higher value for dpi in -Qc would have resulted in a much larger output file. The CPTs were taken from Example (2) Image presentations.

Footnote

[1]These data are available from NCEI (www.ncei.noaa.gov).