id,node_id,number,title,user,state,locked,assignee,milestone,comments,created_at,updated_at,closed_at,author_association,active_lock_reason,draft,pull_request,body,reactions,performed_via_github_app,state_reason,repo,type 497416198,MDExOlB1bGxSZXF1ZXN0MzIwNTUxODg0,3336,Provide better error message when dimension name matches argument,2818208,open,0,,,7,2019-09-24T02:16:05Z,2023-12-02T02:53:11Z,,CONTRIBUTOR,,0,pydata/xarray/pulls/3336,"WIP PR for https://github.com/pydata/xarray/issues/3324. Since `either_dict_or_kwargs` is called 57 times, I don't want to modify every function call without a preliminary review. My main question is if using `locals()` at the top of each function is considered acceptable. Of course, if `locals()` is called _after_ some local variables are created, this code could raise an error when no conflict exists. But explicitly passing in the function argument names in all 57 functions seems brittle. I'd appreciate any thoughts on the PR before I modify all the functions and write some tests.","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/3336/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 499937876,MDU6SXNzdWU0OTk5Mzc4NzY=,3355,"Define aligning, broadcasting, merging, concatenating, combining in new glossary",2818208,closed,0,,,1,2019-09-29T16:16:45Z,2023-08-18T19:49:00Z,2023-08-18T19:49:00Z,CONTRIBUTOR,,,,"Over at https://github.com/pydata/xarray/pull/3352, we're working on a new page describing key Xarray terminology for https://github.com/pydata/xarray/issues/2410. Since it's already a big PR, and we may need to iterate on the definitions a few times, this issue is for extending the glossary once that PR is merged. Some terms are to add are: **aligning**, **broadcasting**, **merging**, **concatenating**, **combining**.","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/3355/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue 499988033,MDU6SXNzdWU0OTk5ODgwMzM=,3356,Explain name matching rules for dimension and non-dimension coordinates,2818208,open,0,,,2,2019-09-29T23:29:19Z,2020-11-29T01:36:57Z,,CONTRIBUTOR,,,,"This arose as part of https://github.com/pydata/xarray/pull/3352. Xarray has important-to-understand name-matching rules for whether or not a coordinate array is a dimension coordinate or a non-dimension coordinate. To my knowledge, this is not in the documentation anywhere. This is what I had, but we decided to remove it since it was overly complicated for a list of key terms; maybe it'll be helpful going forward: > **Name matching rules:** Xarray follows simple but important-to-understand name matching rules for dimensions and coordinates. Let ``arr`` be an array with an existing dimension ``x`` and assigned new coordinates ``new_coords``. If ``new_coords`` is a list-like for e.g. ``[1, 2, 3]`` then they must be assigned a name that matches an existing dimension. For example, if ``arr.assign_coords({'x': [1, 2, 3]}).`` > > However, if ``new_coords`` is a one-dimensional ``DataArray``, then the rules are slightly more complex. In this case, if both ``new_coords``'s name and only dimension match any dimension name in ``arr.dims``, it is assigned as a dimension coordinate to ``arr``. If ``new_coords``'s name matches a name in ``arr.dims`` but its own dimension name does not, it is assigned as a non-dimension coordinate with name ``new_coords.dims[0]`` to ``arr``. Otherwise, an exception is raised.","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/3356/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue 499807676,MDExOlB1bGxSZXF1ZXN0MzIyNDM3NDI5,3352,Add glossary to documentation,2818208,closed,0,,,6,2019-09-28T18:45:40Z,2019-09-30T01:16:49Z,2019-09-29T23:39:54Z,CONTRIBUTOR,,0,pydata/xarray/pulls/3352,"This is my attempt at closing https://github.com/pydata/xarray/issues/2410. I've borrowed a bit of text from that PR (thanks @horta), from https://github.com/pydata/xarray/issues/1295, and from the xarray docs. I avoided verbose examples—it makes quickly searching and reading the glossary difficult—and put most of the effort into explaining dimension vs non-dimension coordinates, which in my experience opens the door to true xarray enlightenment. Corrections, comments, or suggestions for additional terminology welcome.","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/3352/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 482452409,MDU6SXNzdWU0ODI0NTI0MDk=,3231,Dict-like argument support for assign_coords(),2818208,closed,0,,,3,2019-08-19T18:07:39Z,2019-09-28T20:44:08Z,2019-09-28T20:44:08Z,CONTRIBUTOR,,,,"Often the xarray API supports [either a `dict` or `kwargs`](https://github.com/pydata/xarray/blob/master/xarray/core/utils.py#L257), and it seems like this should be consistent as often as possible. With `assign_coords`, this works as expected: ```python >>> dims = [""x"", ""y""] >>> coords = {""fruit"": (""x"", [""apple"", ""banana""])} >>> arr = xr.DataArray([[1,2,3],[4,5,6]], dims=dims, coords=coords) >>> arr.assign_coords(color=(""x"", [""red"", ""yellow""])) array([[1, 2, 3], [4, 5, 6]]) Coordinates: fruit (x) >> arr.assign_coords({""color"": (""x"", [""red"", ""yellow""])}) *** TypeError: assign_coords() takes 1 positional argument but 2 were given ```","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/3231/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue 499811729,MDExOlB1bGxSZXF1ZXN0MzIyNDQwMzk1,3353,Remove `complex.nc` from built docs,2818208,closed,0,,,1,2019-09-28T19:23:10Z,2019-09-28T19:57:37Z,2019-09-28T19:57:37Z,CONTRIBUTOR,,0,pydata/xarray/pulls/3353,"I assume this is related to https://github.com/pydata/xarray/issues/3297 or an associated issue. Basically, a file, `complex.nc`, is being added to `doc/` after running `make clean && make html`. Would be nice to suppress this. ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/3353/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 495920497,MDU6SXNzdWU0OTU5MjA0OTc=,3324,`sel` fails confusingly or silently when a dimension name matches an optional argument,2818208,open,0,,,10,2019-09-19T17:02:17Z,2019-09-20T21:23:18Z,,CONTRIBUTOR,,,,"Given that many Xarray methods accept `dict` or keyword arguments, this may effect other methods. That said, here is a minimal example with `sel`. #### Minimal example If I want to select based on a dimension named `method`, I cannot because Xarray thinks `method` is the `method` argument to `sel`: ```python >>> da1 = xr.DataArray(range(3), dims=['method'], coords={'method': range(3)}) >>> da1 array([0, 1, 2]) Coordinates: * method (method) int64 0 1 2 >>> da1.sel(method=0) ... TypeError: ``method`` must be a string ``` And if the `method` dimension has string labels, this fails silently: ```python >>> da2 = xr.DataArray(range(3), dims=['method'], coords={'method': list('abc')}) >>> da2.sel(method='a') array([0, 1, 2]) Coordinates: * method (method) ..."" to include in what will be committed) example-no-leap.nc foo.zarr/ manipulated-example-data.nc path/ nothing added to commit but untracked files present (use ""git add"" to track) ``` #### Expected Output I would expect no files to be created by `make html` in the `doc` directory. #### Problem Description It's not clear this will happen and may result in some people (me!) accidentally committing these files with `git commit -A`.","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/3227/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue 484089737,MDU6SXNzdWU0ODQwODk3Mzc=,3240,assign_coords adds coordinates without a new dimension if the value is scalar,2818208,closed,0,,,5,2019-08-22T16:14:05Z,2019-08-26T08:16:37Z,2019-08-26T08:16:37Z,CONTRIBUTOR,,,,"### Problem `assign_corods` correctly disallows creating a new dimension when assigning `list`-like coords with a name that does not match an existing dimension. However, it does allow this operation if the value is scalar. ### MCVE Consider the following `DataArray`: ```python >>> coords = {""fruit"": (""x"", [""apple"", ""banana""])} >>> arr = xr.DataArray([[1, 2, 3], [4, 5, 6]], dims=(""x"", ""y""), coords=coords) >>> arr array([[1, 2, 3], [4, 5, 6]]) Coordinates: fruit (x) >> arr.assign_coords(color=(""x"", [""red"", ""yellow""])) array([[1, 2, 3], [4, 5, 6]]) Coordinates: fruit (x) >> arr.assign_coords(color=[""red"", ""yellow""]) ... ValueError: cannot add coordinates with new dimensions to a DataArray ``` The above fails because Xarray, in the absence of an explicit dimension, tries to assign the new coordinates to a `color` dimension which does not exist. So far so good. But why does _this_ work? ```python >>> arr = arr.assign_coords(color=""red"") >>> arr array([[1, 2, 3], [4, 5, 6]]) Coordinates: fruit (x) >> arr.coords Coordinates: fruit (x) Mapping from names matching dimensions and values given by (lists of) the names of existing coordinates or variables to set as new (multi-)index. This suggests that one can set a `DataArray` instance's coordinates by passing in a dimension and a list-like object of coordinates. #### MCVE ```python In [1]: import numpy as np In [2]: import xarray as xr In [3]: arr = xr.DataArray(data=np.ones((2, 3)), dims=['x', 'y']) In [4]: arr.dims Out[4]: ('x', 'y') In [5]: arr.set_index({'x': range(2)}) KeyError ... 144 for n in var_names: --> 145 var = variables[n] 146 if (current_index_variable is not None and 147 var.dims != current_index_variable.dims): KeyError: 0 ``` At first, I thought it might be because `coords` and `_coords` were not being set in this case: ```python In [18]: arr.coords Out[18]: Coordinates: *empty* In [19]: arr._coords Out[19]: OrderedDict() ``` but even if I set the coordinates first and then try to re-index, it fails: ```python In [20]: arr = xr.DataArray(data=np.ones((2, 3)), dims=['x', 'y'], coords={'x': range(2), 'y': range(3)}) In [21]: arr.set_index({'x': ['a', 'b', 'c']}) ... 144 for n in var_names: --> 145 var = variables[n] 146 if (current_index_variable is not None and 147 var.dims != current_index_variable.dims): ``` #### Expected Output I expect my MCVE to work based on the documentation. #### Problem Solution My guess is that the issue is Xarray is using the `merge_indexes` function ([see here](https://github.com/pydata/xarray/blob/master/xarray/core/dataarray.py#L1444)) from the `Dataset` module, and there is no concept of a `variable` in a `DataArray`.","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/3176/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue 467856527,MDExOlB1bGxSZXF1ZXN0Mjk3NDA4MzQx,3126,Return immutable view of Pandas indexes,2818208,closed,0,,,9,2019-07-14T16:02:43Z,2019-08-19T07:33:46Z,2019-08-19T07:33:46Z,CONTRIBUTOR,,0,pydata/xarray/pulls/3126,"- This closes #2949. We return a shallow copy of Pandas indexes to ensure immutability. - Added `test_index_immutability` in `tests/test_dataarray.py`. - Amended `whats-new.rst`.","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/3126/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 467865659,MDExOlB1bGxSZXF1ZXN0Mjk3NDE0NjY0,3128,Support keyword API for `Dataset.drop`,2818208,closed,0,,,20,2019-07-14T17:36:03Z,2019-08-19T02:24:00Z,2019-08-18T17:42:45Z,CONTRIBUTOR,,0,pydata/xarray/pulls/3128,"- Closes https://github.com/pydata/xarray/issues/2910. - In `tests/test_dataset`, added `test_drop_labels_by_keyword` - Added a utility function `is_list_like`. - Documented in `whats-new.rst` and confirmed API docs built correctly.","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/3128/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 481935553,MDExOlB1bGxSZXF1ZXN0MzA4MzI0ODM1,3226,Add PR checklist to contributing docs,2818208,closed,0,,,3,2019-08-17T23:22:49Z,2019-08-18T17:49:24Z,2019-08-18T17:40:30Z,CONTRIBUTOR,,0,pydata/xarray/pulls/3226,"I'm a new contributor working on a couple PRs for Xarray and wished I had a short checklist of things to do before pushing a commit. First, I think such an overview list is useful per se. Second, CI takes a while, and it's much faster to just run `black .` or to build the docs manually than it is easy wait for CI to fail. Inspired by [Scikit-learn's checklist](https://scikit-learn.org/stable/developers/contributing.html#pull-request-checklist). This is just a first draft; happy for suggestions or to add anything I'm missing.","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/3226/reactions"", ""total_count"": 2, ""+1"": 2, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull