pydata / pydata/xarray

improve docstrings with examples and links

Open
#6,793 10 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

contrib-good-first-issue contrib-help-wanted topic-documentation
Dominant language
Python
Stars
4.2k
Forks
1.4k
Avg merge
2d 15h
Merged PRs (30d)
14

Description

This is a (incomplete) checklist for #5816 to make it easier to find methods that are in need of examples and links to the narrative docs with further information (of course, changes to the docstrings of all other methods / functions part of the public API are also appreciated).

Good examples explicitly construct small xarray objects to make it easier to follow (e.g. use np.{ones,full,zeros} or the np.array constructor instead of np.random / loading from files) and show both input and output of the function.

Use

pytest --doctest-modules xarray --ignore xarray/tests/

to verify the examples, or push to a PR to have the CI do it for you (note that you will have much quicker feedback locally though).

To easily generate the expected output install pytest-accept (docs) in your dev environment and then run

pytest --doctest-modules FILE_NAME --accept || true

To link to other documentation pages we can use

:doc:`project:label`
    Description of the linked page

where we can leave out project if we link to somewhere within xarray's documentation. To figure out the label, we can either look at the source, search the output of python -m sphinx.ext.intersphinx https://docs.xarray.dev/en/latest/objects.inv, or use sphobjinv (install from PyPI):

sphobjinv search -su https://docs.xarray.dev/en/latest/ missing

Top-level functions:

  • get_options
  • decode_cf
  • polyval
  • unify_chunks
  • infer_freq
  • date_range

I/O:

  • load_dataarray
  • load_dataset
  • open_dataarray
  • open_dataset
  • open_mfdataset

Contents:

  • DataArray.assign_attrs
  • Dataset.assign_attrs
  • DataArray.expand_dims
  • Dataset.expand_dims
  • DataArray.drop_duplicates
  • Dataset.drop_duplicates
  • DataArray.drop_vars
  • Dataset.drop_vars
  • Dataset.drop_dims
  • DataArray.convert_calendar
  • Dataset.convert_calendar
  • DataArray.set_coords
  • Dataset.set_coords
  • DataArray.reset_coords
  • Dataset.reset_coords

Comparisons:

  • DataArray.equals
  • Dataset.equals
  • DataArray.identical
  • Dataset.identical
  • DataArray.broadcast_equals
  • Dataset.broadcast_equals

Dask:

  • DataArray.compute
  • Dataset.compute
  • DataArray.chunk
  • Dataset.chunk
  • DataArray.persist
  • Dataset.persist

Missing values:

  • DataArray.bfill
  • Dataset.bfill
  • DataArray.ffill
  • Dataset.ffill
  • DataArray.fillna
  • Dataset.fillna
  • DataArray.dropna
  • Dataset.dropna

Indexing:

Aggregations:

  • Dataset.argmax
  • Dataset.argmin
  • DataArray.cumsum (intermediate to advanced)
  • Dataset.cumsum (intermediate to advanced)
  • DataArray.cumprod (intermediate to advanced)
  • Dataset.cumprod (intermediate to advanced)
  • DataArray.reduce
  • Dataset.reduce

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Choose an unchecked function from the listed top-level, I/O, contents, Dask, missing-values, indexing, or aggregation entries, then inspect its existing docstring and related narrative documentation. Use the provided pytest doctest command to verify examples and use the documented Sphinx or sphobjinv guidance to add links. Done means the selected docstring has clear input/output examples, valid links, and passing doctests.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
documentation, testing
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.