Skip to content
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

document restrictions to the inline repr #4912

Merged
merged 6 commits into from
Feb 17, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/requirements/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ dependencies:
- rasterio>=1.1
- seaborn
- setuptools
- sparse
- sphinx=3.3
- sphinx_rtd_theme>=0.4
- sphinx-autosummary-accessors
Expand Down
31 changes: 23 additions & 8 deletions doc/internals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ 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<installing>`.

.. ipython:: python
:suppress:

import numpy as np
import pandas as pd
import sparse
import xarray as xr

np.random.seed(123456)

Variable objects
----------------

Expand Down Expand Up @@ -74,18 +84,23 @@ 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 = np.eye(10)
a[[5, 7, 3, 0], [6, 8, 2, 9]] = 2
a = sparse.COO.from_numpy(a)
a

np.random.seed(123456)
xr.Dataset(
{"a": ("x", np.linspace(0, 1, 10)), "b": (("y", "z"), sparse.COO.from_numpy(a))}
).chunk({"x": 2})

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
Expand Down