Conversation
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
seisman
reviewed
Apr 3, 2026
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
seisman
reviewed
Apr 3, 2026
26 tasks
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Member
Author
Thank you for your guidance. |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new pygmt.grdmask wrapper (and corresponding API/docs/tests) to generate mask grids from polygon/point inputs, aligning PyGMT functionality with GMT’s grdmask module and addressing the “required arguments” behavior discussed in #4427.
Changes:
- Implement
pygmt.grdmaskwrapper with-Noption construction via a dedicated_alias_option_Nhelper. - Add a new test module
pygmt/tests/test_grdmask.pycovering outgrid vs in-memory returns and several-Nbehaviors. - Export
grdmaskat the package level and include it in the API docs index.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pygmt/src/grdmask.py | New grdmask implementation and -N option alias helper. |
| pygmt/tests/test_grdmask.py | New unit tests for grdmask output, metadata, and selected option behaviors. |
| pygmt/src/init.py | Re-export grdmask from pygmt.src. |
| pygmt/init.py | Expose grdmask at the top-level pygmt namespace. |
| doc/api/index.rst | Add grdmask to the autosummary API listing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
Comment on lines
+136
to
+138
| The mask grid can be used to mask out specific regions in other grids using | ||
| :func:`pygmt.grdmath` or similar tools. For masking based on coastline features, | ||
| consider using :func:`pygmt.grdlandmask` instead. |
Member
There was a problem hiding this comment.
So far pygmt.grdmath is not available / wrapped.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Preview: https://pygmt-dev--4463.org.readthedocs.build/en/4463/api/generated/pygmt.grdmask.html
Related to #4427.