-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
document the duck array integration status #4530
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
Changes from all commits
c46ee52
516b25b
f2edbca
8aa4991
3c37a2d
483566b
710f8c6
304684b
9448940
21fefa4
7cd5160
e09f507
f3cfc73
63e07f9
f04012e
74e243b
6af4344
a9553a8
c346f96
261a4a4
d8b20e4
5622898
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
.. currentmodule:: xarray | ||
|
||
Working with numpy-like arrays | ||
============================== | ||
|
||
.. warning:: | ||
|
||
This feature should be considered experimental. Please report any bug you may find on | ||
xarray’s github repository. | ||
|
||
Numpy-like arrays (:term:`duck array`) extend the :py:class:`numpy.ndarray` with | ||
additional features, like propagating physical units or a different layout in memory. | ||
|
||
:py:class:`DataArray` and :py:class:`Dataset` objects can wrap these duck arrays, as | ||
long as they satisfy certain conditions (see :ref:`internals.duck_arrays`). | ||
Comment on lines
+14
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would it make sense to point to the explicitly tested duck arrays here ( I did think about adding usage examples, but maybe it's better to leave that to the extension packages? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think a list would be nice. |
||
|
||
.. note:: | ||
|
||
For ``dask`` support see :ref:`dask`. | ||
|
||
|
||
Missing features | ||
---------------- | ||
Most of the API does support :term:`duck array` objects, but there are a few areas where | ||
the code will still cast to ``numpy`` arrays: | ||
|
||
- dimension coordinates, and thus all indexing operations: | ||
|
||
* :py:meth:`Dataset.sel` and :py:meth:`DataArray.sel` | ||
* :py:meth:`Dataset.loc` and :py:meth:`DataArray.loc` | ||
* :py:meth:`Dataset.drop_sel` and :py:meth:`DataArray.drop_sel` | ||
* :py:meth:`Dataset.reindex`, :py:meth:`Dataset.reindex_like`, | ||
:py:meth:`DataArray.reindex` and :py:meth:`DataArray.reindex_like`: duck arrays in | ||
data variables and non-dimension coordinates won't be casted | ||
|
||
- functions and methods that depend on external libraries or features of ``numpy`` not | ||
covered by ``__array_function__`` / ``__array_ufunc__``: | ||
|
||
* :py:meth:`Dataset.ffill` and :py:meth:`DataArray.ffill` (uses ``bottleneck``) | ||
* :py:meth:`Dataset.bfill` and :py:meth:`DataArray.bfill` (uses ``bottleneck``) | ||
* :py:meth:`Dataset.interp`, :py:meth:`Dataset.interp_like`, | ||
:py:meth:`DataArray.interp` and :py:meth:`DataArray.interp_like` (uses ``scipy``): | ||
duck arrays in data variables and non-dimension coordinates will be casted in | ||
addition to not supporting duck arrays in dimension coordinates | ||
* :py:meth:`Dataset.rolling_exp` and :py:meth:`DataArray.rolling_exp` (uses | ||
``numbagg``) | ||
* :py:meth:`Dataset.rolling` and :py:meth:`DataArray.rolling` (uses internal functions | ||
of ``numpy``) | ||
* :py:meth:`Dataset.interpolate_na` and :py:meth:`DataArray.interpolate_na` (uses | ||
:py:class:`numpy.vectorize`) | ||
* :py:func:`apply_ufunc` with ``vectorize=True`` (uses :py:class:`numpy.vectorize`) | ||
|
||
- incompatibilities between different :term:`duck array` libraries: | ||
|
||
* :py:meth:`Dataset.chunk` and :py:meth:`DataArray.chunk`: this fails if the data was | ||
not already chunked and the :term:`duck array` (e.g. a ``pint`` quantity) should | ||
wrap the new ``dask`` array; changing the chunk sizes works. | ||
|
||
|
||
Extensions using duck arrays | ||
---------------------------- | ||
Here's a list of libraries extending ``xarray`` to make working with wrapped duck arrays | ||
easier: | ||
|
||
- `pint-xarray <https://github.com/xarray-contrib/pint-xarray>`_ | ||
dcherian marked this conversation as resolved.
Show resolved
Hide resolved
|
Uh oh!
There was an error while loading. Please reload this page.