home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1039769097

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/6229#issuecomment-1039769097 https://api.github.com/repos/pydata/xarray/issues/6229 1039769097 IC_kwDOAMm_X849-Z4J 4160723 2022-02-15T01:58:43Z 2022-02-15T02:00:50Z MEMBER

This has been discussed in #4825.

A third option for rename{_vars} would be to rename the coordinate and its index (if any), regardless of whether the old and new names correspond to existing dimensions. We plan to drop the concept of a "dimension coordinate" with an implicit index in favor of indexes explicitly part of Xarray's data model (see https://github.com/pydata/xarray/projects/1), so that it will be possible to set indexes for non-dimension coordinates and/or set dimension coordinates without indexes.

Re your example, in #5692 data.rename({"c": "x"}) does not implicitly create anymore an indexed coordinate (no *):

```python data_renamed

<xarray.DataArray (x: 3)>

array([5, 6, 7])

Coordinates:

x (x) int64 1 2 3

```

Instead, it should be possible to directly set an index for the c coordinate without the need to rename it, e.g.,

```python

API has still to be defined

data_indexed = data.set_index("c", index_cls=xr.PandasIndex)

data_indexed.sel(c=[1, 2])

<xarray.DataArray (x: 2)>

array([5, 6])

Coordinates:

* c (x) int64 1 2

```

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