Skip to content

Clarify vectorized indexing documentation #7747

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion doc/user-guide/indexing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,6 @@ dimensions:
ind_x = xr.DataArray([0, 1], dims=["x"])
ind_y = xr.DataArray([0, 1], dims=["y"])
da[ind_x, ind_y] # orthogonal indexing
da[ind_x, ind_x] # vectorized indexing

Slices or sequences/arrays without named-dimensions are treated as if they have
the same dimension which is indexed along:
Expand Down Expand Up @@ -399,6 +398,12 @@ These methods may also be applied to ``Dataset`` objects
Vectorized indexing may be used to extract information from the nearest
grid cells of interest, for example, the nearest climate model grid cells
to a collection specified weather station latitudes and longitudes.
To trigger vectorized indexing behavior
you will need to provide the selection dimensions with a new
shared output dimension name. In the example below, the selections
of the closest latitude and longitude are renamed to an output
dimension named "points":


.. ipython:: python

Expand Down