pydata / xarray

N-D labeled arrays and datasets in Python
https://xarray.dev
Apache License 2.0
3.63k stars 1.09k forks source link

Support for astropy.units #9704

Closed tien-vo closed 1 week ago

tien-vo commented 3 weeks ago

Is your feature request related to a problem?

As described in duck array requirements, the astropy.units.Quantity object, being a numpy.ndarray subclass, classifies as a duck array with __array_function__ and __array_ufunc__ implementations. I understand there are future plans on the astropy side to work on a Quantity 2.0 soon so that it also interoperates with other array libraries like dask and jax. But it is probably good to make the first steps for xarray to wrap astropy.units.Quantity, following the discussions in #525 . This issue is to track the progress on xarray side to support astropy.units.

cc astropy maintainers @mhvk @nstarman @dstansby who have expertise in astropy.units.

I'm not an expert on either xarray or astropy.units but am currently a heavy user of both. I'd love to contribute in any way I can to make this possible.

Describe the solution you'd like

A few items on the wishlist are:

Describe alternatives you've considered

No response

Additional context

Relevant Astropy issues:

Relevant Xarray issues:

welcome[bot] commented 3 weeks ago

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!