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

Tutorial 2 - scientific Python ecosystem: pandas and GeoPandas: Add JN #4

Open
wants to merge 30 commits into
base: main
Choose a base branch
from

Conversation

yvonnefroehlich
Copy link
Member

@yvonnefroehlich yvonnefroehlich commented Sep 22, 2024

This PR adds the Jupyter notebook for Tutorial 2 - scientific Python ecosystem: pandas and GeoPandas:

  • Data stored as pandas DataFrame and GeoPandas GeoDataFrame
  • Different geometries (point, lines, polygons)
  • Choropleth map
  • Handling aspatial data
  • Filtering and using different styles / files for plotting
  • Conversion of objects from other python packages to geopandas related objects

Preview:

@yvonnefroehlich yvonnefroehlich added the enhancement New feature or request label Sep 22, 2024
@yvonnefroehlich yvonnefroehlich self-assigned this Sep 22, 2024
@yvonnefroehlich yvonnefroehlich marked this pull request as draft September 22, 2024 18:12
@yvonnefroehlich yvonnefroehlich changed the title WIP: Add JN for tutorial on pandas and geopandas WIP: Add JN for tutorial 3 on pandas and geopandas Nov 9, 2024
@yvonnefroehlich yvonnefroehlich changed the title WIP: Add JN for tutorial 3 on pandas and geopandas WIP: Add JN for tutorial 3 on pandas and GeoPandas Nov 9, 2024
@yvonnefroehlich yvonnefroehlich changed the title WIP: Add JN for tutorial 3 on pandas and GeoPandas WIP: Add JN for tutorial 2 on pandas and GeoPandas Nov 9, 2024
@yvonnefroehlich yvonnefroehlich changed the title WIP: Add JN for tutorial 2 on pandas and GeoPandas WIP: Tutorial 2 - SPEC: pandas and GeoPandas: Add JN Nov 9, 2024
@yvonnefroehlich yvonnefroehlich changed the title WIP: Tutorial 2 - SPEC: pandas and GeoPandas: Add JN WIP: Tutorial 2 - scientific Python ecosystem: pandas and GeoPandas: Add JN Nov 9, 2024
Copy link
Member

@weiji14 weiji14 left a comment

Choose a reason for hiding this comment

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

Notebook looks very clean and easy to follow so far! Just some minor suggestions for now, not sure if you're planning to add more materials to this notebook?

book/tut2_spec_pd_gpd.ipynb Outdated Show resolved Hide resolved
book/tut2_spec_pd_gpd.ipynb Outdated Show resolved Hide resolved
book/tut2_spec_pd_gpd.ipynb Outdated Show resolved Hide resolved
book/tut2_spec_pd_gpd.ipynb Outdated Show resolved Hide resolved
@yvonnefroehlich
Copy link
Member Author

Notebook looks very clean and easy to follow so far! Just some minor suggestions for now, not sure if you're planning to add more materials to this notebook?

Thanks @weiji14 for already looking at this JN and the positive feedback! I feel the general structure should be finished. What is missing is some documentation and improvements of the formulations, as you already suggested.

@yvonnefroehlich yvonnefroehlich changed the title WIP: Tutorial 2 - scientific Python ecosystem: pandas and GeoPandas: Add JN Tutorial 2 - scientific Python ecosystem: pandas and GeoPandas: Add JN Nov 13, 2024
@jhtong33
Copy link
Collaborator

Just a simple suggestion, using individual cells can help beginners understand how to set a region.
For example, they can observe the data range beforehand through print(df_jp_eqs["magnitude"].min(), df_jp_eqs["magnitude"].max()) to demonstrates how to visualize data limits.

@yvonnefroehlich
Copy link
Member Author

Just a simple suggestion, using individual cells can help beginners understand how to set a region. For example, they can observe the data range beforehand through print(df_jp_eqs["magnitude"].min(), df_jp_eqs["magnitude"].max()) to demonstrates how to visualize data limits.

This is a good suggestions! Moved these lines to a separate cell.

@yvonnefroehlich yvonnefroehlich marked this pull request as ready for review November 17, 2024 01:05
@yvonnefroehlich yvonnefroehlich added the needs review Review of this PR is welcome label Nov 17, 2024
@Esteban82
Copy link
Member

I think is ready to merge. My only minor suggestion would be to add a frame to the choropleth map.

@@ -13,3 +13,4 @@ parts:
- file: markdown
- file: notebooks
- file: markdown-notebooks
- file: tut2_spec_pd_gpd
Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe it's better to add the file names of the JNs or files together within one PR to avoid merge conflicts.

Copy link
Member

Choose a reason for hiding this comment

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

Let's just leave it as is, it'll be a good example to learn how to handle merge conflicts 🙂

Comment on lines +11 to +13
# Tutorial 2 - pandas and GeoPandas, Tutorial 4 - Geophysics (Seismology)
- pandas=2.2.2
- geopandas=1.0.1
Copy link
Member Author

Choose a reason for hiding this comment

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

Same as above, maybe better to update the environment.yml within one PR for all tutorials to avoid merge conflicts.

Copy link
Member

@weiji14 weiji14 Nov 24, 2024

Choose a reason for hiding this comment

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

Since pandas is a required dependency of pygmt, this won't need to be added here, unless you specifically require pandas=2.2.2?

Note that I'll be updating the conda-lock.yml file to pin all dependencies once all the tutorial notebooks are merged, so that people can reproduce the exact dependency versions in the future (including pandas).

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think I specifically need this pandas version. Just added the version I am currently having installed in the virtual environment I am using for this pre-workshop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs review Review of this PR is welcome
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants