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_App_M_1a.sh 3.2 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
  1. #!/usr/bin/env bash
  2. #
  3. # Makes the insets for Appendix M(cpt)
  4. # [skip srtm which is just a special version of dem2]
  5. #
  6. # We have four sets of CPT figures to make:
  7. # 1a) Our regular, traditional GMT CPTs [44]
  8. # 1b) The regular Scientific Color Maps* [30]
  9. # 1c) Categorical CPTs (ours and SCM*) [18]
  10. # 1d) Cyclic CPTs from SCM* [5]
  11. #
  12. # *from Fabio [www.fabiocrameri.ch/visualisation]
  13. GMT_SHAREDIR=$(gmt --show-sharedir)
  14. # Make a skip list - note we don't need to add those with an O or S added since the will be grepped out as well
  15. cat << EOF > skip.lis
  16. acton
  17. bam
  18. bamako
  19. batlow
  20. batlowK
  21. batlowW
  22. berlin
  23. bilbao
  24. broc
  25. buda
  26. bukavu
  27. cork
  28. davos
  29. devon
  30. fes
  31. grayC
  32. hawaii
  33. imola
  34. lajolla
  35. lapaz
  36. lisbon
  37. nuuk
  38. oleron
  39. oslo
  40. roma
  41. tofino
  42. tokyo
  43. turku
  44. vanimo
  45. vik
  46. srtm
  47. categorical
  48. paired
  49. EOF
  50. # Get the list of CPTs for this figure
  51. sed -e 's/"//g' "${GMT_SOURCE_DIR}"/src/gmt_cpt_masters.h | fgrep -v -f skip.lis | awk '{print $1}' | sort -r > tt.lis
  52. n=$(cat tt.lis | wc -l)
  53. let n2=n/2
  54. # dy is line spacing and y0 is total box height
  55. dy=0.6
  56. y0=$(gmt math -Q $n2 $dy MUL 0.1 ADD =)
  57. gmt begin GMT_App_M_1a
  58. gmt set GMT_THEME cookbook
  59. gmt set MAP_FRAME_PEN thinner FONT_ANNOT_PRIMARY 8p MAP_TICK_LENGTH_PRIMARY 0.1i MAP_ANNOT_OFFSET_PRIMARY 0.04i
  60. gmt basemap -R0/6.1/0/$y0 -Jx1i -B0
  61. let i=1
  62. y=0.375
  63. y2=0.25
  64. while [ $i -le $n ]
  65. do
  66. j=$(expr $i + 1)
  67. left=$(sed -n ${j}p tt.lis)
  68. right=$(sed -n ${i}p tt.lis)
  69. gmt makecpt -H -C$left -T-1/1 > tt.left.cpt
  70. gmt makecpt -H -C$left -T-1/1/0.25 > tt.left2.cpt
  71. gmt makecpt -H -C$right -T-1/1 > tt.right.cpt
  72. gmt makecpt -H -C$right -T-1/1/0.25 > tt.right2.cpt
  73. gmt colorbar -Dx1.55i/${y}i+w2.70i/0.125i+h+jTC+e -Ctt.left.cpt -B0
  74. gmt colorbar -Dx4.50i/${y}i+w2.70i/0.125i+h+jTC+e -Ctt.right.cpt -B0
  75. gmt colorbar -Dx1.55i/${y2}i+w2.70i/0.125i+h+jTC+e -Ctt.left2.cpt -Bf0.25
  76. gmt colorbar -Dx4.50i/${y2}i+w2.70i/0.125i+h+jTC+e -Ctt.right2.cpt -Bf0.25
  77. gmt text -D0/0.05i -F+f9p,Helvetica-Bold+jBC <<- END
  78. 1.55 $y ${left}
  79. 4.50 $y ${right}
  80. END
  81. if [ $(grep -c RANGE ${GMT_SHAREDIR}/cpt/${left}.cpt) -eq 1 ]; then # Plot default range for left CPT
  82. grep RANGE ${GMT_SHAREDIR}/cpt/${left}.cpt | awk '{printf "2.9 %g %s\n", "'$y'", $4}' | gmt text -F+f6p,Helvetica+jRB -D0/0.025i -N
  83. fi
  84. if [ $(grep -c HARD_HINGE ${GMT_SHAREDIR}/cpt/${left}.cpt) -eq 1 ]; then # Plot hard hinge symbol for left CPT
  85. echo 1.55 $y | gmt plot -St0.2c -Gblack -Wfaint -D0/-0.29i
  86. elif [ $(grep -c SOFT_HINGE ${GMT_SHAREDIR}/cpt/${left}.cpt) -eq 1 ]; then # Plot soft hinge symbol for left CPT
  87. echo 1.55 $y | gmt plot -St0.2c -Gwhite -Wfaint -D0/-0.29i
  88. fi
  89. if [ $(grep -c RANGE ${GMT_SHAREDIR}/cpt/${right}.cpt) -eq 1 ]; then # Plot default range for left CPT
  90. grep RANGE ${GMT_SHAREDIR}/cpt/${right}.cpt | awk '{printf "5.85 %g %s\n", "'$y'", $4}' | gmt text -F+f6p,Helvetica+jRB -D0/0.025i -N
  91. fi
  92. if [ $(grep -c HARD_HINGE ${GMT_SHAREDIR}/cpt/${right}.cpt) -eq 1 ]; then # Plot hard hinge symbol for right CPT
  93. echo 4.50 $y | gmt plot -St0.2c -Gblack -Wfaint -D0/-0.29i
  94. elif [ $(grep -c SOFT_HINGE ${GMT_SHAREDIR}/cpt/${right}.cpt) -eq 1 ]; then # Plot soft hinge symbol for right CPT
  95. echo 4.50 $y | gmt plot -St0.2c -Gwhite -Wfaint -D0/-0.29i
  96. fi
  97. i=$(expr $i + 2)
  98. y=$(gmt math -Q $y $dy ADD =)
  99. y2=$(gmt math -Q $y2 $dy ADD =)
  100. done
  101. rm -f tt.* skip.lis
  102. gmt end show
Tip!

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

Comments

Loading...