Skip to content

Fix a regression that was causing failure of categorical test. - #8855

Merged
joa-quim merged 3 commits into
masterfrom
fix-grdview-regression
Jan 5, 2026
Merged

joa-quim merged 3 commits into
masterfrom
fix-grdview-regression

Conversation

@joa-quim

@joa-quim joa-quim commented Jan 5, 2026

Copy link
Copy Markdown
Member

Also document -Qt option that was missing since its creation.

Also document -Qt option that was missing since its creation.
@joa-quim
joa-quim requested a review from a team January 5, 2026 19:53
@Esteban82

Copy link
Copy Markdown
Member

How can I test this?

I tried this script but I got this error:

grdview [ERROR]: Categorical data (as implied by CPT) cannot be interpolated and require -T or just -Qm.

Full script:

gmt begin ex05_3d png
 	gmt makecpt -Ccategorical -T0/4/1 -F+cOceanic,Land,Lakes,Islands,Ponds
	gmt grdview @earth_mask -JM15c -JZ4c -B -Bz0.5 -BSEwnZ -N-1+gwhite -RUY -p120/30 -C -Qt
gmt end

@joa-quim

joa-quim commented Jan 5, 2026

Copy link
Copy Markdown
Member Author

I tested it with a bit of the categorical.sh test.

@Esteban82

Copy link
Copy Markdown
Member

That works but it is a bit different. It doesn't plot use -JZ or -p.

# Finally plot as texture image -Qt100
gmt grdview tt.nc -Ctt.cpt -JU31/2.75 -B5g5 -BWSne+t"-Qt100" -Qt100i -JZ4c -J

@joa-quim

joa-quim commented Jan 5, 2026

Copy link
Copy Markdown
Member Author

That's a different issue (and it lacks -R to use the -JZ)

@Esteban82

Copy link
Copy Markdown
Member

That's a different issue (and it lacks -R to use the -JZ)

This is the full script I am using:

gmt begin ex05_3d png
 	gmt makecpt -Ccategorical -T0/4/1 -F+cOceanic,Land,Lakes,Islands,Ponds
	gmt grdview @earth_relief -G@earth_mask -JM15c -JZ5c -B -Bza -BSEwnZ -N-500+gwhite -R-58/-54/-36/-32/-500/500 -p120/30 -C -Qt100i
gmt end

First, I am not completely sure that I fully understand what the -Qt option is intended for.

Second, using the script above, I was able to generate the figure shown below by adding || Ctrl->Q.special to this line in grdview.c:

gmt/src/grdview.c

Line 1076 in 8d53ecb

if (P->categorical && !(Ctrl->Q.mode == GRDVIEW_MESH || Ctrl->T.active)) {

ex05_3d

Without this modification, I got the previous error:

grdview [ERROR]: Categorical data (as implied by CPT) cannot be interpolated and require -T or just -Qm.

Do you want me to modify the grdview.c file?

@joa-quim

joa-quim commented Jan 5, 2026

Copy link
Copy Markdown
Member Author

Better not. That is a different issue. Open a new one.

@Esteban82

Copy link
Copy Markdown
Member

Ok. I will make another PR.

@joa-quim
joa-quim merged commit 9486343 into master Jan 5, 2026
9 of 13 checks passed
@joa-quim
joa-quim deleted the fix-grdview-regression branch January 5, 2026 23:10
@joa-quim

joa-quim commented Jan 5, 2026

Copy link
Copy Markdown
Member Author

But better wait till I update the copyright year

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants