1GRD2CPT(1)                            GMT                           GRD2CPT(1)
2
3
4

NAME

6       grd2cpt  -  Make linear or histogram-equalized color palette table from
7       grid
8

SYNOPSIS

10       grd2cpt  grid  [   -A[+]transparency  ]  [   -Ccpt  ]  [   -D[i]  ]   [
11       -E[nlevels]  ]  [   -F[R|r|h|c  ][+c]]  [   -Gzlo/zhi ] [  -I[c][z] ] [
12       -Lminlimit/maxlimit ] [  -M ] [  -N ] [  -Q[i|o]  ]  [   -Rregion  ]  [
13       -Szstart/zstop/zinc ] [  -T-|+|_|= ] [  -V[level] ] [  -W[w] ] [  -Z ]
14
15       Note:  No  space  is allowed between the option flag and the associated
16       arguments.
17

DESCRIPTION

19       grd2cpt reads one or more grid files and writes a static color  palette
20       (CPT)  file to standard output. The CPT is based on an existing dynamic
21       master CPT of your choice, and the mapping from data value to colors is
22       through  the data's cumulative distribution function (CDF), so that the
23       colors are histogram equalized. Thus if the grid(s) and  the  resulting
24       CPT  are  used in grdimage with a linear projection, the colors will be
25       uniformly distributed in area on the plot. Let z be the data values  in
26       the  grid.  Define  CDF(Z) = (# of z < Z) / (# of z in grid). (NaNs are
27       ignored). These z-values are then normalized to the master CPT and col‐
28       ors are sampled at the desired intervals.
29
30       The  color palette includes three additional colors beyond the range of
31       z-values. These are the background color (B) assigned to  values  lower
32       than  the  lowest  z-value, the foreground color (F) assigned to values
33       higher than the highest z-value, and the NaN color (N) painted wherever
34       values  are undefined.  For color tables beyond the standard GMT offer‐
35       ings, visit cpt-city: http://soliton.vm.bytemark.co.uk/pub/cpt-city/.
36
37       If the master CPT includes B, F, and N entries, these  will  be  copied
38       into  the  new  master  file.  If not, the parameters COLOR_BACKGROUND,
39       COLOR_FOREGROUND, and COLOR_NAN from the gmt.conf file or  the  command
40       line  will  be  used.  This default behavior can be overruled using the
41       options -D, -M or -N.
42
43       The color model (RGB, HSV or CMYK) of the palette  created  by  makecpt
44       will  be  the  same  as specified in the header of the master CPT. When
45       there is no COLOR_MODEL entry in the master CPT, the COLOR_MODEL speci‐
46       fied in the gmt.conf file or on the command line will be used.
47

REQUIRED ARGUMENTS

49       grid   Names of one or more grid files used to derive the color palette
50              table. All grids need to have the same size and dimensions. (See
51              GRID FILE FORMATS below).
52

OPTIONAL ARGUMENTS

