Skip to content

Wrap grdmask for creating mask grid from polygons or point coverage#4463

Merged
seisman merged 103 commits intomainfrom
grdmask1
Apr 4, 2026
Merged

Wrap grdmask for creating mask grid from polygons or point coverage#4463
seisman merged 103 commits intomainfrom
grdmask1

Conversation

@Chuan1937
Copy link
Copy Markdown
Member

@Chuan1937 Chuan1937 commented Mar 21, 2026

Chuan1937 and others added 30 commits February 25, 2026 20:55
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>
Chuan1937 and others added 4 commits April 3, 2026 19:53
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>
Copy link
Copy Markdown
Member

@seisman seisman left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks.

Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
@Chuan1937
Copy link
Copy Markdown
Member Author

Looks great! Thanks.

Thank you for your guidance.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.grdmask wrapper with -N option construction via a dedicated _alias_option_N helper.
  • Add a new test module pygmt/tests/test_grdmask.py covering outgrid vs in-memory returns and several -N behaviors.
  • Export grdmask at 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.

Chuan1937 and others added 2 commits April 3, 2026 20:37
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@seisman seisman added the final review call This PR requires final review and approval from a second reviewer label Apr 3, 2026
@seisman seisman changed the title pygmt.grdmask: Create mask grid from polygons or point coverage(required arguments) Wrap grdmask for creating mask grid from polygons or point coverage Apr 4, 2026
@seisman seisman merged commit 538d006 into main Apr 4, 2026
20 of 23 checks passed
@seisman seisman deleted the grdmask1 branch April 4, 2026 13:19
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Apr 4, 2026
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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So far pygmt.grdmath is not available / wrapped.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, please fix it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See #4524

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Brand new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pygmt.grdmask: Create mask grid from polygons or point coverage

4 participants