Suppose we have a CPT master file foo.cpt
# HARD_HINGE
# RANGE = -10/20
-1 r/g/b -0.9 r/g/b
:
0.9 r/g/b 1 r/g/b
Am I right in thinking that makecpt -Cfoo.cpt+h7 -T-20/20
will take the file z-values from -1 to 0, make an affine transformation of them to [-20, 7], then the file values from 0 to 1, and affine transform them to [7, 20]? This would seem to be the case from “world.cpt” for example. If I omit the -T
then the RANGE
in the file is used instead.
So I was expecting that gmt makecpt -Cetopo1+h-0.001
to give me something close to the original, a rather odd CPT with a natural hinge 1mm below sea-level, but it does not: The original:
-11000 10 0 121 -10500 26 0 137
-10500 26 0 137 -10000 38 0 152
:
-500 138 227 255 -0.001 188 230 255
-0.001 51 102 0 100 51 204 102
100 51 204 102 200 187 228 146
while gmt makecpt -Cetopo1+h-0.001
gives
-11000 10/0/121 -10500.5 26/0/137 L
-10500.5 26/0/137 -10001 38/0/152 L
:
-510.5 138/227/255 -0.001 188/230/255 L
-0.001 51/102/0 91.600 51/204/102 L
91.600 51/204/102 191.7 187/228/146 L
I find, by bisection, that gmt makecpt -Cetopo1+h11.01001001
gives almost correct negative z-values as the original, but the positive ones are still strangely off
-11000 10/0/121 -10500 26/0/137 L
-10500 26/0/137 -10000 38/0/152 L
:
-1500 79/210/255 -999.99999999 94/223/255 L
-999.9999999 94/223/25 -500 138/227/255 L
-500 138/227/255 11.01001001 188/230/255 L
11.01001001 51/102/0 102.492348903 51/204/102 L
102.492348903 51/204/102 202.462678083 87/228/146 L
All very strange, is etopo1.cpt
broken in some way? Possibly my understanding of how hinges work is at fault.
I come to this using the cpt as a test fixture for cptutils, trying to get v5 cpt handling working, the file below is master etopo1 as generated by cptutils (from the original from cpt-city), but it differs from the version in 6.4 …
# autogenerated GMT palette "ETOPO1"
# cptutils 1.78, Wed Dec 6 23:21:04 2023
# RANGE = -11000/8500
# HARD_HINGE
-1.0000000000 10/0/121 -0.9545454504 26/0/137
-0.9545454504 26/0/137 -0.9090909008 38/0/152
-0.9090909008 38/0/152 -0.8636363512 27/3/166
-0.8636363512 27/3/166 -0.8181818017 16/6/180
-0.8181818017 16/6/180 -0.7727272521 5/9/193
-0.7727272521 5/9/193 -0.7272727025 0/14/203
-0.7272727025 0/14/203 -0.6818181529 0/22/210
-0.6818181529 0/22/210 -0.6363636033 0/30/216
-0.6363636033 0/30/216 -0.5909090537 0/39/223
-0.5909090537 0/39/223 -0.5454545041 12/68/231
-0.5454545041 12/68/231 -0.4999999545 26/102/240
-0.4999999545 26/102/240 -0.4545454050 19/117/244
-0.4545454050 19/117/244 -0.4090908554 14/133/249
-0.4090908554 14/133/249 -0.3636363058 21/158/252
-0.3636363058 21/158/252 -0.3181817562 30/178/255
-0.3181817562 30/178/255 -0.2727272066 43/186/255
-0.2727272066 43/186/255 -0.2272726570 55/193/255
-0.2272726570 55/193/255 -0.1818181074 65/200/255
-0.1818181074 65/200/255 -0.1363635579 79/210/255
-0.1363635579 79/210/255 -0.0909090083 94/223/255
-0.0909090083 94/223/255 -0.0454544587 138/227/255
-0.0454544587 138/227/255 0.0000000000 188/230/255
0.0000000000 51/102/0 0.0117648221 51/204/102
0.0117648221 51/204/102 0.0235295266 187/228/146
0.0235295266 187/228/146 0.0588236401 255/220/185
0.0588236401 255/220/185 0.1176471626 243/202/137
0.1176471626 243/202/137 0.1764706851 230/184/88
0.1764706851 230/184/88 0.2352942076 217/166/39
0.2352942076 217/166/39 0.2941177301 168/154/31
0.2941177301 168/154/31 0.3529412526 164/144/25
0.3529412526 164/144/25 0.4117647751 162/134/19
0.4117647751 162/134/19 0.4705882976 159/123/13
0.4705882976 159/123/13 0.5294118201 156/113/7
0.5294118201 156/113/7 0.5882353426 153/102/0
0.5882353426 153/102/0 0.6470588651 162/89/89
0.6470588651 162/89/89 0.7058823875 178/118/118
0.7058823875 178/118/118 0.7647059100 183/147/147
0.7647059100 183/147/147 0.8235294325 194/176/176
0.8235294325 194/176/176 0.8823529550 204/204/204
0.8823529550 204/204/204 0.9411764775 229/229/229
0.9411764775 229/229/229 1.0000000000 255/255/255
B 10/0/121
F 255/255/255
N 128/128/128