makecpt and grd2cpt overwrite explicit +c category labels with +k keys

Aperta Adatta ai principianti
#9,377 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@yousizaitianqiong ci sta già lavorando.

Dal 4/12/2026.

  • #9379 di @yousizaitianqiong — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
c
Ambito
backend, cli

Direzione di ricerca

Inizia leggendo la documentazione di -F e l’helper condiviso in src/gmt_support.c, soprattutto la gestione di label e key citata nell’issue. Riproduci il problema con il comando makecpt fornito, quindi verifica lo stesso comportamento in grd2cpt. Il lavoro è concluso quando +kA imposta le lookup keys A, B, C mentre le label esplicite restano Wood, Water, Gold in entrambi i comandi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description of the problem

When -F+c supplies display labels and +k supplies lookup keys, the keys also replace the display labels. The one-command example from the PR that introduced +k reproduces this with an ASCII palette. Original example

Full script that reproduces the problem

gmt makecpt -Ccategorical -T0/2/1 -F+cWood,Water,Gold+kA

Actual outcome

A	green	L	;A
B	blue	L	;B
C	red	B	;C
N	128

The command exits 0 with empty stderr. Removing +kA writes ;Wood, ;Water and ;Gold. Removing +cWood,Water,Gold writes the keys as default labels, as expected.

Expected outcome

The first three rows should have lookup keys A, B, C and labels ;Wood, ;Water, ;Gold. The -F documentation describes these two fields separately. On master at 51117ebe, the shared helper assigns the labels and then copies each key over its label. Option documentation · Shared helper

grd2cpt shows the same behavior. The following commands produce A and B as the keys and as the labels, despite the explicit Wood and Water labels.

gmt grdmath -R0/2/0/2 -I0.5 X = grid.nc
gmt grd2cpt grid.nc -Cturbo -T0/2/1 -F+cWood,Water+kA

System information

Windows 11 x86-64, GMT 6.7.0, classic mode.

Lingua principale
C
Stelle
999
Fork
421
Merge medio
12h 59m
PR unite (30g)
58

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di GenericMappingTools/gmt

Tutte le issue di GenericMappingTools/gmt

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.