Skip to content

Drop in Unidata numpy workshop notebooks #39

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 22 commits into from
Jun 16, 2021

Conversation

dcamron
Copy link
Contributor

@dcamron dcamron commented Apr 20, 2021

These are dropped in from this directory of NumPy notebooks from Unidata's workshop materials with exercises modified and branding removed. Otherwise, so far content un-modified.

Notes:

  • Multiple notebooks, not sure about scope/content crossover and if this a good example of a larger unit in development
  • Not unique to this PR, but need to pull out code comments and create more full narratives

@dcamron dcamron changed the title Core numpy Drop in Unidata numpy workshop notebooks Apr 20, 2021
@dcamron dcamron added the content Content related issue label Apr 20, 2021
@github-actions
Copy link

🚀 📚 Preview for git commit SHA: 0bc6a7e at: https://607f68da19f534123ccb6bad--pythia-foundations.netlify.app

@dcamron dcamron requested a review from a team April 22, 2021 17:53
Copy link
Contributor

@clyne clyne left a comment

Choose a reason for hiding this comment

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

test review. Ignore

@mgrover1
Copy link
Contributor

These notebooks look great! I like the use of "synthetic weather data" which helps illustrate geoscience related data/plots, while also showing the user how to utilize numpy. The progression between the three notebooks is also helpful.

@brian-rose
Copy link
Member

I just enabled ReviewNB on this repository, and I'm trying it out for more fine-grained comments on @dcamron's notebooks.

If others want to give it a try, I think you need to first log in to ReviewNB using your GitHub credentials.

@@ -0,0 +1,840 @@
{
Copy link
Member

Choose a reason for hiding this comment

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

This part is all new to me, I've never heard of strides.

I wonder if this part is out of scope for a foundational set of numpy lessons.


Reply via ReviewNB

Copy link
Contributor

Choose a reason for hiding this comment

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

This particular use of as_strided is definitely advanced stuff and could very well be left out. The general concept of strides though of part of even Python's own slicing:

l = list(range(15))
l[::3]

gets the list with a stride of 3. Strides themselves I consider a core concept.

@@ -0,0 +1,783 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add difference between list vs. array?


Reply via ReviewNB

@@ -0,0 +1,783 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Add in specific geoscience example of where this would be helpful - perhaps a graphic would help with this?


Reply via ReviewNB

@@ -0,0 +1,840 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Provide context as to what this would look like without broadcasting (loop)


Reply via ReviewNB

@@ -0,0 +1,840 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

More of an explanation of what this is doing would be helpful


Reply via ReviewNB

@clyne clyne added this to the InitialPortalRelease milestone Jun 4, 2021
@dcamron dcamron added the hackathon Issue highlighted for active hackathon session label Jun 9, 2021
@clyne
Copy link
Contributor

clyne commented Jun 9, 2021

In the spirt of streamlining reviews I am removing myself as a reviewer. It looks like there are plenty of comments from others already.

@clyne
Copy link
Contributor

clyne commented Jun 9, 2021

Hmm. I don't seem to be able to remove myself...

@brian-rose
Copy link
Member

Hmm. I don't seem to be able to remove myself...

Yeah, AFAIK github doesn't let you do that. Maybe @dopplershift knows differently? You can always just ignore the review request though.

@clyne
Copy link
Contributor

clyne commented Jun 10, 2021

I plan to ignore it, and proclaim my ignorance in public :-)

@clyne
Copy link
Contributor

clyne commented Jun 14, 2021

