Skip to content

Commit bcd6081

Browse files
leezushoyer
authored andcommitted
Small documentation fixes (#1516)
* Clarify in docs that inferring DataArray dimensions is deprecated * Fix DataArray docstring * Clarify DataArray coords documentation
1 parent 8e541de commit bcd6081

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

doc/data-structures.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ The :py:class:`~xarray.DataArray` constructor takes:
4646

4747
- ``data``: a multi-dimensional array of values (e.g., a numpy ndarray,
4848
:py:class:`~pandas.Series`, :py:class:`~pandas.DataFrame` or :py:class:`~pandas.Panel`)
49-
- ``coords``: a list or dictionary of coordinates
50-
- ``dims``: a list of dimension names. If omitted, dimension names are
51-
taken from ``coords`` if possible.
49+
- ``coords``: a list or dictionary of coordinates. If a list, it should be a
50+
list of tuples where the first element is the dimension name and the second
51+
element is the corresponding coordinate array_like object.
52+
- ``dims``: a list of dimension names. If omitted and ``coords`` is a list of
53+
tuples, dimension names are taken from ``coords``.
5254
- ``attrs``: a dictionary of attributes to add to the instance
5355
- ``name``: a string that names the instance
5456

xarray/core/dataarray.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,11 @@ def __init__(self, data, coords=None, dims=None, name=None,
175175
coords : sequence or dict of array_like objects, optional
176176
Coordinates (tick labels) to use for indexing along each dimension.
177177
If dict-like, should be a mapping from dimension names to the
178-
corresponding coordinates.
178+
corresponding coordinates. If sequence-like, should be a sequence
179+
of tuples where the first element is the dimension name and the
180+
second element is the corresponding coordinate array_like object.
179181
dims : str or sequence of str, optional
180-
Name(s) of the the data dimension(s). Must be either a string (only
182+
Name(s) of the data dimension(s). Must be either a string (only
181183
for 1D data) or a sequence of strings with length equal to the
182184
number of dimensions. If this argument is omitted, dimension names
183185
are taken from ``coords`` (if possible) and otherwise default to

0 commit comments

Comments
 (0)