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 2.7 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
  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. # Use the knowledge that we need 3 pages: First two pages are the
  7. # 44 original GMT 5 CPTs and the last page has 24 scientific colormaps
  8. # from Fabio [www.fabiocrameri.ch/visualisation]
  9. GMT_SHAREDIR=$(gmt --show-sharedir)
  10. cat << EOF > skip.lis
  11. acton
  12. bamako
  13. batlow
  14. berlin
  15. bilbao
  16. broc
  17. buda
  18. cork
  19. davos
  20. devon
  21. grayC
  22. hawaii
  23. imola
  24. lajolla
  25. lapaz
  26. lisbon
  27. nuuk
  28. oleron
  29. oslo
  30. roma
  31. tofino
  32. tokyo
  33. turku
  34. vik
  35. srtm
  36. EOF
  37. #sed -e 's/"//g' "${GMT_SOURCE_DIR}"/src/gmt_cpt_masters.h | grep -v srtm | awk '{print $1}' | sort -r > tt.lis
  38. sed -e 's/"//g' "${GMT_SOURCE_DIR}"/src/gmt_cpt_masters.h | fgrep -v -f skip.lis | awk '{print $1}' | sort -r > tt.lis
  39. n=$(cat tt.lis | wc -l)
  40. let n2=n/2
  41. let n2=22
  42. # dy is line spacing and y0 is total box height
  43. dy=0.75
  44. y0=$(gmt math -Q $n2 2 ADD $dy MUL 0.5 MUL =)
  45. gmt begin GMT_App_M_1a
  46. gmt set MAP_FRAME_PEN thinner FONT_ANNOT_PRIMARY 8p MAP_TICK_LENGTH_PRIMARY 0.1i MAP_ANNOT_OFFSET_PRIMARY 0.04i
  47. gmt basemap -R0/6.1/0/$y0 -Jx1i -B0
  48. let i=1+n2
  49. y=0.475
  50. y2=0.35
  51. while [ $i -le $n ]
  52. do
  53. j=$(expr $i + 1)
  54. left=$(sed -n ${j}p tt.lis)
  55. right=$(sed -n ${i}p tt.lis)
  56. if [ "$left" = "categorical" ]; then
  57. gmt makecpt -H -C$left > tt.left.cpt
  58. else
  59. gmt makecpt -H -C$left -T-1/1 > tt.left.cpt
  60. fi
  61. gmt makecpt -H -C$left -T-1/1/0.25 > tt.left2.cpt
  62. if [ "$right" = "categorical" ]; then
  63. gmt makecpt -H -C$right > tt.right.cpt
  64. else
  65. gmt makecpt -H -C$right -T-1/1 > tt.right.cpt
  66. fi
  67. gmt makecpt -H -C$right -T-1/1/0.25 > tt.right2.cpt
  68. gmt colorbar -Dx1.55i/${y}i+w2.70i/0.125i+h+jTC -Ctt.left.cpt -B0
  69. gmt colorbar -Dx4.50i/${y}i+w2.70i/0.125i+h+jTC -Ctt.right.cpt -B0
  70. gmt colorbar -Dx1.55i/${y2}i+w2.70i/0.125i+h+jTC -Ctt.left2.cpt -Bf0.25
  71. gmt colorbar -Dx4.50i/${y2}i+w2.70i/0.125i+h+jTC -Ctt.right2.cpt -Bf0.25
  72. gmt text -D0/0.05i -F+f9p,Helvetica-Bold+jBC <<- END
  73. 1.55 $y ${left}
  74. 4.50 $y ${right}
  75. END
  76. if [ $(grep -c HARD_HINGE ${GMT_SHAREDIR}/cpt/${left}.cpt) -eq 1 ]; then # Plot hard hinge symbol for left CPT
  77. echo 1.55 $y | gmt plot -St0.2c -Gblack -Wfaint -D0/-0.29i
  78. elif [ $(grep -c SOFT_HINGE ${GMT_SHAREDIR}/cpt/${left}.cpt) -eq 1 ]; then # Plot soft hinge symbol for left CPT
  79. echo 1.55 $y | gmt plot -St0.2c -Gwhite -Wfaint -D0/-0.29i
  80. fi
  81. if [ $(grep -c HARD_HINGE ${GMT_SHAREDIR}/cpt/${right}.cpt) -eq 1 ]; then # Plot hard hinge symbol for right CPT
  82. echo 4.50 $y | gmt plot -St0.2c -Gblack -Wfaint -D0/-0.29i
  83. elif [ $(grep -c SOFT_HINGE ${GMT_SHAREDIR}/cpt/${right}.cpt) -eq 1 ]; then # Plot soft hinge symbol for right CPT
  84. echo 4.50 $y | gmt plot -St0.2c -Gwhite -Wfaint -D0/-0.29i
  85. fi
  86. i=$(expr $i + 2)
  87. y=$(gmt math -Q $y $dy ADD =)
  88. y2=$(gmt math -Q $y2 $dy ADD =)
  89. done
  90. gmt end show
Tip!

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

Comments

Loading...