Skip to content

GMTDataArrayAccessor: Improve the documentation to clarify how the accessor works #3955

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

seisman
Copy link
Member

@seisman seisman commented May 22, 2025

@seisman seisman added this to the 0.16.0 milestone May 22, 2025
@seisman seisman added documentation Improvements or additions to documentation needs review This PR has higher priority and needs review. labels May 22, 2025
@seisman seisman changed the title GMTDataArrayAccessor: Improve the documentation GMTDataArrayAccessor: Improve the documentation to clarify how the accessor works May 22, 2025
@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. labels May 22, 2025
Comment on lines +35 to +37
:class:`xarray.DataArray` instance. Thus, the *gmt* accessor will be re-initialized
in cases where the :class:`xarray.DataArray` is manipulated (e.g., arithmetic and
slice operations) or when accessing a :class:`xarray.DataArray` from a
Copy link
Member

Choose a reason for hiding this comment

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

"Slice"-ing is still mentioned here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, slice operation creates a new xarray.DataArray instance, so the gmt accessor is re-initialized. The registration and gtype information are correct if the source encoding exists (e.g., loaded via xr.load_dataarray) or incorrect if the source encoding is None (e.g., xr.DataArray created from scracth).

plotting functions. Refer to :class:`pygmt.GMTDataArrayAccessor` for detailed
explanations and workarounds.
:class:`xarray.DataArray` grid can be accessed via the *gmt* accessor. Refer to
:class:`pygmt.GMTDataArrayAccessor` for detailed explanations and limitations.
Copy link
Member Author

@seisman seisman May 26, 2025

Choose a reason for hiding this comment

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

I've also simplified the notes in the load_xxx functions. Please review it and then I'll apply the changes to other load_xxx functions after approval.

Edit: I've updated all files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation final review call This PR requires final review and approval from a second reviewer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GMTDataArrayAccessor doesn't work for temporary files that have been sliced
3 participants