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/7630#issuecomment-1527541305,https://api.github.com/repos/pydata/xarray/issues/7630,1527541305,IC_kwDOAMm_X85bDG45,5821660,2023-04-28T13:09:22Z,2023-04-28T13:09:22Z,MEMBER,@AlxndrLhr I suppose your original issue is resolved. Please reopen or create a new issue if you still have problems with this.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1624560934
https://github.com/pydata/xarray/issues/7630#issuecomment-1479748005,https://api.github.com/repos/pydata/xarray/issues/7630,1479748005,IC_kwDOAMm_X85YMyml,2448579,2023-03-22T15:10:54Z,2023-03-22T15:10:54Z,MEMBER,"Did you try to assign to `nc`? If so, then yes `expand_dims` creates a ""view"" so no new memory is used up. This works really well for read-only usecases. To write to that array, you'll need to copy.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1624560934
https://github.com/pydata/xarray/issues/7630#issuecomment-1478617771,https://api.github.com/repos/pydata/xarray/issues/7630,1478617771,IC_kwDOAMm_X85YIeqr,90059220,2023-03-21T21:39:22Z,2023-03-21T21:39:22Z,NONE,"Thanks all, but it returns the `ValueError: output array is read-only`. Apparently, this is caused by `.expand_dims()` (see https://github.com/pydata/xarray/issues/3813). The work-around seems to be
```python
nc = nc.expand_dims(time=times_).copy()
```
Though I have no idea why.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1624560934
https://github.com/pydata/xarray/issues/7630#issuecomment-1469754531,https://api.github.com/repos/pydata/xarray/issues/7630,1469754531,IC_kwDOAMm_X85Xmqyj,5821660,2023-03-15T10:33:43Z,2023-03-15T10:33:43Z,MEMBER,"Everyday something new to learn, thanks @keewis!","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1624560934
https://github.com/pydata/xarray/issues/7630#issuecomment-1469714769,https://api.github.com/repos/pydata/xarray/issues/7630,1469714769,IC_kwDOAMm_X85XmhFR,14808389,2023-03-15T10:07:06Z,2023-03-15T10:07:06Z,MEMBER,"you can also pass a `dict`, so `nc.loc[{""time"": dt}]` or `nc.loc[dict(time=dt)]` should work as well","{""total_count"": 1, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 1, ""rocket"": 0, ""eyes"": 0}",,1624560934
https://github.com/pydata/xarray/issues/7630#issuecomment-1469497104,https://api.github.com/repos/pydata/xarray/issues/7630,1469497104,IC_kwDOAMm_X85Xlr8Q,5821660,2023-03-15T07:38:13Z,2023-03-15T07:38:13Z,MEMBER,"@AlxndrLhr `.loc` is positional. The correct invocation would be:
```python
nc.loc[dt]
```
This would try to locate `dt` in the first dimension of `nc`.
If you would append your time-dimension to the end, this would look like:
```python
nc = nc.expand_dims(time=times_, axis=-1)
nc.loc[..., dt]
# or
nc.loc[:, :, dt]
```
A good first read: https://docs.xarray.dev/en/stable/user-guide/indexing.html#indexing-and-selecting-data
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1624560934