home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 1361989642

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
1361989642 I_kwDOAMm_X85RLlAK 6990 New MultiIndex dimension behaviours 76457120 closed 0     2 2022-09-05T13:37:29Z 2023-03-12T10:17:14Z 2023-03-12T10:17:13Z NONE      

What is your issue?

As of the latest release (2022.6.0), the behaviour of MultiIndex coordinates and their constituents appears to have changed.

Creating a simple multi-indexed DataSet:

``` ds1 = xr.Dataset({'foo': (('x',), [1, 2, 3])}, {'x': [1, 2, 3], 'y': 'a'}) ds2 = xr.Dataset({'foo': (('x',), [4, 5, 6])}, {'x': [1, 2, 3], 'y': 'b'})

mult = xr.concat([ds1, ds2], dim='y').stack(yx=['y', 'x']) ```

Printing the DataSet and the coordinate indices on version 2022.3.0: mult <xarray.Dataset> Dimensions: (yx: 6) Coordinates: * yx (yx) MultiIndex - y (yx) object 'a' 'a' 'a' 'b' 'b' 'b' - x (yx) int64 1 2 3 1 2 3 Data variables: foo (yx) int64 1 2 3 4 5 6

mult.coords.indexes yx: MultiIndex([('a', 1), ('a', 2), ('a', 3), ('b', 1), ('b', 2), ('b', 3)], names=['y', 'x'])

Printing the DataSet and the coordinate indices on version 2022.6.0: mult <xarray.Dataset> Dimensions: (yx: 6) Coordinates: * yx (yx) object MultiIndex * y (yx) <U1 'a' 'a' 'a' 'b' 'b' 'b' * x (yx) int64 1 2 3 1 2 3 Data variables: foo (yx) int64 1 2 3 4 5 6

mult.coords.indexes Indexes: yx: MultiIndex([('a', 1), ('a', 2), ('a', 3), ('b', 1), ('b', 2), ('b', 3)], name='yx') y: MultiIndex([('a', 1), ('a', 2), ('a', 3), ('b', 1), ('b', 2), ('b', 3)], name='yx') x: MultiIndex([('a', 1), ('a', 2), ('a', 3), ('b', 1), ('b', 2), ('b', 3)], name='yx')

On the latest version (2022.6.0), the constituent coordinates (x,y) of the multi-indexed coordinate (yx) have asterisks next to them, implying that they are dimensional (despite the them not being named equal to their sole dimension, as stated in the docs' coordinates section).

dimension coordinates are one dimensional coordinates with a name equal to their sole dimension (marked by * when printing a dataset or data array)

Further, looking into the .coords.indexes shows that each constituent coordinate is also indexed by an instance of the same MultiIndex.

I was wondering if this change been made design and whether the documentation just need updating, or I have misunderstood something along the way.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/6990/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 1 row from issues_id in issues_labels
  • 2 rows from issue in issue_comments
Powered by Datasette · Queries took 80.849ms · About: xarray-datasette