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_1c.sh 2.4 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
  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. cat << EOF > tt.lis
  15. actonS
  16. bamakoS
  17. batlowS
  18. bilbaoS
  19. budaS
  20. categorical
  21. davosS
  22. devonS
  23. grayCS
  24. hawaiiS
  25. imolaS
  26. lajollaS
  27. lapazS
  28. nuukS
  29. osloS
  30. paired
  31. tokyoS
  32. turkuS
  33. EOF
  34. n=$(cat tt.lis | wc -l)
  35. let n2=n/2
  36. let n2=n
  37. # dy is line spacing and y0 is total box height
  38. dy=0.6
  39. y0=$(gmt math -Q $n2 $dy MUL 0.5 MUL 0.1 ADD =)
  40. gmt begin GMT_App_M_1c
  41. gmt set GMT_THEME cookbook
  42. gmt set MAP_FRAME_PEN thinner FONT_ANNOT_PRIMARY 8p MAP_TICK_LENGTH_PRIMARY 0.1i MAP_ANNOT_OFFSET_PRIMARY 0.04i
  43. gmt basemap -R0/6.1/0/$y0 -Jx1i -B0
  44. i=1
  45. y=0.375
  46. y2=0.25
  47. while [ $i -le $n2 ]
  48. do
  49. j1=$(expr $n2 - $i)
  50. j2=$(expr $n2 - $i + 1)
  51. left=$(sed -n ${j1}p tt.lis)
  52. right=$(sed -n ${j2}p tt.lis)
  53. gmt makecpt -H -C$left > tt.left.cpt
  54. gmt makecpt -H -C$left -T-1/1/0.25 > tt.left2.cpt
  55. gmt makecpt -H -C$right > tt.right.cpt
  56. gmt makecpt -H -C$right -T-1/1/0.25 > tt.right2.cpt
  57. gmt colorbar -Dx1.55i/${y}i+w2.70i/0.125i+h+jTC -Ctt.left.cpt -B0
  58. gmt colorbar -Dx4.50i/${y}i+w2.70i/0.125i+h+jTC -Ctt.right.cpt -B0
  59. gmt colorbar -Dx1.55i/${y2}i+w2.70i/0.125i+h+jTC -Ctt.left2.cpt -Bf0.25
  60. gmt colorbar -Dx4.50i/${y2}i+w2.70i/0.125i+h+jTC -Ctt.right2.cpt -Bf0.25
  61. gmt text -D0/0.05i -F+f9p,Helvetica-Bold+jBC <<- END
  62. 1.55 $y ${left}
  63. 4.50 $y ${right}
  64. END
  65. if [ $(grep -c HARD_HINGE ${GMT_SHAREDIR}/cpt/${left}.cpt) -eq 1 ]; then # Plot hard hinge symbol for left CPT
  66. echo 1.55 $y | gmt plot -St0.2c -Gblack -Wfaint -D0/-0.29i
  67. elif [ $(grep -c SOFT_HINGE ${GMT_SHAREDIR}/cpt/${left}.cpt) -eq 1 ]; then # Plot soft hinge symbol for left CPT
  68. echo 1.55 $y | gmt plot -St0.2c -Gwhite -Wfaint -D0/-0.29i
  69. fi
  70. if [ $(grep -c HARD_HINGE ${GMT_SHAREDIR}/cpt/${right}.cpt) -eq 1 ]; then # Plot hard hinge symbol for right CPT
  71. echo 4.50 $y | gmt plot -St0.2c -Gblack -Wfaint -D0/-0.29i
  72. elif [ $(grep -c SOFT_HINGE ${GMT_SHAREDIR}/cpt/${right}.cpt) -eq 1 ]; then # Plot soft hinge symbol for right CPT
  73. echo 4.50 $y | gmt plot -St0.2c -Gwhite -Wfaint -D0/-0.29i
  74. fi
  75. i=$(expr $i + 2)
  76. y=$(gmt math -Q $y $dy ADD =)
  77. y2=$(gmt math -Q $y2 $dy ADD =)
  78. done
  79. rm -f tt.*
  80. gmt end show
Tip!

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

Comments

Loading...