pygmt.grdmask: Create mask grid from polygons or point coverage(required arguments)#4428
Open
Chuan1937 wants to merge 50 commits intoGenericMappingTools:mainfrom
Open
pygmt.grdmask: Create mask grid from polygons or point coverage(required arguments)#4428Chuan1937 wants to merge 50 commits intoGenericMappingTools:mainfrom
Chuan1937 wants to merge 50 commits intoGenericMappingTools:mainfrom
Conversation
seisman
reviewed
Feb 25, 2026
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
seisman
reviewed
Feb 25, 2026
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
26 tasks
seisman
reviewed
Feb 27, 2026
seisman
reviewed
Mar 2, 2026
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
seisman
reviewed
Mar 2, 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
Mar 4, 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>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
seisman
reviewed
Mar 4, 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>
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
Mar 6, 2026
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
seisman
reviewed
Mar 6, 2026
|
|
||
| Examples | ||
| -------- | ||
| >>> _alias_option_N()._value |
Member
There was a problem hiding this comment.
What if users pass outside=1 only?
Member
Author
There was a problem hiding this comment.
outside=1 alone would generate -N1/None/None which passes invalid None strings to GMT. Fixed by returning None when inside is not set, so GMT uses its default values.
Member
There was a problem hiding this comment.
I think your changes don't make sense. outside=3 should return -N3/0/1 rather than None.
Member
Author
There was a problem hiding this comment.
I've added a more comprehensive test
seisman
reviewed
Mar 16, 2026
Comment on lines
+98
to
+101
| Reads one or more files containing polygon or data point | ||
| coordinates, and creates a grid where nodes that fall inside, on the | ||
| edge, or outside the polygons (or within the search radius from data points) are | ||
| assigned values based on ``outside``, ``edge``, and ``inside`` parameters. |
Member
There was a problem hiding this comment.
Please rewrap these lines to 88 characters.
Comment on lines
+69
to
+71
| elif inside is None and outside is None and edge is None: | ||
| # All three are None, return None (GMT uses default 0/0/1) | ||
| mask_values = None |
Member
There was a problem hiding this comment.
Change it to something like
if all(v is None for v in (outside, inside, edge)):
return Alias(None, name="mask_values")
and move it to the start of the function.
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.
pygmt.grdmask: Create mask grid from polygons or point coverage(required arguments)
Preview: https://pygmt-dev--4428.org.readthedocs.build/en/4428/api/generated/pygmt.grdmask.html#pygmt.grdmask