Closed as not planned
Description
What is your issue?
Currently a DataArray
's dims are ordered, while a Dataset
'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:
- Datasets have a dim order, which is set at construction time or through
.transpose
- Currently
.transpose
changes the order of each variable's dims, but not the dataset's - If dims aren't supplied, we can just use the first variable's
- Currently
- Variables don't have to conform to that order —
.assign(foo=differently_ordered)
maintains the differently ordered dims. So this doesn't limit any current functionality. - When there are transformations which change dim ordering, Xarray is "allowed" to transpose variables to the dataset's ordering. Currently Xarray is "allowed" to change dim order arbitrarily — for example to put a core dim last. IIUC, we'd prefer to set a non-arbitrary order, but we don't have one to reference.
- This would remove a bunch of boilerplate from methods that save the ordering, run
.apply_ufunc
and then reorder in the original order1
- This would remove a bunch of boilerplate from methods that save the ordering, run
What do folks think?
Footnotes
-
though also we could do this in
.apply_ufunc
↩