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

Groupby exclude dimension #1013

Open
pwolfram opened this issue Sep 20, 2016 · 10 comments
Open

Groupby exclude dimension #1013

pwolfram opened this issue Sep 20, 2016 · 10 comments

Comments

@pwolfram
Copy link
Contributor

Is there some way to do a groupby operation where some dimension is excluded from the operation, e.g., a vectorized version of something like this:

vertlevels = [ds.vel.sel(nVertLevels=i).groupby('y').mean() for i in ds.nVertLevels]
xavgvel = xr.concat(vertlevels, 'nVertLevels')

The application here is to average 3D data in the x coordinate to the unique y coordinates, but not the vertical coordinate.

Thus, we are basically looking for something that allows a coordinate to be excluded from the groupby operation, e.g., in this case the vertical coordinate. Ideally this would also be possible within the context of the groupby_bins operation.

Any ideas on how this should work or a pointer on how to implement this type of operation more cleanly with existing infrastructure is greatly appreciated. This appears to be related to #324 and especially (perhaps identically) #924.

cc @vanroekel, @shoyer, @jhamman, @rabernat, @MaximilianR

@rabernat
Copy link
Contributor

I explicitly listed this as a TODO in my multidimensional groupby PR (#818):
https://github.com/pydata/xarray/blob/master/xarray/core/groupby.py#L166

It would definitely be useful and is totally doable!

@shoyer
Copy link
Member

shoyer commented Sep 21, 2016

My guess is that this could be implemented pretty quickly on top of #924, which is currently on hold while I finish up #964.

@pwolfram
Copy link
Contributor Author

Thanks @rabernat and @shoyer!

@rabernat
Copy link
Contributor

If only we could clone @shoyer!

@pwolfram
Copy link
Contributor Author

Isn't there a git command for that? ;-)

@pwolfram
Copy link
Contributor Author

Thanks for making everyone's life so much better via xarray and for helping us all to contribute to this process @shoyer!

@pwolfram
Copy link
Contributor Author

Note, this issue should be resolvable via #924.

@stale
Copy link

stale bot commented Oct 4, 2020

In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity

If this issue remains relevant, please comment here or remove the stale label; otherwise it will be marked as closed automatically

@stale stale bot added the stale label Oct 4, 2020
@dcherian dcherian removed the stale label Oct 4, 2020
@max-sixty
Copy link
Collaborator

Is this still current?

@max-sixty max-sixty added the plan to close May be closeable, needs more eyeballs label Sep 25, 2024
@dcherian
Copy link
Contributor

Yes

@dcherian dcherian removed the plan to close May be closeable, needs more eyeballs label Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants