Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

makecpt.rst 11 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
  1. .. index:: ! makecpt
  2. .. include:: module_core_purpose.rst_
  3. *******
  4. makecpt
  5. *******
  6. |makecpt_purpose|
  7. Synopsis
  8. --------
  9. .. include:: common_SYN_OPTs.rst_
  10. **gmt makecpt** [ |-A|\ *transparency*\ [**+a**] ]
  11. [ |-C|\ *cpt* ]
  12. [ |-D|\ [**i**\|\ **o**] ]
  13. [ |-E|\ [*nlevels*] ]
  14. [ |-F|\ [**R**\|\ **r**\|\ **h**\|\ **c**][**+c**]]
  15. [ |-G|\ *zlo*\ /\ *zhi* ]
  16. [ |-H| ]
  17. [ |-I|\ [**c**][**z**] ]
  18. [ |-M| ]
  19. [ |-N| ]
  20. [ |-Q| ]
  21. [ |-S|\ *mode* ]
  22. [ |-T|\ [*min*/*max*/*inc*\ [**+b**\|\ **l**\|\ **n**]\|\ *file*\|\ *list*] ]
  23. [ |-V|\ [*level*] ]
  24. [ |-W|\ [**w**] ]
  25. [ |-Z| ]
  26. [ |SYN_OPT-bi| ]
  27. [ |SYN_OPT-di| ]
  28. [ |SYN_OPT-h| ]
  29. [ |SYN_OPT-i| ]
  30. [ |SYN_OPT--| ]
  31. |No-spaces|
  32. Description
  33. -----------
  34. **makecpt** is a module that will help you make static color palette tables
  35. (CPTs). In classic mode we write the CMT to standard output, while under
  36. modern mode we simply save the CPT as the current session CPT (but see **-H**).
  37. You define an equidistant set of contour intervals or pass
  38. your own z-table or list, and create a new CPT based on an existing master (dynamic)
  39. CPT. The resulting CPT can be reversed relative to the master
  40. cpt, and can be made continuous or discrete. For color tables beyond the
  41. standard GMT offerings, visit `cpt-city <http://soliton.vm.bytemark.co.uk/pub/cpt-city/>`_ and
  42. `Scientific Colour-Maps <http://www.fabiocrameri.ch/colourmaps.php>`_.
  43. The CPT includes three additional colors beyond the range of
  44. z-values. These are the background color (B) assigned to values lower
  45. than the lowest *z*-value, the foreground color (F) assigned to values
  46. higher than the highest *z*-value, and the NaN color (N) painted
  47. wherever values are undefined.
  48. If the master CPT includes B, F, and N entries, these will be
  49. copied into the new master file. If not, the parameters
  50. :term:`COLOR_BACKGROUND`, :term:`COLOR_FOREGROUND`,
  51. and :term:`COLOR_NAN` from
  52. the :doc:`gmt.conf` file or the command line will be used. This default
  53. behavior can be overruled using the options **-D**, **-M** or **-N**.
  54. The color model (RGB, HSV or CMYK) of the palette created by **makecpt**
  55. will be the same as specified in the header of the master CPT. When
  56. there is no :term:`COLOR_MODEL` entry in the master CPT, the
  57. :term:`COLOR_MODEL` specified in the :doc:`gmt.conf` file or on the command
  58. line will be used.
  59. Required Arguments
  60. ------------------
  61. None.
  62. Optional Arguments
  63. ------------------
  64. .. _-A:
  65. **-A**\ *transparency*\ [**+a**]
  66. Sets a constant level of transparency (0-100) for all color slices.
  67. Append **+a** to also affect the fore-, back-, and nan-colors
  68. [Default is no transparency, i.e., 0 (opaque)].
  69. .. _-C:
  70. .. include:: create_cpt.rst_
  71. .. _-D:
  72. **-D**\ [**i**\|\ **o**]
  73. Select the back- and foreground colors to match the colors for
  74. lowest and highest *z*-values in the output CPT [Default uses
  75. the colors specified in the master file, or those defined by the
  76. parameters :term:`COLOR_BACKGROUND`, :term:`COLOR_FOREGROUND`, and
  77. :term:`COLOR_NAN`]. Append **i** to match the colors for the lowest and
  78. highest values in the input (instead of the output) CPT.
  79. .. _-E:
  80. **-E**\ [*nlevels*]
  81. Implies reading data table(s) from given command-line files or standard input.
  82. We use the last data column to determine the data range; use **-i** to
  83. select another column, and use **-bi** if your data table is native binary.
  84. This z-range information is used instead of providing the **-T** option.
  85. We create a linear color table by dividing the table data z-range into
  86. *nlevels* equidistant slices. If *nlevels* is not given it defaults to
  87. the number of levels in the chosen CPT.
  88. .. _-F:
  89. **-F**\ [**R**\|\ **r**\|\ **h**\|\ **c**][**+c**]]
  90. Force output CPT to be written with r/g/b codes, gray-scale values
  91. or color name (**R**, default) or r/g/b codes only (**r**), or h-s-v
  92. codes (**h**), or c/m/y/k codes (**c**). Optionally or alternatively,
  93. append **+c** to write discrete palettes in categorical format.
  94. .. _-G:
  95. **-G**\ *zlo*\ /\ *zhi*
  96. Truncate the incoming CPT so that the lowest and highest z-levels
  97. are to *zlo* and *zhi*. If one of these equal NaN then
  98. we leave that end of the CPT alone. The truncation takes place
  99. before any resampling. See also :ref:`manipulating_CPTs`
  100. .. _-H:
  101. **-H**\
  102. Modern mode only: Write the CPT to standard output as well [Default saves
  103. the CPT as the session current CPT]. Required for scripts used to make
  104. animations via :doc:`movie` where we must pass named CPT files.
  105. .. _-I:
  106. **-I**\ [**c**][**z**]
  107. Append **c** [Default] to reverse the sense of color progression in the master CPT. Also
  108. exchanges the foreground and background colors, including those
  109. specified by the parameters :term:`COLOR_BACKGROUND` and
  110. :term:`COLOR_FOREGROUND`.
  111. Append **z** to reverse the sign of z-values in the color table. Note that
  112. this change of *z*-direction happens before **-G** and **-T** values are used
  113. so the latter much be compatible with the changed *z*-range.
  114. See also :ref:`manipulating_CPTs`
  115. .. _-M:
  116. **-M**
  117. Overrule background, foreground, and NaN colors specified in the
  118. master CPT with the values of the parameters
  119. :term:`COLOR_BACKGROUND`, :term:`COLOR_FOREGROUND`,
  120. and :term:`COLOR_NAN`
  121. specified in the :doc:`gmt.conf` file or on the command line. When
  122. combined with **-D**, only :term:`COLOR_NAN` is considered.
  123. .. _-N:
  124. **-N**
  125. Do not write out the background, foreground, and NaN-color fields [Default will write them].
  126. .. _-Q:
  127. **-Q**
  128. For logarithmic interpolation scheme with input given as logarithms.
  129. Expects input z-values provided via **-T** to be log10(*z*\ ), assigns colors, and
  130. writes out *z*.
  131. .. _-S:
  132. **-S**\ *mode*
  133. Determine a suitable range for the **-T** option from the input table(s) (or stdin).
  134. Choose from several types of range determinations:
  135. **-Sr** will use the data range min/max, **-S**\ *inc*\ [**+d**] will use the data min/max but rounded
  136. to nearest *inc* (append **+d** to resample to a discrete CPT), **-Sa**\ *scl* will
  137. make a symmetric range around the average (i.e., mean)
  138. and ±\ *scl* * *sigma*, **-Sm**\ *scl* will make a symmetric range around the median
  139. and ±\ *scl* * *L1_scale*, **-Sp**\ *scl* will make symmetric range around mode (i.e., LMS; least median of squares) and
  140. ±\ *scl* * *LMS_scale*, while **-Sq**\ *low/high* sets the range from *low* quartile
  141. to *high* quartile (in percentages). We use the last data column for this calculation;
  142. use **i** if you need to adjust the column orders.
  143. .. _-T:
  144. **-T**\ [*min*/*max*/*inc*\ [**+b**\|\ **l**\|\ **n**]\|\ *file*\|\ *list*]
  145. Defines the range of the new CPT by giving the lowest and
  146. highest z-value (and optionally an interval). If **-T** is
  147. not given, the existing range in the master CPT will be used intact.
  148. The values produces defines the color slice boundaries. If **+n** is
  149. used it refers to the number of such boundaries and not the number of slices.
  150. For details on array creation, see `Generate 1D Array`_.
  151. .. _-V:
  152. .. |Add_-V| unicode:: 0x20 .. just an invisible code
  153. .. include:: explain_-V.rst_
  154. .. _-W:
  155. **-W**\ [**w**]
  156. Do not interpolate the input color table but pick the output colors
  157. starting at the beginning of the color table, until colors for all
  158. intervals are assigned. This is particularly useful in combination
  159. with a categorical color table, like "categorical". Alternatively,
  160. use **-Ww** to produce a wrapped (cyclic) color table that endlessly
  161. repeats its range.
  162. .. _-Z:
  163. **-Z**
  164. Force a continuous CPT when building from a list of colors and a list of *z*-values [discrete].
  165. .. |Add_-bi| replace:: [Default is the required number of columns given the chosen settings].
  166. .. include:: explain_-bi.rst_
  167. .. |Add_-di| unicode:: 0x20 .. just an invisible code
  168. .. include:: explain_-di.rst_
  169. .. include:: explain_-h.rst_
  170. .. include:: explain_-icols.rst_
  171. .. include:: explain_help.rst_
  172. .. include:: explain_transparency.rst_
  173. .. include:: explain_array.rst_
  174. Color Hinges
  175. ------------
  176. Some of the GMT master dynamic CPTs are actually two separate CPTs
  177. meeting at a *hinge*. Usually, colors may change dramatically across
  178. the hinge, which is used to separate two different domains (e.g., land
  179. and ocean across the shoreline, for instance). CPTs with a hinge will
  180. have their two parts stretched to the required range separately, i.e.,
  181. the bottom part up to the hinge will be stretched independently of the
  182. part from the hinge to the top, according to the prescribed new range.
  183. Hinges are either *hard* or *soft*. Soft hinges must be *activated* by
  184. appending **+h**\ [*hinge*] to the CPT name.
  185. If the selected range does not include an activated soft or hard hinge then
  186. we only resample colors from the half of the CPT that pertains to the range.
  187. See :ref:`Of Colors and Color Legends` for more information.
  188. Discrete versus Continuous CPT
  189. ------------------------------
  190. All CPTs can be stretched, but only continuous CPTs can be sampled
  191. at new nodes (i.e., by given an increment in **-T**). We impose this
  192. limitation to avoid aliasing the original CPT.
  193. Examples
  194. --------
  195. .. include:: explain_example.rst_
  196. To make a CPT with z-values from -200 to 200, with discrete color
  197. changes every 25, and using a polar blue-white-red colortable:
  198. ::
  199. gmt makecpt -Cpolar -T-200/200/25 > colors.cpt
  200. To make an equidistant CPT from z = -2 to 6 using the
  201. continuous default turbo rainbow of colors:
  202. ::
  203. gmt makecpt -T-2/6 > colors.cpt
  204. To use the GEBCO look-alike CPT with its default range for bathymetry, run
  205. ::
  206. gmt makecpt -Cgebco > my_gebco.cpt
  207. or simply use -Cgebco directly in the application that needs the color table.
  208. To create a 24-level color table suitable for plotting the depths in
  209. the remote ata table v3206_06.txt (with lon, lat, depths), run
  210. ::
  211. gmt makecpt -Cgebco @v3206_06.txt -E24 > my_depths.cpt
  212. To use the gebco color table but reverse the z-values so it can be used for
  213. positive depth values, try
  214. ::
  215. gmt makecpt -Cgebco -Iz > my_positive_gebco.cpt
  216. To make a custom discrete color table for depth of seismicity, using red color for
  217. hypocenters between 0 and 100 km, green for 100-300 km, and blue for deep (300-1000 km)
  218. earthquakes, use
  219. ::
  220. gmt makecpt -Cred,green,blue -T0,80,300,1000 -N > seis.cpt
  221. To make a continuous CPT from white to blue as z goes from
  222. 3 to 10, try
  223. ::
  224. gmt makecpt -Cwhite,blue -T3/10 > cold.cpt
  225. To make a wrapped (cyclic) CPT from the jet table over the interval
  226. 0 to 500, i.e., the color will be wrapped every 500 z-units so that
  227. we always get a color regardless of the *z* value, try
  228. ::
  229. gmt makecpt -Cjet -T0/500 -Ww > wrapped.cpt
  230. .. include:: cpt_notes.rst_
  231. Bugs
  232. ----
  233. Since **makecpt** will also interpolate from any existing CPT you
  234. may have in your directory, you should not use one of the listed cpt names
  235. as an output filename; hence the my_gebco.cpt in the example. If you
  236. do create a CPT of such a name, e.g., rainbow.cpt, then **makecpt** will
  237. read that file first and not look for the master CPT in the shared GMT
  238. directory.
  239. See Also
  240. --------
  241. :doc:`gmt`, :doc:`grd2cpt`
  242. References
  243. ----------
  244. Crameri, F., (2018). Scientific colour-maps. Zenodo. http://doi.org/10.5281/zenodo.1243862
  245. Crameri, F. (2018), Geodynamic diagnostics, scientific visualisation and StagLab 3.0,
  246. *Geosci. Model Dev.*, 11, 2541-2562, doi:10.5194/gmd-11-2541-2018.
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...