Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise UserWarning when rename creates a new dimension coord #6999

Merged
merged 3 commits into from
Sep 27, 2022

Conversation

benbovy
Copy link
Member

@benbovy benbovy commented Sep 6, 2022

Current implemented "fix": raise a UserWarning and suggest using swap_dims (*)

Alternatively, we could:

  • revert the breaking change (i.e., create the index again) and raise a DeprecationWarning instead
  • raise an error instead of a warning

I don't have strong opinions on this, I'm happy to implement another alternative. The downside of reverting the breaking change now is that unfortunately it will introduce a breaking change in the next release., while workarounds are pretty straightforward.

(*) from #6607 (comment), doing ds.set_coords(['lon']).rename(x='lon').set_index(lon='lon') is working too. With #6971, .set_xindex('lon') could work as well.

@benbovy benbovy mentioned this pull request Sep 23, 2022
@headtr1ck
Copy link
Collaborator

looks good to me

@Illviljan Illviljan added the plan to merge Final call for comments label Sep 24, 2022
@benbovy
Copy link
Member Author

benbovy commented Sep 27, 2022

Thanks @headtr1ck, ok let's merge this.

@benbovy benbovy merged commit 45c0a11 into pydata:main Sep 27, 2022
@benbovy benbovy deleted the add-warning-rename-dim-coord branch December 8, 2022 09:38
johnomotani added a commit to boutproject/xBOUT that referenced this pull request Jan 20, 2023
xarray behaviour changed, see pydata/xarray#6999
and links from there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plan to merge Final call for comments
Projects
None yet
3 participants