From ccd562ed701c6e8f144e37b447059352d66f07c4 Mon Sep 17 00:00:00 2001 From: Leonard Lausen Date: Wed, 23 Aug 2017 20:19:08 +0900 Subject: [PATCH 1/3] Clarify in docs that inferring DataArray dimensions is deprecated --- doc/data-structures.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/data-structures.rst b/doc/data-structures.rst index 48c8e2d9874..ac3aab402a5 100644 --- a/doc/data-structures.rst +++ b/doc/data-structures.rst @@ -48,7 +48,7 @@ The :py:class:`~xarray.DataArray` constructor takes: :py:class:`~pandas.Series`, :py:class:`~pandas.DataFrame` or :py:class:`~pandas.Panel`) - ``coords``: a list or dictionary of coordinates - ``dims``: a list of dimension names. If omitted, dimension names are - taken from ``coords`` if possible. + taken from ``coords`` if possible (deprecated). - ``attrs``: a dictionary of attributes to add to the instance - ``name``: a string that names the instance From 15ceb39c61dcb7447e830db53388b32544830d50 Mon Sep 17 00:00:00 2001 From: Leonard Lausen Date: Wed, 23 Aug 2017 20:19:13 +0900 Subject: [PATCH 2/3] Fix DataArray docstring --- xarray/core/dataarray.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index 8700446295c..688189de155 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -177,7 +177,7 @@ def __init__(self, data, coords=None, dims=None, name=None, If dict-like, should be a mapping from dimension names to the corresponding coordinates. dims : str or sequence of str, optional - Name(s) of the the data dimension(s). Must be either a string (only + Name(s) of the data dimension(s). Must be either a string (only for 1D data) or a sequence of strings with length equal to the number of dimensions. If this argument is omitted, dimension names are taken from ``coords`` (if possible) and otherwise default to From 9dc2dda88ce869aadd81aeaa211ab0959ad3d7f3 Mon Sep 17 00:00:00 2001 From: Leonard Lausen Date: Thu, 24 Aug 2017 11:04:19 +0900 Subject: [PATCH 3/3] Clarify DataArray coords documentation --- doc/data-structures.rst | 8 +++++--- xarray/core/dataarray.py | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/data-structures.rst b/doc/data-structures.rst index ac3aab402a5..95f755680df 100644 --- a/doc/data-structures.rst +++ b/doc/data-structures.rst @@ -46,9 +46,11 @@ The :py:class:`~xarray.DataArray` constructor takes: - ``data``: a multi-dimensional array of values (e.g., a numpy ndarray, :py:class:`~pandas.Series`, :py:class:`~pandas.DataFrame` or :py:class:`~pandas.Panel`) -- ``coords``: a list or dictionary of coordinates -- ``dims``: a list of dimension names. If omitted, dimension names are - taken from ``coords`` if possible (deprecated). +- ``coords``: a list or dictionary of coordinates. If a list, it should be a + list of tuples where the first element is the dimension name and the second + element is the corresponding coordinate array_like object. +- ``dims``: a list of dimension names. If omitted and ``coords`` is a list of + tuples, dimension names are taken from ``coords``. - ``attrs``: a dictionary of attributes to add to the instance - ``name``: a string that names the instance diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index 688189de155..6b4d28e1006 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -175,7 +175,9 @@ def __init__(self, data, coords=None, dims=None, name=None, coords : sequence or dict of array_like objects, optional Coordinates (tick labels) to use for indexing along each dimension. If dict-like, should be a mapping from dimension names to the - corresponding coordinates. + corresponding coordinates. If sequence-like, should be a sequence + of tuples where the first element is the dimension name and the + second element is the corresponding coordinate array_like object. dims : str or sequence of str, optional Name(s) of the data dimension(s). Must be either a string (only for 1D data) or a sequence of strings with length equal to the