Skip to content
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

Add element.where method support dim expressions #3933

Closed
jonmmease opened this issue Aug 28, 2019 · 2 comments
Closed

Add element.where method support dim expressions #3933

jonmmease opened this issue Aug 28, 2019 · 2 comments

Comments

@jonmmease
Copy link
Collaborator

It would be nice to have an xarray-style where method (http://xarray.pydata.org/en/stable/generated/xarray.DataArray.where.html) on elements.

The signature would be something like

Element.where(cond, other=nan)

Here cond could be a boolean array matching the size of the element, or it could be a dim-expression. The result would be an element of the same type as the input, with the same size, but the values where cond is True would be replaced by other.

One application of this method would be to support arbitrary dim expression filtering on gridded datasets. If other is nan, this would make it possible to overlay a subset of an image on top of itself, where the subset is not a clean slice, but an arbitrary function of the element's dimensions.

@philippjfr
Copy link
Member

Similar to #4312, I'll close this and continue discussion there but we may want to keep the where API.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants