diff --git a/ci/requirements/doc.yml b/ci/requirements/doc.yml index e092272654b..cdb763e9748 100644 --- a/ci/requirements/doc.yml +++ b/ci/requirements/doc.yml @@ -23,6 +23,7 @@ dependencies: - rasterio>=1.1 - seaborn - setuptools + - sparse - sphinx=3.3 - sphinx_rtd_theme>=0.4 - sphinx-autosummary-accessors diff --git a/doc/internals.rst b/doc/internals.rst index 60d32128c60..f3d67de9077 100644 --- a/doc/internals.rst +++ b/doc/internals.rst @@ -10,6 +10,17 @@ stack, NumPy and pandas. It is written in pure Python (no C or Cython extensions), which makes it easy to develop and extend. Instead, we push compiled code to :ref:`optional dependencies`. +.. ipython:: python + :suppress: + + import dask.array as da + import numpy as np + import pandas as pd + import sparse + import xarray as xr + + np.random.seed(123456) + Variable objects ---------------- @@ -74,18 +85,24 @@ argument: ... - -Extending xarray ----------------- +To avoid duplicated information, this method must omit information about the shape and +:term:`dtype`. For example, the string representation of a ``dask`` array or a +``sparse`` matrix would be: .. ipython:: python - :suppress: - import numpy as np - import pandas as pd - import xarray as xr + a = da.linspace(0, 1, 20, chunks=2) + a - np.random.seed(123456) + b = np.eye(10) + b[[5, 7, 3, 0], [6, 8, 2, 9]] = 2 + b = sparse.COO.from_numpy(b) + b + + xr.Dataset({"a": ("x", a), "b": (("y", "z"), b)}) + +Extending xarray +---------------- xarray is designed as a general purpose library, and hence tries to avoid including overly domain specific functionality. But inevitably, the need for more