Future of `DataArray.rename`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 14
Description
What is your issue?
In https://github.com/pydata/xarray/pull/6665 the question came up what to do with DataArray.rename in light of the new index refactor.
To be consistent with Dataset we should introduce a
DataArray.rename_dimsDataArray.rename_varsDataArray.rename
Several open questions about the behavior (Similar things apply to Dataset.rename{, _dims, _vars}):
- Should
rename_dimsalso rename indexes (dimension coordinates)? - Should
rename_varsalso rename the DataArray? - What to do if the
DataArrayhas the same name as one of its coordinates? - Should
renamestill rename everything (like it is now) or only the name (Possibly with some deprecation cycle)?
The current implementation of DataArray.rename is a bit inconsistent:
As stated by @max-sixty in https://github.com/pydata/xarray/issues/6665#issuecomment-1154368202_:
- rename operates on DataArray as described in https://github.com/pydata/xarray/pull/6665#issuecomment-1150810485.%C2%A0Generally I'm less keen on "different types have different semantics", and here a positional arg would mean a DataArray rename, and kwarg would mean var rename. But it does work locally to DataArray quite well.
- rename only exists on DataArrays for the name of the DataArray, and we use rename_vars & rename_dims for both DataArrays & Datasets. So Dataset.rename is soft-deprecated.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the current DataArray.rename implementation and the discussion in pull request 6665 and issue 6665. Review the corresponding Dataset.rename, rename_dims, and rename_vars behavior, then resolve the listed questions about indexes, variable names, name collisions, and deprecation before defining completion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100