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

Figure.grdview, Figure.grdimage: Add alias "no_interpolation" for "-T" #3355

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

yvonnefroehlich
Copy link
Member

@yvonnefroehlich yvonnefroehlich commented Jul 25, 2024

Description of proposed changes

This PR addes an alias for -T of Figure.grdview and Figure.grdimage:

Preview: https://pygmt-dev--3355.org.readthedocs.build/en/3355/api/generated/pygmt.Figure.grdview.html

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
  • If adding new functionality, add an example to docstrings or tutorials.
  • Use underscores (not hyphens) in names of Python files and directories.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash command is:

  • /format: automatically format and lint the code

@yvonnefroehlich yvonnefroehlich added documentation Improvements or additions to documentation enhancement Improving an existing feature labels Jul 25, 2024
@yvonnefroehlich yvonnefroehlich added this to the 0.13.0 milestone Jul 25, 2024
@yvonnefroehlich yvonnefroehlich self-assigned this Jul 25, 2024
@seisman
Copy link
Member

seisman commented Jul 25, 2024

Two points:

  1. grdimage also has the same -T option, which is not aliased yet
  2. Instead of just alias -T to no_interpolate, we may want to more Pythonic parameters.

@yvonnefroehlich yvonnefroehlich changed the title Figure.grdview: Add alias "no_interpolation" for "-T" Figure.grdview, Figure.grdimage: Add alias "no_interpolation" for "-T" Jul 25, 2024
@yvonnefroehlich
Copy link
Member Author

Two points:

  1. grdimage also has the same -T option, which is not aliased yet

Thanks for pointing out! Included in commit 28bf914.

  1. Instead of just alias -T to no_interpolate, we may want to more Pythonic parameters.

You mean splitting the functionality of -T to have additionally separate parameters for +o and +s?

@seisman
Copy link
Member

seisman commented Jul 26, 2024

You mean splitting the functionality of -T to have additionally separate parameters for +o and +s?

Yes.

@seisman
Copy link
Member

seisman commented Jul 26, 2024

The full syntax of the -T option is -T[+o[<pen>]][+s], so here are all the possibilities:

  • -T
  • -T+s
  • -T+o
  • -T+s+o
  • -T+o<pen>
  • -T+o<pen>+s

Instead of alias -T to no_interpolation, maybe we can alias is to tileplot instead? The name tileplot comes from the comment
here https://github.com/GenericMappingTools/gmt/blob/586699fa813c176cd271793bcd375a6f722c56f6/src/grdview.c#L708, although GMT uses no_interp at https://github.com/GenericMappingTools/gmt/blob/586699fa813c176cd271793bcd375a6f722c56f6/src/longopt/grdview_inc.h#L43.

So, we can use two parameters tileplot and tile_outline:

  • -T => tileplot=True
  • -T+s => tileplot="skipnans"
  • -T+o => tile_outline=True
  • -T+s+o => tileplot="skipnans", tile_outline=True
  • -T+o<pen> => tile_outline=<pen>
  • -T+o<pen>+s => tileplot="skipnans", tile_outline=<pen>

@seisman seisman modified the milestones: 0.13.0, 0.14.0 Aug 1, 2024
@seisman seisman removed this from the 0.14.0 milestone Sep 5, 2024
@yvonnefroehlich yvonnefroehlich marked this pull request as draft September 8, 2024 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement Improving an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants