1GRD2CPT(1) Generic Mapping Tools GRD2CPT(1)
2
3
4
6 grd2cpt - Make a color palette table from grid files
7
9 grd2cpt grdfiles [ -Ccptmaster ] [ -D ] [ -Enlevels ] [ -I ] [ -Lmin‐
10 limit/maxlimit ] [ -M ] [ -N ] [ -Q[i|o] ] [ -Rwest/east/south/north[r]
11 ] [ -Szstart/zstop/zinc ] [ -T-|+|_|= ] [ -V ] [ -Z ]
12
14 grd2cpt reads one or more grid files and writes a color palette (cpt)
15 file to standard output. The cpt file is based on an existing master
16 cpt file of your choice, and the mapping from data value to colors is
17 through the data's cumulative distribution function (CDF), so that the
18 colors are histogram equalized. Thus if the grid(s) and the resulting
19 cpt file are used in grdimage with a linear projection, the colors will
20 be uniformly distributed in area on the plot. Let z be the data values
21 in the grid. Define CDF(Z) = (# of z < Z) / (# of z in grid). (NaNs
22 are ignored). These z-values are then normalized to the master cpt
23 file and colors are sampled at the desired intervals.
24 The color palette includes three additional colors beyond the range of
25 z-values. These are the background color (B) assigned to values lower
26 than the lowest z-value, the foreground color (F) assigned to values
27 higher than the highest z-value, and the NaN color (N) painted
28 whereever values are undefined.
29 If the master cpt file includes B, F, and N entries, these will be
30 copied into the new master file. If not, the parameters COLOR_BACK‐
31 GROUND, COLOR_FOREGROUND, and COLOR_NAN from the .gmtdefaults4 file or
32 the command line will be used. This default behavior can be overruled
33 using the options -D, -M or -N.
34 The color model (RGB, HSV or CMYK) of the palette created by makecpt
35 will be the same as specified in the header of the master cpt file.
36 When there is no COLOR_MODEL entry in the master cpt file, the
37 COLOR_MODEL specified in the .gmtdefaults4 file or on the command line
38 will be used.
39
40 grdfiles
41 Names of one or more 2-D binary grid files used to derive the
42 color palette table. All grids need to have the same size and
43 dimensions. (See GRID FILE FORMATS below).
44
46 -C Selects the master color table to use in the interpolation.
47 Choose among the built-in tables (type grd2cpt to see the list)
48 or give the name of an existing cpt file [Default gives a rain‐
49 bow cpt file].
50
51 -D Select the colors for lowest and highest z-values in the output
52 cpt file as the back- and foreground colors that will be written
53 to the cpt file [Default uses the colors specified in the master
54 file, or those defined by the parameters COLOR_BACKGROUND,
55 COLOR_FOREGROUND, and COLOR_NAN].
56
57 -E Create a linear color table by dividing the grid z-range into
58 nlevels equidistant slices.
59
60 -I Reverses the sense of color progression in the master cpt file.
61 Also exchanges the foreground and background colors, including
62 those specified by the parameters COLOR_BACKGROUND and
63 COLOR_FOREGROUND.
64
65 -L Limit range of cpt file to minlimit/maxlimit, and don't count
66 data outside range when estimating CDF(Z). [Default uses min
67 and max of data.]
68
69 -M Overrule background, foreground, and NaN colors specified in the
70 master cpt file with the values of the parameters COLOR_BACK‐
71 GROUND, COLOR_FOREGROUND, and COLOR_NAN specified in the .gmtde‐
72 faults4 file or on the command line. When combined with -D,
73 only COLOR_NAN is considered.
74
75 -N Do not write out the background, foreground, and NaN-color
76 fields [Default will write them].
77
78 -Q Selects a logarithmic interpolation scheme [Default is linear].
79 -Qi expects input z-values to be log10(z), assigns colors, and
80 writes out z [Default]. -Qo takes log10(z) first, assigns col‐
81 ors, and writes out z.
82
83 -R xmin, xmax, ymin, and ymax specify the Region of interest. For
84 geographic regions, these limits correspond to west, east,
85 south, and north and you may specify them in decimal degrees or
86 in [+-]dd:mm[:ss.xxx][W|E|S|N] format. Append r if lower left
87 and upper right map coordinates are given instead of w/e/s/n.
88 The two shorthands -Rg and -Rd stand for global domain (0/360
89 and -180/+180 in longitude respectively, with -90/+90 in lati‐
90 tude). Alternatively, specify the name of an existing grid file
91 and the -R settings (and grid spacing, if applicable) are copied
92 from the grid. For calendar time coordinates you may either
93 give (a) relative time (relative to the selected TIME_EPOCH and
94 in the selected TIME_UNIT; append t to -JX|x), or (b) absolute
95 time of the form [date]T[clock] (append T to -JX|x). At least
96 one of date and clock must be present; the T is always required.
97 The date string must be of the form [-]yyyy[-mm[-dd]] (Gregorian
98 calendar) or yyyy[-Www[-d]] (ISO week calendar), while the clock
99 string must be of the form hh:mm:ss[.xxx]. The use of delim‐
100 iters and their type and positions must be exactly as indicated
101 (however, input, output and plot formats are customizable; see
102 gmtdefaults).
103
104 -S Set steps in cpt file. Calculate entries in cpt file from
105 zstart to zstop in steps of (zinc). [Default chooses arbitrary
106 values by a crazy scheme.]
107
108 -T Force the color table to be symmetric about zero (from -R to
109 +R). Append flag to set the range R: - for R =|zmin|, + for R =
110 |zmax|, _ for R = min(|zmin|, |zmax|), or = for R = max(|zmin|,
111 |zmax|).
112
113 -V Verbose operation. This will write CDF(Z) estimates to stderr.
114 [Default is silent.]
115
116 -Z Will create a continuous color palette. [Default is discontinu‐
117 ous, i.e., constant color intervals]
118
120 GMT is able to recognize many of the commonly used grid file formats,
121 as well as the precision, scale and offset of the values contained in
122 the grid file. When GMT needs a little help with that, you can add the
123 suffix =id[/scale/offset[/nan]], where id is a two-letter identifier of
124 the grid type and precision, and scale and offset are optional scale
125 factor and offset to be applied to all grid values, and nan is the
126 value used to indicate missing data. See grdreformat(1) and Section
127 4.17 of the GMT Technical Reference and Cookbook for more information.
128
129 When reading a netCDF file that contains multiple grids, GMT will read,
130 by default, the first 2-dimensional grid that can find in that file. To
131 coax GMT into reading another multi-dimensional variable in the grid
132 file, append ?varname to the file name, where varname is the name of
133 the variable. Note that you may need to escape the special meaning of ?
134 in your shell program by putting a backslash in front of it, or by
135 placing the filename and suffix between quotes or double quotes. See
136 grdreformat(1) and Section 4.18 of the GMT Technical Reference and
137 Cookbook for more information, particularly on how to read splices of
138 3-, 4-, or 5-dimensional grids.
139
141 Sometimes you don't want to make a cpt file (yet) but would find it
142 helpful to know that 90% of your data lie between z1 and z2, something
143 you cannot learn from grdinfo. So you can do this to see some points
144 on the CDF(Z) curve (use -V option to see more):
145
146 grd2cpt mydata.grd -V > /dev/null
147
148 To make a cpt file with entries from 0 to 200 in steps of 20, and
149 ignore data below zero in computing CDF(Z), and use the built-in master
150 cpt file relief, run
151
152 grd2cpt mydata.grd -Crelief -L0/10000 -S0/200/20 > mydata.cpt
153
155 gmtdefaults(1), GMT(1), grdhisteq(1), grdinfo(1), makecpt(1)
156
157
158
159GMT 4.5.6 10 Mar 2011 GRD2CPT(1)