7.4 A 3-D perspective mesh plot
Keywords: GMT_Docs

Next: 7.5 A 3-D illuminated Up: 7. Cook-book Previous: 7.3 Spectral estimation and Contents Index

#
7.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 bathymetry7.1and Geosat geoid data sets which we will extract from the local data bases using grdraster. 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. This is how to do it:

    #!/bin/csh
    #        GMT EXAMPLE 04
    #
    #        $Id: job04.csh,v 1.9 2006/10/23 18:14:12 remko Exp $
    #
    # Purpose:    3-D mesh plot of Hawaiian topography and geoid
    # GMT progs:    grdcontour, grdview, pscoast, pstext, psxyz
    # Unix progs:    echo, rm
    #
    echo '-10     255     0       255' >! zero.cpt
    echo '0       100     10      100' >> zero.cpt
    grdcontour HI_geoid4.nc -Jm0.45i -E60/30 -R195/210/18/25 -C1 -A5+o -Gd4i -K -P -X1.5i -Y1.5i \
       -U/-1.25i/-1.25i/"Example 4 in Cookbook" >! example_04.ps
    pscoast -J -E60/30 -R -B2/2NEsw -Gblack -O -K -T209/19.5/1i >> example_04.ps
    grdview HI_topo4.nc -J -Jz0.34i -Czero.cpt -E60/30 -R195/210/18/25/-6/4 -N-6/lightgray -Qsm -O -K \
       -B2/2/2:"Topo (km)":neswZ -Y2.2i >> example_04.ps
    echo '3.25 5.75 60 0.0 33 BC H@#awaiian@# R@#idge' | pstext -R0/10/0/10 -Jx1i -O >> example_04.ps
    \rm -f zero.cpt .gmt*
    csh -f job4c.csh

The purpose of the color palette file zero.cpt is to have the positive topography mesh painted light gray (the remainder is white). Figure 7.4 shows the complete illustration.

Figure 7.4: 3-D perspective mesh plot.

A color version of this figure was used in our first article in EOS Trans. AGU (Oct. 8th, 1991). It was created along similar lines, but instead of a mesh plot we chose a color-coded surface with artificial illumination from a light-source due north. We choose to use the -Qi 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). We used grdgradient to provide the intensity files. The following script creates the color PostScript file. Note that the size of the resulting output file is directly dependent on the square of the dpi chosen for the scanline conversion. A higher value for dpi in -Qi would have resulted in a much larger output file. The cpt files were taken from Example 2.

    #!/bin/csh
    #        GMT EXAMPLE 4c
    #
    #        $Id: job4c.csh,v 1.10 2006/10/30 19:09:11 remko Exp $
    #
    # 3-D perspective color plot of Hawaiian topography and geoid
    # GMT progs:    grdcontour, grdview, pscoast, pstext, psxyz
    # Unix progs:    echo, rm
    #
    grdgradient HI_geoid4.nc -A0 -Gg_intens.grd -Nt0.75 -M
    grdgradient HI_topo4.nc -A0 -Gt_intens.grd -Nt0.75 -M
    #
    grdview HI_geoid4.nc -Ig_intens.grd -JM6.75i -E60/30 -R195/210/18/25 -Cgeoid.cpt -Qi100 -K -X1.5i \
       -Y1.25i -P -U/-1.25i/-1i/"Example 4c in Cookbook" >! example_4c.ps
    pscoast -J -E60/30 -R -B2/2NEsw -Gblack -O -K >> example_4c.ps
    psbasemap -R -J -E60/30 -O -K -T209/19.5/1i \
       --COLOR_BACKGROUND=red --TICK_PEN=thinner,red >> example_4c.ps
    grdview HI_topo4.nc -It_intens.grd -J -JZ3.4i -Ctopo.cpt -E60/30 -R195/210/18/25/-6/4 \
       -N-6/lightgray -Qi100 -O -K -Y2.2i >> example_4c.ps
    psbasemap -J -JZ3.4i -E60/30 -R -Z-6 -O -K -B2/2/2:"Topo (km)":neZ >> example_4c.ps
    echo '3.25 5.75 60 0.0 33 BC H@#awaiian@# R@#idge' | pstext -R0/10/0/10 -Jx1i -O >> example_4c.ps
    \rm -f *_intens.grd .gmtcommands4

Next: 7.5 A 3-D illuminated Up: 7. Cook-book Previous: 7.3 Spectral estimation and Contents Index