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

Allow BasicGrid serialization #86

Open
wpreimes opened this issue Jul 18, 2024 · 0 comments
Open

Allow BasicGrid serialization #86

wpreimes opened this issue Jul 18, 2024 · 0 comments

Comments

@wpreimes
Copy link
Member

wpreimes commented Jul 18, 2024

For some reason Basic Grid can not be pkled, but CellGrid can. This can lead to issues with eg parallelization frameworks and should be fixed.

import cloudpickle
from pygeogrids.grids import CellGrid, BasicGrid

cloudpickle.dumps(CellGrid([1,2,3], [1,2,3], [1,2,3]))
print("Cellgrid could be pickled")
cloudpickle.dumps(BasicGrid([1,2,3], [1,2,3]))
Traceback (most recent call last):
  File "/home/wpreimes/miniforge3/envs/smecv_gapfill/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3553, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-3-7762823bd9a7>", line 6, in <module>
    cloudpickle.dumps(BasicGrid([1,2,3], [1,2,3]))
  File "/home/wpreimes/miniforge3/envs/smecv_gapfill/lib/python3.10/site-packages/cloudpickle/cloudpickle.py", line 1479, in dumps
    cp.dump(obj)
  File "/home/wpreimes/miniforge3/envs/smecv_gapfill/lib/python3.10/site-packages/cloudpickle/cloudpickle.py", line 1245, in dump
    return super().dump(obj)
  File "<stringsource>", line 2, in pykdtree.kdtree.KDTree.__reduce_cython__
TypeError: no default __reduce__ due to non-trivial __cinit__
``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant