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

Đang mở Phù hợp với người mới
#9,377 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@yousizaitianqiong đang làm issue này rồi.

Từ ngày 4/12/2026.

  • #9379 của @yousizaitianqiong — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
c
Lĩnh vực
backend, cli

Hướng nghiên cứu

Bắt đầu bằng cách đọc tài liệu -F và helper dùng chung trong src/gmt_support.c, đặc biệt là cách xử lý label và key được đề cập trong issue. Tái hiện vấn đề bằng lệnh makecpt được cung cấp, sau đó kiểm tra hành vi tương tự trong grd2cpt. Công việc hoàn tất khi +kA đặt các lookup key là A, B, C trong khi các label tường minh vẫn là Wood, Water, Gold ở cả hai lệnh.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
C
Star
999
Fork
421
Merge trung bình
12 giờ 59 phút
Pull request đã merge (30 ngày)
58

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của GenericMappingTools/gmt

Tất cả issue của GenericMappingTools/gmt

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.