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/issues/2067#issuecomment-601543091,https://api.github.com/repos/pydata/xarray/issues/2067,601543091,MDEyOklzc3VlQ29tbWVudDYwMTU0MzA5MQ==,26384082,2020-03-20T05:24:25Z,2020-03-20T05:24:25Z,NONE,"In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity
If this issue remains relevant, please comment here or remove the `stale` label; otherwise it will be marked as closed automatically
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,315948443
https://github.com/pydata/xarray/issues/2067#issuecomment-382972351,https://api.github.com/repos/pydata/xarray/issues/2067,382972351,MDEyOklzc3VlQ29tbWVudDM4Mjk3MjM1MQ==,6815844,2018-04-20T04:31:30Z,2018-04-20T05:09:29Z,MEMBER,"I think this will share a similar API with the evenly spaced coordinate discussed in issue #1650.
I thought the possible API would be
```
xr.Dataset({'foo': ('x', data)}, {'x': slice(None)})
```
where it will construct a evenly spaced coordinate.
But I am not sure if we should add this API now or after #1650 is implemented.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,315948443
https://github.com/pydata/xarray/issues/2067#issuecomment-382960446,https://api.github.com/repos/pydata/xarray/issues/2067,382960446,MDEyOklzc3VlQ29tbWVudDM4Mjk2MDQ0Ng==,1411280,2018-04-20T03:24:29Z,2018-04-20T03:27:09Z,NONE,"My issue is not so much with the `range` but the `len`. If done during construction from numpy arrays, it might need to be `range(data.shape[0])` or `range(data.shape[1])` or etc. based on the layout of the data. If done after construction with `assign_coords`, both the name of the dataset and the name of the dimension need to be written twice. This all creates room for silly mistakes.
On the bright side, the mistakes are quickly caught when the code executes at runtime. On the other side, they can be entirely avoided.
---
Of course, xarray doesn't have to do this; a user concerned about making these mistakes can easily capture this usage pattern in a wrapper function around `assign_coords`:
```python
def assign_auto_coords(da, *dims):
""""""Give each specified dimension of a DataArray or Dataset automatic coords from 0 to n-1.""""""
return da.assign_coords(**{dim: range(self.sizes[dim]) for dim in dims})
```
it's merely that first-class support during construction would be nice to have.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,315948443
https://github.com/pydata/xarray/issues/2067#issuecomment-382931094,https://api.github.com/repos/pydata/xarray/issues/2067,382931094,MDEyOklzc3VlQ29tbWVudDM4MjkzMTA5NA==,1217238,2018-04-20T01:09:01Z,2018-04-20T01:09:01Z,MEMBER,"If I understand correctly, instead of writing `xr.Dataset({'foo': ('x', data)}, {'x': range(len(data))})`, you want to be able to write something like `xr.Dataset({'foo': ('x', data)}, {'x': xr.AUTO_NUMBER})`?
I agree that it's sometimes convenient to automatically get coordinates 0 to `n-1`, but using `range()` is also pretty convenient, so I'm not sure we really need this shortcut.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,315948443