html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue https://github.com/pydata/xarray/pull/3336#issuecomment-569074436,https://api.github.com/repos/pydata/xarray/issues/3336,569074436,MDEyOklzc3VlQ29tbWVudDU2OTA3NDQzNg==,2818208,2019-12-26T15:14:45Z,2019-12-26T15:14:45Z,CONTRIBUTOR,"The more I think about this PR, the more I dislike this approach. The solution must either be brittle or over-engineered. I discussed this issue with a friend, and other approaches don't seem better: currying the function—`arr.sel(method=""nearest"")(method=""foo"")`—or adding a decorator that caches the results of a stripped down `inspect.signature`. I think the best approach is to just raise a `ValueError` if certain string arguments are not in a predefined set of choices: ``` if method not in [""nearest"", ...]: raise ValueError(...) ``` @max-sixty, @dcherian, @shoyer thoughts? --- Not to open a can of worms, but the root cause of this issue is that the Xarray API accepts both `**kwargs` and ordinary named args. This PR—and methods like `either_dict_or_kwargs`—seems like workarounds to accommodate this model. Is there any interest in moving away from this API long-term?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,497416198 https://github.com/pydata/xarray/pull/3336#issuecomment-564076665,https://api.github.com/repos/pydata/xarray/issues/3336,564076665,MDEyOklzc3VlQ29tbWVudDU2NDA3NjY2NQ==,2818208,2019-12-10T15:08:55Z,2019-12-10T15:08:55Z,CONTRIBUTOR,"I'm almost done with classes and am happy to return to this if there is any interest. I don't want to design something brittle, though, and would love some guidance.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,497416198 https://github.com/pydata/xarray/pull/3352#issuecomment-536352264,https://api.github.com/repos/pydata/xarray/issues/3352,536352264,MDEyOklzc3VlQ29tbWVudDUzNjM1MjI2NA==,2818208,2019-09-29T23:34:32Z,2019-09-29T23:34:32Z,CONTRIBUTOR,"I've integrated the latest feedback and created https://github.com/pydata/xarray/issues/3356 for the section on name-matching rules. @jthielen, it's not my call, but I think a downstream PR makes sense.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,499807676 https://github.com/pydata/xarray/pull/3352#issuecomment-536317258,https://api.github.com/repos/pydata/xarray/issues/3352,536317258,MDEyOklzc3VlQ29tbWVudDUzNjMxNzI1OA==,2818208,2019-09-29T16:18:11Z,2019-09-29T16:18:11Z,CONTRIBUTOR,"Thanks for the feedback @max-sixty and @dcherian. I tried to incorporate your feedback and pushed some new changes. [Here's a screenshot of the page](https://user-images.githubusercontent.com/2818208/65835246-e7f20f00-e2b1-11e9-89c4-007acacea461.png). Happy to iterate more on this if needed. I do think getting this stuff right is really useful for new users. > Other things we should add (but not required right now): alignment, broadcasting, merging, concatenating, combining. Ah, these would be great to have. I've created https://github.com/pydata/xarray/issues/3355 so I/we remember.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,499807676 https://github.com/pydata/xarray/issues/3324#issuecomment-533693878,https://api.github.com/repos/pydata/xarray/issues/3324,533693878,MDEyOklzc3VlQ29tbWVudDUzMzY5Mzg3OA==,2818208,2019-09-20T20:13:07Z,2019-09-20T20:13:07Z,CONTRIBUTOR,"> This could be an addition to the either_dict_or_kwargs helper function. Currently, `either_dict_or_kwargs` doesn't have access to the `DataArray` instance's `dims` or the function's keyword arguments; are you suggesting that `either_dict_or_kwargs` be modified to take these? I do like this approach. Otherwise, I'd have to add a second utility function check everywhere `either_dict_or_kwargs` is used, and it'd be easy to forget going forward.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,495920497 https://github.com/pydata/xarray/issues/3324#issuecomment-533515745,https://api.github.com/repos/pydata/xarray/issues/3324,533515745,MDEyOklzc3VlQ29tbWVudDUzMzUxNTc0NQ==,2818208,2019-09-20T11:28:48Z,2019-09-20T11:28:48Z,CONTRIBUTOR,"What if I create a PR with a function in `utils` that takes an array and a list of keyword arguments, and warns the user if the array has any of the keyword arguments as dimensions. The warning can suggest using a `dict`.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,495920497 https://github.com/pydata/xarray/issues/3227#issuecomment-525519957,https://api.github.com/repos/pydata/xarray/issues/3227,525519957,MDEyOklzc3VlQ29tbWVudDUyNTUxOTk1Nw==,2818208,2019-08-27T23:19:25Z,2019-08-27T23:19:25Z,CONTRIBUTOR,"Thanks for the explanation, @DocOtak. I didn't initially understand `:suppress:`, but I now agree that a cleaning block with `:suppress:` is straightforward. It also follows the current pattern in the docs—I noticed this other places once I knew what to look for.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,482023929 https://github.com/pydata/xarray/issues/3227#issuecomment-525190165,https://api.github.com/repos/pydata/xarray/issues/3227,525190165,MDEyOklzc3VlQ29tbWVudDUyNTE5MDE2NQ==,2818208,2019-08-27T08:07:28Z,2019-08-27T08:07:28Z,CONTRIBUTOR,"After doing some more research, I can't find an ipythonic way of doing this—even have a question with a bounty on StackOverflow. However, here are some options. My vote is for using the `Makefile`: ### Remove via `Makefile` It's not ideal, but it ensures the files get removed immediately after they get created or upon `clean`. Near the top of the file, put something like ```bash ... TMP_FILES = example-no-leap.nc foo.zarr/ manipulated-example-data.nc path/ ... ``` Then the `clean` and `html` commands are ```bash .PHONY: clean clean: rm -rf $(BUILDDIR)/* rm -rf generated/* rm -rf auto_gallery/ rm -rf $(TMP_FILES) .PHONY: html html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html rm -rf $(TMP_FILES) @echo @echo ""Build finished. The HTML pages are in $(BUILDDIR)/html."" ``` ### Remove via more documentation As @DocOtak points out, [some of the documentation already cleans up after itself](https://github.com/pydata/xarray/blob/master/doc/dask.rst#chunking-and-performance). Personally, I dislike this as it's not clear to the reader why these extra snippets exist. ### Remove via `.gitignore` Easy to do, but I dislike this as it leaves a bunch of temporary junk in my working directory. I'd rather have it cleaned up somehow. ### Remove by writing to and ignoring temp directory Every ipython directive that creates a file should place that file in `tmp/` directory. Then we `.gitignore` this. This is a bit cleaner than the other `.gitignore` option. This is my second choice. ### Remove using `tempdir` utilities I dislike this for the same reason I dislike ""Remove via more documentation"": it clutters the documentation with utility snippets/code that are opaque to the reader. --- Happy to create a PR for any of these, but does anyone have any preferences or a better way of doing this?","{""total_count"": 1, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 1, ""rocket"": 0, ""eyes"": 0}",,482023929 https://github.com/pydata/xarray/issues/3240#issuecomment-524617139,https://api.github.com/repos/pydata/xarray/issues/3240,524617139,MDEyOklzc3VlQ29tbWVudDUyNDYxNzEzOQ==,2818208,2019-08-25T10:02:39Z,2019-08-25T10:02:39Z,CONTRIBUTOR,"I see. This is because coordinates are just `DataArray` objects. So ```python >>> arr.coords['y'] = range(3) ``` is equivalent to ```python >>> new_coords = xr.DataArray(data=range(3)) >>> arr.coords['y'] = new_coords ``` And the reason _this_ is a `ValueError` is that `new_coords` has a default dimension `dim_0` that is not on `arr`. However, this ```python >>> arr.coords['y'] = 1 ``` is equivalent to... ```python >>> new_coords = xr.DataArray(data=1, dims=[]) >>> arr.coords['y'] = new_coords ``` And `new_coords` has no dimensions that are not on `arr`.","{""total_count"": 2, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 1, ""eyes"": 0}",,484089737 https://github.com/pydata/xarray/issues/3240#issuecomment-524525841,https://api.github.com/repos/pydata/xarray/issues/3240,524525841,MDEyOklzc3VlQ29tbWVudDUyNDUyNTg0MQ==,2818208,2019-08-24T06:39:00Z,2019-08-24T06:39:00Z,CONTRIBUTOR,"@shoyer, maybe I am missing a nuance in your answer, but I think I already understand this bit about Xarray. My question was why is it is allowed to add a scalar: ```python >>> arr = xr.DataArray(range(3), dims=['x'], coords={'x': list('abc')}) >>> arr.coords Coordinates: * x (x) >> arr.coords['y'] = 1 # <----------- Why does this work? >>> arr.coords Coordinates: * x (x) >> import pandas as pd >>> import xarray as xr >>> index = pd.Index(list('abcd'), name='foo') >>> series = pd.Series(range(4), index) >>> array = xr.DataArray.from_series(series) >>> array.get_index('foo').name = 'bar' >>> array.get_index('foo').name 'foo' >>> array['foo'].to_index().name = 'bar' >>> array['foo'].to_index().name 'foo' >>> array.to_index().name = 'bar' >>> array.to_index().name 'foo' >>> array.indexes['foo'].name = 'bar' >>> array.indexes['foo'].name 'foo' ``` Since a `Dataset` is just a collection of `DataArray` objects, the behavior propagates nicely, e.g. ```python >>> dataset = xr.Dataset({'myvar': array}) >>> dataset['myvar'].to_index().name = 'bar' >>> dataset['myvar'].to_index().name 'foo' >>> dataset.indexes['foo'].name = 'bar' >>> dataset.indexes['foo'].name 'foo' ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,467856527 https://github.com/pydata/xarray/pull/3126#issuecomment-511716413,https://api.github.com/repos/pydata/xarray/issues/3126,511716413,MDEyOklzc3VlQ29tbWVudDUxMTcxNjQxMw==,2818208,2019-07-16T08:20:34Z,2019-07-16T08:21:07Z,CONTRIBUTOR,"Locally, I've moved my changes from `DataArray.to_series` to `DataWithCoords.get_index`, and my tests still pass. After work, I'll write some more tests, e.g. for for `DataArray.to_index`, and push. @shoyer, it seems like this issue happens anywhere the user can modify a Pandas index. For example, the Dataset bug in [my comment yesterday](https://github.com/pydata/xarray/pull/3126#issuecomment-511506569). Do we want all views of indexes to be immutable or do we trust the user to not do stuff like this: ```python >>> dataset.indexes['mutable?'].name = 'yes' >>> dataset.indexes['mutable?'].name 'yes' ```","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,467856527 https://github.com/pydata/xarray/pull/3126#issuecomment-511506569,https://api.github.com/repos/pydata/xarray/issues/3126,511506569,MDEyOklzc3VlQ29tbWVudDUxMTUwNjU2OQ==,2818208,2019-07-15T17:59:23Z,2019-07-15T17:59:23Z,CONTRIBUTOR,"@max-sixty, `name` is just a mutable property on a Pandas index: ```python >>> dates = pd.date_range('01-Jan-2019', '31-Jan-2019', name='mutable?') >>> series = pd.Series(np.random.randn(dates.size), dates) >>> series.index.name 'mutable?' >>> series.index.name = 'yes' >>> series.index.name 'yes' ``` But you're right that `to_series` is the wrong place. It looks like `to_series` calls `to_index`, which calls [`get_index`](https://github.com/pydata/xarray/blob/master/xarray/core/common.py#L288), which is inherited by other classes such as `Dataset`. For example, the bug persists with `Dataset` despite my fix: ```python >>> dates = pd.date_range('01-Jan-2019', '31-Jan-2019', name='mutable?') >>> series = pd.Series(np.random.randn(dates.size), dates) >>> dataset = xr.Dataset({'foo': series}) >>> dataset.indexes['mutable?'].name = 'yes' >>> dataset.indexes['mutable?'].name 'yes' ``` Does anyone know if `get_index` is the best place for this? Maybe the tests should be somewhere more generic as well.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,467856527 https://github.com/pydata/xarray/issues/2910#issuecomment-511221426,https://api.github.com/repos/pydata/xarray/issues/2910,511221426,MDEyOklzc3VlQ29tbWVudDUxMTIyMTQyNg==,2818208,2019-07-14T17:36:36Z,2019-07-14T17:36:36Z,CONTRIBUTOR,Created PR https://github.com/pydata/xarray/pull/3128 to add support for this feature.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,435339263 https://github.com/pydata/xarray/issues/2949#issuecomment-511215090,https://api.github.com/repos/pydata/xarray/issues/2949,511215090,MDEyOklzc3VlQ29tbWVudDUxMTIxNTA5MA==,2818208,2019-07-14T16:08:12Z,2019-07-14T16:08:12Z,CONTRIBUTOR,I've created PR https://github.com/pydata/xarray/pull/3126 to fix this issue.,"{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,442063346