Skip to content

Commit 13a47fd

Browse files
minor doc updates to clarify extensions using accessors (#7751)
* minor updates to clarify extension using accessors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 67ff171 commit 13a47fd

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

doc/internals/extending-xarray.rst

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11

2-
Extending xarray
3-
================
2+
Extending xarray using accessors
3+
================================
44

55
.. ipython:: python
66
:suppress:
77
88
import xarray as xr
99
1010
11-
Xarray is designed as a general purpose library, and hence tries to avoid
11+
Xarray is designed as a general purpose library and hence tries to avoid
1212
including overly domain specific functionality. But inevitably, the need for more
1313
domain specific logic arises.
1414

15-
One standard solution to this problem is to subclass Dataset and/or DataArray to
15+
One potential solution to this problem is to subclass Dataset and/or DataArray to
1616
add domain specific functionality. However, inheritance is not very robust. It's
1717
easy to inadvertently use internal APIs when subclassing, which means that your
1818
code may break when xarray upgrades. Furthermore, many builtin methods will
@@ -29,7 +29,9 @@ from pandas) may suffice.
2929
To resolve this issue for more complex cases, xarray has the
3030
:py:func:`~xarray.register_dataset_accessor` and
3131
:py:func:`~xarray.register_dataarray_accessor` decorators for adding custom
32-
"accessors" on xarray objects. Here's how you might use these decorators to
32+
"accessors" on xarray objects, thereby "extending" the functionality of your xarray object.
33+
34+
Here's how you might use these decorators to
3335
write a custom "geo" accessor implementing a geography specific extension to
3436
xarray:
3537

0 commit comments

Comments
 (0)