Skip to content

Conversation

@seisman
Copy link
Member

@seisman seisman commented Feb 18, 2023

Description of proposed changes

See #499 for context.

Preview: https://pygmt-dev--2375.org.readthedocs.build/en/2375/api/generated/pygmt.GMTDataArrayAccessor.html

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
  • If adding new functionality, add an example to docstrings or tutorials.
  • Use underscores (not hyphens) in names of Python files and directories.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

@seisman seisman force-pushed the accessor-limitations branch from 7437520 to 9104524 Compare February 18, 2023 10:03
@seisman seisman force-pushed the accessor-limitations branch from 9104524 to 628648a Compare February 18, 2023 10:04
@seisman seisman changed the title Document the limitations of GMT xarray accessors Document limitations of GMT xarray accessors Feb 18, 2023
@seisman seisman added the documentation Improvements or additions to documentation label Feb 18, 2023
@seisman seisman marked this pull request as ready for review February 20, 2023 16:01
@seisman seisman added this to the 0.9.0 milestone Feb 20, 2023
@seisman seisman added the needs review This PR has higher priority and needs review. label Feb 20, 2023
@seisman
Copy link
Member Author

seisman commented Feb 22, 2023

Ping @GenericMappingTools/pygmt-maintainers for reviews.

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.

Just one very minor suggestion, but otherwise I think it's documented really well!

Comment on lines +85 to +90
Inplace assignment operators like ``*=`` don't create new instances, so the
properties are still kept:
>>> grid *= 2.0
>>> grid.gmt.registration, grid.gmt.gtype
(0, 1)
Copy link
Member

Choose a reason for hiding this comment

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

Interesting, good to know that in-place assignment preserves the registration and gtype information!

Comment on lines +16 to +17
The accessor extends :class:`xarray.DataArray` to store GMT-specific
properties about grids, which are important for PyGMT to correctly process
Copy link
Member

Choose a reason for hiding this comment

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

Technically xarray accessors are not just about setting properties/attributes. You may need to change this sentence if the .gmt.imshow() function at #2372 is added to this accessor class.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will rephrase this sentence in PR #2372.

@weiji14 weiji14 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 Feb 22, 2023
@seisman seisman merged commit 8aec841 into main Feb 22, 2023
@seisman seisman deleted the accessor-limitations branch February 22, 2023 13:47
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Feb 22, 2023
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.

5 participants