Skip to content

Conversation

@seisman
Copy link
Member

@seisman seisman commented Nov 1, 2025

GMT documentation: https://docs.generic-mapping-tools.org/6.6/gmt.html#nodereg-full

The GMT CLI syntax is -r[g|p]. Here, we use the descriptive values "gridline" and "pixel".

I'm still thinking if we should support the GridRegistration enums (https://www.pygmt.org/dev/api/generated/pygmt.enums.GridRegistration.html#pygmt.enums.GridRegistration), i.e.,

import pygmt
from pygmt.enums import GridRegistration

pygmt.xyz2grd(..., registration=GridRegistration.PIXEL)

@GenericMappingTools/pygmt-maintainers What do you think?

@seisman seisman changed the title AliasSystem: Migrate the 'registration' parameter to the new alias system AliasSystem: Migrate the 'registration' parameter to the new alias system and support descriptive arguments Nov 1, 2025
@seisman seisman added the enhancement Improving an existing feature label Nov 1, 2025
@seisman seisman added this to the 0.18.0 milestone Nov 1, 2025
@seisman seisman added the needs review This PR has higher priority and needs review. label Nov 1, 2025
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.

thinking if we should support the GridRegistration enums

Ideally yes, but probably do in another PR. Not sure how easy it is to convert an IntEnum to support StrEnum also (maybe ReprEnum?).

] = "number",
quantile_value: float = 50,
region: Sequence[float | str] | str | None = None,
registration: Literal["gridline", "pixel"] | bool = False,
Copy link
Member

Choose a reason for hiding this comment

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

Docstring for registration should be updated to 1) add bool type hint, and 2) indicate that registration=True means pixel registration.

"registration": r"""
registration : str
**g**\|\ **p**.
Force gridline (**g**) or pixel (**p**) node registration
[Default is **g**\ (ridline)].""",

Copy link
Member Author

Choose a reason for hiding this comment

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

add bool type hint,

Type hints are now added via function signatures, not in docstrings.

@seisman seisman requested a review from a team November 5, 2025 02:13
@seisman seisman added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. final review call This PR requires final review and approval from a second reviewer labels Nov 5, 2025
@seisman seisman merged commit 195347d into main Nov 6, 2025
22 of 25 checks passed
@seisman seisman deleted the AliasSystem/registration branch November 6, 2025 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improving an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants