home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1202535745

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/6867#issuecomment-1202535745 https://api.github.com/repos/pydata/xarray/issues/6867 1202535745 IC_kwDOAMm_X85HrT1B 4160723 2022-08-02T13:17:09Z 2022-08-02T20:23:32Z MEMBER

Hi @ZhaJiMan, this topic has been brought up several times recently (see, e.g., #4825, #6607, #6704).

I can't tell much about your latitude / longitude case without a more detailed example, but looking at your simple case the result is the one I would expect, i.e., rename_dims renames only the dimension (not the coordinate).

Note that with version 2022.6.0, the space coordinate keeps its index so that you can still use it with .sel():

```python renamed = ds.rename_dims(space='label'))

renamed

<xarray.Dataset>

Dimensions: (label: 3)

Coordinates:

* space (label) <U1 'a' 'b' 'c'

Dimensions without coordinates: label

Data variables:

x (label) int64 1 2 3

renamed.sel(space="a")

<xarray.Dataset>

Dimensions: ()

Coordinates:

space <U1 'a'

Data variables:

x int64 1

```

Given that we can now use non-dimension coordinates for data selection, we should probably remove the "Dimensions without coordinates: label" in the repr for such case, as it becomes rather confusing. We should probably change that line to something like "Dimensions without index" or "Dimensions without indexed coordinates" or address that in the indexes repr section (#6795).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  1325761961
Powered by Datasette · Queries took 78.773ms · About: xarray-datasette