Next: 4.3.1 Exercises Up: 4. SESSION FOUR Previous: 4.2 Illumination and intensities Contents Index

#
4.3 Color images

Once a cpt file has been made it is relatively straightforward to generate a color image of a gridded data. Here, we will extract a subset of the global 30" DEM (data id 9) from USGS:

    grdraster 9 -R-108/-103/35/40 -Gus.nc

You can find the grid us.nc also in the tutorial directory of your GMT installation. Using grdinfo we find that the data ranges from 1000m to 4300m so we make a cpt file accordingly:

    makecpt -Crainbow -T1000/5000/500 -Z >! topo.cpt

Color images are made with grdimage which takes the usual common command options (by default the -R is taken from the data set) and a cptfile; the main other options are

Table 4.3: The main options in grdimage.
Option | Purpose
-E dpi | Sets the desired resolution of the image [Default is data resolution]
-I intenfile | Use artificial illumination using intensities from intensfile
-M | Force grayshade using the (television) YIQ conversion

We want to make a plain color map with a color bar superimposed above the plot. We try

    grdimage us.nc -JM6i -P -B2 -Ctopo.cpt -V -K >! topo.ps
    psscale -D3i/8.5i/5i/0.25ih -Ctopo.cpt -I0.4 -B/:m: -O >> topo.ps

The plain color map lacks detail and fails to reveal the topographic complexity of this Rocky Mountain region. What it needs is artificial illumination. We want to simulate shading by a sun source in the east, hence we derive the required intensities from the gradients of the topography in the N90°E direction using grdgradient. Other than the required input and output filenames, the available options are

Table 4.4: The grdgradient options.
Option | Purpose
-A azimuth | Azimuthal direction for gradients
-M | Indicates that this is a geographic grid
-N[t e][norm[/offset]] | Normalize gradients by norm/offset [= 1/0 by default].
| Insert t to normalize by the transformation.
| Insert e to normalize by the cumulative Laplace distribution.

Figure 4.1 shows that raw slopes from bathymetry tend to be far from normally distributed (left). By using the inverse tangent transformation we can ensure a more uniform distribution (right). The inverse tangent transform simply takes the raw slope estimate (the x value at the arrow) and returns the corresponding inverse tangent value (normalized to fall in the ±1 range; horizontal arrow pointing to the y-value).

Figure 4.1: How the inverse tangent operation works.

Both -Ne and -Nt yield well behaved gradients. Personally, we prefer to use the -Ne option; the value of norm is subjective and you may experiment somewhat in the 0.5-5 range. For our case we choose

    grdgradient us.nc -Ne0.8 -A100 -M -Gus_i.nc

Given the cpt file and the two gridded data sets we can create the shaded relief image:

    grdimage us.nc -Ius_i.nc -JM6i -P -B2 -Ctopo.cpt -K >! topo.ps
    psscale -D3i/8.5i/5i/0.25ih -Ctopo.cpt -I0.4 -B/:m: -O >> topo.ps

Subsections

- 4.3.1 Exercises

Next: 4.3.1 Exercises Up: 4. SESSION FOUR Previous: 4.2 Illumination and intensities Contents Index