Skip to content

Should Dataset enforce some ordering of dims in its variables? #689

@max-sixty

Description

@max-sixty

I'm not sure on this one. I'm currently having a bunch of issues with this sort of Dataset:
(notice the dims are (d, c) and (c, d) for different variables)

<xray.Dataset>
Dimensions:               (c: 193, d: 6781)
Coordinates:
  * d                   (d) object 5218 5219 5220 5221 5222 5223 5224 ...
  * c                (c) object LDS. ...
    j                    (c, d) bool False False False False ...
Data variables:
    r                  (d, c) float64 nan -0.05083 nan ...
    s                  (d, c) float64 nan -0.05083 nan ...
    n                  (c, d) float64 nan nan nan nan nan ...

In my case, this is particularly painful when passing the result of ds.r.to_pandas() into a function expecting a DataFrame with a certain orientation when that orientation isn't reliable.

Is this a problem generally?

If it is, I could imagine a few solutions - enforce ordering, offer a method on a DataSet to align the dims, offer a kwarg on .to_pandas() to allow specifying the dims-axis mapping, etc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions