xarray-tutorial icon indicating copy to clipboard operation
xarray-tutorial copied to clipboard

A few points for improving the indexing notebooks

Open negin513 opened this issue 1 year ago • 3 comments

From today's presentation, I can think of a few things to improve the whole indexing materials:

  • Advanced indexing :
  • [x] Add a schematic image on the subsetted points to explain the difference between the orthogonal vs. point-wise indexing. Something similar to this:

The right figure here shows it for Numpy/ poinwise indexing: image Here is another one showing the orthogonal indexing:

  • [x] Adding an exercise for this notebook.
  • [ ] Adding an example for this warning: If an indexer is a DataArray(), its coordinates should not conflict with the selected subpart of the target array (except for the explicitly indexed dimensions with .loc/.sel). Otherwise, IndexError will be raised!
  • Boolean indexing:
  • [ ] Adding a plot of all grid locations to show how dims and physical coordinates are different for the curvilinear grid.

negin513 avatar Jul 11 '23 19:07 negin513

Here is another one I have found from Matlab: matlab

negin513 avatar Jul 11 '23 20:07 negin513

These images are great! Thanks Negin.

dcherian avatar Jul 12 '23 15:07 dcherian

Okay, so I created this for adding to the tutorial, to better explain these concepts:

Untitled drawio (1)

np_arr = np.arange(1, 26).reshape(5, 5)
np_arr [[0, 2, 4], [0, 2, 4]]
da = xr.DataArray(np_arr)
da [[0, 2, 4], [0, 2, 4]]

I will add these to our notebooks soon...

negin513 avatar Jul 13 '23 18:07 negin513