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 2052694433,PR_kwDOAMm_X85ilhQm,8565,Faster encoding functions.,2448579,closed,0,,,1,2023-12-21T16:05:02Z,2024-01-04T14:25:45Z,2024-01-04T14:25:43Z,MEMBER,,0,pydata/xarray/pulls/8565,"Spotted when profiling some write workloads. 1. Speeds up the check for multi-index 2. Speeds up one string encoder by not re-creating variables when not necessary. @benbovy is there a better way?","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/8565/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 2052952379,I_kwDOAMm_X856XZE7,8568,Raise when assigning attrs to virtual variables (default coordinate arrays),2448579,open,0,,,0,2023-12-21T19:24:11Z,2023-12-21T19:24:19Z,,MEMBER,,,,"### Discussed in https://github.com/pydata/xarray/discussions/8567
Originally posted by **matthew-brett** December 21, 2023 Sorry for the introductory question, but we (@ivanov and I) ran into this behavior while experimenting: ```python import numpy as np data = np.zeros((3, 4, 5)) ds = xr.DataArray(data, dims=('i', 'j', 'k')) print(ds['k'].attrs) ``` This shows `{}` as we might reasonably expect. But then: ```python ds['k'].attrs['foo'] = 'bar' print(ds['k'].attrs) ``` This also gives `{}`, which we found surprising. We worked out why that was, after a little experimentation (the default coordinate arrays seems to get created on the fly and garbage collected immediately). But it took us a little while. Is that as intended? Is there a way of making this less confusing? Thanks for any help.
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/8568/reactions"", ""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue 2052610515,PR_kwDOAMm_X85ilOq9,8564,Fix mypy type ignore,2448579,closed,0,,,1,2023-12-21T15:15:26Z,2023-12-21T15:41:13Z,2023-12-21T15:24:52Z,MEMBER,,0,pydata/xarray/pulls/8564,,"{""url"": ""https://api.github.com/repos/pydata/xarray/issues/8564/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull