Skip to content

Conversation

willschlitzer
Copy link
Contributor

This PR adds an inline code example to the docstring for grdcut.

Addresses #1686

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.

Slash Commands

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

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

@willschlitzer willschlitzer added the documentation Improvements or additions to documentation label Dec 30, 2021
@willschlitzer willschlitzer added this to the 0.6.0 milestone Dec 30, 2021
@willschlitzer willschlitzer self-assigned this Dec 30, 2021
Co-authored-by: Meghan Jones <[email protected]>
@maxrjones
Copy link
Member

The example looks nice!

Do you want to figure out the CI separation mentioned here as part of this RFC?

@willschlitzer
Copy link
Contributor Author

The example looks nice!

Do you want to figure out the CI separation mentioned here as part of this RFC?

@meghanrjones I decided to use # doctest: +SKIP; I think the better long term solution is to edit the makefile, but I don't want to go outside the scope of this PR.

@maxrjones
Copy link
Member

The example looks nice!
Do you want to figure out the CI separation mentioned here as part of this RFC?

@meghanrjones I decided to use # doctest: +SKIP; I think the better long term solution is to edit the makefile, but I don't want to go outside the scope of this PR.

It's nice that the doctest comments are not included in the rendered html docs: https://pygmt-5z64fvi6h-gmt.vercel.app/api/generated/pygmt.grdcut.html#pygmt.grdcut.

Copy link
Member

@maxrjones maxrjones left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Copy link
Member

@weiji14 weiji14 left a comment

Choose a reason for hiding this comment

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

The example looks nice!
Do you want to figure out the CI separation mentioned here as part of this RFC?

@meghanrjones I decided to use # doctest: +SKIP; I think the better long term solution is to edit the makefile, but I don't want to go outside the scope of this PR.

It's nice that the doctest comments are not included in the rendered html docs: https://pygmt-5z64fvi6h-gmt.vercel.app/api/generated/pygmt.grdcut.html#pygmt.grdcut.

Wow, very handy that they hide the # doctest: +SKIP comment! So much for overthinking. Let's hope that Sphinx keeps this as a 'feature' rather than a 'bug' 😆

@maxrjones maxrjones added the final review call This PR requires final review and approval from a second reviewer label Jan 25, 2022
@seisman
Copy link
Member

seisman commented Jan 26, 2022

Is there any way to skip the entire code block using a single directive?

@willschlitzer
Copy link
Contributor Author

Is there any way to skip the entire code block using a single directive?

The example I found online involves wrapping the example in a function, and then calling that function but then adding doctest: +SKIP. I think that would complicate the example code if we tried that.

@seisman seisman changed the title RFC: Add inline example for grdcut.py Add inline example for grdcut.py Jan 27, 2022
@seisman seisman changed the title Add inline example for grdcut.py Add inline example for grdcut Jan 27, 2022
@weiji14 weiji14 merged commit 586f2d9 into main Jan 27, 2022
@weiji14 weiji14 deleted the inline-example/grdcut branch January 27, 2022 15:23
@weiji14 weiji14 removed the final review call This PR requires final review and approval from a second reviewer label Jan 27, 2022
sixy6e pushed a commit to sixy6e/pygmt that referenced this pull request Dec 21, 2022
Example to create a new grid from an input grid using pygmt.grdcut.

Co-authored-by: Meghan Jones <[email protected]>Create a new grid from an input grid
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants