-
Notifications
You must be signed in to change notification settings - Fork 228
POC: Extend GMTDataArrayAccessor to support grid operations #3854
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
base: main
Are you sure you want to change the base?
Conversation
def clip(self, **kwargs) -> xr.DataArray: | ||
""" | ||
Clip the range of grid values. | ||
|
||
See the :func:`pygmt.grdclip` function for available parameters. | ||
""" | ||
return grdclip(grid=self._obj, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably best to keep the method name as .gmt.grdclip
instead of .gmt.clip
, because there is also https://docs.generic-mapping-tools.org/6.5/clip.html (same with the other grd* methods below), and who knows if we might use pandas accessors at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if we decide to implement the pandas accessors in the future (actually, I feel it's a good idea), there are still no conflicts since the two accessors are in different namespaces. E.g.,
da.gmt.clip
: Clip operation on a xr.DataArray grid/imagedf.gmt.clip
: Clip operation on a pd.DataFrame object
Address #499 (comment).
This is a POC PR to show how GMTDataArrayAccessor can access GMT's grid-operation modules, i.e.,
grid.gmt.fill(**kwargs)
instead ofpygmt.grdfill(grid, **kwargs)
: