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

未关闭 适合新手
#9,377 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@yousizaitianqiong 已经在做这个了。

开始于 2026年12月4日。

  • #9379 来自 @yousizaitianqiong —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
c
领域
backend, cli

调研方向

首先阅读 -F 文档和 src/gmt_support.c 中的共享 helper,尤其是 issue 中提到的 label 和 key 处理。使用提供的 makecpt 命令重现问题,然后检查 grd2cpt 中的相同行为。完成标准是:在两个命令中,+kA 都将查找键设置为 A、B、C,同时显式标签仍为 Wood、Water、Gold。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
C
星标
999
派生
421
平均合并
12 小时 59 分钟
30 天内合并 PR
58

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

GenericMappingTools/gmt 的其他 Issue

查看 GenericMappingTools/gmt 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。