Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TODO: xray objects support the pickle protocol #24

Closed
shoyer opened this issue Feb 26, 2014 · 4 comments
Closed

TODO: xray objects support the pickle protocol #24

shoyer opened this issue Feb 26, 2014 · 4 comments

Comments

@shoyer
Copy link
Member

shoyer commented Feb 26, 2014

I actually don't know if our current objects support pickle. But we should add tests and make sure this works, for a dead simple form of inter-process communication.

@ebrevdo
Copy link
Contributor

ebrevdo commented Feb 26, 2014

In [73]: h = cPickle.dumps(f)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-73-a875f963f7d4> in <module>()
----> 1 h = cPickle.dumps(f)

/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy_reg.pyc in _reduce_ex(self, proto)
     68     else:
     69         if base is self.__class__:
---> 70             raise TypeError, "can't pickle %s objects" % base.__name__
     71         state = base(self)
     72     args = (self.__class__, base, state)

TypeError: can't pickle Variable objects

@ebrevdo
Copy link
Contributor

ebrevdo commented Feb 26, 2014

@shoyer
Copy link
Member Author

shoyer commented Feb 26, 2014

Something to consider is whether we should always store the data as an ndarray before pickling an XArray, or whether we should just store a reference to the original sources (e.g., make a pickle-able version of netCDF4.Variable). I am inclined to the former so pickle can be used a simple serialization format, but Iris has implemented the later approach.

@shoyer shoyer added this to the 0.1 milestone Mar 3, 2014
@shoyer shoyer modified the milestone: 0.1 Mar 12, 2014
@shoyer shoyer changed the title xray objects support the pickle protocol TODO: xray objects support the pickle protocol Apr 11, 2014
@shoyer
Copy link
Member Author

shoyer commented Apr 18, 2014

Some investigation reveals that this is only an issue when pickling datasets containing netCDF4.Variable objects (not xray.Variable objects). So the simple fix should be to make sure that all values are loaded into memory before pickling an xray.Variable.

@shoyer shoyer closed this as completed in ec3ec65 Apr 20, 2014
keewis pushed a commit to keewis/xarray that referenced this issue Jan 17, 2024
* added methods from xarray.core._typed_ops.py to list to map over

* test ops with non-datatrees acting on datatrees

* removed the xfails

* refactored ops out into new file

* linting

* minimise imports of xarray internals
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants