Next: 4.1.1 Exercises Up: 4. SESSION FOUR Previous: 4. SESSION FOUR Contents Index

#
4.1 The cpt file format

The cpt file has already been briefly mentioned in connection with our seismicity plot in session 2. Here we will treat the issue in more detail. The general format of cpt files is

z | R | G | B | z | R | G | B | [A]
... |  |  |  |  |  |  |  |
z | R | G | B | z | R | G | B | [A]

Since a cpt file may contain only shades of gray (here listed as the red component), the green and blue columns are optional and only used for color tables. An optional final column may be used to affect annotation of color bars (created by psscale). The U, L, and B flags (position A) indicate we want to annotate the upper, lower, and both color boundaries, respectively. Alternatively, you can use the psscale -B option in the same way you use it in, say, psbasemap.

Cpt files can be created in any number of ways. GMT provides two mechanisms:

1. Create simple, linear color tables given a master color table (several are built-in) and the desired -values at color boundaries (makecpt)

2. Create color tables based on a master cpt color table and the histogram-equalized distribution of -values in a gridded data file (grd2cpt)

One can also make these files manually or with awk or other tools. Here we will limit our discussion to makecpt. Its main argument is the name of the master color table (a list is shown if you run the program with no arguments) and the equidistant -values to go with it. The main options are given below.

Table 4.1: Prime options available in makecpt.
Option | Purpose
-C | Set the name of the master cpt file to use
-I | Reverse the sense of the color progression
-V | Run in verbose mode
-Z | Make a continuous rather than discrete table

To make discrete and continuous color cpt files for data that ranges from -20 to 60, with color changes at every 10, try these two variants:

    makecpt -Crainbow -T-20/60/10 >! disc.cpt
    makecpt -Crainbow -T-20/60/10 -Z >! cont.cpt

We can plot these color tables with psscale; the options worth mentioning here are listed in Table 4.2. In addition, the -B option can be used to set the title and unit label (and optionally to set the annotation-, tick-, and grid-line intervals for the colorbars.)

Table 4.2: The main switches and options in psscale.
Option | Purpose
-C cptfile | The required cpt file
-D xpos/ypos/length/width[h] | Sets the position of the center/left and dimensions of scale bar.
| Append h to get horizontal bar and give center/top instead
-I max_intensity | Add illumination effects

    psbasemap -R0/8.5/0/11 -Jx1i -P -B0 -K >! bar.ps
    psscale -D3i/3i/4i/0.5ih -Cdisc.cpt -B:discrete: -O -K >> bar.ps
    psscale -D3i/5i/4i/0.5ih -Ccont.cpt -B:continuous: -O -K >> bar.ps
    psscale -D3i/7i/4i/0.5ih -Cdisc.cpt -B:discrete: -I0.5 -O -K >> bar.ps
    psscale -D3i/9i/4i/0.5ih -Ccont.cpt -B:continuous: -I0.5 -O >> bar.ps

Subsections

- 4.1.1 Exercises

Next: 4.1.1 Exercises Up: 4. SESSION FOUR Previous: 4. SESSION FOUR Contents Index