What happened?
The data structures documentation in user guide states that:
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
|
- ``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. |
But the example immediately following it has a list of coords that is not a list of tuples:
locs = ["IA", "IL", "IN"]
times = pd.date_range("2000-01-01", periods=4)
foo = xr.DataArray(data, coords=[times, locs], dims=["time", "space"])
instead [times, locs] is a just a list of lists.
|
locs = ["IA", "IL", "IN"] |
|
times = pd.date_range("2000-01-01", periods=4) |
|
foo = xr.DataArray(data, coords=[times, locs], dims=["time", "space"]) |
I believe the code is correct though so just the description of coords needs an update and should be clear that if you have just a list of coordinate lists, then the order of the outer list should match the order of the dims list.
What did you expect to happen?
Example not to contradict the description of the type.
Minimal Complete Verifiable Example
N/A
MVCE confirmation
Relevant log output
N/A
Anything else we need to know?
No response
Environment
Details
What happened?
The data structures documentation in user guide states that:
But the example immediately following it has a list of
coordsthat is not a list of tuples:instead
[times, locs]is a just a list of lists.xarray/doc/user-guide/data-structures.rst
Lines 68 to 70 in 48be376
I believe the code is correct though so just the description of
coordsneeds an update and should be clear that if you have just a list of coordinate lists, then the order of the outer list should match the order of thedimslist.What did you expect to happen?
Example not to contradict the description of the type.
Minimal Complete Verifiable Example
N/A
MVCE confirmation
Relevant log output
N/A
Anything else we need to know?
No response
Environment
Details