Bug #1001

makecpt and abyss color palette

Added by Cyril 7 months ago. Updated 6 months ago.

Status:ClosedStart date:2016-11-09
Priority:NormalDue date:
Assignee:Paul% Done:

100%

Category:-
Target version:Candidate for next bugfix release
Affected version:5.3.1 Platform:

Description

I used GMT5.2.1 and tried to upgrade to 5.3.1. My GMT scripts work quite well with the new release, but I do not understand the change that occur with makecpt.
I used makecpt with GMT5.2.1 to create a topographic colorscale combining the abyss and dem2 palettes, with the following command :
gmt makecpt -Cabyss -G-7000/-20 -T-7000/-20/20 -Z -N > ./topo.cpt
gmt makecpt -Cdem2 -G-20/4000 -T-20/4000/20 -Z >> ./topo.cpt
With GMT5.3.1, this code doesn't give any colors of the abyss palette. To obtain a correct color scale, I need to drop -Z and -T options and to pass positive values to the makecpt command that uses the abyss palette :
gmt makecpt -Cabyss -G0/7000 -V > ./topo.cpt
gmt makecpt -Cdem2 -G-20/4000 -V >> ./topo.cpt

Surprisingly also, the above commands don't take into account the -G-20/4000 and use the abyss colors for the depths between -20 and 0.

Moreover, using :
gmt makecpt -Cabyss -G20/7000 -T20/7000/20 -V > ./topo.cpt
gmt makecpt -Cdem2 -G-20/4000 -T-20/4000/20 -V >> ./topo.cpt

results in an error :
makecpt: Prepare CPT via the master file abyss
makecpt: CPT is continuous
ERROR: Caught signal number 11 (Segmentation fault) at
0 libgmt.5.dylib 0x000000010389aa1b gmt_sample_cpt + 539

Finally, using only : gmt makecpt -Cabyss -G20/7000 -V > ./topo.cpt

gives also an error :
ERROR: Caught signal number 11 (Segmentation fault) at
0 libgmt.5.dylib 0x000000010a0e528a gmt_stretch_cpt + 106
1 ??? 0x0000000000000000 0x0 + 0
Stack backtrace:
0 libgmt.5.dylib 0x00000001037dd217 sig_handler + 567

So it seems impossible to use abyss palette with a range that doesn't start at zero or with negative values.

Associated revisions

Revision 17339
Added by Paul 7 months ago

Address issue #1001 via -Iz and better -G testing

History

#1 Updated by Paul 7 months ago

  • Status changed from New to Resolved
  • Assignee set to Paul
  • Target version set to Candidate for next bugfix release
  • % Done changed from 0 to 100

Thanks for pointing out these issues. I have implemented fixes to address them. They are:

  1. Added error checking for the -G values to make sure they are compatible with the original CPT range. if the selection is outside the actual range we yield an error.
  2. Extended -I to take optional modifiers c [Default] and z. The latter reverses the sign of the z-values in the CPT while the former reverses the colors (same as -I). Both can be appended to reverse both features.

This means that for you to accomplish what you need will have to reverse the z-values in the abyss CPT via -Iz and the truncate the range you want with positive values in -G. Note that your -G settings for the dem2 case will give an error since the CPT does not cross the zero boundary.

In r17340.

#2 Updated by Joaquim 6 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF