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/2269#issuecomment-403271908,https://api.github.com/repos/pydata/xarray/issues/2269,403271908,MDEyOklzc3VlQ29tbWVudDQwMzI3MTkwOA==,6815844,2018-07-08T08:31:21Z,2018-07-08T08:31:21Z,MEMBER,"@jhamman
> Perhaps, after the data model and api have really stabilized, this would make sense, but it strikes me as something that is going to be more work than its worth to maintain.
Agreed.
In my experience, surprisingly many people (including my students) are using pickle without notifying its potential risk.
Is it too redundant to issue a warning when xarray object is being pickled (maybe in __getstate__ method)?
It is annoying for the short term usage by advanced users though.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,338662554
https://github.com/pydata/xarray/issues/2269#issuecomment-403125304,https://api.github.com/repos/pydata/xarray/issues/2269,403125304,MDEyOklzc3VlQ29tbWVudDQwMzEyNTMwNA==,6815844,2018-07-06T19:24:41Z,2018-07-06T19:24:41Z,MEMBER,"> We are pretty clear in the docs that pickle isn't supported for long term storage, so this is a problem they somewhat brought upon themselves.
That makes sense.
Actually, I was also one of the victims of pickle, so I prefer to be friendly to beginners.
pandas looks to have their [unpickling method](https://github.com/pandas-dev/pandas/blob/v0.23.2/pandas/io/pickle.py#L83) that is more robust against the subclass changes.
Maybe in the long term, we can have the similar method.
OK. I will add a patch to their repo and try to see how much burden is required to maintain it.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,338662554
https://github.com/pydata/xarray/issues/2269#issuecomment-403076034,https://api.github.com/repos/pydata/xarray/issues/2269,403076034,MDEyOklzc3VlQ29tbWVudDQwMzA3NjAzNA==,6815844,2018-07-06T16:01:25Z,2018-07-06T16:01:25Z,MEMBER,"Some additional explanations
I was consulted by an onwer of a project that is using xarray inside it,
the way to load xarray objects that is **pickled** with older-version xarray.
They does not recommend to use pickle, but some users actually do this and have troubles to restore old pickled files.
In partiular, xarray renamed `Coordinate` to `IndexVariable` in some point between v0.7 to v0.8.
There might be another module/class name changes too, and
these result in the (uninformed) error
```python
UnpicklingError: NEWOBJ class argument isn't a type object
```
What I would like to propose here is to provide a workaround to unpickle old xarray objects.
The function would look like
```python
def unpickle_legacy(filename):
""""""
Unpickle old xarray objects.
""""""
class RenamingUnpickler(pickle.Unpickler):
def find_class(self, module, name):
if name == 'Coordinate':
name = 'IndexVariable'
return super().find_class(module, name)
with open(filename, 'rb') as f:
return RenamingUnpickler(f).load()
```
for all the previous releases.
Continuously supporting such a function might be an additional task,
but it will emphasize the robustness of our project.
Any comments are welcome.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,338662554