-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Allow some notion of ordering in Dataset dims #8498
Comments
My understanding of why we don't have ordered dims on
then how can you decide what the order of the dimensions You could make a choice, but it will always be arbitrary, and either inconsistent with one of the variables or require changing the order of one of the variables. If that choice lives "above" the dataarrays, then it's sort of weird silent extra information. I also think we might want to think of this in terms of preserving some properties, e.g.
I'm not sure if that is addressed by your proposal but it's my mental model of why we don't do this.
Do we gain anything by having ordered dims? |
Good question! The main thing thing is having some canonical ordering:
For example:
Some methods that need a
We have this sort of boilerplate littered around, because
I agree — "sort of weird silent extra information." is exactly right. Though at the moment, arguably we have this extra information — |
I don't really think this is boilerplate, I think it's the user entering new information (or an arbitrary choice being made for them) at the exact moment it's needed. The examples you've shown here are basically the only times we have to step outside the
This is clearer to me, thanks. I'm not sure I agree that we already have this extra information though - |
Yeah — it sounds like your perspective is:
I think that's quite reasonable. I had weighed them differently, but I agree with the map of arguments. Unless someone wants to arrive like Joan of Arc in favor of ordering, we can close... |
Closing (but not forgetting! One day... 😁 ) |
What is your issue?
Currently a
DataArray
's dims are ordered, while aDataset
's are not.Do we gain anything from have unordered dims in a Dataset? Could we have an ordering without enforcing it on every variable?
Here's one proposal, with fairly wide error-bars:
.transpose
.transpose
changes the order of each variable's dims, but not the dataset's.assign(foo=differently_ordered)
maintains the differently ordered dims. So this doesn't limit any current functionality..apply_ufunc
and then reorder in the original order1What do folks think?
Footnotes
though also we could do this in
.apply_ufunc
↩The text was updated successfully, but these errors were encountered: