pydata / pydata/xarray

Numpy to xarray docs

Open
#7,533 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic-documentation
Dominant language
Python
Stars
4.2k
Forks
1.4k
Avg merge
2d 15h
Merged PRs (30d)
14

Description

We should make a docs page specifically to ease the transition from pure-numpy to xarray.

A lot of new xarray users come from already using numpy as their primary data structure. We relatively often get questions about "what's the xarray equivalent of X numpy function" but we don't have a dedicated place to collect those answers, or explain key conceptual differences.

I think this deserves its own dedicated docs page, with:

  • High-level conceptual differences (e.g. transpose invariance)
  • Arguments for the benefits of using xarray over pure numpy
  • Table of numpy <-> xarray function equivalents (similar to the existing "How do I..." page)
  • Other common recommendations for numpy users (e.g. use netCDF / Zarr instead of .npz or pickle to store data on disk)

For the table I thought of a few already, but I know there will be a lot more:

  • np.concatenate/np.vstack/np.hstack/np.stackxr.concat
  • np.blockxr.combine_nested
  • np.apply_along_axisxr.apply_ufunc
  • np.polynomialxr.polyfit
  • np.reshape -> xr.coarsen().construct()

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

Start by locating the existing "How do I..." documentation page and reviewing how it presents function equivalents. Create a dedicated NumPy-to-xarray page covering the listed conceptual differences, benefits, equivalent functions, and storage recommendations, with the requested mappings included.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.