Description of `coords` type in documentation contradicts the example following it.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 14
Description
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
https://github.com/pydata/xarray/blob/48be37601d3fe7495a0a5ddff20a854582298da5/doc/user-guide/data-structures.rst?plain=1#L57-L59
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.
https://github.com/pydata/xarray/blob/48be37601d3fe7495a0a5ddff20a854582298da5/doc/user-guide/data-structures.rst?plain=1#L68-L70
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
- Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
- Complete example — the example is self-contained, including all data and the text of any traceback.
- Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
- New issue — a search of GitHub Issues suggests this is not a duplicate.
- Recent environment — the issue occurs with the latest version of xarray and its dependencies.
Relevant log output
N/A
Anything else we need to know?
No response
Environment
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open doc/user-guide/data-structures.rst around lines 57-70 and compare the coords description with the following DataArray example. Update the description so it covers a list of coordinate lists and its ordering with dims; done means the text no longer contradicts the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- pandas, python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100