Skip to content

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.

@seisman seisman merged commit 6396328 into main Jun 2, 2025
22 of 24 checks passed
@seisman seisman deleted the docs/accessor branch June 2, 2025 10:27
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Jun 2, 2025
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

4 participants