-
Notifications
You must be signed in to change notification settings - Fork 224
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
GMTDataArrayAccessor: Support passing values using enums GridRegistration and GridType for grid registration and type #3696
Open
seisman
wants to merge
26
commits into
main
Choose a base branch
from
enums/grid-reg-type
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
seisman
force-pushed
the
enums/grid-reg-type
branch
from
December 18, 2024 14:34
170a15d
to
fd099b0
Compare
seisman
commented
Dec 19, 2024
seisman
commented
Dec 19, 2024
Merged
7 tasks
seisman
changed the title
GMTDataArrayAccessor: Support passing values using enums GridReg and GridType for grid registration and type
GMTDataArrayAccessor: Support passing values using enums GridRegistration and GridType for grid registration and type
Jan 5, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
Improving an existing feature
needs review
This PR has higher priority and needs review.
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.
Description of proposed changes
This PR improves the
GMTDataArrayAccessor
by allowing setting grid registration and gtype using more readable enums, rather than numeric values.Refer to #499 (comment) for the initial thoughts but implemented using
enums
as proposed in #499 (comment).This PR does a few things:
GridReg
/GridType
.GMTDataArrayAccessor
to support passing enum values (e.g.,grid.gmt.registration=GridReg.PIXEL
, notgrid.gmt.registration=1
).assert grid.gmt.registration==GridReg.PIXEL
, notassert grid.gmt.registration==1
test_accessor.py
The plan is to cherry-pick the commit 8c7f8f6 into a separate PR and keep the other commits in this PR, so that we can have two separate entries in the release changelog.[Done in #3693]Please note that:
grid.gmt.registration = "gridline"
) initially proposed in Make a gmt xarray accessor to store metadata from grdinfo #499 (comment) are not supported in this PR. It's simple to support string-type values, but I feel it's not necessary (see the reverted changes in 259771a).TODO:
GridReg
/GridType
to API docs [in Add enums GridRegistration and GridType for grid registration and type #3693]Preview: https://pygmt-dev--3696.org.readthedocs.build/en/3696/api/generated/pygmt.GMTDataArrayAccessor.html
Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.