54       -A[+]transparency
55              Sets  a  constant  level  of  transparency (0-100) for all color
56              slices.  Prepend + to also affect the fore-, back-, and nan-col‐
57              ors [Default is no transparency, i.e., 0 (opaque)].
58
59       -Ccpt  Selects  the  master  color  table  to use in the interpolation.
60              Choose among the built-in tables (type grd2cpt to see the  list)
61              or  give  the  name  of an existing CPT [Default gives a rainbow
62              CPT].      Yet     another     option     is     to      specify
63              -Ccolor1,color2[,color3,...]   to  build a linear continuous CPT
64              from those colors automatically.  In this case colorn can  be  a
65              r/g/b  triplet, a color name, or an HTML hexadecimal color (e.g.
66              #aabbcc ).
67
68       -D[i]  Select the back- and foreground colors to match the  colors  for
69              lowest  and highest z-values in the output CPT [Default uses the
70              colors specified in the master file, or  those  defined  by  the
71              parameters  COLOR_BACKGROUND,  COLOR_FOREGROUND, and COLOR_NAN].
72              Append i to match the colors for the lowest and  highest  values
73              in the input (instead of the output) CPT.
74
75       -E[nlevels]
76              Create a linear color table by using the grid z-range as the new
77              limits in the CPT.  Alternatively, append nlevels  and  we  will
78              resample the color table into nlevels equidistant slices.
79
80       -F[R|r|h|c][+c]]
81              Force  output CPT to written with r/g/b codes, gray-scale values
82              or color name (R, default) or r/g/b codes  only  (r),  or  h-s-v
83              codes  (h),  or c/m/y/k codes (c).  Optionally or alternatively,
84              append +c to write discrete palettes in categorical format.
85
86       -Gzlo/zhi
87              Truncate the incoming CPT so that the lowest and highest  z-lev‐
88              els are to zlo and zhi.  If one of these equal NaN then we leave
89              that end of the CPT alone.  The truncation  takes  place  before
90              any resampling. See also manipulating_CPTs
91
92       -I[c][z]
93              Append  c [Default] to reverse the sense of color progression in
94              the master CPT. Also exchanges  the  foreground  and  background
95              colors,  including those specified by the parameters COLOR_BACK‐
96              GROUND and COLOR_FOREGROUND.  Append z to reverse  the  sign  of
97              z-values  in the color table.  Note that this change of z-direc‐
98              tion happens before -G and -T values are used so the latter much
99              be  compatible  with  the  changed  z-range. See also manipulat‐
100              ing_CPTs
101
102       -Lminlimit/maxlimit
103              Limit range of CPT to minlimit/maxlimit, and  don't  count  data
104              outside this range when estimating CDF(Z). [Default uses min and
105              max of data.]
106
107       -M     Overrule background, foreground, and NaN colors specified in the
108              master  CPT  with the values of the parameters COLOR_BACKGROUND,
109              COLOR_FOREGROUND, and COLOR_NAN specified in the  gmt.conf  file
110              or on the command line. When combined with -D, only COLOR_NAN is
111              considered.
112
113       -N     Do not write  out  the  background,  foreground,  and  NaN-color
114              fields [Default will write them].
115
116       -Q[i|o]
117              Selects  a logarithmic interpolation scheme [Default is linear].
118              -Qi expects input z-values to be log10(z), assigns  colors,  and
119              writes  out  z [Default]. -Qo takes log10(z) first, assigns col‐
120              ors, and writes out z.
121
122       -Rxmin/xmax/ymin/ymax[+r][+uunit] (more ...)
123              Specify the region of interest.
124
125       -Szstart/zstop/zinc or -Sn
126              Set steps in CPT. Calculate entries in CPT from zstart to  zstop
127              in  steps of (zinc). Default chooses arbitrary values by a crazy
128              scheme based on equidistant values for a Gaussian CDF.  Use  -Sn
129              to  select  n  points from such a cumulative normal distribution
130              [11].
131
132       -T-|+|_|=
133              Force the color table to be symmetric about  zero  (from  -R  to
134              +R).  Append flag to set the range R: - for R =|zmin|, + for R =
135              |zmax|, _ for R = min(|zmin|, |zmax|), or = for R =  max(|zmin|,
136              |zmax|).
137
138       -V     Verbose  operation.  This will write CDF(Z) estimates to stderr.
139              [Default is silent.]
140
141       -W     Do not interpolate the input color table  but  pick  the  output
142              colors  starting  at  the beginning of the map. This is particu‐
143              larly useful in combination with a categorical color table. Can‐
144              not  be  used in combination with -Z.  Alternatively, use -Ww to
145              produce a wrapped (cyclic) color table  that  endlessly  repeats
146              its range.
147
148       -Z     Will  create a continuous color palette. [Default is discontinu‐
149              ous, i.e., constant color intervals]
150
151       -^ or just -
152              Print a short message about the  syntax  of  the  command,  then
153              exits (NOTE: on Windows just use -).
154
155       -+ or just +
156              Print  an extensive usage (help) message, including the explana‐
157              tion of any module-specific  option  (but  not  the  GMT  common
158              options), then exits.
159
160       -? or no arguments
161              Print a complete usage (help) message, including the explanation
162              of all options, then exits.
163

GRID FILE FORMATS

165       By default GMT  writes  out  grid  as  single  precision  floats  in  a
166       COARDS-complaint  netCDF  file  format. However, GMT is able to produce
167       grid files in many other commonly  used  grid  file  formats  and  also
168       facilitates  so  called  "packing" of grids, writing out floating point
169       data as 1- or 2-byte integers. (more ...)
170

NOTES ON TRANSPARENCY

172       The PostScript language originally  had  no  accommodation  for  trans‐
173       parency.   However,  Adobe added an extension that allows developers to
174       encode some forms of transparency using the PostScript  language  model
175       but  it is only realized when converting the PostScript to PDF (and via
176       PDF to any raster image format).  GMT uses this  model  but  there  are
177       some  limitations:  Transparency can only be controlled on a per-object
178       or per-layer basis.  This means that a color  specifications  (such  as
179       those  in  CPTs of given via command-line options) only apply to vector
180       graphic items (i.e., text, lines, polygon fills) or to an entire  layer
181       (which could include items such as PostScript images).  This limitation
182       rules out any mechanism of controlling transparency in such images on a
183       pixel level.
184

COLOR ALIASING

186       For  best  result  when -E is used we recommend you do no append a spe‐
187       cific nlevels.  This way the original CPT is used exactly as is but the
188       z boundaries are adjusted to match the grid limits.  Otherwise you may,
189       depending on the nature of the input CPT, miss  aspects  of  the  color
190       changes by aliasing the signal.
191

EXAMPLES

193       Sometimes  you don't want to make a CPT (yet) but would find it helpful
194       to know that 90% of your data lie between z1 and z2, something you can‐
195       not  learn  from  grdinfo. So you can do this to see some points on the
196       CDF(Z) curve (use -V option to see more):
197
198              gmt grd2cpt mydata.nc -V > /dev/null
199
200       To make a CPT with entries from 0 to 200 in steps  of  20,  and  ignore
201       data  below  zero  in computing CDF(Z), and use the built-in master cpt
202       file relief, run
203
204              gmt grd2cpt mydata.nc -Crelief -L0/10000 -S0/200/20 > mydata.cpt
205

SEE ALSO

207       gmt, gmt.conf, grdhisteq, grdinfo, makecpt
208
210       2019, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe
211
212
213
214
2155.4.5                            Feb 24, 2019                       GRD2CPT(1)
Impressum