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

Saving sparse (or duck) arrays in datasets to file #8599

Closed
renecotyfanboy opened this issue Jan 8, 2024 · 2 comments
Closed

Saving sparse (or duck) arrays in datasets to file #8599

renecotyfanboy opened this issue Jan 8, 2024 · 2 comments

Comments

@renecotyfanboy
Copy link

Is your feature request related to a problem?

As the sparse package seems to grow in the ecosystem, I have integrated the combination of xarray and sparse in the package I am currently developing. I have experienced the power of duck-array features in xarray, since it took less than 10 minutes to convert the matrix involved to a sparse matrix and get all the tests to green. However, datasets involving sparse arrays can't be exported to netcdf files at this time.

Describe the solution you'd like

It would be great to think about some sort of interface so that the sparse (and maybe more generally duck) arrays could be serialized using declared methods.

Describe alternatives you've considered

At this time, I am converting the sparse entry to dense before saving them, which is fine but kinda loses the point of using it. I think I will write a custom loader/unloader using the coords/data interface of the sparse package at some point.

Additional context

No response

Copy link

welcome bot commented Jan 8, 2024

Thanks for opening your first issue here at xarray! Be sure to follow the issue template!
If you have an idea for a solution, we would really welcome a Pull Request with proposed changes.
See the Contributing Guide for more.
It may take us a while to respond here, but we really value your contribution. Contributors like you help make xarray better.
Thank you!

@dcherian
Copy link
Contributor

dcherian commented Jan 8, 2024

Closing as duplicate of #4156.

Can you reply there with answers to these questions please:

  1. Which sparse format are you using?
  2. Do any of the CF-compliant representations work better for your use case?

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