Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -Ccpt option to sample colors from sample1d and grdxyz #8195

Merged
merged 3 commits into from Dec 16, 2023

Conversation

PaulWessel
Copy link
Member

We had no simple way to determine what the colour would be for a given z value (other than under the hood for the usual plotting). This PR lets sample1d and grd2xyz optionally take -Ccpt. This lets sample1d look up the colour based on the input records' last column (or via -i) while grd2xyz will get the colour based on the grid z-values. Both modules then add 4 new columns r, g, b, a to their output.

Note: grd2xyz already used -C[f|i] for some formatting schemes that are rarely used. I changed this to -F and made -C backwards compatible of, course.

gmt math -o1 -T0/30/5 T = | gmt sample1d  -Ct.cpt
0	0	0	127	55
5	0	42	255	55
10	0	212	255	55
15	128	255	128	55
20	255	212	0	55
25	255	42	0	55
30	127	0	0	55

for a random CPT that I made with makecpt -A55 to have a nonzero transparency.

PS. Joaquim and I are working some fixes to the writing of images via GDAL. The goal is to pixel-by-pixel transparency which PostScript cannot do.

We had no simple ways to determine what teh color would be for a given z value (other than under the hood for plotting).  This PR lets sample1d and grd2xyz optionally take -Ccpt. This lets sample1d look up the color based on the input records last column (or via -i) while gr2xyz will get the color based on the grid z-values.  Both modules then adds 4 new columns r, g, b, a to their output.

Note: grd2xyz already used -Ci|f for some formatting that is rarely used.  I changed this to -F and made -Ci|f backwards compatible of course.
@PaulWessel PaulWessel added add-changelog Add PR to the changelog new core module feature PR that implements a new core module feature labels Dec 16, 2023
@PaulWessel PaulWessel added this to the 6.5.0 milestone Dec 16, 2023
@PaulWessel PaulWessel requested a review from a team December 16, 2023 10:12
@PaulWessel PaulWessel self-assigned this Dec 16, 2023
@PaulWessel PaulWessel merged commit 9c6a67b into master Dec 16, 2023
6 checks passed
@PaulWessel PaulWessel deleted the rgb-support branch December 16, 2023 10:35
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 new core module feature PR that implements a new core module feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants