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/3470#issuecomment-573971694,https://api.github.com/repos/pydata/xarray/issues/3470,573971694,MDEyOklzc3VlQ29tbWVudDU3Mzk3MTY5NA==,14808389,2020-01-14T02:37:28Z,2020-01-14T02:37:28Z,MEMBER,"I might be wrong, but I think you should be able to implement this by overriding `Variable.values.setter` in `IndexVariable`, the same way it is done for `Variable.data.setter`.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,514792972
https://github.com/pydata/xarray/issues/3470#issuecomment-573964243,https://api.github.com/repos/pydata/xarray/issues/3470,573964243,MDEyOklzc3VlQ29tbWVudDU3Mzk2NDI0Mw==,2448579,2020-01-14T02:06:30Z,2020-01-14T02:06:30Z,MEMBER,"> I think what we probably want to do is mark variables used in indexes as having immutable data in xarray's data model, and raise an error for attempts to modify them in-place.
How do I implement this?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,514792972
https://github.com/pydata/xarray/issues/3470#issuecomment-566214653,https://api.github.com/repos/pydata/xarray/issues/3470,566214653,MDEyOklzc3VlQ29tbWVudDU2NjIxNDY1Mw==,1217238,2019-12-16T19:48:38Z,2019-12-16T19:48:38Z,MEMBER,"The main problem is that when you write `ds.time.values = something`, you are modifying an attribute of a DataArray that happens to use the same variable as the as the Dataset, but otherwise the DataArray and Dataset are entirely independent. The DataArray does not have a reference to the original dataset, so it can't check or update the indexes.
This happened to work in previous versions of xarray, but only because indexes always mapped directly into the data of an xarray.Variable. But I don't think this is the right pattern to continue in the future, especially because we want to do define indexes over multiple variables (e.g., for MultiIndex).
I think what we *probably* want to do is mark variables used in indexes as having immutable data in xarray's data model, and raise an error for attempts to modify them in-place.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,514792972
https://github.com/pydata/xarray/issues/3470#issuecomment-566208875,https://api.github.com/repos/pydata/xarray/issues/3470,566208875,MDEyOklzc3VlQ29tbWVudDU2NjIwODg3NQ==,1277781,2019-12-16T19:33:46Z,2019-12-16T19:33:46Z,CONTRIBUTOR,"Is it already decided what the resolution should be?
* Giving a warning, as the title of this thread suggests?
* Disable setting .values directly for dimensions?
* Or making sure that .indexes are updated when .values are set directly","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,514792972
https://github.com/pydata/xarray/issues/3470#issuecomment-548272942,https://api.github.com/repos/pydata/xarray/issues/3470,548272942,MDEyOklzc3VlQ29tbWVudDU0ODI3Mjk0Mg==,35295222,2019-10-31T08:58:10Z,2019-10-31T08:58:10Z,NONE,"@dcherian Yes, ds.assign_coords does work and that's what I'm using now.
So can ds.assign_coords(..) be seen as the _right_ way and changing the values inplace with ds.time.values = pd.... the _wrong_ way? It all worked fine until changing from version 0.11.3 to 0.12.0. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,514792972
https://github.com/pydata/xarray/issues/3470#issuecomment-547998577,https://api.github.com/repos/pydata/xarray/issues/3470,547998577,MDEyOklzc3VlQ29tbWVudDU0Nzk5ODU3Nw==,5635139,2019-10-30T16:37:47Z,2019-10-30T16:37:47Z,MEMBER,"> I've seen this type of code elsewhere: direct assignment to `.values` and `.data` of a coordinate variable which then leads to inconsistent objects and confusing behaviour. Is there something we can do to alert users?
Should we raise an error? Is there ever a use here?
It might be messy to implement though; the `ds.time` would have to know it's a coord.
Does the bigger index refactor help us at all here?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,514792972
https://github.com/pydata/xarray/issues/3470#issuecomment-547995641,https://api.github.com/repos/pydata/xarray/issues/3470,547995641,MDEyOklzc3VlQ29tbWVudDU0Nzk5NTY0MQ==,2448579,2019-10-30T16:31:50Z,2019-10-30T16:31:50Z,MEMBER,"`ds.time.values = pd.to_datetime(ds.time.values) + pd.DateOffset(months=2)`
By doing this, `ds.indexes[""time""]` is not updated.
@folmerkrikken How about `ds.assign_coords(time=pd.to_datetime(ds.time.values) + pd.DateOffset(months=2))`
@shoyer I've seen this type of code elsewhere: direct assignment to `.values` and `.data` of a coordinate variable which then leads to inconsistent objects and confusing behaviour. Is there something we can do to alert users?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,514792972