Skip to content

Add another surface mode to grdview based on the Gouraud gradient. - #8848

Merged
joa-quim merged 3 commits into
masterfrom
surf-gouraud
Jan 2, 2026
Merged

joa-quim merged 3 commits into
masterfrom
surf-gouraud

Conversation

@joa-quim

Copy link
Copy Markdown
Member

The recent Gouraud gradient is much more efficient than the surface method in grdview (-Qs). See these numbers:

gmt grdmath -R-5/5/-5/5 -I0.5 X Y HYPOT NEG 3 POW 10 MUL = peak.nc

time gmt grdview peak.nc -R-5/5/-5/5/-3536/0 -JX8c -JZ4c -Qg -Ct.cpt -p135/30 -Bafg -Bzafg -BWSneZ+t"Gouraud" -P > lixo1.ps

real    0m0.297s
user    0m0.026s
sys     0m0.010s

time gmt grdview peak.nc -R-5/5/-5/5/-3536/0 -JX8c -JZ4c -Qs -Ct.cpt -p135/30 -Bafg -Bzafg -BWSneZ+t"Gouraud" -P > lixo2.ps

real    0m4.527s
user    0m0.522s
sys     0m0.085s

lixo1.ps 184,005    KB
lixo2.ps 7,722,824  KB

But the result isn't exactly equal either (though most of times is visually indistinguishable). With vertical discontinuities they are different.

gmt grdmath -R0/10/0/10 -I0.2 X 5 GT 10 MUL = cliff.nc
makecpt -T0/11 > tt.cpt
gmt grdview cliff.nc -R0/10/0/10/0/10 -JX8c -JZ4c -Qs -Ctt.cpt -p260/30 -Bafg -Bzafg -BWSneZ+t"Surface" -png surf
gmt grdview cliff.nc -R0/10/0/10/0/10 -JX8c -JZ4c -Qg -Ctt.cpt -p260/30 -Bafg -Bzafg -BWSneZ+t"Gouraud" -png gou
surf gou

@joa-quim
joa-quim requested a review from a team December 29, 2025 19:42
@Esteban82 Esteban82 added enhancement Improving an existing feature add-changelog Add PR to the changelog labels Dec 29, 2025

@Esteban82 Esteban82 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it and it works fine on Linux.
In my case is bearly better

real    0m0.636s
user    0m0.530s
sys     0m0.083s

real    0m0.819s
user    0m0.700s
sys     0m0.098s

@joa-quim

Copy link
Copy Markdown
Member Author

Strange. What I posted was from WSL but on pure windows, even if only visual, the time difference was striking.

@joa-quim
joa-quim merged commit 7f9d909 into master Jan 2, 2026
9 of 13 checks passed
@joa-quim
joa-quim deleted the surf-gouraud branch January 2, 2026 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add-changelog Add PR to the changelog enhancement Improving an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants