Skip to content

Raise UserWarning when rename creates a new dimension coord - #6999

Merged
benbovy merged 3 commits into
pydata:mainfrom
benbovy:add-warning-rename-dim-coord
Sep 27, 2022
Merged

Raise UserWarning when rename creates a new dimension coord#6999
benbovy merged 3 commits into
pydata:mainfrom
benbovy:add-warning-rename-dim-coord

Conversation

@benbovy

@benbovybenbovy commented Sep 6, 2022

Copy link
Copy Markdown
Member

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.

@benbovybenbovy mentioned this pull request Sep 23, 2022
@headtr1ck

Copy link
Copy Markdown
Collaborator

looks good to me

@IllviljanIllviljan added the plan to merge Final call for comments label Sep 24, 2022
@benbovy

Copy link
Copy Markdown
MemberAuthor

Thanks @headtr1ck, ok let's merge this.

@benbovy
benbovy merged commit 45c0a11 into pydata:mainSep 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
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plan to mergeFinal call for comments

Projects

None yet

3 participants

@benbovy@headtr1ck@Illviljan