@dcamron just checking in. Do you think this is still doable for Wednesday? Sorry to nag :-(

@dcamron
Copy link
Contributor Author

dcamron commented Jun 14, 2021

@dcamron just checking in. Do you think this is still doable for Wednesday? Sorry to nag :-(

Yep!

@github-actions
Copy link

🚀 📚 Preview for git commit SHA: 2b618e9 at: https://60c7ce31d73be21c27ea36ae--pythia-foundations.netlify.app

Copy link
Contributor

@mgrover1 mgrover1 left a comment

Choose a reason for hiding this comment

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

this looks great - thank you for making all those changes!

@github-actions
Copy link

🚀 📚 Preview for git commit SHA: 2762df0 at: https://60c7dd908f2199310e4e8ae7--pythia-foundations.netlify.app

@brian-rose
Copy link
Member

Awesome, I will get to this tonight or tomorrow morning.

@@ -0,0 +1,674 @@
{
Copy link
Member

@brian-rose brian-rose Jun 15, 2021

Choose a reason for hiding this comment

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

This seems to refer to an exercise that we don't have here.


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I removed that.

@@ -0,0 +1,674 @@
{
Copy link
Member

@brian-rose brian-rose Jun 15, 2021

Choose a reason for hiding this comment

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

Add a note here like "Recall that axis=-1 refers to the last axis, which in this case means the sum of x and y."


Reply via ReviewNB

@@ -0,0 +1,674 @@
{
Copy link
Member

@brian-rose brian-rose Jun 15, 2021

Choose a reason for hiding this comment

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

This section is pretty long. Is there a way to break it up with titled subsections?


Reply via ReviewNB

@@ -0,0 +1,674 @@
{
Copy link
Member

@brian-rose brian-rose Jun 15, 2021

Choose a reason for hiding this comment

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

This material is really good. We could introduce np.where() here to show how to implement the same logic with a numpy-native method. The point would mostly be to demonstrate that numpy has a rich library of methods for manipulating arrays that is well worth exploring. Not necessary, but that was my thought on reading this.


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that's valuable! It also extends to potentially common uses within xarray, but maybe I'll open an issue on covering it in another notebook (separating out intermediate content?) or extending this notebook sometime in the future

@@ -0,0 +1,975 @@
{
Copy link
Member

@brian-rose brian-rose Jun 15, 2021

Choose a reason for hiding this comment

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

This callout is rendering oddly. Can it be made consistent with the example "Warning" alert in the template?


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep just left in something I was messing around with on accident

@@ -0,0 +1,975 @@
{
Copy link
Member

@brian-rose brian-rose Jun 15, 2021

Choose a reason for hiding this comment

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

"Everything along the last index of the final dimension"

It may be helpful to state that *in this 3D example*, this is entirely equivalent to

c[:,:,-1]

but is useful when you don't know (or care) about the number of dimensions.


Reply via ReviewNB

@@ -0,0 +1,975 @@
{
Copy link
Member

@brian-rose brian-rose Jun 15, 2021

Choose a reason for hiding this comment

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

Fix capitalization: Pandas, Xarray


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are often stylized this way in-line, check out the pandas docs and xarray docs. We can decide on a consistent stylization for non sentence starters if-needed and I don't think anyone would be too mad if I did capitalize these. Either way.

Copy link
Member

Choose a reason for hiding this comment

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

No big deal! There are more important things to get mad about.

@@ -0,0 +1,921 @@
{
Copy link
Member

@brian-rose brian-rose Jun 15, 2021

Choose a reason for hiding this comment

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

It would be great to break this section up into multiple subsections.


Reply via ReviewNB

@@ -0,0 +1,921 @@
{
Copy link
Member

@brian-rose brian-rose Jun 15, 2021

Choose a reason for hiding this comment

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

"iterating over all the points" (typo)


Reply via ReviewNB

@@ -0,0 +1,921 @@
{
Copy link
Member

@brian-rose brian-rose Jun 15, 2021

Choose a reason for hiding this comment

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

Fix capitalization: Pandas, Xarray


Reply via ReviewNB

Copy link
Member

@brian-rose brian-rose left a comment

Choose a reason for hiding this comment

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

I left detailed comments on ReviewNB. One additional comment: it would be great to update the landing page of the numpy section to have a brief description of the topics covered in the three notebooks.

(That can be a separate PR or included here, either is fine)

@dcamron
Copy link
Contributor Author

dcamron commented Jun 15, 2021

I have to step out for a bit, but I think the notebook feedback has all been incorporated. I agree about expanding on the NumPy chapter page (and think that's valuable for all of our content so far) and will tackle that here or in a new PR later today or first thing in the morning.

@github-actions
Copy link

🚀 📚 Preview for git commit SHA: 8fe181a at: https://60c92a7372003b3ac2707e39--pythia-foundations.netlify.app

Copy link
Member

@brian-rose brian-rose left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks for making the revisions. The added subheadings are very welcome.

I suggest we merge this and open a separate PR to update the numpy landing page, in order to keep the reviews streamlined.

@brian-rose
Copy link
Member

Note to self (or someone else): we still need to update the Numpy landing page once this PR is merged.

@mgrover1
Copy link
Contributor

Looks good to me! Ready to merge!

@brian-rose
Copy link
Member

There's a little conflict with some notebook metadata. I will fix and merge.

@mgrover1
Copy link
Contributor

There's a little conflict with some notebook metadata. I will fix and merge.

Ope good catch - thanks!

@github-actions
Copy link

🚀 📚 Preview for git commit SHA: 7571104 at: https://60c96b8d7c9d3c33a83bc796--pythia-foundations.netlify.app

@brian-rose brian-rose merged commit b97494a into ProjectPythia:main Jun 16, 2021
@dcamron dcamron deleted the core-numpy branch June 16, 2021 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content Content related issue hackathon Issue highlighted for active hackathon session ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kernel spec in template.ipynb
5 participants