-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Docs page on interoperability #7992
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
198f67b
add page on internal design
TomNicholas 9fe6635
add xarray-datatree to intersphinx mapping
TomNicholas c231f58
typo
TomNicholas 957675d
add subheadings to the accessors page
TomNicholas 9fd2fc5
Revert "add page on internal design"
TomNicholas 04fcab2
rename page on variables
TomNicholas 40fc8c5
whatsnew
TomNicholas 011ab25
page on interoperability
TomNicholas 869363a
add interoperability page to index
TomNicholas 3abe029
fix whatsnew
TomNicholas 39437fb
Merge branch 'main' into docs_internal_design
TomNicholas 2ab30d6
Merge branch 'main' into docs_interoperability
TomNicholas e688526
Merge branch 'main' into docs_interoperability
TomNicholas 3809d50
sel->isel
TomNicholas 1e98361
Merge branch 'docs_internal_design' of https://github.com/TomNicholas…
TomNicholas 3ad0722
Merge branch 'docs_internal_design' into docs_interoperability
TomNicholas 4afea37
add section on lazy indexing
TomNicholas 84e9aa2
actually show lazy indexing example
TomNicholas 0e0a240
Merge branch 'main' into docs_internal_design
TomNicholas 4e98b58
Merge branch 'docs_internal_design' into docs_interoperability
TomNicholas 1c2a5b7
link to custom indexes page
TomNicholas c8b2653
fix some formatting
TomNicholas 2964c60
put encoding last
TomNicholas 4e41c42
Merge branch 'main' into docs_interoperability
TomNicholas 6e1240f
attrs and encoding are not ordered dicts
TomNicholas 8bc561a
Merge branch 'main' into docs_interoperability
TomNicholas 40e799a
Merge branch 'main' into docs_interoperability
TomNicholas b2b8338
reword lack of support for subclassing
TomNicholas 1f9c17c
Merge branch 'main' into docs_interoperability
TomNicholas a4a72cd
remove duplicate word
TomNicholas bc0d55d
encourage contributions to supporting subclassing
TomNicholas ae4619b
Merge branch 'main' into docs_interoperability
TomNicholas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
.. _interoperability: | ||
|
||
Interoperability of Xarray | ||
========================== | ||
|
||
Xarray is designed to be extremely interoperable, in many orthogonal ways. | ||
Making xarray as flexible as possible is the common theme of most of the goals on our :ref:`roadmap`. | ||
|
||
This interoperability comes via a set of flexible abstractions into which the user can plug in. The current full list is: | ||
|
||
- :ref:`Custom file backends <add_a_backend>` via the :py:class:`~xarray.backends.BackendEntrypoint` system, | ||
- Numpy-like :ref:`"duck" array wrapping <internals.duckarrays>`, which supports the `Python Array API Standard <https://data-apis.org/array-api/latest/>`_, | ||
- :ref:`Chunked distributed array computation <internals.chunkedarrays>` via the :py:class:`~xarray.core.parallelcompat.ChunkManagerEntrypoint` system, | ||
- Custom :py:class:`~xarray.Index` objects for :ref:`flexible label-based lookups <internals.custom indexes>`, | ||
- Extending xarray objects with domain-specific methods via :ref:`custom accessors <internals.accessors>`. | ||
|
||
.. warning:: | ||
|
||
One obvious way in which xarray could be more flexible is that whilst subclassing xarray objects is possible, we | ||
currently don't support it in most transformations, instead recommending composition over inheritance. See the | ||
:ref:`internal design page <internal design.subclassing>` for the rationale and look at the corresponding `GH issue <https://github.com/pydata/xarray/issues/3980>`_ | ||
if you're interested in improving support for subclassing! | ||
|
||
.. note:: | ||
|
||
If you think there is another way in which xarray could become more generically flexible then please | ||
tell us your ideas by `raising an issue to request the feature <https://github.com/pydata/xarray/issues/new/choose>`_! | ||
|
||
|
||
Whilst xarray was originally designed specifically to open ``netCDF4`` files as :py:class:`numpy.ndarray` objects labelled by :py:class:`pandas.Index` objects, | ||
it is entirely possible today to: | ||
|
||
- lazily open an xarray object directly from a custom binary file format (e.g. using ``xarray.open_dataset(path, engine='my_custom_format')``, | ||
- handle the data as any API-compliant numpy-like array type (e.g. sparse or GPU-backed), | ||
- distribute out-of-core computation across that array type in parallel (e.g. via :ref:`dask`), | ||
- track the physical units of the data through computations (e.g via `pint-xarray <https://pint-xarray.readthedocs.io/en/stable/>`_), | ||
- query the data via custom index logic optimized for specific applications (e.g. an :py:class:`~xarray.Index` object backed by a KDTree structure), | ||
- attach domain-specific logic via accessor methods (e.g. to understand geographic Coordinate Reference System metadata), | ||
- organize hierarchical groups of xarray data in a :py:class:`~datatree.DataTree` (e.g. to treat heterogenous simulation and observational data together during analysis). | ||
|
||
All of these features can be provided simultaneously, using libaries compatible with the rest of the scientific python ecosystem. | ||
In this situation xarray would be essentially a thin wrapper acting as pure-python framework, providing a common interface and | ||
separation of concerns via various domain-agnostic abstractions. | ||
|
||
Most of the remaining pages in the documentation of xarray's internals describe these various types of interoperability in more detail. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really cool page!