I’m running a perl script which calls a Generic Mapping Tools (GMT) module, pscontour , with the following arguments
gmt pscontour '../../../TMP_files/hor/vpvs3 1.grd.xyz' -R-72.1999969/-69.5000000/-22.5000000/-18.5000000 -JX7c/11.0715172245984c -C'../../../DATA/GEO_DAT1/MODEL_01/data/dv_anom_NaN.cpt' -I -B1.0/0.5:"latitude, degrees"::."Vp/Vs, depth= 10 km":WeSn -Xa4c -Ya39.9284827754016c -O -K >> '../../../PICS/ps/GEO_DAT1/MODEL_01/vis_result_VpVs_3.ps'
where it essentially tries to create a contoured map as a PostScript file with the given input files and parameters. However, this line of code gives errors:
pscontour: Error: Z-slice with dz = 0
[Session gmt (0)]: Error returned from GMT API: GMT_CPT_READ_ERROR (8)
[Session gmt (0)]: Error returned from GMT API: GMT_CPT_READ_ERROR (8)
[Session gmt (0)]: Error returned from GMT API: GMT_CPT_READ_ERROR (8)
and thus the output is a blank .ps file (i.e. vis_result_VpVs_3.ps is empty).
The dv_anom_NaN.cpt contains
1.6 0/24/120 1.63 0/24/120
1.63 0/74/157 1.66 0/74/157
1.66 0/148/213 1.69 0/148/213
-10000 gray -500 gray
-500 51/221/255 1.72 51/221/255
1.69 51/221/255 1.72 51/221/255
1.69 51/221/255 1.72 51/221/255
1.72 179/255/242 1.75 179/255/242
1.75 203/203/152 1.78 203/203/152
1.78 133/133/82 1.81 133/133/82
1.81 59/51/8 1.84 59/51/8
1.84 105/48/48 1.87 105/48/48
1.87 137/16/16 1.9 137/16/16
1.9 137/16/16 1.9 137/16/16
500 137/16/16 1.9 137/16/16
B black
F white
N gray49
I don’t know what is the problem with the content of this file. When I compare this file with an example of a .cpt file in my GMT directories, the formatting seems okay to me. To give some clarities, this .cpt file is created with this line of code (inside the perl script):
gmt makecpt -Cblue_brown.cpt -T1.6/1.9/0.03 > dv_anom.cpt
where blue_brown.cpt contains
# blue brown 25lvl color pallete table 29/10/2009
#COLOR_MODEL = RGB
0 0 0 102 1 0 0 102
1 0 24 120 2 0 24 120
2 0 49 139 3 0 49 139
3 0 74 157 4 0 74 157
4 0 98 176 5 0 98 176
5 0 123 194 6 0 123 194
6 0 148 213 7 0 148 213
7 0 173 231 8 0 173 231
8 0 197 250 9 0 197 250
9 51 221 255 10 51 221 255
10 120 244 255 11 120 244 255
11 179 255 242 12 179 255 242
12 229 255 217 13 229 255 217
13 238 238 187 14 238 238 187
14 203 203 152 15 203 203 152
15 167 167 116 16 167 167 116
16 133 133 82 17 133 133 82
17 100 100 49 18 100 100 49
18 67 67 16 19 67 67 16
19 59 51 8 20 59 51 8
20 74 51 8 21 74 51 8
21 89 51 38 22 89 51 38
22 105 48 48 23 105 48 48
23 121 32 32 24 121 32 32
24 137 16 16 25 137 16 16
25 153 0 0 26 153 0 0
N 125 125 125
and dv_anom.cpt contains
.6 0/24/120 1.63 0/24/120
1.63 0/74/157 1.66 0/74/157
1.66 0/148/213 1.69 0/148/213
1.69 51/221/255 1.72 51/221/255
1.72 179/255/242 1.75 179/255/242
1.75 203/203/152 1.78 203/203/152
1.78 133/133/82 1.81 133/133/82
1.81 59/51/8 1.84 59/51/8
1.84 105/48/48 1.87 105/48/48
1.87 137/16/16 1.9 137/16/16
B black
F white
N gray49
At some point inside the perl script, dv_anom.cpt modifies the content of dv_anom_NaN.cpt .
Again, I suspect there is nothing wrong with the content and the formatting of these two files. I tried Googling this error, only to find a really old thread about the same error message (but different module used) here and here, which I doubt is still relevant (I’m using latest gmt version 5.4.3). Oh yeah, I’m running Ubuntu 18.04.