I’m having an issue creating a cpt.
Steps:
Create a simple text file with colors (as hex).
I want constant color for each slice, so Color_min = Color_max (ref. 3.20.2. Regular CPTs):
# colors manually read off the map
# https://www.gebco.net/news_and_media/ibcao_printable_map.html
cat<<eof > temp-ibcao.cpt
-6000 #2E5085 -5000 #2E5085
-5000 #3563A0 -4000 #3563A0
-4000 #3C77BC -3000 #3C77BC
-3000 #4897D3 -2000 #4897D3
-2000 #5AB9E9 -1000 #5AB9E9
-1000 #5CC3EB -500 #5CC3EB
-500 #78CEF0 -200 #78CEF0
-200 #94DAF5 -100 #94DAF5
-100 #B0E6FA -50 #B0E6FA
-50 #CDF2FF 0 #CDF2FF
0 #C3D150 50 #C3D150
50 #E2E166 100 #E2E166
100 #DFC45C 200 #DFC45C
200 #D3B251 300 #D3B251
300 #BD962F 400 #BD962F
400 #A37F2F 500 #A37F2F
500 #99762B 600 #99762B
600 #8F6E27 700 #8F6E27
700 #876824 800 #876824
800 #75581D 1000 #75581D
1000 #75581D 1001 #FFFFFF
eof
Use makecpt -Ctemp-ibcao.cpt
to make a proper cpt, with fore-, back- and NaN-colors:
# use makecpt to make proper cpt
$ gmt makecpt -Ctemp-ibcao.cpt
-6000 46/80/133 -5000 46/80/133
-5000 53/99/160 -4000 53/99/160
-4000 60/119/188 -3000 60/119/188
-3000 72/151/211 -2000 72/151/211
-2000 90/185/233 -1000 90/185/233
-1000 92/195/235 -500 92/195/14 B <-- color_max != color_min
-500 120/206/240 -200 120/206/240
-200 148/218/245 -100 148/218/245
-100 176/230/250 -50 176/230/250
-50 205/242/255 0 205/242/255
0 195/209/80 50 195/209/80
50 226/225/102 100 226/225/102
100 223/196/92 200 223/196/92
200 211/178/81 300 211/178/81
300 189/150/47 400 189/150/47
400 163/127/47 500 163/127/47
500 153/118/43 600 153/118/2 B <-- color_max != color_min
600 143/110/39 700 143/110/39
700 135/104/36 800 135/104/36
800 117/88/29 1000 117/88/29
1000 117/88/29 1001 white
B black
F white
N 128
Everything looks as expected, except the color slices -1000 to -500 and 500 to 600. In these slices the Color_max is changed. In addition, these two slices get a B (the optional flag to indicate annotation of both limits of the particular z-slice of the color scale when plotted using colorbar, again ref. 3.20.2. Regular CPTs).
Why is this? Feature of bug? From testing, it seems like the default is that all slices get the L flag, except the last one, which gets a B flag. I cannot find much information about this in the docs.
If I manually add L to the two problem-slices, it works as expected:
cat<<eof > temp-ibcao.cpt
-6000 #2E5085 -5000 #2E5085
-5000 #3563A0 -4000 #3563A0
-4000 #3C77BC -3000 #3C77BC
-3000 #4897D3 -2000 #4897D3
-2000 #5AB9E9 -1000 #5AB9E9
-1000 #5CC3EB -500 #5CC3EB L
-500 #78CEF0 -200 #78CEF0
-200 #94DAF5 -100 #94DAF5
-100 #B0E6FA -50 #B0E6FA
-50 #CDF2FF 0 #CDF2FF
0 #C3D150 50 #C3D150
50 #E2E166 100 #E2E166
100 #DFC45C 200 #DFC45C
200 #D3B251 300 #D3B251
300 #BD962F 400 #BD962F
400 #A37F2F 500 #A37F2F
500 #99762B 600 #99762B L
600 #8F6E27 700 #8F6E27
700 #876824 800 #876824
800 #75581D 1000 #75581D
1000 #75581D 1001 #FFFFFF
eof
$ gmt makecpt -Ctemp-ibcao.cpt
-6000 46/80/133 -5000 46/80/133
-5000 53/99/160 -4000 53/99/160
-4000 60/119/188 -3000 60/119/188
-3000 72/151/211 -2000 72/151/211
-2000 90/185/233 -1000 90/185/233
-1000 92/195/235 -500 92/195/235 L <-- correct, color_max = color_min
-500 120/206/240 -200 120/206/240
-200 148/218/245 -100 148/218/245
-100 176/230/250 -50 176/230/250
-50 205/242/255 0 205/242/255
0 195/209/80 50 195/209/80
50 226/225/102 100 226/225/102
100 223/196/92 200 223/196/92
200 211/178/81 300 211/178/81
300 189/150/47 400 189/150/47
400 163/127/47 500 163/127/47
500 153/118/43 600 153/118/43 L <-- correct, color_max = color_min
600 143/110/39 700 143/110/39
700 135/104/36 800 135/104/36
800 117/88/29 1000 117/88/29
1000 117/88/29 1001 white
B black
F white
N 128