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/sh
    #               GMT EXAMPLE 04
    #
    # Purpose:      3-D mesh plot of Hawaiian topography and geoid
    # GMT progs:    grdcontour, grdview, pscoast, pstext
    # Unix progs:   echo, rm
    #
    ps=example_04.ps
    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" > $ps
    pscoast -J -E60/30 -R -B2/2NEsw -Gblack -O -K -T209/19.5/1i >> $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 >> $ps
    echo '3.25 5.75 60 0.0 33 BC H@#awaiian@# R@#idge' | pstext -R0/10/0/10 -Jx1i -O >> $ps
    rm -f zero.cpt .gmt*

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

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

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/sh
    #               GMT EXAMPLE 04c
    #
    # 3-D perspective color plot of Hawaiian topography and geoid
    # GMT progs:    grdcontour, grdview, pscoast, pstext
    # Unix progs:   echo, rm
    #
    ps=example_04c.ps
    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 04c in Cookbook" > $ps
    pscoast -J -E60/30 -R -B2/2NEsw -Gblack -O -K >> $ps
    psbasemap -R -J -E60/30 -O -K -T209/19.5/1i --COLOR_BACKGROUND=red --TICK_PEN=thinner,red >> $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 >> $ps
    psbasemap -J -JZ3.4i -E60/30 -R -Z-6 -O -K -B2/2/2:"Topo (km)":neZ >> $ps
    echo '3.25 5.75 60 0.0 33 BC H@#awaiian@# R@#idge' | pstext -R0/10/0/10 -Jx1i -O >> $ps
    rm -f *_intens.grd .gmt*

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