Better "merge" defaults for Dataset.__setitem__ and Dataset.update
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 dataset_update_method we call merge_core without specific values for join and compat. https://github.com/pydata/xarray/blob/e71c34174572b03e46e9d10bbea4528aef382021/xarray/structure/merge.py#L1063-L1068
These values default to join="outer" and compat="broadcast_equals"
https://github.com/pydata/xarray/blob/e71c34174572b03e46e9d10bbea4528aef382021/xarray/structure/merge.py#L639-L649.
We should probably migrate to join="left" and compat="override". Using override will avoid any potentially expensive equality comparisons for non-indexed coordiante variables. I am not sure how compat="override" interacts with priority_arg.
cc @shoyer
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 in xarray/structure/merge.py at dataset_update_method and the merge_core defaults around the referenced lines. Check how join="left" and compat="override" interact with priority_arg, then confirm that Dataset.setitem and Dataset.update use the intended defaults without the unnecessary equality comparisons.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100