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

Don't emit a warning with .rename if it is a no-op #8265

Closed
hoxbro opened this issue Oct 3, 2023 · 3 comments · Fixed by #8266
Closed

Don't emit a warning with .rename if it is a no-op #8265

hoxbro opened this issue Oct 3, 2023 · 3 comments · Fixed by #8266

Comments

@hoxbro
Copy link
Contributor

hoxbro commented Oct 3, 2023

What is your issue?

When running this code:

import xarray as xr
ds = xr.tutorial.load_dataset("rasm")
ds.rename({"time": "time"})

I will get the following warning:

UserWarning: rename 'time' to 'time' does not create an index anymore. Try using swap_dims instead or use set_index after rename to create an indexed coordinate.
  ds.rename({"time": "time"})
@hoxbro hoxbro added the needs triage Issue that has not been reviewed by xarray team member label Oct 3, 2023
@welcome
Copy link

welcome bot commented Oct 3, 2023

Thanks for opening your first issue here at xarray! Be sure to follow the issue template!
If you have an idea for a solution, we would really welcome a Pull Request with proposed changes.
See the Contributing Guide for more.
It may take us a while to respond here, but we really value your contribution. Contributors like you help make xarray better.
Thank you!

@max-sixty max-sixty added contrib-help-wanted topic-error reporting and removed needs triage Issue that has not been reviewed by xarray team member labels Oct 3, 2023
@max-sixty
Copy link
Collaborator

I think we'd merge a contribution here. But for the sake of prioritization — this warning on .rename will likely go away at some point...

@hoxbro
Copy link
Contributor Author

hoxbro commented Oct 3, 2023

I'm up for making a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants