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

GMT_Chapter_4.tex 123 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
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
  1. %------------------------------------------
  2. % $Id$
  3. %
  4. % The GMT Documentation Project
  5. % Copyright (c) 2000-2012.
  6. % P. Wessel, W. H. F. Smith, R. Scharroo, and J. Luis
  7. %------------------------------------------
  8. %
  9. \chapter{General features}
  10. \label{ch:4}
  11. \thispagestyle{headings}
  12. This section explains features common to all the programs
  13. in \GMT\ and summarizes the philosophy behind the system. Some
  14. of the features described here may make more sense once you reach
  15. the cook-book section where we present actual examples of their use.
  16. \section{\gmt\ units}
  17. \index{GMT@\GMT!units|(}
  18. \index{Dimensions|(}
  19. \index{Units|(}
  20. While \GMT\ has default units for both actual Earth distances and
  21. plot lengths (dimensions) of maps, it is recommended that you specifically indicate
  22. the units of your arguments by appending the unit character, as discussed below.
  23. This will aid you in debugging, let others understand your scripts, and remove
  24. any uncertainty as to what unit you thought you wanted.
  25. \subsection{Distance units}
  26. For Cartesian data and scaling the data units do not normally matter (they could be
  27. kg or Lumens for all we know) and are never entered. Geographic data are different
  28. as distances can be specified in a variety of ways. \GMT\ programs that accept actual
  29. Earth length scales like search radii or distances can therefore
  30. handle a variety of units. These choices are listed in Table~\ref{tbl:distunits};
  31. simply append the desired unit to the distance value you supply. A value without
  32. a unit suffix will be consider to be in meters. For example, a distance of
  33. 30 nautical miles should be given as 30\textbf{n}.
  34. \begin{table}[H]
  35. \centering
  36. \index{Distance units}%
  37. \index{Units, distance}%
  38. \begin{tabular}{|l|l||l|l|} \hline
  39. \multicolumn{1}{|c|}{\emph{Suffix}} & \multicolumn{1}{c|}{\emph{Distance unit}} & \multicolumn{1}{|c|}{\emph{Suffix}} & \multicolumn{1}{c|}{\emph{Distance unit}} \\ \hline
  40. \textbf{d} & Degrees of arc & \textbf{m} & Minutes of arc \\ \hline
  41. \textbf{e} & Meters [Default] & \textbf{M} & Statute miles \\ \hline
  42. \textbf{f} & Feet & \textbf{n} & Nautical miles \\ \hline
  43. \textbf{k} & Kilometers & \textbf{s} & Seconds of arc \\ \hline
  44. \end{tabular}
  45. \caption{Distance units recognized by \gmt\ command line switches.}
  46. \label{tbl:distunits}
  47. \end{table}
  48. \subsection{Distance calculations}
  49. The calculation of distances on Earth (or other planetary bodies) depends on the
  50. ellipsoidal parameters of the body and the method of computation. \GMT\ offers
  51. three alternatives that trade off accuracy and computation time.
  52. \subsubsection{Flat Earth distances}
  53. Quick, but approximate ``Flat Earth'' calculations make a first-order correction
  54. for the spherical nature of a planetary body by computing the distance between
  55. two points A and B as
  56. \begin{equation}
  57. d_f = R \sqrt{(\theta_A - \theta_B)^2 + \frac{\theta_A + \theta_B}{2}(\lambda_A - \lambda_B)^2},
  58. \label{eq:flatearth}
  59. \end{equation}
  60. where $R$ is the mean (or spherical) radius of the planet, $\theta$ is latitude, and the difference in longitudes, $\Delta \lambda$,
  61. is adjusted for any jumps that might occur across Greenwich or the Dateline. This approach is suitable
  62. when the points you use to compute $d_f$ do not greatly differ in latitude and computation
  63. speed is paramount. You can specify this mode of computation by using the \textbf{-} prefix to
  64. the specified distance (or to the unit itself in cases where no distance is required and only a unit is expected).
  65. For instance, a search radius of 50 statute miles using this mode of computation might be specified via \Opt{S-}50\textbf{M}.
  66. \subsubsection{Great circle distances}
  67. This is the default distance calculation, which will also approximate the planetary body by a sphere of mean
  68. radius $R$. However, we compute an exact distance between two points A and B on such a sphere via
  69. the Haversine equation
  70. \begin{equation}
  71. d_g = 2R \sin^{-1} {\sqrt{\sin^2\frac{\theta_A - \theta_B}{2} + \cos \theta_A \cos \theta_B \sin^2 \frac{\lambda_A - \lambda_B}{2}} },
  72. \label{eq:greatcircle}
  73. \end{equation}
  74. This approach is suitable for most situations unless exact calculations for an ellipsoid
  75. is required (typically for a limited surface area). For instance, a search radius of 5000 feet using this
  76. mode of computation would be specified as \Opt{S}5000\textbf{f}.
  77. \subsubsection{Geodesic distances}
  78. For the most accurate calculations we use a full ellipsoidal formulation. Currently,
  79. we are using Rudoe's formula. You select this mode of computation by using the \textbf{+} prefix to
  80. the specified distance (or to the unit itself in cases where no distance is required).
  81. For instance, a search radius of 20 km using this mode of computation would be set by \Opt{S+}20\textbf{k}.
  82. \subsection{Length units}
  83. \GMT\ programs can accept dimensional quantities and plot lengths
  84. in \textbf{c}m, \textbf{i}nch,
  85. or \textbf{p}oint (1/72 of an inch)\footnote{\PS\ definition.
  86. In the typesetting industry a slightly different definition of point
  87. (1/72.27 inch) is used.}. There are two ways to ensure that \GMT\ understands
  88. which unit you intend to use:
  89. \begin{enumerate}
  90. \item Append the desired unit to the dimension you supply. This
  91. way is explicit and clearly communicates what you intend, e.g.,
  92. \Opt{X}4\textbf{c} means the length being passed to the \Opt{X} switch is 4 cm.
  93. \item Set the parameter \textbf{PROJ\_LENGTH\_UNIT} to the desired unit. Then, all
  94. dimensions without explicit unit will be interpreted accordingly.
  95. \end{enumerate}
  96. The latter method is less secure as other users may have a different unit
  97. set and your script may not work as intended. We therefore recommend
  98. you always supply the desired unit explicitly.
  99. \index{GMT@\GMT!units|)}
  100. \index{Dimensions|)}
  101. \index{Units|)}
  102. \section{\gmt\ defaults}
  103. \label{sec:gmt.conf}
  104. \subsection{Overview and the \protect\filename{gmt.conf}\ file}
  105. \index{GMT@\GMT!defaults|(}
  106. \index{Default settings|(}
  107. \GMTfig[h]{GMT_Defaults_1a}{Some \gmt\ parameters that affect plot appearance.}
  108. There are about 100 parameters which can be adjusted individually
  109. to modify the appearance of plots or affect the manipulation of data.
  110. When a program is run, it initializes all parameters to the \GMT\
  111. defaults\footnote{Choose between SI and US default units by modifying
  112. \filename{gmt.conf} in the \GMT\ share directory.},
  113. then tries to open the file \filename{gmt.conf}
  114. in the current directory\footnote{To remain backwards compatible with \GMT\ 4.x
  115. we will also look for \filename{.gmtdefaults4} but only if \filename{gmt.conf}
  116. cannot be found.}. If not found, it will look for that file in a sub-directory
  117. \filename{\~/.gmt} of your home directory, and finally in your home directory itself. If successful, the program will read the
  118. contents and set the default values to those provided in the file.
  119. By editing this file you can affect features such as pen thicknesses
  120. used for maps, fonts and font sizes used for annotations and labels,
  121. color of the pens, dots-per-inch resolution of the hardcopy device,
  122. what type of spline interpolant to use, and many other choices
  123. (A complete list of all the parameters and their default values can
  124. be found in the \GMTprog{gmt.conf} manual pages). Figures
  125. \ref{fig:GMT_Defaults_1a}, \ref{fig:GMT_Defaults_1b},
  126. and \ref{fig:GMT_Defaults_1c} show the parameters that affect plots). You may create
  127. your own \filename{gmt.conf} files by running \GMTprog{gmtdefaults}
  128. and then modify those parameters you want to change. If you want
  129. to use the parameter settings in another file you can do so by
  130. specifying \texttt{+<defaultfile>} on the command line.
  131. This makes it easy to maintain several distinct parameter settings,
  132. corresponding perhaps to the unique styles required by different
  133. journals or simply reflecting font changes necessary to make
  134. readable overheads and slides. Note that any arguments given on
  135. the command line (see below) will take precedent over the default
  136. values. E.g., if your \filename{gmt.conf} file has \emph{x}
  137. offset = 1\textbf{i} as default, the \Opt{X}1.5\textbf{i} option will override the
  138. default and set the offset to 1.5 inches.
  139. There are at least two good reasons why the \GMT\ default options
  140. are placed in a separate parameter file:
  141. \begin{enumerate}
  142. \item It would not be practical to allow for command-line syntax
  143. covering so many options, many of which are rarely or never
  144. changed (such as the ellipsoid used for map projections).
  145. \item It is convenient to keep separate \filename{gmt.conf}
  146. files for specific projects, so that one may achieve a special
  147. effect simply by running \GMT\ commands in the directory whose
  148. \filename{gmt.conf} file has the desired settings. For example,
  149. when making final illustrations for a journal article one must often
  150. standardize on font sizes and font types, etc. Keeping all those
  151. settings in a separate \filename{gmt.conf} file simplifies this
  152. process and will allow you to generate those illustrations with the same settings
  153. later on. Likewise, \GMT\ scripts that make figures for PowerPoint
  154. presentations often use a different color scheme and font size than
  155. output intended for laser printers. Organizing these various scenarios
  156. into separate \filename{gmt.conf} files will minimize headaches
  157. associated with micro-editing of illustrations.
  158. \GMTfig[h]{GMT_Defaults_1b}{More \gmt\ parameters that affect plot appearance.}
  159. \end{enumerate}
  160. \subsection{Changing \gmt\ defaults}
  161. As mentioned, \GMT\ programs will attempt to open a file named
  162. \filename{gmt.conf}. At times it may be desirable to override
  163. that default. There are several ways in which this can be accomplished.
  164. \begin{enumerate}
  165. \item One method is to start each script by saving a
  166. copy of the current \filename{gmt.conf}, then copying the desired
  167. \filename{gmt.conf} file to the current directory, and finally
  168. reverting the changes at the end of the script. Possible side effects
  169. include premature ending of the script due to user error or bugs which
  170. means the final resetting does not take place (unless you write your
  171. script very carefully.)
  172. \item To permanently change some of the \GMT\ parameters on the fly
  173. inside a script the \GMTprog{gmtset} utility can be used. E.g., to
  174. change the primary annotation font to 12 point Times-Bold in red we run \\
  175. \texttt{gmtset FONT\_ANNOT\_PRIMARY 12p,Times-Bold,red} \\
  176. These changes will remain in effect until they are overridden.
  177. \item If all you want to achieve is to change a few parameters during
  178. the execution of a single command but otherwise leave the environment intact, consider
  179. passing the parameter changes on the command line via the {--}{--}\emph{PAR=value}
  180. mechanism. For instance, to temporarily set the output format for floating
  181. points to have lots of decimals, say, for map projection coordinate output,
  182. append {--}{--}\textbf{FORMAT\_FLOAT\_OUT}=\%.12lg to the command in question.
  183. \item Finally, \GMT\ provides to possibility to override the
  184. settings only during the running of a single script, reverting to the original settings
  185. after the script is run, as if the script was run in ``isolation''. The isolation mode
  186. is discussed in Section~\ref{sec:isolationmode}.
  187. \end{enumerate}
  188. In addition to those parameters
  189. that directly affect the plot there are numerous parameters than
  190. modify units, scales, etc. For a complete listing, see the
  191. \GMTprog{gmt.conf} man pages. We suggest that you go through
  192. all the available parameters at least once so that you know what is
  193. available to change via one of the described mechanisms.
  194. \GMTfig[h]{GMT_Defaults_1c}{Even more \gmt\ parameters that affect plot appearance.}
  195. \index{GMT@\GMT!defaults|)}
  196. \index{Default settings|)}
  197. \section{Command line arguments}
  198. \index{Command line!arguments}%
  199. \index{Arguments, command line}%
  200. Each program requires certain arguments specific to its operation.
  201. These are explained in the manual pages and in the usage messages.
  202. Most programs are ``case-sensitive''; almost all options must start
  203. with an upper-case letter. We have tried to choose letters of the
  204. alphabet which stand for the argument so that they will be easy to
  205. remember. Each argument specification begins with a hyphen
  206. (except input file names; see below), followed by a letter, and
  207. sometimes a number or character string immediately after the letter.
  208. \emph{Do not} space between the hyphen, letter, and number or string.
  209. \emph{Do} space between options. Example:
  210. \vspace{\baselineskip}
  211. \texttt{pscoast -R0/20/0/20 -Ggray -JM6i -Wthin -B5 -V -P $>$ map.ps}
  212. \section{Standardized command line options}
  213. \index{Standardized command line options}%
  214. \index{Command line!standardized options|(}%
  215. \label{sec:stopt}
  216. Most of the programs take many of the same arguments like those
  217. related to setting the data region, the map projection, etc.
  218. The 24 switches in Table~\ref{tbl:switches} have the same meaning
  219. in all the programs (although some programs may not use all of them).
  220. These options will be described here as well as in the manual pages,
  221. as is vital that you understand how to use these options. We will present
  222. these options in order of importance (some are use a lot more than others).
  223. \begin{table}
  224. \centering
  225. \index{Standardized command line options}%
  226. \index{\Opt{B} (set annotations and ticks)}%
  227. \index{\Opt{J} (set map projection)}%
  228. \index{\Opt{K} (continue plot)}%
  229. \index{\Opt{O} (overlay plot)}%
  230. \index{\Opt{P} (portrait orientation)}%
  231. \index{\Opt{R} (set region)}%
  232. \index{\Opt{U} (plot timestamp)}%
  233. \index{\Opt{V} (verbose mode)}%
  234. \index{\Opt{X} (shift plot in $x$)}%
  235. \index{\Opt{Y} (shift plot in $y$)}%
  236. \index{\Opt{a} (aspatial data)}%
  237. \index{\Opt{b} (binary i/o)}%
  238. \index{\Opt{c} (set \# of copies)}%
  239. \index{\Opt{f} (formatting of i/o)}%
  240. \index{\Opt{g} (detect data gaps)}%
  241. \index{\Opt{h} (header records)}%
  242. \index{\Opt{i} (select input columns)}%
  243. \index{\Opt{n} (control grid interpolation settings)}%
  244. \index{\Opt{o} (select output columns)}%
  245. \index{\Opt{p} (set perspective view)}%
  246. \index{\Opt{r} (set pixel registration)}%
  247. \index{\Opt{s} (NaN-record treatment)}%
  248. \index{\Opt{t} (layer transparency)}%
  249. \index{\Opt{:} (input and/or output is $y,x$, not $x,y$)}%
  250. \begin{tabular}{|l|l|} \hline
  251. \multicolumn{1}{|c|}{\emph{Option}} & \multicolumn{1}{c|}{\emph{Meaning}} \\ \hline
  252. \Opt{B} & Define tickmarks, annotations, and labels for basemaps and axes \\ \hline
  253. \Opt{J} & Select a map projection or coordinate transformation \\ \hline
  254. \Opt{K} & Allow more plot code to be appended to this plot later \\ \hline
  255. \Opt{O} & Allow this plot code to be appended to an existing plot \\ \hline
  256. \Opt{P} & Select Portrait plot orientation [Default is landscape] \\ \hline
  257. \Opt{R} & Define the extent of the map/plot region \\ \hline
  258. \Opt{U} & Plot a time-stamp, by default in the lower left corner of page \\ \hline
  259. \Opt{V} & Select verbose operation; reporting on progress \\ \hline
  260. \Opt{X} & Set the \emph{x}-coordinate for the plot origin on the page \\ \hline
  261. \Opt{Y} & Set the \emph{y}-coordinate for the plot origin on the page \\ \hline
  262. \Opt{a} & Associate aspatial data from OGR/GMT files with data columns \\ \hline
  263. \Opt{b} & Select binary input and/or output \\ \hline
  264. \Opt{c} & Specify the number of plot copies \\ \hline
  265. \Opt{f} & Specify the data format on a per column basis \\ \hline
  266. \Opt{g} & Identify data gaps based on supplied criteria \\ \hline
  267. \Opt{h} & Specify that input/output tables have header record(s) \\ \hline
  268. \Opt{i} & Specify which input columns to read \\ \hline
  269. \Opt{n} & Specify grid interpolation settings \\ \hline
  270. \Opt{o} & Specify which output columns to write \\ \hline
  271. \Opt{p} & Control perspective views for plots \\ \hline
  272. \Opt{r} & Set the grid registration to pixel [Default is gridline] \\ \hline
  273. \Opt{s} & Control output of records containing one or more NaNs \\ \hline
  274. \Opt{t} & Change layer PDF transparency \\ \hline
  275. \Opt{:} & Assume input geographic data are (\emph{lat,lon}) and not (\emph{lon,lat}) \\ \hline
  276. \end{tabular}
  277. \caption{The 24 standardized \gmt\ command line switches.}
  278. \label{tbl:switches}
  279. \end{table}
  280. \subsection{Data domain or map region: The \Opt{R} option}
  281. \index{\Opt{R} (set region)}
  282. \index{Region, specifying}
  283. \label{sec:R}
  284. \GMTfig[h]{GMT_-R}{The plot region can be specified in two different ways. (a) Extreme values
  285. for each dimension, or (b) coordinates of lower left and upper right corners.}
  286. The \Opt{R} option defines the map region or data domain of interest. It may be specified
  287. in one of three ways (Figure~\ref{fig:GMT_-R}):
  288. \begin{enumerate}
  289. \item \Opt{R}\emph{xmin}/\emph{xmax}/\emph{ymin}/\emph{ymax}. This is the standard way to specify
  290. Cartesian data domains and geographical regions when using map projections where meridians and
  291. parallels are rectilinear.
  292. \item \Opt{R}\emph{xlleft}/\emph{ylleft}/\emph{xuright}/\emph{yuright}\textbf{r}.
  293. This form is used with map projections that are oblique, making meridians and parallels poor
  294. choices for map boundaries. Here, we instead specify the lower left corner and upper right
  295. corner geographic coordinates, followed by the suffix \textbf{r}.
  296. \item \Opt{R}\emph{gridfile}. This will copy the domain settings found for the grid in specified
  297. file. Note that depending on the nature of the calling program, this mechanism will also set grid spacing
  298. and possibly the grid registration (see Section~\ref{sec:grid_registration}).
  299. \end{enumerate}
  300. For rectilinear projections the first two forms give identical results. Depending on the selected map
  301. projection (or the kind of expected input data), the boundary coordinates may take on three different
  302. formats:
  303. \begin{description}
  304. \item [Geographic coordinates:] These are longitudes and latitudes and may be given in decimal degrees (e.g., -123.45417)
  305. or in the
  306. [\PM]\emph{ddd}[:\emph{mm}[:\emph{ss}[\emph{.xxx}]]][\textbf{W}$|$\textbf{E}$|$\textbf{S}$|$\textbf{N}]
  307. format (e.g., 123:27:15W). Note that \Opt{Rg} and \Opt{Rd} are shorthands for ``global domain''
  308. \Opt{R}\emph{0}/\emph{360}/\emph{-90}/\emph{90}
  309. and \Opt{R}\emph{-180}/\emph{180}/\emph{-90}/\emph{90}, respectively.
  310. When used in conjunction with the Cartesian Linear Transformation (\Opt{Jx} or \Opt{JX}) ---which can be used
  311. to map floating point data, geographical coordinates, as well as time coordinates--- it is prudent to indicate
  312. that you are using geographical coordinates in one of the following ways:
  313. \begin{itemize}
  314. \item Use \Opt{Rg} or \Opt{Rd} to indicate the global domain.
  315. \item Use \Opt{Rg}\emph{xmin}/\emph{xmax}/\emph{ymin}/\emph{ymax} to indicate a limited geographic domain.
  316. \item Add \textbf{W}, \textbf{E}, \textbf{S}, or \textbf{N} to the coordinate limits or add the generic \textbf{D} or
  317. \textbf{G}. Example: \Opt{R}\emph{0}/\emph{360G}/\emph{-90}/\emph{90N}.
  318. \end{itemize}
  319. Alternatively, you may indicate geographical coordinates by supplying \Opt{fg}; see Section \ref{sec:fg_option}.
  320. \item [Calendar time coordinates:] These are absolute time coordinates referring to a Gregorian or ISO calendar.
  321. The general format is [\emph{date}]\textbf{T}[\emph{clock}], where \emph{date} must be in the
  322. \emph{yyyy}[\emph{-mm}[\emph{-dd}]] (year, month, day-of-month)
  323. or \emph{yyyy}[\emph{-jjj}] (year and day-of-year) for Gregorian calendars and
  324. \emph{yyyy}[\emph{-}\textbf{W}\emph{ww}[\emph{-d}]] (year, week, and
  325. day-of-week) for the ISO calendar. If no \emph{date} is given we assume the present day. Following the
  326. [optional] \emph{date} string we require the \textbf{T} flag.
  327. The optional \emph{clock} string is a 24-hour clock in \emph{hh}[\emph{:mm}[\emph{:ss}[\emph{.xxx}]]] format.
  328. If no \emph{clock} is given
  329. it implies 00:00:00, i.e., the start of the specified day.
  330. Note that not all of the specified entities need be present in the data. All calendar date-clock strings are internally represented as double precision seconds since
  331. proleptic Gregorian date Monday January 1 00:00:00 0001. Proleptic means we assume that the modern calendar
  332. can be extrapolated forward and backward; a year zero is used, and Gregory's reforms\footnote{The Gregorian Calendar
  333. is a revision of the Julian Calendar which was instituted in a papal bull by Pope Gregory XIII in 1582. The reason for the calendar
  334. change was to correct for drift in the dates of significant religious observations (primarily Easter) and to prevent further drift
  335. in the dates. The important effects of the change were (a) Drop 10 days from October 1582 to realign the Vernal Equinox with 21 March,
  336. (b) change leap year selection so that not all years ending in ``00'' are leap years, and (c) change the beginning of the year to
  337. 1 January from 25 March. Adoption of the new calendar was essentially immediate within Catholic countries. In the Protestant countries,
  338. where papal authority was neither recognized not appreciated, adoption came more slowly.
  339. England finally adopted the new calendar in 1752, with eleven days removed from September. The additional day came because the old and
  340. new calendars disagreed on whether 1700 was a leap year, so the Julian calendar had to be adjusted by one more day.} are extrapolated
  341. backward. Note that this is not historical.
  342. \item [Relative time coordinates:] These are coordinates which count seconds, hours, days or years relative to a
  343. given epoch. A combination of the parameters \textbf{TIME\_EPOCH} and
  344. \textbf{TIME\_UNIT} define the epoch and time unit. The parameter \textbf{TIME\_SYSTEM} provides a few shorthands for common combinations
  345. of epoch and unit, like \textbf{j2000} for days since noon of 1 Jan 2000.
  346. Denote relative time coordinates by appending the optional lower case
  347. \textbf{t} after the value. When it is otherwise apparent that the coordinate is relative time (for example by using
  348. the \Opt{f} switch), the \textbf{t} can be omitted.
  349. \item [Other coordinates:] These are simply any coordinates that are not related to geographic or calendar time or relative
  350. time and are
  351. expected to be simple floating point values such as [\PM]\emph{xxx.xxx}[E$|$e$|$D$|$d[\PM]xx], i.e., regular or exponential
  352. notations, with the enhancement to understand FORTRAN double precision output which may use D instead of E for exponents.
  353. These values are simply converted as they are to internal representation.\footnote{While
  354. UTM coordinates clearly refer to points on the Earth, in this context they are considered ``other''. Thus, when we
  355. refer to ``geographical'' coordinates herein we imply longitude, latitude.}
  356. \end{description}
  357. \subsection{Coordinate transformations and map projections: The \Opt{J} option}
  358. \index{\Opt{J} (set map projection)}
  359. \index{Map projections}
  360. This option selects the coordinate transformation or map projection. The general format is
  361. \begin{itemize}
  362. \item \Opt{J}$\delta$[\emph{parameters}/]\emph{scale}. Here, $\delta$ is a \emph{lower-case}
  363. letter of the alphabet that selects a particular map projection, the \emph{parameters}
  364. is zero or more slash-delimited projection parameter, and \emph{scale} is map scale given in
  365. distance units per degree or as 1:xxxxx.
  366. \item \Opt{J}$\Delta$[\emph{parameters}/]\emph{width}. Here, $\Delta$ is an \emph{upper-case}
  367. letter of the alphabet that selects a particular map projection, the \emph{parameters}
  368. is zero or more slash-delimited projection parameter, and \emph{width} is map width (map
  369. height is automatically computed from the implied map scale and region).
  370. \end{itemize}
  371. Since \GMT\ version 4.3.0, there is an alternative way to specify the projections: use the same abbreviation as in the mapping package \progname{Proj4}. The options thus either look like:
  372. \begin{itemize}
  373. \item \Opt{J}\emph{abbrev}/[\emph{parameters}/]\emph{scale}. Here, \textbf{abbrev} is a \emph{lower-case}
  374. abbreviation that selects a particular map projection, the \emph{parameters}
  375. is zero or more slash-delimited projection parameter, and \emph{scale} is map scale given in
  376. distance units per degree or as 1:xxxxx.
  377. \item \Opt{J}\emph{Abbrev}/[\emph{parameters}/]\emph{width}. Here, \textbf{Abbrev} is an \emph{capitalized} abbreviation that selects a particular map projection, the \emph{parameters}
  378. is zero or more slash-delimited projection parameter, and \emph{width} is map width (map
  379. height is automatically computed from the implied map scale and region).
  380. \end{itemize}
  381. \GMTfig[h]{GMT_-J}{The 30+ map projections and coordinate transformations available in \gmt.}
  382. The projections available in \GMT\ are presented in Figure~\ref{fig:GMT_-J}.
  383. For details on all \GMT\ projections and the required parameters, see the \GMTprog{psbasemap} man page.
  384. We will also show examples of every projection in the next Chapters, and a quick
  385. summary of projection syntax was given in Chapter~\ref{ch:3}.
  386. \subsection{Map frame and axes annotations: The \Opt{B} option}
  387. \index{\Opt{B} (set annotations and ticks)}
  388. \index{Tickmarks}
  389. \index{Annotations}
  390. \index{Gridlines}
  391. \index{Frame}
  392. \index{Basemap}
  393. \label{sec:timeaxis}
  394. This is by far the most complicated option in \GMT, but most examples
  395. of its usage are actually quite simple.
  396. Given as \Opt{B}[\textbf{p}$|$\textbf{s}]\emph{xinfo}[/\emph{yinfo}[/\emph{zinfo}]][:."title
  397. string":][\textbf{W}$|$\textbf{w}][\textbf{E}$|$\textbf{e}][\textbf{S}$|$\textbf{s}][\textbf{N}$|$\textbf{n}][\textbf{Z}$|$\textbf{z}[\textbf{+}]][\textbf{+g}\emph{fill}],
  398. this switch specifies map boundaries (or plot axes) to be plotted by using the
  399. selected information. The optional flag following \Opt{B} selects \textbf{p}(rimary) [Default] or \textbf{s}(econdary)
  400. axes information (mostly used for time axes annotations; see examples below).
  401. The components \emph{xinfo}, \emph{yinfo} and \emph{zinfo} are of the form \\
  402. \par \emph{info}[:"axis label":][:="prefix":][:,"unit label":] \\
  403. \noindent
  404. where \emph{info} is one or more concatenated substrings of the form
  405. [\textbf{t}]\emph{stride}[\emph{phase}][\textbf{u}]. The \textbf{t} flag sets the axis item of interest; the
  406. available items are listed in Table~\ref{tbl:inttype}.
  407. By default, all 4 map boundaries (or plot axes) are plotted (denoted \textbf{W}, \textbf{E}, \textbf{S},
  408. \textbf{N}). To change this selection, append the codes for those you want
  409. (e.g., \textbf{WSn}). In this example, the lower case \textbf{n} denotes to draw the axis and (major and minor) tick marks on the ``northern'' (top) edge of the plot. The upper case \textbf{WS} will annotate the ``western'' and ''southern'' axes with numerals and plot the optional axis label in addition to
  410. draw axis/tick-marks. The title, if given, will appear centered above the plot. Unit label or prefix may start with a
  411. leading -- to suppress the space between it and the annotation. Normally, equidistant annotations
  412. occur at multiples of \emph{stride}; you can phase-shift this by appending \emph{phase}, which can be a
  413. positive or negative number. Finally, note you may paint the canvas by appending the \textbf{+g}\emph{fill} modifier.
  414. \begin{table}[H]
  415. \centering
  416. \begin{tabular}{|c|l|} \hline
  417. \emph{Flag} & \emph{Description} \\ \hline
  418. \textbf{a} & Annotation and major tick spacing \\ \hline
  419. \textbf{f} & Minor tick spacing \\ \hline
  420. \textbf{g} & Grid line spacing \\ \hline
  421. \end{tabular}
  422. \caption{Interval type codes.}
  423. \label{tbl:inttype}
  424. \end{table}
  425. \noindent
  426. Note that the appearance of certain time annotations (month-, week-, and day-names) may be affected
  427. by the \textbf{TIME\_LANGUAGE}, \textbf{FORMAT\_TIME\_PRIMARY\_MAP}, and \textbf{FORMAT\_TIME\_SECONDARY\_MAP} settings.
  428. For automated plots the region may not always be the same and thus it can be difficult to determine the appropriate \emph{stride} in advance. Here \GMT{} provides the opportunity to autoselect the spacing between the major and minor ticks and the grid lines, by not specifying the \emph{stride} value. For example, \Opt{Bafg} will select all three spacings automatically for both axes. In case of longitude-latitude plots, this will keep the spacing the same on both axes. You can also use \Opt{Bafg/afg} to autoselect them separately.
  429. In the case of automatic spacing, when the \emph{stride} argument is omitted after \textbf{g}, the grid line spacing is chosen the same as the minor tick spacing; unless \textbf{g} is used in consort with \textbf{a}, then the grid lines are spaced the same as the annotations.
  430. The unit flag \textbf{u} can take on one of 18 codes; these are listed in Table~\ref{tbl:units}.
  431. Almost all of these units are time-axis specific. However, the \textbf{m} and \textbf{s} units will be
  432. interpreted as arc minutes and arc seconds, respectively, when a map projection is in effect.
  433. \begin{table}[h]
  434. \centering
  435. \begin{tabular}{|c|l|l|} \hline
  436. \emph{Flag} & \emph{Unit} & \emph{Description} \\ \hline
  437. \textbf{Y} & year & Plot using all 4 digits \\ \hline
  438. \textbf{y} & year & Plot using last 2 digits \\ \hline
  439. \textbf{O} & month & Format annotation using \textbf{FORMAT\_DATE\_MAP} \\ \hline
  440. \textbf{o} & month & Plot as 2-digit integer (1--12) \\ \hline
  441. \textbf{U} & ISO week & Format annotation using \textbf{FORMAT\_DATE\_MAP} \\ \hline
  442. \textbf{u} & ISO week & Plot as 2-digit integer (1--53) \\ \hline
  443. \textbf{r} & Gregorian week & 7-day stride from start of week (see \textbf{TIME\_WEEK\_START}) \\ \hline
  444. \textbf{K} & ISO weekday & Plot name of weekday in selected language \\ \hline
  445. \textbf{k} & weekday & Plot number of day in the week (1-7) (see \textbf{TIME\_WEEK\_START})\\ \hline
  446. \textbf{D} & date & Format annotation using \textbf{FORMAT\_DATE\_MAP} \\ \hline
  447. \textbf{d} & day & Plot day of month (1--31) or day of year (1--366) \\
  448. & & (see \bf{FORMAT\_DATE\_MAP} \\ \hline
  449. \textbf{R} & day & Same as \textbf{d}; annotations aligned with week (see \textbf{TIME\_WEEK\_START})\\ \hline
  450. \textbf{H} & hour & Format annotation using \textbf{FORMAT\_CLOCK\_MAP} \\ \hline
  451. \textbf{h} & hour & Plot as 2-digit integer (0--24) \\ \hline
  452. \textbf{M} & minute & Format annotation using \textbf{FORMAT\_CLOCK\_MAP} \\ \hline
  453. \textbf{m} & minute & Plot as 2-digit integer (0--60) \\ \hline
  454. \textbf{S} & seconds & Format annotation using \textbf{FORMAT\_CLOCK\_MAP} \\ \hline
  455. \textbf{s} & seconds & Plot as 2-digit integer (0--60) \\ \hline
  456. \end{tabular}
  457. \caption{Interval unit codes.}
  458. \label{tbl:units}
  459. \end{table}
  460. There may be two levels of annotations. Here, ``primary'' refers to the annotation
  461. that is closest to the axis (this is the primary annotation), while ``secondary'' refers to the secondary
  462. annotation that is plotted further from the axis. The examples below
  463. will clarify what is meant. Note that the terms ``primary'' and ``secondary'' do not reflect any hierarchical
  464. order of units: The ``primary'' annotation interval is usually smaller (e.g., days) while the
  465. ``secondary'' annotation interval typically is larger (e.g., months).
  466. \subsubsection{Geographic basemaps}
  467. Geographic basemaps may differ from regular plot axis in that some projections support a
  468. ``fancy'' form of axis and is selected by the \textbf{MAP\_FRAME\_TYPE} setting. The annotations
  469. will be formatted according to the \textbf{FORMAT\_GEO\_MAP} template and \textbf{MAP\_DEGREE\_SYMBOL}
  470. setting. A simple example of part of a basemap is shown in Figure~\ref{fig:GMT_-B_geo_1}.
  471. \GMTfig[h]{GMT_-B_geo_1}{Geographic map border using separate selections for annotation,
  472. frame, and grid intervals. Formatting of the annotation is controlled by
  473. the parameter \textbf{FORMAT\_GEO\_MAP} in your \protect\filename{gmt.conf}\ file.}
  474. The machinery for primary and secondary annotations introduced for time-series axes can
  475. also be utilized for geographic basemaps. This may be used to separate
  476. degree annotations from minutes- and seconds-annotations. For a more complicated basemap
  477. example using several sets of intervals, including different intervals and pen attributes
  478. for grid lines and grid crosses, see Figure~\ref{fig:GMT_-B_geo_2}.
  479. \GMTfig[h]{GMT_-B_geo_2}{Geographic map border with both primary (P) and secondary (S) components.}
  480. \subsubsection{Cartesian linear axes}
  481. \index{linear axes}
  482. \index{Axes!linear}
  483. For non-geographic axes, the \textbf{MAP\_FRAME\_TYPE} setting is implicitly set to plain. Other than that,
  484. cartesian linear axes are very similar to geographic axes. The annotation format may be controlled with
  485. the \textbf{FORMAT\_FLOAT\_OUT} parameter. By default, it is set to ``\%g'', which is a C language format statement
  486. for floating point numbers\footnote{Please consult the man page for \emph{printf} or any book on C .},
  487. and with this setting the various axis routines will automatically determine
  488. how many decimal points should be used by inspecting the \emph{stride} settings. If \textbf{FORMAT\_FLOAT\_OUT} is set
  489. to another format it will be used directly (.e.g, ``\%.2f'' for a fixed, two decimals format).
  490. Note that for these axes you may use the \emph{unit} setting to
  491. add a unit string to each annotation (see Figure~\ref{fig:GMT_-B_linear}).
  492. \GMTfig[h]{GMT_-B_linear}{Linear Cartesian projection axis. Long tickmarks accompany
  493. annotations, shorter ticks indicate frame interval. The axis label is
  494. optional. We used \Opt{R}0/12/0/1 \Opt{JX}3/0.4 \Opt{Ba}4\textbf{f}2\textbf{g}1:Frequency::,\protect\%:.}
  495. \subsubsection{Cartesian log$_{10}$ axes}
  496. \index{log$_{10}$ axes}
  497. \index{Logarithmic axes}
  498. \index{Axes!log$_{10}$}
  499. \index{Axes!Logarithmic}
  500. Due to the logarithmic nature of annotation spacings, the \emph{stride} parameter takes on specific
  501. meanings. The following concerns are specific to log axes:
  502. \begin{enumerate}
  503. \item \emph{stride} must be 1, 2, 3, or a negative integer $-n$. Annotations/ticks will
  504. then occur at 1, 1--2--5, or 1,2,3,4,...,9, respectively, for each magnitude range.
  505. For $-n$ the annotations will take place every \emph{n}'th magnitude.
  506. \item Append \textbf{l} to \emph{stride}. Then, log$_{10}$ of the annotation
  507. is plotted at every integer log$_{10}$ value (e.g., $x = 100$ will be annotated as ``2'')
  508. [Default annotates $x$ as is].
  509. \item Append \textbf{p} to \emph{stride}. Then, annotations appear as 10
  510. raised to log$_{10}$ of the value (e.g., $10^{-5}$).
  511. \end{enumerate}
  512. \GMTfig[h]{GMT_-B_log}{Logarithmic projection axis using separate values for annotation,
  513. frame, and grid intervals. (top) Here, we have chosen to annotate the actual
  514. values. Interval = 1 means every whole power of 10, 2 means 1, 2, 5 times
  515. powers of 10, and 3 means every 0.1 times powers of 10. We used
  516. \Opt{R}1/1000/0/1 \Opt{JX}3l/0.4 \Opt{Ba}1\textbf{f}2\textbf{g}3.
  517. (middle) Here, we have chosen to
  518. annotate log$_{10}$ of the actual values, with \Opt{Ba}1\textbf{f}2\textbf{g}3\textbf{l}.
  519. (bottom) We annotate every power of 10 using log$_{10}$ of the actual values
  520. as exponents, with \Opt{Ba}1\textbf{f}2\textbf{g}3\textbf{p}.}
  521. \index{Exponential axis}
  522. \index{Axes!exponential}
  523. \index{Axes!power}
  524. \subsubsection{Cartesian exponential axes}
  525. Normally, \emph{stride} will be used to create equidistant (in the user's unit) annotations
  526. or ticks, but because of the exponential nature of the axis, such annotations may converge
  527. on each other at one end of the axis. To avoid this problem, you can
  528. append \textbf{p }to \emph{stride}, and the annotation
  529. interval is expected to be in transformed units, yet the annotation itself will be plotted
  530. as un-transformed units. E.g., if \emph{stride} = 1 and power = 0.5 (i.e., sqrt),
  531. then equidistant annotations labeled 1, 4, 9, ... will appear.
  532. \GMTfig[h]{GMT_-B_pow}{Exponential or power projection axis. (top) Using an exponent of 0.5
  533. yields a $\sqrt{x}$ axis. Here, intervals refer to actual data values, in
  534. \Opt{R}0/100/0/1 \Opt{JX}3\textbf{p}0.5/0.4\ \Opt{Ba}20\textbf{f}10\textbf{g}5.
  535. (bottom) Here, intervals refer to projected values, although the annotation
  536. uses the corresponding unprojected values, as in \Opt{Ba}3\textbf{f}2\textbf{g}1\textbf{p}.}
  537. \index{Time axis}
  538. \index{Axes!time}
  539. \subsubsection{Cartesian time axes}
  540. What sets time axis apart from the other kinds of plot axes is the numerous ways in which we
  541. may want to tick and annotate the axis. Not only do we have both primary and secondary annotation
  542. items but we also have interval annotations versus tickmark annotations, numerous time units,
  543. and several ways in which to modify the plot. We will demonstrate this flexibility with a
  544. series of examples. While all our examples will only show a single $x$-axis, time-axis is supported for all axes.
  545. Our first example shows a time period of almost two months in Spring 2000. We want to annotate the month
  546. intervals as well as the date at the start of each week:
  547. \script{GMT_-B_time1}
  548. These commands result in Figure~\ref{fig:GMT_-B_time1}. Note the leading hyphen in the \textbf{FORMAT\_DATE\_MAP}
  549. removes leading zeros from calendar items (e.g., 02 becomes 2).
  550. \GMTfig[h]{GMT_-B_time1}{Cartesian time axis, example 1.}
  551. The next example shows two different ways to annotate an axis portraying 2 days in July 1969:
  552. \script{GMT_-B_time2}
  553. The lower example (Figure~\ref{fig:GMT_-B_time2}) chooses to annotate the weekdays (by specifying
  554. \textbf{a}1\textbf{K}) while the upper
  555. example choses dates (by specifying \textbf{a}1\textbf{D}). Note how the clock format only selects hours and minutes (no seconds) and
  556. the date format selects a month name, followed by one space and a two-digit day-of-month number.
  557. \GMTfig[h!]{GMT_-B_time2}{Cartesian time axis, example 2.}
  558. The third example presents two years, annotating both the years and every 3rd month.
  559. \script{GMT_-B_time3}
  560. Note that while the year annotation is centered on the 1-year interval, the month annotations must be centered
  561. on the corresponding month and \emph{not} the 3-month interval. The \textbf{FORMAT\_DATE\_MAP} selects month
  562. name only and \textbf{FORMAT\_TIME\_PRIMARY\_MAP} selects the 1-character, upper case abbreviation of month names using
  563. the current language (selected by \textbf{TIME\_LANGUAGE}).
  564. \GMTfig[h!]{GMT_-B_time3}{Cartesian time axis, example 3.}
  565. The fourth example (Figure~\ref{fig:GMT_-B_time4}) only shows a few hours of a day, using relative time by
  566. specifying \textbf{t} in the \Opt{R} option while the \textbf{TIME\_UNIT} is \textbf{d} (for days).
  567. We select both primary and
  568. secondary annotations, ask for a 12-hour clock, and let time go from right to left:
  569. \script{GMT_-B_time4}
  570. \GMTfig[h!]{GMT_-B_time4}{Cartesian time axis, example 4.}
  571. The fifth example shows a few weeks of time (Figure~\ref{fig:GMT_-B_time5}). The lower axis shows ISO weeks with
  572. week numbers and abbreviated names of the weekdays. The upper uses Gregorian weeks (which start at the day chosen
  573. by \textbf{TIME\_WEEK\_START}); they do not have numbers.
  574. \script{GMT_-B_time5}
  575. \GMTfig[h!]{GMT_-B_time5}{Cartesian time axis, example 5.}
  576. Our sixth example shows the first five months of 1996, and we have annotated each month with an abbreviated, upper case
  577. name and 2-digit year. Only the primary axes information is specified.
  578. \script{GMT_-B_time6}
  579. \GMTfig[h!]{GMT_-B_time6}{Cartesian time axis, example 6.}
  580. Our seventh and final example illustrates annotation of year-days. Unless we specify the formatting with a leading hyphen
  581. in \textbf{FORMAT\_DATE\_MAP} we get 3-digit integer days. Note that in order to have the two years
  582. annotated we need to allow for the annotation of small fractional intervals; normally such truncated interval must
  583. be at least half of a full interval.
  584. \script{GMT_-B_time7}
  585. \GMTfig[h!]{GMT_-B_time7}{Cartesian time axis, example 7.}
  586. \index{Custom axis}
  587. \index{Axes!custom}
  588. \subsubsection{Custom axes}
  589. \label{sec:custaxes}
  590. Irregularly spaced annotations or annotations based on look-up tables can be implemented using
  591. the \emph{custom} annotation mechanism. Here, we given the \textbf{c} (custom) type to the \Opt{B}
  592. option followed by a filename that contains the annotations (and or tick/grid-lines) for one axis.
  593. The file can contain any number of comments (lines starting with \#) and any number of records of
  594. the format
  595. \\
  596. \emph{coord}\quad \emph{type}\quad [\emph{label}]
  597. \\
  598. The \emph{coord} is the location of the desired annotation, tick, or grid-line, whereas
  599. \emph{type} is a string composed of letters from \textbf{a} (annotation), \textbf{i} interval
  600. annotation, \textbf{f} frame tick, and \textbf{g} gridline. You must use either \textbf{a} or \textbf{i}
  601. within one file; no mixing is allowed. The coordinates should be arranged in increasing order.
  602. If \emph{label} is given it replaces the normal
  603. annotation based on the \emph{coord} value. Our last example shows such a custom basemap
  604. with an interval annotations on the \emph{x}-axis and irregular annotations on the \emph{y}-axis.
  605. \script{GMT_-B_custom}
  606. \GMTfig[h!]{GMT_-B_custom}{Custom and irregular annotations, tick-marks, and gridlines.}
  607. \subsection{Portrait plot orientation: The \Opt{P} option}
  608. \index{Orientation!of plot}
  609. \index{Plot!orientation}
  610. \index{Landscape orientation}
  611. \index{Orientation!landscape}
  612. \index{Portrait orientation \Opt{P}}
  613. \index{Orientation!portrait \Opt{P}}
  614. \index{\Opt{P} (portrait orientation)}
  615. \GMTfig[h]{GMT_-P}{Users can specify Landscape [Default] or Portrait (\Opt{P}) orientation.}
  616. \Opt{P} selects Portrait plotting mode\footnote{For historical reasons, the \GMT\
  617. Default is Landscape, see \GMTprog{gmt.conf} to change this.}. In general,
  618. a plot has an \emph{x}-axis increasing from left to
  619. right and a \emph{y}-axis increasing from bottom to top. If the
  620. paper is turned so that the long dimension of the paper is
  621. parallel to the \emph{x}-axis then the plot is said to have
  622. \emph{Landscape} orientation. If the long dimension of
  623. the paper parallels the \emph{y}-axis the orientation is called
  624. \emph{Portrait} (think of taking pictures with a camera
  625. and these words make sense). The
  626. default Landscape orientation is obtained by translating the origin in the
  627. \emph{x}-direction (by the width of the chosen paper \textbf{PAPER\_MEDIA)} and then rotating the
  628. coordinate system counterclockwise by 90\DS. By default the \textbf{PS\_MEDIA} is
  629. set to Letter (or A4 if SI is chosen); this value must be changed
  630. when using different media, such as 11" x 17" or large format plotters
  631. (Figure~\ref{fig:GMT_-P}).
  632. \subsection{Plot overlays: The \Opt{K} \Opt{O} options}
  633. \index{Overlay plot \Opt{O} \Opt{K}}
  634. \index{Plot!overlay \Opt{O} \Opt{K}}
  635. \index{Plot!continue \Opt{O} \Opt{K}}
  636. \index{\Opt{K} (continue plot)}
  637. \index{\Opt{O} (overlay plot)}
  638. \GMTfig[h]{GMT_-OK}{A final \PS\ file consists of any number of individual pieces.}
  639. The \Opt{K} and \Opt{O} options control the generation of \PS\ code for multiple
  640. overlay plots. All \PS\ files must have a header (for initializations),
  641. a body (drawing the figure), and a trailer (printing it out) (see
  642. Figure~\ref{fig:GMT_-OK}). Thus,
  643. when overlaying several \GMT\ plots we must make sure that the first plot
  644. call omits the trailer, that all intermediate calls omit both header and
  645. trailer, and that the final overlay omits the header.
  646. \Opt{K} omits the trailer which implies that more \PS\ code will be appended
  647. later [Default terminates the plot system]. \Opt{O} selects Overlay plot
  648. mode and omits the header information [Default initializes a new plot system].
  649. Most unexpected results for multiple overlay plots can be traced to the
  650. incorrect use of these options. If you run only one plot
  651. program, ignore both the \Opt{O} and \Opt{K} options; they are
  652. only used when stacking plots.
  653. \subsection{Timestamps on plots: The \Opt{U} option}
  654. \index{\Opt{U} (plot timestamp)}
  655. \index{Timestamp}
  656. \index{UNIX@\UNIX!timestamp}
  657. \Opt{U} draws \UNIX\ System time stamp. Optionally, append an arbitrary
  658. text string (surrounded by double quotes), or the code \textbf{c}, which will
  659. plot the current command string (Figure~\ref{fig:GMT_-U}).
  660. \GMTfig[h]{GMT_-U}{The \Opt{U} option makes it easy to ``date'' a plot.}
  661. \subsection{Verbose feedback: The \Opt{V} option}
  662. \index{\Opt{V} (verbose mode)}
  663. \index{Verbose (\Opt{V})}
  664. \label{sec:verbose}
  665. \Opt{V} selects verbose mode, which will send progress reports to
  666. \emph{stderr} [Default runs ``silently'']. The interpretation of
  667. this option can be toggled by changing the default \textbf{GMT\_VERBOSE}.
  668. \subsection{Plot positioning and layout: The \Opt{X} \Opt{Y} options}
  669. \index{\Opt{X} (shift plot in $x$)}
  670. \index{\Opt{Y} (shift plot in $y$)}
  671. \index{Plot!offset}
  672. \index{Offset, plot}
  673. \GMTfig[h]{GMT_-XY}{Plot origin can be translated freely with \Opt{X} \Opt{Y}.}
  674. \Opt{X} and \Opt{Y} shift origin of plot by (\emph{xoff},\emph{yoff})
  675. inches (Default is (\textbf{MAP\_ORIGIN\_X}, \textbf{MAP\_ORIGIN\_Y}) for new plots\footnote{Ensures that
  676. boundary annotations do not fall off the page.} and (0,0) for overlays (\Opt{O})).
  677. By default, all translations are relative to the previous origin
  678. (see Figure~\ref{fig:GMT_-XY}). Supply offset as \textbf{c} to center the
  679. plot in that direction relative to the page margin.
  680. Absolute translations (i.e., relative to a fixed point (0,0) at the
  681. lower left corner of the paper) can be achieve by prepending ``a''
  682. to the offsets. Subsequent overlays will be co-registered with the
  683. previous plot unless the origin is shifted using these options.
  684. The offsets are measured in the current coordinates system (which can
  685. be rotated using the initial \Opt{P} option; subsequent \Opt{P} options
  686. for overlays are ignored).
  687. \subsection{OGR/GMT GIS i/o: The \Opt{a} option}
  688. \index{Table!GIS}
  689. \index{Table!OGR}
  690. \index{GIS tables}
  691. \index{OGR/GIS tables}
  692. \index{Input!aspatial \Opt{a}}
  693. \index{\Opt{a} (process aspatial data)}
  694. \GMT\ relies on external tools to translate geospatial files such as shapefiles
  695. into a format we can read. The tool \progname{ogr2ogr} in the GDAL package can do such
  696. translations and preserve the aspatial metadata via a new OGR/GMT format
  697. specification (See Appendix Q). For this to be useful we need a mechanism
  698. to associate certain metadata values with required input and output columns expected
  699. by \GMT\ programs. The \Opt{a} option allows you to supply one or more
  700. comma-separated associations \emph{col=name}, where
  701. \emph{name} is the name of an aspatial attribute field in a OGR/GMT file
  702. and whose value we wish to as data input for column \emph{col}. The
  703. given aspatial field thus replaces any other value already set. Note
  704. that \emph{col = 0} is the first data columns. Note that if no aspatial attributes
  705. are needed then the \Opt{a} option is not needed -- \GMT\ will still process
  706. and read such data files.
  707. \subsubsection{OGR/GMT input with \Opt{a} option}
  708. If you need to populate GMT data columns with (constant) values specified by aspatial
  709. attributes, use \Opt{a} and append any number of comma-separated \emph{col=name}
  710. associations. E.g., \emph{2=depth} will read the spatial \emph{x,y} columns from the
  711. file and add a third (\emph{z}) column based on the value of the aspatial field called
  712. \emph{depth}. You can also associate aspatial fields with other settings such as
  713. labels, fill colors, pens, and values used to look-up colors. Do so by letting
  714. the \emph{col} value be one of \textbf{D}, \textbf{G}, \textbf{L}, \textbf{T}, \textbf{W}, or \textbf{Z}. This
  715. works analogously to how standard multi-segment files can pass such options via
  716. its segment headers (See Appendix B).
  717. \subsubsection{OGR/GMT output with \Opt{a} option}
  718. You can also make \GMT\ table-writing tools output the OGR/GMT format directly.
  719. Again, specify if certain \GMT\ data columns with constant values should be stored
  720. as aspatial metadata using the \emph{col=name}[:\emph{type}], where you can optionally
  721. specify what data type it should be (double, integer, string, logical, byte, or
  722. datetime) [double is default]. As for input, you can also use the special \emph{col}
  723. entries of \textbf{D}, \textbf{G}, \textbf{L}, \textbf{T}, \textbf{W}, or \textbf{Z} to have values stored
  724. as options in segment headers be used as the source for the name aspatial field.
  725. Finally, for output you must append +\textbf{g}\emph{geometry}, where \emph{geometry}
  726. can be any of [\textbf{M}]\textbf{POINT}$|$\textbf{LINE}$|$\textbf{POLY}; the \textbf{M} represent
  727. the multi-versions of these three geometries. Use upper-case +\textbf{G} to signal that
  728. you want to split any line or polygon features that straddle the Dateline.
  729. \subsection{Binary table i/o: The \Opt{b} option}
  730. \index{Table!binary}
  731. \index{Table!netCDF}
  732. \index{Binary tables}
  733. \index{NetCDF tables}
  734. \index{Input!binary \Opt{bi}}
  735. \index{Output!binary \Opt{bo}}
  736. \index{\Opt{bi} (select binary input)}
  737. \index{\Opt{bo} (select binary output)}
  738. All \GMT\ programs that accept table data input may read ASCII, native binary, or netCDF data.
  739. When using native binary data the user must be aware
  740. of the fact that \GMT\ has no way of determining the actual
  741. number of columns in the file. You must therefore pass that
  742. information to \GMT\ via the binary \Opt{bi}[\emph{n}]\textbf{t} option,
  743. where \emph{n} is the actual number of data columns and \textbf{t}
  744. must be one of \textbf{c} (signed 1-byte character), \textbf{u}
  745. (unsigned 1-byte character), \textbf{h} (signed 2-byte int), \textbf{H}
  746. (unsigned 2-byte int), \textbf{i} (signed 4-byte int), \textbf{I}
  747. (unsigned 4-byte int), \textbf{l} (signed 8-byte int), \textbf{K}
  748. (unsigned 8-byte int), \textbf{f} (4-byte single-precision float), and
  749. \textbf{d} (8-byte double-precision float). For a mixed-type data record
  750. you can concatenate several [\emph{n}]\textbf{t} combinations,
  751. separated by commas. You may append \textbf{w}
  752. to any of the items to force byte-swapping. Alternatively, append
  753. \textbf{+L}$|$\textbf{B} to indicate that the entire data file
  754. should be read or written as little- or big-endian, respectively.
  755. Here, \emph{n} is the number of each items in your binary file.
  756. Note that \emph{n} may be larger than \emph{m}, the number of
  757. columns that the \GMT\ program requires to do its task.
  758. If \emph{n} is not given then it defaults to \emph{m} and all columns
  759. are assumed to be of the single specified type \textbf{t} [\textbf{d} (double), if not set].
  760. If \emph{n} $<$ \emph{m} an error is generated.
  761. For binary output, use the \Opt{bo}[\emph{n}]\textbf{t} option; see \Opt{bi} for further
  762. details.
  763. Because of its meta data, reading netCDF tables (i.e., netCDF files containing 1-dimensional arrays)
  764. is quite a bit less complex than reading native binary files. When feeding netCDF tables to programs
  765. like \GMTprog{psxy}, the program will automatically recognize the format and read whatever amount of
  766. columns are needed for that program. To steer which columns are to be read, the user can
  767. append the suffix \textbf{?}\emph{var1}\textbf{/}\emph{var2}\textbf{/}\emph{...} to the netCDF file name,
  768. where \emph{var1}, \emph{var2}, etc.\
  769. are the names of the variables to be processed. No \Opt{bi} option is needed in this case.
  770. Currently, netCDF tables can only be input, not output.
  771. For more information, see Appendix~\ref{app:B}.
  772. \subsection{Number of Copies: The \Opt{c} option}
  773. \index{\Opt{c} (set \# of copies)}
  774. \index{Number of copies}
  775. The \Opt{c} option specifies the number of plot copies [Default is 1]. This
  776. value is embedded in the \PS\ file and will make a printer issue the chosen
  777. number of copies without respooling.
  778. \subsection{Data type selection: The \Opt{f} option}
  779. \label{sec:fg_option}
  780. \index{Table!format}
  781. \index{Input!format \Opt{fi}}
  782. \index{Output!format \Opt{fo}}
  783. \index{\Opt{fi} (set input format)}
  784. \index{\Opt{fo} (set output format)}
  785. When map projections are not required we must explicitly state
  786. what kind of data each input or output column contains. This is accomplished with
  787. the \Opt{f} option. Following an optional \textbf{i} (for input only) or \textbf{o} (for output
  788. only), we append a text string with information about each column (or range of columns) separated by commas.
  789. Each string starts with the column number (0 is first column) followed by either
  790. \textbf{x} (longitude), \textbf{y} (latitude), \textbf{T} (absolute calendar time) or \textbf{t} (relative time). If
  791. several consecutive columns have the same format you may specify a range of columns
  792. rather than a single column, i.e., 0--4 for the first 5 columns. For example, if our
  793. input file has geographic coordinates (latitude, longitude) with absolute calendar
  794. coordinates in the columns 3 and 4, we would specify \textbf{fi}0\textbf{y},1\textbf{x},3-4\textbf{T}. All other columns
  795. are assumed to have the default, floating point format and need not be set individually.
  796. The shorthand \Opt{f}[\textbf{i}$|$\textbf{o}]\textbf{g} means \Opt{f}[\textbf{i}$|$\textbf{o}]0x,1y (i.e., geographic coordinates).
  797. For more information, see Sections~\ref{sec:input data} and~\ref{sec:output data}.
  798. \subsection{Data gap detection: The \Opt{g} option}
  799. \index{\Opt{g} (activate data gap detection)}
  800. \label{sec:gap}
  801. \GMT\ has several mechanisms that can determine line segmentation. Typically, data segments are
  802. separated by multiple segment header records (see Appendix B). However, if key data
  803. columns contain a NaN we may also use that information to break lines into multiple
  804. segments. This behavior is modified by the parameter \textbf{IO\_NAN\_RECORDS} which
  805. by default is set to \emph{skip}, meaning such records are considered bad and simply
  806. skipped. If you wish such records to indicate a segment boundary then set this parameter
  807. to \emph{pass}. Finally, you may wish to indicate gaps based on the data values themselves.
  808. The \Opt{g} option is used to detect gaps based on one or more criteria (use \Opt{g+} if
  809. \emph{all} the criteria must be met; otherwise only one of the specified criteria needs
  810. to be met to signify a data gap). Gaps can be based on excessive jumps in the \emph{x}- or
  811. \emph{y}-coordinates (\Opt{gx} or \Opt{gy}), or on the distance between points (\Opt{gd}).
  812. Append the \emph{gap} distance and optionally a unit for actual distances.
  813. For geographic data the optional unit may be arc \textbf{d}egree, \textbf{m}inute, and \textbf{s}econd,
  814. or m\textbf{e}ter [Default], \textbf{f}eet, \textbf{k}ilometer, \textbf{M}iles, or \textbf{n}autical miles.
  815. For programs that map data to map coordinates you can optionally specify these criteria to apply to
  816. the projected coordinates (by using upper-case \Opt{gX}, \Opt{gY} or \Opt{gD}).
  817. In that case, choose from \textbf{c}entimeter, \textbf{i}nch or \textbf{p}oint
  818. [Default unit is controlled by \textbf{PROJ\_LENGTH\_UNIT}].
  819. Note: For \Opt{gx} or \Opt{gy} with time data the unit is instead controlled by \textbf{TIME\_UNIT}.
  820. \subsection{Header data records: The \Opt{h} option}
  821. \index{\Opt{h} (header records)}
  822. \index{Header records \Opt{h}}
  823. \label{sec:header}
  824. The \Opt{h}[\textbf{i}$|$\textbf{o}][\emph{n\_recs}] option lets \GMT\ know that input file(s) have
  825. one [Default] or more header records. If there are more than one header
  826. record you must specify the number after the \Opt{h} option, e.g., \Opt{h}4. The
  827. default number of header records if \Opt{h} is used is one of the many parameters
  828. in the \filename{gmt.conf} file (\textbf{IO\_N\_HEADER\_RECS}, by default 1),
  829. but can be overridden by \Opt{h}\emph{n\_header\_recs}.
  830. Note that blank lines and records that be start with the character \# are
  831. automatically skipped. Normally, programs that both read and write tables will
  832. output the header records that are found on input. Use \Opt{hi} to suppress the
  833. writing of header records. Use \Opt{ho} to tell programs to output a header record
  834. identifying each data column.
  835. When \Opt{b} is used to indicate binary data the \Opt{h} takes on a slightly different meaning.
  836. Now, the \emph{n\_recs} argument is taken to mean how many \emph{bytes} should be
  837. skipped (on input) or padded with the space character (on output).
  838. \subsection{Input columns selection: The \Opt{i} option}
  839. \index{\Opt{i} (Input columns selection)}
  840. \index{Columns selection \Opt{i}}
  841. \label{sec:incols}
  842. The \Opt{i}\emph{columns} option allows you to specify which
  843. input file data columns to use and it what order. By default, \GMT\ will
  844. read all the data columns in the file, starting with the first column (0).
  845. Using \Opt{i} modifies that process. For instance, to use the 4th, 7th, and
  846. 3rd data column as the required \emph{x,y,z} to \GMTprog{blockmean} you would
  847. specify \Opt{i}3,6,2 (since 0 is the first column). The chosen data columns
  848. will be used as is. Optionally, you can specify that input columns should be
  849. transformed according to a linear or logarithmic conversion. Do so by appending
  850. [\textbf{l}][\textbf{s}\emph{scale}][\textbf{o}\emph{offset}] to each column (or range
  851. of columns). All items are optional: The \textbf{l} implies we should first take
  852. $\log_{10}$ of the data [leave as is]. Next, we may scale the result by the given \emph{scale} [1].
  853. Finally, we add in the specified \emph{offset} [0].
  854. \subsection{Grid interpolation parameters: The \Opt{n} option}
  855. \index{\Opt{n} (Grid resampling parameters)}
  856. \index{Resampling \Opt{n}}
  857. \label{sec:resample}
  858. The \Opt{n}\emph{type} option controls parameters
  859. used for 2-D grids resampling. You can select the type
  860. of spline used (\Opt{nb} for B-spline smoothing, \Opt{nc} for bicubic [Default],
  861. \Opt{nl} for bilinear, or \Opt{nn} for nearest-node value).
  862. For programs that support it, antialiasing is by default on;
  863. optionally, append \textbf{+a} to switch off antialiasing.
  864. By default, boundary conditions are set according to the grid type and extent.
  865. Change boundary conditions by appending \textbf{+b}\emph{BC},
  866. where \emph{BC} is either \textbf{g} for geographic boundary conditions
  867. or one (or both) of \textbf{n} and \textbf{p} for natural or periodic boundary
  868. conditions, respectively. Append \textbf{x} or \textbf{y} to only apply the condition
  869. in one dimension. E.g., \Opt{nb+nxpy} would imply natural boundary conditions in
  870. the \emph{x} direction and periodic conditions in the \emph{y} direction.
  871. Finally, append \textbf{+t}\emph{threshold} to control
  872. how close to nodes with NaN the interpolation should go. A
  873. \emph{threshold} of 1.0 requires all (4 or 16) nodes involved in the
  874. interpolation to be non-NaN. 0.5 will interpolate about half way from a
  875. non-NaN value; 0.1 will go about 90\% of the way, etc.
  876. \subsection{Output columns selection: The \Opt{o} option}
  877. \index{\Opt{o} (Output columns selection)}
  878. \index{Columns selection \Opt{o}}
  879. \label{sec:outcols}
  880. The \Opt{o}\emph{columns} option allows you to specify which
  881. columns to write on output and it what order. By default, \GMT\ will
  882. write all the data columns produced by the program.
  883. Using \Opt{o} modifies that process. For instance, to write just the 4th and
  884. 2nd data column to the output you would use \Opt{o}3,1 (since 0 is the first column).
  885. \subsection{Perspective view: The \Opt{p} option}
  886. \index{\Opt{p} Perspective view}
  887. \index{Perspective view}
  888. All plotting programs that normally produce a flat, two-dimensional illustration can
  889. be told to view this flat illustration from a particular vantage point, resulting in
  890. a perspective view. You can select perspective view with the \Opt{p} option by setting
  891. the azimuth and elevation of the viewpoint [Default is 180/90].
  892. When \Opt{p} is used in consort with \Opt{Jz} or \Opt{JZ}, a third value can be appended which indicates
  893. at which \emph{z}-level all 2D material, like the plot frame, is plotted (in perspective)
  894. [Default is at the bottom of the z-axis].
  895. For frames used for animation, you may want to append \textbf{+} to fix the center
  896. of your data domain (or specify a particular world coordinate point with \textbf{+w}\emph{lon0/lat}[\emph{z}])
  897. which will project to the center of your page size (or you may specify the coordinates
  898. of the \emph{projected} view point with \textbf{+v}\emph{x0/y0}.
  899. When \Opt{p} is used without any further arguments, the values from the last use of \Opt{p} in a previous \GMT\
  900. command will be used.
  901. \subsection{Grid registration: The \Opt{r} option}
  902. \index{\Opt{r} Grid registration}
  903. \index{grid file!registration|(}
  904. \label{sec:grid_registration}
  905. All 2-D grids in \GMT\ have their nodes organized in one of two ways, known
  906. as \emph{gridline}- and \emph{pixel} registration. The \GMT\ default is
  907. gridline registration; programs that allow for the creation of grids can
  908. use the \Opt{r} option to select pixel registration instead.
  909. \subsubsection{Gridline registration}
  910. \index{grid file!registration!grid line|(}
  911. In this registration, the nodes are centered on the grid line
  912. intersections and the data points represent the average value
  913. in a cell of dimensions ($x_{inc} \cdot y_{inc}$) centered on each
  914. node (Figure~\ref{fig:GMT_registration}).
  915. In the case of grid line registration the number of nodes are
  916. related to region and grid spacing by \\
  917. \[ \begin{array}{ccl}
  918. nx & = & (x_{max} - x_{min}) / x_{inc} + 1 \\
  919. ny & = & (y_{max} - y_{min}) / y_{inc} + 1
  920. \end{array} \]
  921. which for the example in Figure~\ref{fig:GMT_registration} yields $nx = ny = 4$.
  922. \GMTfig[h]{GMT_registration}{Gridline- and pixel-registration of data nodes.}
  923. \index{grid file!registration!grid line|)}
  924. \subsubsection{Pixel registration}
  925. \index{grid file!registration!pixel|(}
  926. Here, the nodes are centered in the grid cells, i.e., the areas
  927. between grid lines, and the data points represent the average
  928. values within each cell (Figure~\ref{fig:GMT_registration}.
  929. In the case of pixel registration the number of nodes are related
  930. to region and grid spacing by \\
  931. \[ \begin{array}{ccl}
  932. nx & = & (x_{max} - x_{min}) / x_{inc} \\
  933. ny & = & (y_{max} - y_{min}) / y_{inc}
  934. \end{array} \]
  935. Thus, given the same region (\Opt{R}) and grid spacing, the pixel-registered grids have one less
  936. column and one less row than the gridline-registered grids; here we
  937. find $nx = ny = 3$.
  938. \index{grid file!registration!pixel|)}
  939. \index{grid file!registration|)}
  940. \subsection{NaN-record treatment: The \Opt{s} option}
  941. \index{\Opt{s} NaN-record treatment}
  942. \index{NaN}
  943. We can use this option to suppress output for records whose \emph{z}-value equals NaN
  944. (by default we output all records). Alternatively, append \textbf{r} to reverse the suppression,
  945. i.e., only output the records whose \emph{z}-value equals NaN. Use \Opt{sa} to suppress
  946. output records where one or more fields (and not necessarily \emph{z}) equal NaN. Finally, you can supply
  947. a comma-separated list of all columns or column ranges to consider for this NaN test.
  948. \subsection{Layer PDF transparency: The \Opt{t} option}
  949. \index{\Opt{t} Layer PDF transparency}
  950. \index{Transparency}
  951. \label{sec:ltransp}
  952. While the \PS\ language does not support transparency, PDF does, and via \PS\ extensions
  953. one can manipulate the transparency levels of objects. The \Opt{t} option allows you to change
  954. the transparency level for the current overlay by appending a percentage in the 0--100 range; the
  955. default is 0, or opaque. Transparency may also be controlled
  956. on a feature by feature basis when setting color or fill (see section~\ref{sec:fill}).
  957. \subsection{Latitude/Longitude or Longitude/Latitude?: The \Opt{:} option}
  958. \index{\Opt{:} (input and/or output is $y,x$, not $x,y$)}
  959. \index{lat/lon input}
  960. For geographical data, the first column is expected to contain longitudes
  961. and the second to contain latitudes. To reverse this expectation you must
  962. apply the \Opt{:} option. Optionally, append \textbf{i} or \textbf{o} to restrict
  963. the effect to input or output only. Note that command line arguments that may take
  964. geographic coordinates (e.g., \Opt{R}) \emph{always} expect longitude before
  965. latitude. Also, geographical grids are expected to have the longitude as
  966. first (minor) dimension.
  967. \index{Command line!standardized options|)}%
  968. \section{Command line history}
  969. \label{sec:gmtcommands}
  970. \index{Command line!history}
  971. \index{History, command line}
  972. \GMT\ programs ``remember'' the standardized command line options
  973. (See Section~\ref{sec:stopt}) given during their previous invocations
  974. and this provides a shorthand notation for complex options.
  975. For example, if a basemap was created with an oblique Mercator
  976. projection, specified as
  977. \vspace{\baselineskip}
  978. \texttt{-Joc170W/25:30S/33W/56:20N/1:500000} \\
  979. \vspace{\baselineskip}
  980. \noindent
  981. then a subsequent \GMTprog{psxy} command to plot symbols only needs
  982. to state \Opt{J}o in order to activate the same projection. In
  983. contrast, note that \Opt{J} by itself will pick the most recently used projection.
  984. Previous commands are maintained in the file \filename{.gmtcomands},
  985. of which there will be one in each directory you run the programs
  986. from. This is handy if you create separate directories for
  987. separate projects since chances are that data manipulations
  988. and plotting for each project will share many of the same options.
  989. Note that an option spelled out on the command line will always
  990. override the last entry in the \filename{.gmtcomands} file and,
  991. if execution is successful, will replace this entry as the
  992. previous option argument in the \filename{.gmtcomands} file.
  993. If you call several \GMT\ modules piped together then \GMT\ cannot
  994. guarantee that the \filename{.gmtcomands} file is processed
  995. in the intended order from left to right. The only guarantee
  996. is that the file will not be clobbered since \GMT\ uses advisory
  997. file locking. The uncertainty in processing order makes the use
  998. of shorthands in pipes unreliable. We therefore recommend that you
  999. only use shorthands in single process command lines, and spell out
  1000. the full command option when using chains of commands connected with
  1001. pipes.
  1002. \section{Usage messages, syntax- and general error messages}
  1003. \index{Usage messages}
  1004. \index{Messages!usage}
  1005. \index{Syntax messages}
  1006. \index{Messages!syntax}
  1007. \index{Error messages}
  1008. \index{Messages!error}
  1009. Each program carries a usage message. If you enter the program
  1010. name without any arguments, the program will write the complete
  1011. usage message to standard error (your screen, unless you
  1012. redirect it). This message explains in detail what all the
  1013. valid arguments are. If you enter the program name followed
  1014. by a \emph{hyphen} (--) only you will get a shorter version
  1015. which only shows the command line syntax and no detailed
  1016. explanations. If you incorrectly specify an option or omit
  1017. a required option, the program will produce syntax errors and
  1018. explain what the correct syntax for these options should be.
  1019. If an error occurs during the running of a program, the
  1020. program will in some cases recognize this and give you an
  1021. error message. Usually this will also terminate the run.
  1022. The error messages generally begin with the name of the
  1023. program in which the error occurred; if you have several
  1024. programs piped together this tells you where the trouble is.
  1025. \section{Standard input or file, header records}
  1026. \index{Standard input}
  1027. \index{Input!standard}
  1028. \index{Header records \Opt{h}}
  1029. \index{Record, header \Opt{h}}
  1030. \index{\Opt{h} (header records)}
  1031. \index{GMT\_DATADIR}
  1032. Most of the programs which expect table data input can read
  1033. either standard input or input in one or several files.
  1034. These programs will try to read \emph{stdin} unless you type
  1035. the filename(s) on the command line without the above hyphens.
  1036. (If the program sees a hyphen, it reads the next character
  1037. as an instruction; if an argument begins without a hyphen,
  1038. it tries to open this argument as a filename).
  1039. This feature allows you to connect programs with pipes if
  1040. you like. If your input is ASCII and has one or more header
  1041. records that do not begin with \#, you must use the \Opt{h}
  1042. option (see Section~\ref{sec:header}).
  1043. ASCII files may in many cases also contain segment-headers
  1044. separating data segments. These are called ``multi-segment files''.
  1045. For binary table data the \Opt{h} option may specify how many bytes should
  1046. be skipped before the data section is reached.
  1047. Binary files may also contain segment-headers
  1048. separating data segments. These segment-headers are simply data records
  1049. whose fields are all set to NaN;
  1050. see Appendix~\ref{app:B} for complete documentation.
  1051. If filenames are given for reading, \GMT\ programs will first look for them in the
  1052. current directory. If the file is not found, the programs
  1053. will look in two other directories pointed to by environmental
  1054. parameters (if set). These are \textbf{GMT\_USERDIR} and
  1055. \textbf{GMT\_DATADIR}, and they may be set by the user to point to directories
  1056. that contain data sets of general use. Normally, the \textbf{GMT\_DATADIR} directory (or directories:
  1057. add multiple paths by separating them with colons (semi-colons under Windows)) will
  1058. hold data sets of a general nature (tables, grids), although a particular use
  1059. is to make available large grids accessible via the supplemental programs \GMTprog{grdraster}
  1060. or \GMTprog{img2grd}; see Appendix~\ref{app:A} for information
  1061. about these supplemental programs. The \textbf{GMT\_USERDIR} directory may hold miscellaneous
  1062. data sets more specific to the user; this directory also stores \GMT\ defaults and other
  1063. configuration files. Any directory that ends in a trailing slash (/) will be searched
  1064. recursively. Data sets that the user finds are often needed
  1065. may be placed in these directories, thus eliminating the need to specify
  1066. a full path to the file. Program output is always written to the
  1067. current directory unless a full path has been specified.
  1068. \section{Verbose operation}
  1069. \index{Verbose (\Opt{V})}
  1070. \index{\Opt{V} (verbose mode)}
  1071. Most of the programs take an optional \Opt{V} argument
  1072. which will run the program in the ``verbose'' mode (see Section~\ref{sec:verbose}).
  1073. Verbose will write to standard error information about the progress
  1074. of the operation you are running. Verbose reports things
  1075. such as counts of points read, names of data files
  1076. processed, convergence of iterative solutions, and the like.
  1077. Since these messages are written to \emph{stderr}, the
  1078. verbose talk remains separate from your data output.
  1079. You may optionally choose among five levels of \emph{verbosity}; each level
  1080. adds more messages with an increasing level of details. The levels are
  1081. \begin{description}
  1082. \item [0]: Complete silence, not even fatal error messages.
  1083. \item [1]: Fatal error messages.
  1084. \item [2]: Warnings and progress messages [Default].
  1085. \item [3]: Detailed progress messages.
  1086. \item [4]: Debugging messages.
  1087. \end{description}
  1088. The verbosity is cumulative, i.e., level 3 means all messages of levels 0--3
  1089. will be reported.
  1090. \section{Program output}
  1091. \index{Output!standard}
  1092. \index{Output!error}
  1093. \index{grid file!formats!netCDF}
  1094. Most programs write their results, including \PS\
  1095. plots, to standard output. The exceptions are those which may
  1096. create binary netCDF grid files such as \GMTprog{surface} (due to
  1097. the design of netCDF a filename must be provided; however,
  1098. alternative binary output formats allowing piping are available; see Section~\ref{sec:grdformats}).
  1099. With \UNIX\, you can redirect standard output to a file or pipe it
  1100. into another process. Error messages, usage messages, and
  1101. verbose comments are written to standard error in all cases.
  1102. You can use \UNIX\ to redirect standard error as well,
  1103. if you want to create a log file of what you are doing.
  1104. The syntax for redirection differ among the main shells (Bash and C-shell).
  1105. \section{Input data formats}
  1106. \label{sec:input data}
  1107. \index{Input!format}
  1108. Most of the time, \GMT\ will know what kind of $x$ and $y$ coordinates it is reading because you have selected
  1109. a particular coordinate transformation or map projection. However,
  1110. there may be times when you must explicitly specify what you are
  1111. providing as input using the \Opt{f} switch. When binary input data are expected (\Opt{bi}) you must
  1112. specify exactly the format of the records. However, for ASCII input there are numerous
  1113. ways to encode data coordinates (which may be separated by white-space or commas). Valid input data are generally
  1114. of the same form as the arguments to the \Opt{R} option (see Section~\ref{sec:R}), with additional
  1115. flexibility for calendar data. Geographical coordinates, for example, can be given in decimal degrees
  1116. (e.g., -123.45417) or in the
  1117. [\PM]\emph{ddd}[:\emph{mm}[:\emph{ss}[\emph{.xxx}]]][\textbf{W}$|$\textbf{E}$|$\textbf{S}$|$\textbf{N}]
  1118. format (e.g., 123:27:15W).
  1119. Because of the widespread use of incompatible and ambiguous formats, the processing of input
  1120. date components is guided by the template \textbf{FORMAT\_DATE\_IN} in your
  1121. \filename{gmt.conf} file; it is by default set to \emph{yyyy-mm-dd}. Y2K-challenged input data such as
  1122. 29/05/89 can be processed by setting \textbf{FORMAT\_DATE\_IN}
  1123. to dd/mm/yy. A complete description of possible formats is given in the \GMTprog{gmt.conf}
  1124. man page. The \emph{clock} string is more standardized but issues like 12- or 24-hour clocks complicate matters
  1125. as well as the presence or absence of delimiters between fields. Thus, the processing of input
  1126. clock coordinates is guided by the template \textbf{FORMAT\_CLOCK\_IN} which defaults to \emph{hh:mm:ss.xxx}.
  1127. \GMT\ programs that require a map projection argument will implicitly know what kind of data to expect, and the
  1128. input processing is done accordingly. However, some programs that simply report on minimum and maximum
  1129. values or just do a reformatting of the data will in general not know what to expect, and furthermore there is
  1130. no way for the programs to know what kind of data other columns (beyond the leading $x$ and $y$ columns) contain.
  1131. In such instances we must
  1132. explicitly tell \GMT\ that we are feeding it data in the specific geographic or calendar formats (floating point
  1133. data are assumed by default). We specify the data type via the \Opt{f} option (which sets both input and output
  1134. formats; use \Opt{fi} and \Opt{fo} to set input and output separately). For instance, to specify that the
  1135. the first two columns are longitude and latitude, and that the third column (e.g., $z$) is absolute calendar time, we add
  1136. \Opt{fi}0x,1y,2T to the command line. For more details, see the man page for the program you need to use.
  1137. \section{Output data formats}
  1138. \label{sec:output data}
  1139. \index{Output!format}
  1140. The numerical output from \GMT\ programs can be binary (when \Opt{bo} is used) or ASCII [Default].
  1141. In the latter case the issue of formatting becomes important. \GMT\ provides extensive
  1142. machinery for allowing just about any imaginable format to be used on output. Analogous to
  1143. the processing of input data, several templates guide the formatting process. These are
  1144. \textbf{FORMAT\_DATE\_OUT} and \textbf{FORMAT\_CLOCK\_OUT} for calendar-time coordinates,
  1145. \textbf{FORMAT\_GEO\_OUT} for geographical coordinates, and \textbf{FORMAT\_FLOAT\_OUT} for generic
  1146. floating point data. In addition, the user have control over how columns are separated via
  1147. the \textbf{FIELD\_SEPARATOR} parameter. Thus, as an example, it is possible to create limited
  1148. FORTRAN-style card records by setting \textbf{FORMAT\_FLOAT\_OUT} to \%7.3lf and \textbf{FIELD\_SEPARATOR} to
  1149. none [Default is tab].
  1150. \section{\PS\ features}
  1151. \index{PostScript@\PS!features}
  1152. \PS\ is a command language for driving graphics
  1153. devices such as laser printers. It is ASCII text which you
  1154. can read and edit as you wish (assuming you have some knowledge
  1155. of the syntax). We prefer this to binary metafile plot
  1156. systems since such files cannot easily be modified after they
  1157. have been created. \GMT\ programs also write many comments to
  1158. the plot file which make it easier for users to orient
  1159. themselves should they need to edit the file (e.g., \% Start
  1160. of x-axis)\footnote{To keep \PS\ files small, such comments are by default
  1161. turned off; see \textbf{PS\_COMMENTS} to enable them.}. All \GMT\ programs create \PS\ code by
  1162. calling the \textbf{PSL} plot library (The user may call these
  1163. functions from his/her own C or FORTRAN plot programs. See the
  1164. manual pages for \textbf{PSL} syntax). Although \GMT\ programs
  1165. can create very individualized plot code, there will always be
  1166. cases not covered by these programs. Some knowledge of
  1167. \PS\ will enable the user to add such features
  1168. directly into the plot file. By default, \GMT\ will produce
  1169. freeform \PS\ output with embedded printer directives. To
  1170. produce Encapsulated \PS\ (EPS) that can be imported into graphics programs such as
  1171. \progname{CorelDraw}, \progname{Illustrator} or \progname{InkScape} for further
  1172. embellishment, change the \textbf{PS\_MEDIA} setting in the \filename{gmt.conf}
  1173. file. See Appendix~\ref{app:C} and the \GMTprog{gmt.conf} man page for more details.
  1174. \section{Specifying pen attributes}
  1175. \index{Attributes!pen}%
  1176. \index{Pen!setting attributes}%
  1177. \label{sec:pen}
  1178. A pen in \GMT\ has three attributes: \emph{width}, \emph{color},
  1179. and \emph{style}. Most programs will accept pen attributes in
  1180. the form of an option argument, with commas separating the
  1181. given attributes, e.g.,
  1182. \vspace{\baselineskip}
  1183. \par \Opt{W}[\emph{width}[\textbf{c$|$i$|$p}]],[\emph{color}],[\emph{style}[\textbf{c$|$i$|$p$|$}]]\par
  1184. \begin{description}
  1185. \index{Pen!width}
  1186. \index{Width, pen}
  1187. \index{Attributes!pen!width}%
  1188. \item[$\rightarrow$]\emph{Width} is by default measured in points (1/72 of an inch).
  1189. Append \textbf{c}, \textbf{i}, or \textbf{p} to specify pen width in cm, inch, or points,
  1190. respectively.
  1191. Minimum-thickness pens can be achieved by
  1192. giving zero width, but the result is device-dependent. Finally, a few
  1193. predefined pen names can be used: default, faint, and \{thin, thick, fat\}[er$|$est],
  1194. and obese. Table~\ref{tbl:pennames} shows this list and the corresponding pen widths.
  1195. \begin{table}[h]
  1196. \centering
  1197. \begin{tabular}{|l|c||l|c|} \hline
  1198. \multicolumn{1}{|c|}{\emph{Pen name}} & \multicolumn{1}{c|}{\emph{Width}} & \multicolumn{1}{|c|}{\emph{Pen name}} & \multicolumn{1}{c|}{\emph{Width}} \\ \hline
  1199. faint & 0 & thicker & 1.5p \\ \hline
  1200. default & 0.25p & thickest & 2p \\ \hline
  1201. thinnest & 0.25p & fat & 3p \\ \hline
  1202. thinner & 0.50p & fatter & 6p \\ \hline
  1203. thin & 0.75p & fattest & 12p \\ \hline
  1204. thick & 1.0p & obese & 18p \\ \hline
  1205. \end{tabular}
  1206. \caption{\gmt\ predefined pen widths.}
  1207. \label{tbl:pennames}
  1208. \end{table}
  1209. \index{Pen!color}
  1210. \index{Color!pen}
  1211. \index{Color!RGB system}
  1212. \index{Color!HSV system}
  1213. \index{Color!CMYK system}
  1214. \index{Attributes!pen!color}%
  1215. \item[$\rightarrow$]The \emph{color} can be specified in five different ways:
  1216. \begin{enumerate}
  1217. \item Gray. Specify a \emph{gray} shade in the range 0--255 (linearly going from black [0] to white [255]).
  1218. \item RGB. Specify \emph{r}/\emph{g}/\emph{b}, each ranging from 0--255. Here 0/0/0 is black, 255/255/255 is white,
  1219. 255/0/0 is red, etc.
  1220. \item HSV. Specify \emph{hue}-\emph{saturation}-\emph{value}, with the former in the 0--360 degree range while the latter
  1221. two take on the range 0--1\footnote{For an overview of color systems such as HSV, see Appendix~\ref{app:I}.}.
  1222. \item CMYK. Specify \emph{cyan}/\emph{magenta}/\emph{yellow}/\emph{black}, each ranging from 0--100\%.
  1223. \item Name. Specify one of 663 valid color names. Use \progname{man gmtcolors} to list all valid names.
  1224. A very small yet versatile subset consists of the 29 choices \emph{white}, \emph{black}, and
  1225. [light$|$dark]\{\emph{red,
  1226. orange, yellow, green, cyan, blue, magenta, gray$|$grey, brown}\}.
  1227. The color names are case-insensitive, so mixed upper and lower case can be used (like
  1228. \emph{DarkGreen}).
  1229. \end{enumerate}
  1230. \index{Pen!style}
  1231. \index{Style, pen}
  1232. \index{Attributes!pen!style}%
  1233. \item[$\rightarrow$]The \emph{style} attribute controls the appearance
  1234. of the line. A ``.'' yields a dotted line, whereas a dashed pen is requested with ``-''.
  1235. Also combinations of dots and dashes, like ``.-'' for a dot-dashed line, are allowed.
  1236. The lengths of dots and dashes are scaled relative to the pen width (dots has
  1237. a length that equals the pen width while dashes are 8 times as long; gaps between
  1238. segments are 4 times the pen width).
  1239. For more detailed attributes including exact dimensions you may specify \emph{string}:\emph{offset},
  1240. where \emph{string} is a series of numbers separated by underscores.
  1241. These numbers represent a pattern by indicating the length of line
  1242. segments and the gap between segments. The \emph{offset} phase-shifts the
  1243. pattern from the beginning the line. For example, if you want a yellow line of width
  1244. 0.1~cm that alternates between long dashes (4 points), an 8 point gap, then
  1245. a 5 point dash, then another 8 point gap, with pattern offset by 2 points
  1246. from the origin, specify \Opt{W}0.1c,yellow,4\_8\_5\_8:2p.
  1247. Just as with pen width, the default style units are points, but can also be explicitly specified in cm, inch, or points
  1248. (see \emph{width} discussion above).
  1249. \end{description}
  1250. Table~\ref{tbl:penex} contains additional examples of pen specifications suitable for, say, \GMTprog{psxy}.
  1251. \begin{table}[h]
  1252. \centering
  1253. \begin{tabular}{|l|l|} \hline
  1254. \multicolumn{1}{|c|}{\emph{Pen example}} & \multicolumn{1}{c|}{\emph{Comment}} \\ \hline
  1255. \Opt{W}0.5p & 0.5 point wide line of default color and style \\ \hline
  1256. \Opt{W}green & Green line with default width and style \\ \hline
  1257. \Opt{W}thin,red,- & Dashed, thin red line \\ \hline
  1258. \Opt{W}fat,. & Fat dotted line with default color \\ \hline
  1259. \Opt{W}0.1c,120-1-1 & Green (in h-s-v) pen, 1~mm thick \\ \hline
  1260. \Opt{W}faint,100/0/0/0,..- & Very thin, cyan (in c/m/y/k), dot-dot-dashed line \\ \hline
  1261. \end{tabular}
  1262. \caption{A few examples of pen specifications. The default width, color and style are determined by the \textbf{MAP\_DEFAULT\_PEN} parameter.}
  1263. \label{tbl:penex}
  1264. \end{table}
  1265. In addition to these pen settings there are several \PS\ settings that can affect the appearance of lines.
  1266. These are controlled via the \GMT\ defaults settings \textbf{PS\_LINE\_CAP}, \textbf{PS\_LINE\_JOIN},
  1267. and \textbf{PS\_MITER\_LIMIT}. They determine how a line segment ending is rendered, be it at the
  1268. termination of a solid line or at the end of all dashed line segments making up a line, and how a
  1269. straight lines of finite thickness should behave when joined at a common point. By default, line segments
  1270. have rectangular ends, but this can change to give rounded ends. When \textbf{PS\_LINE\_CAP} is set to
  1271. round the a segment length of zero will appear as a circle. This can be used to created circular dotted
  1272. lines, and by manipulating the phase shift in the \emph{style} attribute and plotting the same line twice
  1273. one can even alternate the color of adjacent items. Figure~\ref{fig:GMT_linecap} shows various lines made
  1274. in this fashion. See the \GMTprog{gmt.conf} man page for more information.
  1275. \GMTfig[h]{GMT_linecap}{Line appearance can be varied by using \textbf{PS\_LINE\_CAP} and the \emph{style} attribute.}
  1276. \section{Specifying area fill attributes}
  1277. \index{Attributes!fill!color}%
  1278. \index{Attributes!fill!pattern}%
  1279. \index{Fill!attributes!color}%
  1280. \index{Fill!attributes!pattern}%
  1281. \index{Color!fill}%
  1282. \index{Pattern!fill}%
  1283. \index{Pattern!color}%
  1284. \index{\Opt{GP} \Opt{Gp}}
  1285. \label{sec:fill}
  1286. Many plotting programs will allow the user to draw filled polygons or
  1287. symbols. The fill specification may take two forms:
  1288. \vspace{\baselineskip}
  1289. \par \Opt{G}\emph{fill}\par
  1290. \par \Opt{Gp}\emph{dpi/pattern}[:\textbf{B}\emph{color}[\textbf{F}\emph{color}]]\par
  1291. \vspace{\baselineskip}
  1292. \noindent
  1293. \begin{description}
  1294. \item [fill:]
  1295. In the first case we may specify a \emph{gray} shade (0--255), RGB color
  1296. (\emph{r}/\emph{g}/\emph{b} all in the 0--255 range or in hexadecimal \emph{\#rrggbb}), HSV color (\emph{hue}-\emph{saturation}-\emph{value}
  1297. in the 0--360, 0--1, 0--1 range), CMYK color (\emph{cyan}/\emph{magenta}/\emph{yellow}/\emph{black},
  1298. each ranging from 0--100\%), or a valid color \emph{name}; in that respect it is similar
  1299. to specifying the pen color settings (see pen color discussion under Section~\ref{sec:pen}).
  1300. \item [pattern:]
  1301. The second form allows us to use a predefined bit-image pattern.
  1302. \emph{pattern} can either be a number in the range 1--90 or the name of a 1-,
  1303. 8-, or 24-bit Sun raster file. The former will result in one of the 90
  1304. predefined 64 x 64 bit-patterns provided with \GMT\ and reproduced in Appendix~\ref{app:E}.
  1305. The latter allows the user to create customized, repeating images using
  1306. standard Sun raster files\footnote{Convert other graphics formats to Sun ras format using
  1307. ImageMagick's \progname{convert} program.}. The \emph{dpi} parameter sets the resolution of
  1308. this image on the page; the area fill is thus made up of a series of these
  1309. ``tiles''. Specifying \emph{dpi} as 0 will result in highest resolution
  1310. obtainable given the present dpi setting in \filename{gmt.conf}.
  1311. By specifying upper case \Opt{GP} instead of \Opt{Gp} the image will be
  1312. bit-reversed, i.e., white and black areas will be interchanged (only applies
  1313. to 1-bit images or predefined bit-image patterns). For these patterns and
  1314. other 1-bit images one may specify alternative background and foreground
  1315. colors (by appending :\textbf{B}\emph{color}[\textbf{F}\emph{color}]) that will
  1316. replace the default white and black pixels, respectively. Setting one of the
  1317. fore- or background colors to -- yields a \emph{transparent} image where only the
  1318. back- \emph{or} foreground pixels will be painted.
  1319. \end{description}
  1320. Due to \PS\ implementation limitations the raster images used with
  1321. \Opt{G} must be less than 146 x 146 pixels in size; for larger images see
  1322. \GMTprog{psimage}. The format of Sun raster files is outlined in Appendix~\ref{app:B}.
  1323. Note that under \PS\ Level 1 the patterns are filled by using
  1324. the polygon as a \emph{clip path}. Complex clip paths may require
  1325. more memory than the \PS\ interpreter has been assigned.
  1326. There is therefore the possibility that some \PS\ interpreters
  1327. (especially those supplied with older laserwriters) will run out of memory
  1328. and abort. Should that occur we recommend that you use a regular gray-shade
  1329. fill instead of the patterns. Installing more memory in your printer
  1330. \emph{may or may not} solve the problem!
  1331. Table~\ref{tbl:fillex} contains a few examples of fill specifications.
  1332. \begin{table}[h]
  1333. \centering
  1334. \begin{tabular}{|l|l|} \hline
  1335. \multicolumn{1}{|c|}{\emph{Fill example}} & \multicolumn{1}{c|}{\emph{Comment}} \\ \hline
  1336. \Opt{G}128 & Solid gray \\ \hline
  1337. \Opt{G}127/255/0 & Chartreuse, R/G/B-style \\ \hline
  1338. \Opt{G}\#00ff00 & Green, hexadecimal RGB code \\ \hline
  1339. \Opt{G}25-0.86-0.82 & Chocolate, h-s-v -- style \\ \hline
  1340. \Opt{G}DarkOliveGreen1 & One of the named colors \\ \hline
  1341. \Opt{Gp}300/7 & Simple diagonal hachure pattern in b/w at 300 dpi\\ \hline
  1342. \Opt{Gp}300/7:Bred & Same, but with red lines on white \\ \hline
  1343. \Opt{Gp}300/7:BredF- & Now the gaps between red lines are transparent \\ \hline
  1344. \Opt{Gp}100/marble.ras & Using user image of marble as the fill at 100 dpi \\ \hline
  1345. \end{tabular}
  1346. \caption{A few examples of fill specifications.}
  1347. \label{tbl:fillex}
  1348. \end{table}
  1349. \index{Specifying fonts}
  1350. \index{Fonts, specifying}
  1351. \index{Font!attributes!size}%
  1352. \index{Font!attributes!type}%
  1353. \index{Font!attributes!fill}%
  1354. \index{Font!attributes!transparency}%
  1355. \index{Font!attributes!outline}%
  1356. \label{sec:fonts}
  1357. \section{Specifying Fonts}
  1358. The fonts used by \GMT\ are typically set indirectly via the \GMT\ defaults parameters.
  1359. However, some programs, like \GMTprog{pstext} may wish to have this information passed directly.
  1360. A font is specified by a comma-delimited attribute list of \emph{size}, \emph{fonttype} and \emph{fill}, each of which is optional.
  1361. The \emph{size} is the font size (usually in points) but \textbf{c}, \textbf{i} or \textbf{p} can be added to indicate a specific unit.
  1362. The \emph{fonttype} is the name (case sensitive!) of the font or its equivalent numerical ID (e.g., Helvetica-Bold or 1).
  1363. \emph{fill} specifies the gray shade, color or pattern of the text (see section~\ref{sec:fill} above).
  1364. Optionally, you may append \textbf{=}\emph{pen} to the \emph{fill} value in order to draw the text outline with the specified
  1365. \emph{pen};
  1366. if used you may optionally skip the filling of the text by setting \emph{fill} to \textbf{-}.
  1367. If any of the attributes is omitted their default or previous setting will be retained.
  1368. See Appendix G for a list of all fonts recognized by \GMT.
  1369. \section{Stroke, Fill and Font Transparency}
  1370. \index{Attributes!transparency}%
  1371. \index{Fill!attributes!transparency}%
  1372. \index{Font!attributes!transparency}%
  1373. \index{Color!transparency}%
  1374. \index{Pattern!transparency}%
  1375. \index{Pattern!transparency}%
  1376. \label{sec:transp}
  1377. The \PS\ language has no built-in mechanism for transparency. However, \PS\
  1378. extensions make it possible to request transparency, and tools that can render such extensions
  1379. will produce transparency effects. We specify transparency in percent: 0 is opaque [Default]
  1380. while 100 is fully transparent (i.e., nothing will show). As noted in section~\ref{sec:ltransp}, we can control
  1381. transparency on a layer-by-layer basis using the \Opt{t} option. However, we may also set
  1382. transparency as an attribute of stroke or fill (including for fonts) settings. Here, transparency is requested by
  1383. appending @\emph{transparency} to colors or pattern fills. The transparency \emph{mode} can be changed
  1384. by using the \GMT\ default parameter \textbf{PS\_TRANSPARENCY}; the default is Normal but you can choose among
  1385. Color, ColorBurn, ColorDodge, Darken, Difference, Exclusion, HardLight, Hue,
  1386. Lighten, Luminosity, Multiply, Normal, Overlay, Saturation, SoftLight, and Screen.
  1387. For more information, see for instance (search online for) the Adobe pdfmark Reference Manual.
  1388. Most printers and many \PS\ viewers can neither print nor show transparency. They will simply ignore your attempt to
  1389. create transparency and will plot any material as opaque. \progname{GhostScript} and its derivatives
  1390. such as \GMT's \GMTprog{ps2raster} support transparency (if compiled with the correct build option).
  1391. Note: If you use \progname{Acrobat Distiller} to create a PDF file you must first change some settings to make
  1392. transparency effective: change the parameter /AllowTransparency to true in your *.joboptions file.
  1393. \section{Color palette tables}
  1394. \index{Color!palette tables|(}
  1395. \index{CPT!file|(}
  1396. Several programs, such as those which read 2-D gridded data sets and create
  1397. colored images or shaded reliefs, need to be told what colors to use and
  1398. over what \emph{z}-range each color applies. This is the purpose of the
  1399. color palette table (CPT file). These files may also be used by \GMTprog{psxy}
  1400. and \GMTprog{psxyz} to plot color-filled symbols. For most applications, you
  1401. will simply create a CPT file using the tool \GMTprog{makecpt} which will
  1402. take an existing color table and resample it to fit your chosen data
  1403. range, or use \GMTprog{grd2cpt} to build a CPT file based on the data distribution
  1404. in one or more given grid files. However, in some situations you will need to make a CPT file by
  1405. hand or using text tools like \progname{awk} or \progname{perl}.
  1406. Color palette tables (CPT) comes in two flavors: (1) Those designed to work with
  1407. categorical data (e.g., data where interpolation of values is undefined) and
  1408. (2) those designed for regular, continuously-varying data. In both cases
  1409. the \emph{fill} information follows the format given in Section \ref{sec:fill}.
  1410. \subsection{Categorical CPT files}
  1411. Categorical data are information on which normal numerical operations are not
  1412. defined. As an example, consider various land classifications (desert, forest, glacier, etc.)
  1413. and it is clear that even if we assigned a numerical value to these categories (e.g.,
  1414. desert = 1, forest = 2, etc) it would be meaningless to compute average values (what would
  1415. 1.5 mean?). For such data a special format of the CPT files are provided. Here,
  1416. each category is assigned a unique key, a color or pattern, and an optional
  1417. label (usually the category name) marked by a leading semi-colon. Keys must be
  1418. monotonically increasing but do not need to be consecutive. The format is
  1419. \begin{center}
  1420. \begin{tabular}{lll}
  1421. key$_1$ & \emph{fill} & [;\emph{label}] \\
  1422. \ldots & & \\
  1423. key$_n$ & \emph{fill} & [;\emph{label}] \\
  1424. \end{tabular}
  1425. \end{center}
  1426. The \emph{fill} information follows the format given in Section \ref{sec:fill}.
  1427. While not always applicable to categorical data, the background color (for
  1428. \emph{key}-values $<$ \emph{key$_1$}), foreground color
  1429. (for \emph{key}-values $>$ \emph{key$_{n}$}), and not-a-number (NaN) color (for
  1430. \emph{key}-values = NaN) are all defined in the \filename{gmt.conf}
  1431. file, but can be overridden by the statements
  1432. \begin{center}
  1433. \begin{tabular}{llll}
  1434. B & R$_{back}$ & G$_{back}$ & B$_{back}$ \\
  1435. F & R$_{fore}$ & G$_{fore}$ & B$_{fore}$ \\
  1436. N & R$_{nan}$ & G$_{nan}$ & B$_{nan}$ \\
  1437. \end{tabular}
  1438. \end{center}
  1439. \subsection{Regular CPT files}
  1440. Suitable for continuous data types and allowing for color interpolations, the
  1441. format of the regular CPT files is:
  1442. \begin{center}
  1443. \begin{tabular}{llllll}
  1444. z$_0$ & Color$_{min}$ & z$_1$ & Color$_{max}$ & [\bf{A}] & [;\emph{label}] \\
  1445. \ldots & & & & & \\
  1446. z$_{n-2}$ & Color$_{min}$ & z$_{n-1}$ & Color$_{max}$ & [\textbf{A}] & [;\emph{label}] \\
  1447. \end{tabular}
  1448. \end{center}
  1449. Thus, for each ``\emph{z}-slice'', defined as the interval between two boundaries
  1450. (e.g., \emph{z$_0$} to \emph{z$_1$}), the color can be constant (by letting Color$_{max}$
  1451. = Color$_{min}$ or -) or a continuous, linear function of \emph{z}. If patterns are
  1452. used then the second (max) pattern must be set to -. The optional flag \textbf{A} is used to indicate annotation
  1453. of the color scale when plotted using \GMTprog{psscale}. The optional flag \textbf{A} may be \textbf{L},
  1454. \textbf{U}, or \textbf{B} to select annotation of the lower, upper, or both limits
  1455. of the particular $z$-slice, respectively. However, the standard \Opt{B} option can be used
  1456. by \GMTprog{psscale} to affect annotation and ticking of color scales. Just as other \GMT{} programs, the \emph{stride} can be omitted to determine the annotation and tick interval automatically (e.g., \Opt{Baf}). The optional
  1457. semicolon followed by a text label will make \GMTprog{psscale}, when used with the \Opt{L} option,
  1458. place the supplied label instead of formatted \emph{z}-values.
  1459. As for categorical tables, the background color (for \emph{z}-values $<$ \emph{z$_0$}), foreground color
  1460. (for \emph{z}-values $>$ \emph{z$_{n-1}$}), and not-a-number (NaN) color (for
  1461. \emph{z}-values = NaN) are all defined in the \filename{gmt.conf}
  1462. file, but can be overridden by the statements
  1463. \begin{center}
  1464. \begin{tabular}{ll}
  1465. B & Color$_{back}$ \\
  1466. F & Color$_{fore}$ \\
  1467. N & Color$_{nan}$ \\
  1468. \end{tabular}
  1469. \end{center}
  1470. \noindent
  1471. which can be inserted into the beginning or end of the CPT file. If
  1472. you prefer the HSV system, set the
  1473. \filename{gmt.conf} parameter accordingly and replace red, green,
  1474. blue with hue, saturation, value. Color palette tables that contain
  1475. gray-shades only may replace the \emph{r/g/b} triplets with a single gray-shade
  1476. in the 0--255 range. For CMYK, give four values in the 0--100 range.
  1477. Both the min and max color specifications in one \emph{z}-slice must use
  1478. the same color system, i.e., you cannot mix ``red'' and 0/255/100 on the
  1479. same line.
  1480. A few programs (i.e., those that plot polygons such as \GMTprog{grdview},
  1481. \GMTprog{psscale}, \GMTprog{psxy} and \GMTprog{psxyz}) can accept pattern fills instead
  1482. of gray-shades. You must specify the pattern as in Section~\ref{sec:fill} (no
  1483. leading \Opt{G} of course), and only the first pattern (for low $z$) is used (we cannot
  1484. interpolate between patterns).
  1485. Finally, some programs let you skip features whose $z$-slice in the CPT file has
  1486. gray-shades set to --. As an example, consider
  1487. \begin{center}
  1488. \begin{tabular}{lllll}
  1489. 30 & p200/16 & 80 & -- \\
  1490. 80 & -- & 100 & -- \\
  1491. 100 & 200/0/0 & 200/255/255 & 0 \\
  1492. 200 & yellow & 300 & green \\
  1493. \end{tabular}
  1494. \end{center}
  1495. \noindent
  1496. where slice $30 < z < 80$ is painted with pattern \# 16 at 200 dpi,
  1497. slice $80 < z < 100$ is skipped, slice $100 < z < 200$ is
  1498. painted in a range of dark red to yellow, whereas the slice $200 < z < 300$
  1499. will linearly yield colors from yellow to green, depending on the actual value
  1500. of $z$.
  1501. \index{Color!palette tables|)}
  1502. \index{CPT!file|)}
  1503. \index{Artificial illumination}
  1504. \index{Illumination, artificial}
  1505. \index{Shaded relief}
  1506. \index{Relief, shaded}
  1507. Some programs like \GMTprog{grdimage} and \GMTprog{grdview} apply artificial
  1508. illumination to achieve shaded relief maps. This is typically done
  1509. by finding the directional gradient in the direction of the artificial
  1510. light source and scaling the gradients to have approximately a normal
  1511. distribution on the interval [-1,+1]. These intensities are used
  1512. to add ``white'' or ``black'' to the color as defined by the \emph{z}-values
  1513. and the CPT file. An intensity of zero leaves the color unchanged.
  1514. Higher values will brighten the color, lower values will darken it,
  1515. all without changing the original hue of the color (see Appendix~\ref{app:I}
  1516. for more details). The illumination is decoupled from the data
  1517. grid file in that a separate grid file holding intensities in the
  1518. [-1,+1] range must be provided. Such intensity files can be
  1519. derived from the data grid using \GMTprog{grdgradient} and modified
  1520. with \GMTprog{grdhisteq}, but could equally well be a separate data set.
  1521. E.g., some side-scan sonar systems collect both bathymetry and
  1522. backscatter intensities, and one may want to use the latter information
  1523. to specify the illumination of the colors defined by the former.
  1524. Similarly, one could portray magnetic anomalies superimposed on
  1525. topography by using the former for colors and the latter for shading.
  1526. \section{The Drawing of Vectors}
  1527. \label{sec:vectors}
  1528. \index{Vectors!Cartesian}
  1529. \index{Vectors!Circular}
  1530. \index{Vectors!Great-circle}
  1531. \GMT\ supports plotting vectors in various forms. A vector is one of many symbols
  1532. that may be plotted by \GMTprog{psxy} and \GMTprog{psxyz}, is the main feature
  1533. in \GMTprog{grdvector}, and is indirectly used by other programs. All vectors plotted by \GMT\ consist of two separate
  1534. parts: The vector line (controlled by the chosen pen attributes) and the optional
  1535. vector head(s) (controlled by the chosen fill). We distinguish between three types of vectors:
  1536. \begin{enumerate}
  1537. \item Cartesian vectors are plotted as straight lines. They can be specified by a
  1538. start point and the direction and length (in map units) of the vector, or by its beginning and end point.
  1539. They may also be specified giving the azimuth and length (in km) instead.
  1540. \item Circular vectors are (as the name implies) drawn as circular arcs and can be used to indicate opening
  1541. angles. It accepts an origin, a radius, and the beginning and end angles.
  1542. \item Geo-vectors are drawn using great circle arcs. They are specified by a beginning point
  1543. and the azimuth and length (in km) of the vector, or by its beginning and end point.
  1544. \end{enumerate}
  1545. \GMTfig[h]{GMT_arrows}{Examples of Cartesian (left), circular (middle), and geo-vectors (right) for different
  1546. attribute specifications. Note that both full and half arrow-heads can be specified, as well as no head at all.}
  1547. There are numerous attributes you can modify, including how the vector should be justified relative
  1548. to the given point (beginning, center, or end), where heads (if any) should be placed, if the head should just be the
  1549. left or right half, if the vector attributes should shrink for vectors whose length are less than a given cutoff
  1550. length, and the size and shape of the head. These attributes are detailed further in the relevant manual pages.
  1551. \section{Character escape sequences}
  1552. \label{sec:escape}
  1553. \index{Characters!European}
  1554. \index{Characters!escape sequences}
  1555. \index{Characters!escape sequences!subscript}
  1556. \index{Characters!escape sequences!superscript}
  1557. \index{Characters!escape sequences!switch fonts}
  1558. \index{Characters!escape sequences!composite character}
  1559. \index{Characters!escape sequences!small caps}
  1560. \index{Characters!escape sequences!octal character}
  1561. \index{Escape sequences!characters}
  1562. \index{European characters}
  1563. \index{Text!European}
  1564. \index{Text!escape sequences}
  1565. \index{Text!subscript}
  1566. \index{Subscripts}
  1567. \index{Text!superscript}
  1568. \index{Superscripts}
  1569. \index{Characters!composite}
  1570. \index{Composite characters}
  1571. \index{Font!switching}
  1572. \index{Font!symbol}
  1573. \index{Symbol font}
  1574. \index{"@, printing}
  1575. \index{Small caps}
  1576. \index{Characters!octal}
  1577. \index{Octal characters}
  1578. For annotation labels or text strings plotted with \GMTprog{pstext},
  1579. \GMT\ provides several escape sequences that allow the user to
  1580. temporarily switch to the symbol font, turn on sub- or superscript,
  1581. etc., within words. These conditions are toggled on/off by the
  1582. escape sequence @\textbf{x}, where \textbf{x} can be one of several types.
  1583. The escape sequences recognized in \GMT\ are listed in Table~\ref{tbl:escape}.
  1584. Only one level of sub- or superscript is supported.
  1585. Note that under Windows the percent symbol indicates a batch variable,
  1586. hence you must use two percent-signs for each one required in the escape sequence for font switching.
  1587. \begin{table}[H]
  1588. \centering
  1589. \begin{tabular}{|l|l|} \hline
  1590. \multicolumn{1}{|c|}{\emph{Code}} & \multicolumn{1}{c|}{\emph{Effect}} \\ \hline
  1591. @\~ & Turns symbol font on or off \\ \hline
  1592. @+ & Turns superscript on or off \\ \hline
  1593. @- & Turns subscript on or off \\ \hline
  1594. @\# & Turns small caps on or off \\ \hline
  1595. @\_ & Turns underline on or off \\ \hline
  1596. @\%\emph{fontno}\% & Switches to another font; @\%\% resets to previous font \\ \hline
  1597. @:\emph{size}: & Switches to another font size; @:: resets to previous size \\ \hline
  1598. @;\emph{color}; & Switches to another font color; @;; resets to previous color \\ \hline
  1599. @! & Creates one composite character of the next two characters \\ \hline
  1600. @@ & Prints the @ sign itself \\ \hline
  1601. \end{tabular}
  1602. \caption{\gmt\ text escape sequences.}
  1603. \label{tbl:escape}
  1604. \end{table}
  1605. Shorthand notation for a few special European characters has also been
  1606. added (Table~\ref{tbl:scand}):
  1607. \index{Characters!escape sequences!European}
  1608. \index{European characters}
  1609. \begin{table}[H]
  1610. \centering
  1611. \begin{tabular}{|l|l||l|l|} \hline
  1612. \emph{Code} & \emph{Effect} & \emph{Code} & \emph{Effect} \\ \hline
  1613. @E & \AE & @e & \ae \\ \hline
  1614. @O & \O & @o & \o \\ \hline
  1615. @A & \AA & @a & \aa \\ \hline
  1616. @C & \c{C} & @c & \c{c} \\ \hline
  1617. @N & \~{N} & @n & \~{n} \\ \hline
  1618. @U & \"{U} & @u & \"{u} \\ \hline
  1619. @s & \ss & & \\ \hline
  1620. \end{tabular}
  1621. \caption{Shortcuts for some European characters.}
  1622. \label{tbl:scand}
  1623. \end{table}
  1624. \PS\ fonts used in \GMT\ may be re-encoded to include
  1625. several accented characters used in many European languages. To
  1626. access these, you must specify the full octal code $\backslash$xxx
  1627. allowed for your choice of character encodings
  1628. determined by the \textbf{PS\_CHAR\_ENCODING} setting described
  1629. in the \GMTprog{gmt.conf} man page. Only the special characters
  1630. belonging to a particular encoding will
  1631. be available. Many characters not directly available by
  1632. using single octal codes may be constructed with the composite
  1633. character mechanism @!.
  1634. Some examples of escape sequences and embedded octal codes in \GMT\ strings using the
  1635. Standard+ encoding:
  1636. \begin{tabbing}
  1637. XXX\=\verb|2@~p@~r@+2@+h@-0@- E\363tv\363s|XXXX \== XXXX\=text \kill
  1638. \>\verb|2@~p@~r@+2@+h@-0@- E\363tv\363s| \> = \> 2$\pi r^2h_0$ E\"{o}tv\"{o}s \\
  1639. \>\verb|10@+-3 @Angstr@om| \> = \> 10$^{-3}$ \AA ngstr\o m \\
  1640. \>\verb|Se@nor Gar@con| \> = \> Se\~{n}or Gar\c{c}on \\
  1641. \>\verb|M@!\305anoa stra@se| \> = \> M\={a}noa stra\ss e \\
  1642. \>\verb|A@\#cceleration@\# (ms@+-2@+)| \> = \> \sc{Acceleration (ms$^{-2}$)}
  1643. \end{tabbing}
  1644. The option in \GMTprog{pstext} to draw a rectangle surrounding the text
  1645. will not work for strings with escape sequences. A chart of characters
  1646. and their octal codes is given in Appendix~\ref{app:F}.
  1647. \section{Grid file format specifications}
  1648. \index{grid file!formats|(}
  1649. \index{grid file!formats!netCDF}
  1650. \index{grid file!formats!COARDS}
  1651. \index{grid file!formats!floats}
  1652. \index{grid file!formats!shorts}
  1653. \index{grid file!formats!unsigned char}
  1654. \index{grid file!formats!bits}
  1655. \index{grid file!formats!raster file}
  1656. \index{grid file!formats!custom format}
  1657. \label{sec:grdformats}
  1658. \GMT\ has the ability to read and write grids using more than one grid file
  1659. format (see Table \ref{tbl:grdformats} for supported format and their IDs). For
  1660. reading, \GMT\ will automatically determine the format of grid files, while for writing
  1661. you will normally have to append \emph{=ID} to the filename if you want \GMT\ to use a different format
  1662. than the default.
  1663. By default, \GMT\ will create new grid files using the \textbf{nf} format; however,
  1664. this behavior can be overridden by setting the \textbf{GRID\_FORMAT} defaults parameter
  1665. to any of the other recognized values (or by appending \emph{=ID}).
  1666. \GMT\ can also read netCDF grid files produced by other software packages, provided the grid files
  1667. satisfy the COARDS and Hadley Centre conventions for netCDF grids. Thus, products created under
  1668. those conventions (provided the grid is 2-, 3-, 4-, or 5-dimensional) can be read directly by \GMT\ and the netCDF grids
  1669. written by \GMT\ can be read by other programs that conform to those conventions. Three such programs are
  1670. \htmladdnormallink{\progname{ncview}}{http://meteora.ucsd.edu/~pierce/ncview_home_page.html},
  1671. \htmladdnormallink{\progname{Panoply}}{http://www.giss.nasa.gov/tools/panoply/}
  1672. and
  1673. \htmladdnormallink{\progname{ncBrowse}}{http://www.epic.noaa.gov/java/ncBrowse/}; others can be found
  1674. on the \htmladdnormallink{netCDF website}{http://www.unidata.ucar.edu/software/netcdf/software.html}.
  1675. In addition, users with some C-programming experience may add
  1676. their own read/write functions and link them with the \GMT\ library
  1677. to extend the number of predefined formats. Technical information
  1678. on this topic can be found in the source file \filename{gmt\_customio.c}.
  1679. Users who are considering this approach should contact the \GMT\ team.
  1680. \begin{table}[H]
  1681. \centering
  1682. \begin{tabular}{|l|l|} \hline
  1683. \multicolumn{1}{|c|}{\emph{ID}} & \multicolumn{1}{c|}{\emph{GMT 4 netCDF standard formats}} \\ \hline \hline
  1684. nb & GMT netCDF format (byte) (COARDS-compliant) \\ \hline
  1685. ns & GMT netCDF format (short) (COARDS-compliant) \\ \hline
  1686. ni & GMT netCDF format (int) (COARDS-compliant) \\ \hline
  1687. nf & GMT netCDF format (float) (COARDS-compliant) \\ \hline
  1688. nd & GMT netCDF format (double) (COARDS-compliant) \\ \hline \hline
  1689. \multicolumn{1}{|c|}{\emph{ID}} & \multicolumn{1}{c|}{\emph{GMT 3 netCDF legacy formats}} \\ \hline \hline
  1690. cb & GMT netCDF format (byte) (depreciated) \\ \hline
  1691. cs & GMT netCDF format (short) (depreciated) \\ \hline
  1692. ci & GMT netCDF format (int) (depreciated) \\ \hline
  1693. cf & GMT netCDF format (float) (depreciated) \\ \hline
  1694. cd & GMT netCDF format (double) (depreciated) \\ \hline \hline
  1695. \multicolumn{1}{|c|}{\emph{ID}} & \multicolumn{1}{c|}{\emph{GMT native binary formats}} \\ \hline \hline
  1696. bm & GMT native, C-binary format (bit-mask) \\ \hline
  1697. bb & GMT native, C-binary format (byte) \\ \hline
  1698. bs & GMT native, C-binary format (short) \\ \hline
  1699. bi & GMT native, C-binary format (int) \\ \hline
  1700. bf & GMT native, C-binary format (float) \\ \hline
  1701. bd & GMT native, C-binary format (double) \\ \hline \hline
  1702. \multicolumn{1}{|c|}{\emph{ID}} & \multicolumn{1}{c|}{\emph{Miscellaneous grid formats}} \\ \hline \hline
  1703. rb & SUN raster file format (8-bit standard) \\ \hline
  1704. rf & GEODAS grid format GRD98 (NGDC) \\ \hline
  1705. sf & Golden Software Surfer format 6 (float) \\ \hline
  1706. sd & Golden Software Surfer format 7 (double) \\ \hline
  1707. af & Atlantic Geoscience Center AGC (float) \\ \hline
  1708. ei & ESRI Arc/Info ASCII Grid Interchange format (integer) \\ \hline
  1709. ef & ESRI Arc/Info ASCII Grid Interchange format (float) \\ \hline
  1710. gd & Read-only via GDAL\footnote{Requires building \GMT\ with GDAL.} (float) \\ \hline
  1711. \end{tabular}
  1712. \caption{\gmt\ grid file formats.}
  1713. \label{tbl:grdformats}
  1714. \end{table}
  1715. Because some formats have limitations on the range of values they can store
  1716. it is sometimes necessary to provide more
  1717. than simply the name of the file and its ID on the command line. For instance,
  1718. a native short integer file may use a unique value to signify an empty node
  1719. or NaN, and the data may need translation and scaling prior to use.
  1720. Therefore, all \GMT\ programs that read or write grid files will decode
  1721. the given filename as follows:
  1722. \vspace{\baselineskip}
  1723. \par name[=\emph{ID}[/\emph{scale}/\emph{offset}[/\emph{nan}]]]\par
  1724. \vspace{\baselineskip}
  1725. \noindent
  1726. where everything in brackets is optional. If you are reading a grid
  1727. then no options are needed: just continue to pass
  1728. the name of the grid file. However, if you write another format you must
  1729. append the =\emph{ID} string, where \emph{ID} is the format code
  1730. listed above. In addition, should you want to (1) multiply the data by
  1731. a scale factor, and (2) add a constant offset you must append the
  1732. /\emph{scale}/\emph{offset} modifier. Finally, if you need to indicate
  1733. that a certain data value should be interpreted as a NaN (not-a-number)
  1734. you must append the /\emph{nan} suffix to the scaling string (it cannot
  1735. go by itself; note the nesting of the brackets!).
  1736. Some of the grid formats allow writing to standard output and reading
  1737. from standard input which means you can connect \GMT\ programs that
  1738. operate on grid files with pipes, thereby speeding up execution and
  1739. eliminating the need for large, intermediate grid files. You specify
  1740. standard input/output by leaving out the filename entirely.
  1741. That means the ``filename'' will begin with
  1742. ``=\emph{ID}\,'' since no \GMT\ netCDF format
  1743. allow piping (due to the design of netCDF).
  1744. Everything looks clearer after a few examples:
  1745. \begin{enumerate}
  1746. \item To write a native binary float grid file, specify the name as \filename{my\_file.f4=bf}.
  1747. \item To read a native short integer grid file, multiply the data by 10 and then
  1748. add 32000, but first let values that equal 32767 be set to NaN,
  1749. use the filename \filename{my\_file.i2=bs/10/32000/32767}.
  1750. \item To read a Golden Software ``surfer'' format 6 grid file, just pass the file name,
  1751. e.g., \filename{my\_surferfile.grd}.
  1752. \item To read a 8-bit standard Sun raster file (with values in the 0--255 range)
  1753. and convert it to a \PM 1 range, give the name as
  1754. \filename{rasterfile=rb/7.84313725e-3/-1} (i.e., 1/127.5).
  1755. \item To write a native binary short integer grid file to standard output after subtracting
  1756. 32000 and dividing its values by 10, give filename as \filename{=bs/0.1/-3200}.
  1757. \end{enumerate}
  1758. Programs that both read and/or write more than one grid file may
  1759. specify different formats and/or scaling for the files involved.
  1760. The only restriction with the embedded grid specification mechanism
  1761. is that no grid files may actually use the ``=''
  1762. character as part of their name (presumably, a small sacrifice).
  1763. \index{grid file!suffix}
  1764. One can also define special file suffixes to imply a specific file
  1765. format; this approach represents a more intuitive and user-friendly
  1766. way to specify the various file formats. The user may create a file
  1767. called \filename{.gmt\_io} in the current directory, home directory
  1768. or in the directory \filename{$\sim$/.gmt} and define any
  1769. number of custom formats. The following is an example of a
  1770. \filename{.gmt\_io} file:
  1771. \index{.gmt\_io}
  1772. \vspace{\baselineskip}
  1773. \noindent
  1774. \begin{tabbing}
  1775. MMM\=\# suffix \=format\_id \=scale \=offset \=NaNxxx\=Comments \kill
  1776. \>\# GMT i/o shorthand file \\
  1777. \>\# It can have any number of comment lines like this one anywhere \\
  1778. \>\# suffix \> format\_id \> scale \> offset \>NaN\>Comments \\
  1779. \>grd \> nf \> - \> - \> - \>Default format \\
  1780. \>b \> bf \> - \> - \> - \> Native binary floats \\
  1781. \>i2 \> bs \> - \> - \> 32767 \> 2-byte integers with NaN value \\
  1782. \>ras \> rb \> - \> - \> - \> Sun raster files \\
  1783. \>byte \> bb \> - \> - \> 255 \> Native binary 1-byte grids \\
  1784. \>bit \> bm \> - \> - \> - \> Native binary 0 or 1 grids \\
  1785. \>mask \> bm \> - \> - \> 0 \> Native binary 1 or NaN masks \\
  1786. \>faa \> bs \> 0.1 \> - \> 32767 \> Native binary gravity in 0.1 mGal
  1787. \end{tabbing}
  1788. These suffices can be anything that makes sense to the user. To
  1789. activate this mechanism, set parameter \textbf{IO\_GRIDFILE\_SHORTHAND} to TRUE in
  1790. your \filename{gmt.conf} file. Then, using the filename
  1791. \filename{stuff.i2} is equivalent to saying \filename{stuff.i2=bs/1/0/32767},
  1792. and the filename \filename{wet.mask} means wet.mask=bm/1/0/0. For a
  1793. file intended for masking, i.e., the nodes are either 1 or NaN,
  1794. the bit or mask format file may be as small as 1/32 the size of the
  1795. corresponding grid float format file.
  1796. \index{grid file!formats|)}
  1797. \section{Options for COARDS-compliant netCDF files}
  1798. \label{sec:netcdf}
  1799. \index{grid file!formats!netCDF|(}
  1800. \index{grid file!formats!COARDS|(}
  1801. When the netCDF file contains more than one 2-dimensional variable, \GMT\ programs
  1802. will load the first such variable in the file and ignore all others. Alternatively,
  1803. the user can select the
  1804. required variable by adding the suffix ``?\emph{varname}'' to the file name. For example,
  1805. to get information on the variable ``slp'' in file \filename{file.nc}, use:
  1806. \begin{verbatim}
  1807. grdinfo "file.nc?slp"
  1808. \end{verbatim}
  1809. Since COARDS-compliant netCDF files are the default, the additional suffix ``=nf'' can be omitted.
  1810. In case the named variable is 3-dimensional, \GMT\ will load the first (bottom) layer. If another
  1811. layer is required, either add ``[\emph{index}]'' or ``(\emph{level})'', where \emph{index} is
  1812. the index of the third (depth) variable (starting at 0 for the first layer) and \emph{level}
  1813. is the numerical value of the third (depth) variable associated with the requested layer.
  1814. To indicate the second layer of the 3-D variable ``slp'' use as file name: \filename{file.nc?slp[1]}.
  1815. When you supply the numerical value for the third variable using ``(\emph{level})'',
  1816. \GMT\ will pick the layer closest to that value. No interpolation is performed.
  1817. Note that the question mark, brackets and parentheses have special meanings on Unix-based platforms. Therefore,
  1818. you will need to either \emph{escape} these characters, by placing a backslash in front of them, or place the
  1819. whole file name plus modifiers between single quotes or double quotes.
  1820. A similar approach is followed for loading 4-dimensional grids. Consider a 4-dimensional grid with the following
  1821. variables:
  1822. \begin{verbatim}
  1823. lat(lat): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
  1824. lon(lon): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
  1825. depth(depth): 0, 10, 20, 30, 40, 50, 60, 70, 80, 90
  1826. time(time): 0, 12, 24, 36, 48
  1827. pressure(time,depth,lat,lon): (5000 values)
  1828. \end{verbatim}
  1829. To get information on the 10$\times$10 grid of pressure at depth 10 and at time 24, one would use:
  1830. \begin{verbatim}
  1831. grdinfo "file.nc?pressure[2,1]"
  1832. \end{verbatim}
  1833. or (only in case the coordinates increase linearly):
  1834. \begin{verbatim}
  1835. grdinfo "file.nc?pressure(24,10)"
  1836. \end{verbatim}
  1837. The COARDS conventions set restrictions on the names that can be used for the units of the variables
  1838. and coordinates. For example, the units of longitude and latitude are ``degrees\_east'' and ``degrees\_north'',
  1839. respectively. Here is an example of the header of a COARDS compliant netCDF file (to be obtained using
  1840. \progname{ncdump}):
  1841. \begin{verbatim}
  1842. netcdf M2_fes2004 {
  1843. dimensions:
  1844. lon = 2881 ;
  1845. lat = 1441 ;
  1846. variables:
  1847. float lon(lon) ;
  1848. lon:long_name = "longitude" ;
  1849. lon:units = "degrees_east" ;
  1850. lon:actual_range = 0., 360. ;
  1851. float lat(lat) ;
  1852. lat:long_name = "latitude" ;
  1853. lat:units = "degrees_north" ;
  1854. lat:actual_range = -90., 90. ;
  1855. short amp(lat, lon) ;
  1856. amp:long_name = "amplitude" ;
  1857. amp:unit = "m" ;
  1858. amp:scale_factor = 0.0001 ;
  1859. amp:add_offset = 3. ;
  1860. amp:_FillValue = -32768s ;
  1861. short pha(lat, lon) ;
  1862. pha:long_name = "phase" ;
  1863. pha:unit = "degrees" ;
  1864. pha:scale_factor = 0.01 ;
  1865. pha:_FillValue = -32768s ;
  1866. \end{verbatim}
  1867. This file contains two grids, which can be plotted separately using the names \filename{M2\_fes2004.nc?amp}
  1868. and \filename{M2\_fes2004.nc?pha}. The attributes \verb|long_name| and \verb|unit| for each variable are
  1869. combined in \GMT\ to a single unit string. For example, after reading the grid \verb|y_unit| equals
  1870. \verb|latitude [degrees_north]|. The same method can be used in reverse to set the proper variable names
  1871. and units when writing a grid. However, when the coordinates are set properly as geographical or time axes,
  1872. \GMT\ will take care of this. The user is, however, still responsible for setting the variable name and
  1873. unit of the z-coordinate. The default is simply ``z''.
  1874. \index{grid file!formats!netCDF|)}
  1875. \index{grid file!formats!COARDS|)}
  1876. \section{Options for grids and images read via GDAL}
  1877. \label{sec:GDAL}
  1878. \index{grid file!formats!GDAL|(}
  1879. If the support has been configured during installation, then \GMT\ can read a variety
  1880. of grid and image formats via GDAL. This extends the capability of \GMT\ to handle
  1881. data sets from a variety of sources.
  1882. \subsection{Reading multi-band images}
  1883. \GMTprog{grdimage} and \GMTprog{psimage} both lets the user select individual bands
  1884. in a multi-band image file and treats the result as an image (that is the values,
  1885. in the 0--255 range, are treated as colors, not data). To select individual bands
  1886. you use the \textbf{+b}{\it band-number} mechanism that must be appended to the image
  1887. filename. Here, {\it band-number} can be the number of one individual band (the
  1888. counting starts at zero), or it could be a comma-separated list of bands. For example
  1889. \begin{verbatim}
  1890. psimage jpeg_image_with_three_bands.jpg+b0
  1891. \end{verbatim}
  1892. will plot only the first band (i.e., the red band) of the jpeg image as a gray-scale image, and
  1893. \begin{verbatim}
  1894. psimage jpeg_image_with_three_bands.jpg+b2,1,0
  1895. \end{verbatim}
  1896. will plot the same image in color but where the RGB band order has been reversed.
  1897. Instead of treating them as images, all other \GMT\ programs that process grids can
  1898. read individual bands from an image but will consider the values to be regular data.
  1899. For example, let \filename{multiband} be the name of a multi-band file with a near
  1900. infrared component in band 4 and red in band 3. We will compute the NDVI (Normalized
  1901. Difference Vegetation Index), which is defined as NDVI = (NIR - R) / (NIR + R), as
  1902. \begin{verbatim}
  1903. grdmath multiband=gd+b3 multiband=gd+b2 SUB multiband=gd+b3 \
  1904. multiband=gd+b2 ADD DIV = ndvi.nc
  1905. \end{verbatim}
  1906. The resulting grid \filename{ndvi.nc} can then be plotted as usual.
  1907. \subsection{Reading more complex multi-band IMAGES or GRIDS}
  1908. It is also possible to access to sub-datasets in a multi-band grid. The next example
  1909. shows how we can extract the SST from the MODIS file \filename{A20030012003365.L3m\_YR\_NSST\_9}
  1910. that is stored in the HDF ``format''. We need to run the GDAL program \GMTprog{gdalinfo} on the
  1911. file because we first must extract the necessary metadata from the file:
  1912. \begin{verbatim}
  1913. gdalinfo A20030012003365.L3m_YR_NSST_9
  1914. Driver: HDF4/Hierarchical Data Format Release 4
  1915. Files: A20030012003365.L3m_YR_NSST_9
  1916. Size is 512, 512
  1917. Coordinate System is `'
  1918. Metadata:
  1919. Product Name=A20030012003365.L3m_YR_NSST_9
  1920. Sensor Name=MODISA
  1921. Sensor=
  1922. Title=MODISA Level-3 Standard Mapped Image
  1923. ...
  1924. Scaling=linear
  1925. Scaling Equation=(Slope*l3m_data) + Intercept = Parameter value
  1926. Slope=0.000717185
  1927. Intercept=-2
  1928. Scaled Data Minimum=-2
  1929. Scaled Data Maximum=45
  1930. Data Minimum=-1.999999
  1931. Data Maximum=34.76
  1932. Subdatasets:
  1933. SUBDATASET_1_NAME=HDF4_SDS:UNKNOWN:"A20030012003365.L3m_YR_NSST_9":0
  1934. SUBDATASET_1_DESC=[2160x4320] l3m_data (16-bit unsigned integer)
  1935. SUBDATASET_2_NAME=HDF4_SDS:UNKNOWN:"A20030012003365.L3m_YR_NSST_9":1
  1936. SUBDATASET_2_DESC=[2160x4320] l3m_qual (8-bit unsigned integer)
  1937. \end{verbatim}
  1938. Now, to access this file with \GMT\ we need to use the =gd mechanism and append the name
  1939. of the sub-dataset that we want to extract. Here, a simple example using \GMTprog{grdinfo}
  1940. would be
  1941. \scriptsize
  1942. \begin{verbatim}
  1943. grdinfo A20030012003365.L3m_YR_NSST_9=gd?HDF4_SDS:UNKNOWN:"A20030012003365.L3m_YR_NSST_9:0"
  1944. HDF4_SDS:UNKNOWN:A20030012003365.L3m_YR_NSST_9:0: Title: Grid imported via GDAL
  1945. HDF4_SDS:UNKNOWN:A20030012003365.L3m_YR_NSST_9:0: Command:
  1946. HDF4_SDS:UNKNOWN:A20030012003365.L3m_YR_NSST_9:0: Remark:
  1947. HDF4_SDS:UNKNOWN:A20030012003365.L3m_YR_NSST_9:0: Gridline node registration used
  1948. HDF4_SDS:UNKNOWN:A20030012003365.L3m_YR_NSST_9:0: Grid file format: gd = Import through GDAL (convert to float)
  1949. HDF4_SDS:UNKNOWN:A20030012003365.L3m_YR_NSST_9:0: x_min: 0.5 x_max: 4319.5 x_inc: 1 name: x nx: 4320
  1950. HDF4_SDS:UNKNOWN:A20030012003365.L3m_YR_NSST_9:0: y_min: 0.5 y_max: 2159.5 y_inc: 1 name: y ny: 2160
  1951. HDF4_SDS:UNKNOWN:A20030012003365.L3m_YR_NSST_9:0: z_min: 0 z_max: 65535 name: z
  1952. HDF4_SDS:UNKNOWN:A20030012003365.L3m_YR_NSST_9:0: scale_factor: 1 add_offset: 0
  1953. \end{verbatim}
  1954. \normalsize
  1955. Be warned, however, that things are not yet completed because while the data are scaled
  1956. according to the equation printed above (``Scaling Equation=(Slope*l3m\_data) + Intercept
  1957. = Parameter value''), this scaling is not applied by GDAL on reading so it cannot be done
  1958. automatically by \GMT. One solution is to do the reading and scaling via \GMTprog{grdmath}
  1959. first, i.e.,
  1960. \scriptsize
  1961. \begin{verbatim}
  1962. grdmath A20030012003365.L3m_YR_NSST_9=gd?HDF4_SDS:UNKNOWN:"A20030012003365.L3m_YR_NSST_9:0" \
  1963. 0.000717185 MUL -2 ADD = sst.nc
  1964. \end{verbatim}
  1965. \normalsize
  1966. \noindent
  1967. then plot the \filename{sst.nc} directly.
  1968. \index{grid file!formats!GDAL|)}
  1969. \section{The NaN data value}
  1970. \index{NaN}
  1971. \index{Not-a-Number}
  1972. For a variety of data processing and plotting tasks there is a need to acknowledge that
  1973. a data point is missing or unassigned. In the ``old days'' such information was passed
  1974. by letting a value like -9999.99 take on the special meaning of ``this is not really a
  1975. value, it is missing''. The problem with this scheme is that -9999.99 (or any other
  1976. floating point value) may be a perfectly reasonable data value and in such a scenario
  1977. would be skipped. The solution adopted in \GMT\ is to use the IEEE concept Not-a-Number
  1978. (NaN) for this purpose. Mathematically, a NaN is what you get if you do an undefined
  1979. mathematical operation like $0/0$; in ASCII data files they appear as the textstring NaN.
  1980. This value is internally stored with a particular bit pattern
  1981. defined by IEEE so that special action can be taken when it is encountered by programs.
  1982. In particular, a standard library function called \texttt{isnan} is used to test if a floating point
  1983. is a NaN. \GMT\ uses these tests extensively to determine if a value is suitable for plotting
  1984. or processing (if a NaN is used in a calculation the result would become NaN as well). Data points
  1985. whose values equal NaN are not normally plotted (or plotted with the special NaN color given in
  1986. \filename{gmt.conf}). Several tools such as \GMTprog{xyz2grd}, \GMTprog{gmtmath}, and
  1987. \GMTprog{grdmath} can convert user data to NaN and vice versa, thus facilitating arbitrary
  1988. masking and clipping of data sets. Note that a few computers do not have native IEEE hardware
  1989. support. At this point, this applies to some of the older Cray super-computers. Users on such
  1990. machines may have to adopt the old `-9999.99'' scheme to achieve the desired results.
  1991. Data records that contain NaN values for the \emph{x} or \emph{y} columns (or the \emph{z} column
  1992. for cases when 3-D Cartesian data are expected) are usually skipped during reading. However,
  1993. the presence of these bad records can be interpreted in two different ways, and this behavior
  1994. is controlled by the \textbf{IO\_NAN\_RECORDS} defaults parameter. The default setting (\emph{gap})
  1995. considers such records to indicate a gap in an otherwise continuous series of points (e.g., a line),
  1996. and programs can act upon this information, e.g., not to draw a line across the gap or to break the line
  1997. into separate segments. The alternative setting (\emph{bad}) makes no such interpretation and
  1998. simply reports back how many bad records were skipped during reading; see Section~\ref{sec:gap} for details.
  1999. \section{\gmt\ environment parameters}
  2000. \index{Environment parameters}
  2001. \GMT\ relies on several environment parameters, in particular to find data files and program settings.
  2002. \begin{description}
  2003. \item [\$GMT\_SHAREDIR] points to the \GMT\ share directory where all run-time support files
  2004. such as coastlines, custom symbols, \PS\ macros, color tables, and much more reside. If this
  2005. parameter is not set it defaults to the share sub-directory selected during the \GMT\
  2006. install process (i.e., your answer to question C.9 on the web install form, or specified by the
  2007. option \filename{--datarootdir} in the \filename{configure} step of the installation), which normally
  2008. is the share directory under the \GMT\ installation directory.
  2009. \item [\$GMT\_DATADIR] points to one or more directories where large and/or widely used data files can
  2010. be placed. All \GMT\ programs look in these directories when a file is specified on the
  2011. command line and it is not present in the current directory. This allows maintainers to
  2012. consolidate large data files and to simplify scripting that use these files since the absolute path need not be specified.
  2013. Separate multiple directories with colons (:); under Windows you use semi-colons (;). Any directory
  2014. name that ends in a trailing / will be search recursively (not under Windows).
  2015. \item [\$GMT\_USERDIR] points to a directory where the user may place custom configuration files
  2016. (e.g., an alternate \filename{coastline.conf} file, preferred default settings in \filename{gmt.conf},
  2017. custom symbols and color palettes, and
  2018. shorthands for gridfile extensions via \filename{.gmt\_io}). Users may also place their own
  2019. data files in this directory as \GMT\ programs will search for files given on the command
  2020. line in both \textbf{\$GMT\_DATADIR} and \textbf{\$GMT\_USERDIR}.
  2021. \item [\$GMT\_TMPDIR] is where \GMT\ will write its state parameters via the two files
  2022. \filename{.gmtcommands} and \filename{gmt.conf}. If \textbf{\$GMT\_TMPDIR} is not set,
  2023. these files are written to the current directory. See Appendix~\ref{app:P} for more on
  2024. the use of \textbf{\$GMT\_TMPDIR}.
  2025. \end{description}
  2026. Note that files whose full path is given will never be searched for in any of these directories.
Tip!

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

Comments

Loading...