Skip to content
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

Update indexing material #192

Merged
merged 56 commits into from
Jul 10, 2023
Merged

Update indexing material #192

merged 56 commits into from
Jul 10, 2023

Conversation

negin513
Copy link
Contributor

@negin513 negin513 commented Jul 6, 2023

Adding two new notebooks in support of SciPy 2023:

  1. 02.1_indexing_Basic.ipynb (Comprehensive coverage of all basic indexing)
  2. 02.2_indexing_Advanced.ipynb

The first notebook includes comprehensive coverage of all basic indexing and can basically replace the 02.1_working_with_labeled_data.ipynb. But I wanted to first ask for feedback before removing the other notebook.

The second notebook includes :

  • Vectorized Indexing
  • Boolean Indexing and isin, and masking using where

Relevant Issue: #170

We can add materials for Fancy Datetime Indexing here @andersy005 .

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@negin513 negin513 mentioned this pull request Jul 7, 2023
34 tasks
@dcherian
Copy link
Contributor

dcherian commented Jul 7, 2023

Very nice! I just took a quick look, will do a more thorough review tomorrow.

The first notebook includes comprehensive coverage of all basic indexing and can basically replace the 02.1_working_with_labeled_data.ipynb. But I wanted to first ask for feedback before removing the other notebook.

Perhaps we can copy the exercises over? That notebook also has some date time indexing material that could be copied?

Can you add entries in _toc.yml please? I think your second notebook should go in the Intermediate section.

@dcherian dcherian changed the title Scipy2023 Update indexing material Jul 7, 2023
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the logo.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you'll need one or two more lines to explain "orthogonal" indexing.

We should also link to the xarray docs appropriately.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a new subsection for "pointwise indexing"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For masking, another motivation is selecting regions that are not regular: like lat and lon ranges on a curvilinear grid. A figure might be useful to illustrate the difference. "rasm" is a useful dataset for this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use the myst syntax where we can instead of alerts and bold font

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Masking and isin can be grouped under "Boolean indexing". They could be moved to its own notebook.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can skip "align and reindex". Reindexing can be its own section left for some future work.

Copy link
Contributor Author

@negin513 negin513 Jul 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your comments.
I significantly updated this notebook based on your comments:
I added a section called orthogonal indexing. I tried to add the pointwise terminology as you recommended.

For the boolean masking :
I created a separate notebook for Boolean masking/indexing (as you recommended).
I updated the notebook to use rasm dataset and created a specific section/exercise telling them why they cannot use sel for such datasets for selecting regions.

@dcherian
Copy link
Contributor

dcherian commented Jul 7, 2023

Here's a proposal for organizing:

  • Fundamentals
    • Labeled data
      • Selecting Data <- First notebook : positional vs label-based indexing
      • Selection with Times <- Datetime Indexing stuff
  • Intermediate
    • Indexing
      • Vectorized and Pointwise indexing
      • Boolean Indexing & Masking

What do you think? We've been evolving towards breaking up the material in to small pieces so it's easy to choose subsets for a syllabus.

We'll need to add the parts you want to cover to the workshops/scipy2023/README.md in the appropriate dropdown.

@negin513
Copy link
Contributor Author

negin513 commented Jul 8, 2023

@dcherian I am not sure why the JupyterBuild of this notebook fails.

It complains about the redirect and a page already existing:


WARNING: (broken) fundamentals/02.1_working_with_labeled_data.html redirects to fundamentals/02.1_indexing_Basic.html but /home/runner/work/xarray-tutorial/xarray-tutorial/_build/html/fundamentals/02.1_working_with_labeled_data.html already exists!

Should I manually deleted the cached htmls ?

@dcherian
Copy link
Contributor

dcherian commented Jul 8, 2023

You can change the key to force a new cache:

# NOTE: change key to "jupyterbook-DATE" to force rebuilding cache
key: jupyterbook-20230626

@andersy005
Copy link
Member

You can change the key to force a new cache:

# NOTE: change key to "jupyterbook-DATE" to force rebuilding cache
key: jupyterbook-20230626

i usually delete stale cache via the actions UI, and this seems to invalidate it and force a new cache (under the same key though)

Screenshot 2023-07-07 at 21 35 20

@andersy005
Copy link
Member

@andersy005, please feel free to add a section to the basic or advanced indexing notebook on the fancy datetime indexing. I think at this point I am not going to make any other changes to these notebooks unless I hear back from you or @dcherian .

thank you for putting this together, @negin513! i intend to push changes to this PR tomorrow and sunday

@dcherian
Copy link
Contributor

Thanks all. This is looking great.

I pushed some minor edits.

Some major comments:

  • let's delete the numpy advanced indexing piece from "basic indexing" material. That's going to be confusing. It can be moved to the "advanced indexing" notebook if you prefer.
  • "basic indexing" uses datetime indexing before it is introduced. Let's edit that to select along lat instead of time. or reorder the material

@dcherian
Copy link
Contributor

We only have 30 minutes for the indexing topic, so perhaps just do only the Advanced and Vectorized Indexing notebook?

Given that I'm just going to merge here.

Thanks @negin513 and @andersy005 !

@dcherian dcherian merged commit 34d1a4a into xarray-contrib:main Jul 10, 2023
@negin513
Copy link
Contributor Author

Sounds great. Thanks @dcherian. Do we have a schedule now and how long each topic is going to take?

dcherian added a commit to negin513/xarray-tutorial that referenced this pull request Jul 10, 2023
* upstream/main:
  Update indexing material (xarray-contrib#192)
  Migrate to exercise syntax (xarray-contrib#196)
  Bump pangeo/base-image from 2023.06.20 to 2023.07.05 in /.devcontainer (xarray-contrib#193)
  Add Nebari-specific instructions for SciPy 2023 (xarray-contrib#195)
  Add contributors image (xarray-contrib#194)
  Computational pattern tutorial edits (xarray-contrib#186)
  Housekeeping + clean up sidebar (xarray-contrib#190)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants