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

pyon: Add xarray object encoding and decoding. #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ThorstenGroh
Copy link

Hey, thanks for the nice work here.

I would like to send xarray objects via RPC, but sipyco was missing a decoder/encoder for xarray objects (xarray.pydata.org/). Xarray DataArray and Dataset objects have a to_dict method, that can be easily used to transform the object to something serializable (one however needs to bypass the conversion of numpy objects to lists).

Let me know if this is within the interest of this package and how to proceed.

I added the necessary encode and decode methods and a unittest. Is there anything else to do?

Best regards
Thorsten

@ThorstenGroh ThorstenGroh changed the title Added xarray object encoding and decoding. pyon: Add xarray object encoding and decoding. Mar 2, 2022
@sbourdeauducq
Copy link
Member

We don't want to add a mandatory dependency on xarray.

There would be several ways to address this:

  • handle ImportError and disable the corresponding functionality accordingly.
  • add a with_xarray parameter and import xarray dynamically.
  • a plug-in system, though PYON: add plugin support #22 is overly complicated. Simply extending the handlers using some dictionary or class passed to encode/decode would be better. Then the plugin could be integrated into sipyco.

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

Successfully merging this pull request may close these issues.

2 participants