Skip to content

Upgrade grd2cpt like makecpt and improve docs#8138

Merged
PaulWessel merged 5 commits intomasterfrom
cpt-grayscale
Dec 5, 2023
Merged

Upgrade grd2cpt like makecpt and improve docs#8138
PaulWessel merged 5 commits intomasterfrom
cpt-grayscale

Conversation

@PaulWessel
Copy link
Member

This PR does several things:

  1. It adds -F directive g for grayscale. While a couple of GMT modules (e.g., grdimage, grdview) has a -M option (for converting colors to black and white television via the YIQ transformation), we cannot actually make sure CPT output. With -Fg we now get a single grayscale column wether it was originally gray or had to be YIQ converted..
  2. While makecpt had the +kkeys modifier, grd2cpt did not. No good reason other than obviously a keyed categorical CPT cannot be used with a grid since the look-up values are always numbers. But users may still want to make a categorical CPT with keys via gd2cpt that can then be used for non-grid plotting. Thus I duplicated the +k stuff from makecpt to grd2cpt.
  3. Because they now have identical synopsis and usage I made helper functions that are called by both instead of maintaining duplicate usage messages. The -Farg string is now also a constant in gmt_constants.h
  4. Same deal with the docs: Introduced an include file (explain_cpt_output.rst_) to ensure we say the same thing in the two modules. The updated -F docs now look like this:
F

@PaulWessel PaulWessel added documentation Improve documentation enhancement Improving an existing feature labels Dec 5, 2023
@PaulWessel PaulWessel added this to the 6.5.0 milestone Dec 5, 2023
@PaulWessel PaulWessel requested a review from a team December 5, 2023 16:41
@PaulWessel PaulWessel self-assigned this Dec 5, 2023
Copy link
Contributor

@remkos remkos left a comment

Choose a reason for hiding this comment

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

Compiles and works for me.

@PaulWessel PaulWessel merged commit e67d46b into master Dec 5, 2023
@PaulWessel PaulWessel deleted the cpt-grayscale branch December 5, 2023 17:34
@maxrjones maxrjones added the add-changelog Add PR to the changelog label Dec 8, 2023
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 documentation Improve documentation enhancement Improving an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants