Skip to content

Commit

Permalink
Merge pull request #89 from kafitzgerald/ams_revisions
Browse files Browse the repository at this point in the history
AMS revisions
  • Loading branch information
jukent authored Jan 11, 2025
2 parents 094e5c0 + 38927b6 commit f945ea6
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 107 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Advanced Visualization Cookbook

[![Binder](https://binder.projectpythia.org/badge_logo.svg)](https://binder.pythia.2i2c.cloud/v2/gh/ProjectPythia/advanced-viz-cookbook.git/main?labpath=notebooks)
[![Binder](https://binder.projectpythia.org/badge_logo.svg)](https://binder.projectpythia.org/v2/gh/ProjectPythia/advanced-viz-cookbook.git/main?labpath=notebooks)
[![DOI](https://zenodo.org/badge/671205314.svg)](https://zenodo.org/badge/latestdoi/671205314)

This Project Pythia Cookbook covers advanced visualization techniques building upon and combining various Python packages.
Expand All @@ -11,7 +11,7 @@ This Project Pythia Cookbook covers advanced visualization techniques building u

The possibilities of data visualization in Python are almost endless. Already using `matplotlib` the workhorse behind many visualization packages, the user has a lot of customization options available to them. `cartopy`, `metpy`, `seaborn`, `geocat-viz`, and `datashader` are all also great packages that can offer unique additions to your Python visualization toolbox.

This Cookbook will house various visualization workflow examples that use different visualization packages, highlight the differences in functionality between the packages, any noteable syntax distinctions, and demonstrate combining tools to achieve a specific outcome.
This cookbook will house various visualization workflow examples that use different visualization packages, highlight the differences in functionality between the packages, any noteable syntax distinctions, and demonstrate combining tools to achieve a specific outcome.

## Authors

Expand All @@ -29,11 +29,11 @@ This cookbook is broken up into a few sections - a "Basics of Geoscience Visuali

### Basics of Geoscience Visualization

Here we introduce the basics of geoscience visualization, the elements of a plot, different types of plots, and some unique considerations when dealing with model and measured data. Here we also share a comparison of different visualization packages available to the Scientific Python programmer.
Here we introduce the basics of geoscience visualization, the elements of a plot, different types of plots, and some unique considerations when dealing with model and measured data. We also share a comparison of different visualization packages available in the scientific Python ecosystem.

### Specialty Plots

There are some plot types that are unique to atmospheric science such as Taylor Diagrams or Skew-T plots. Here we will use [`metpy`](https://unidata.github.io/MetPy/latest/index.html) and [`geocat-viz`](https://geocat-viz.readthedocs.io/en/latest/) to demonstrate these specialty plots.
There are some plot types that are unique to atmospheric science such as Taylor Diagrams and Skew-T plots. Here we will use [`metpy`](https://unidata.github.io/MetPy/latest/index.html) and [`geocat-viz`](https://geocat-viz.readthedocs.io/en/latest/) to demonstrate these specialty plots.

### Visualization of Structured Grids

Expand Down
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ sphinx:
icon: fab fa-youtube-square
type: fontawesome
launch_buttons:
binderhub_url: https://binder.pythia.2i2c.cloud
binderhub_url: https://binder.projectpythia.org
notebook_interface: jupyterlab
logo:
link: https://projectpythia.org
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ dependencies:
- sphinx-pythia-theme
- jupyter-book
- jupyterlab
- jupyterlab-myst
- pandas
- matplotlib
- cartopy
Expand Down
68 changes: 35 additions & 33 deletions notebooks/1-comparison.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
"metadata": {},
"source": [
"## Overview\n",
"There are nearly endless possibilities when it comes to data visualization in Python. Some of these choices can be overwhelming. This chapter aims to lay out and distinguish different Python visualization libraries so that you are more equipped to make the right choice for your data visualization needs. This Cookbook is not a comprehensive tutorial on these packages, but we can offere enough information and links to documentation or relevant tutorials to help get you started.\n",
"There are nearly endless possibilities when it comes to data visualization in Python. Some of these choices can be overwhelming. This chapter aims to lay out and distinguish between different Python visualization libraries so that you are better equipped to make the right choice for your data visualization needs. This cookbook is not a comprehensive tutorial on these packages, but we can offer enough information and resources to help get you started.\n",
"\n",
"1. Matplotlib\n",
"1. Cartopy\n",
"1. GeoCAT-viz\n",
"1. MetPy\n",
"1. Vapor\n",
"1. VAPOR\n",
"\n",
"```{admonition} Info\n",
":class: tip\n",
"\n",
"The plotting libraries mentioned here are either ones used extensively by the authors of this Cookbook OR ones that we get asked about a lot when giving plotting tutorials. This does not cover every library that can be used for plotting in the Python scientific ecosystem, but should cover the more popular packages you might come across.\n",
"The plotting libraries mentioned here are either ones used extensively by the authors of this Cookbook OR ones that we get asked about a lot when giving data visualization tutorials. This does not cover every library that can be used for plotting in Python, but should cover the more popular packages you might come across.\n",
"\n",
"Missing a plotting library that you use and want others to know more about? Let us know by opening a [GitHub Issue](https://github.com/ProjectPythia/advanced-viz-cookbook/issues).\n"
]
Expand All @@ -39,13 +39,7 @@
"| [Matplotlib](https://foundations.projectpythia.org/core/matplotlib.html) | Necessary | |\n",
"| [Cartopy](https://foundations.projectpythia.org/core/cartopy.html) | Necessary | |\n",
"\n",
"- **Time to learn**: 50 minutes"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"- **Time to learn**: 10 minutes\n",
"---"
]
},
Expand All @@ -55,9 +49,12 @@
"source": [
"## Matplotlib\n",
"\n",
"<img src=\"images/logos/matplotlib.svg\" width=250 alt=\"Matplotlib Logo\"></img>\n",
"```{image} images/logos/matplotlib.svg\n",
":alt: Matplotlib logo\n",
":width: 250px\n",
"```\n",
"\n",
"Matplotlib is the workhorse of Python visualization needs. It is a comprehensive plotting library that has the capacity to make static, animated, or interactive visualizations. It is hard to imagine plotting in Python without first getting comfortable with Matplotlib. Be sure to check out the [Matplotlib documentation](https://matplotlib.org/) as well as the [Pythia foundations chapter on Matplotlib](https://foundations.projectpythia.org/core/matplotlib.html) for guidance.\n",
"Matplotlib is the workhorse of the Python visualization landscape. It is a comprehensive plotting library that has the capacity to make static, animated, or interactive visualizations. It is hard to imagine plotting in Python without first getting comfortable with Matplotlib. Be sure to check out the [Matplotlib documentation](https://matplotlib.org/) as well as the [Pythia foundations chapter on Matplotlib](https://foundations.projectpythia.org/core/matplotlib.html) for guidance.\n",
"\n",
"Matplotlib's syntax should feel familiar to anyone who has plotted data in Matlab.\n",
"\n",
Expand Down Expand Up @@ -93,9 +90,12 @@
"source": [
"## Cartopy\n",
"\n",
"<img src=\"images/logos/cartopy.jpeg\" width=250 alt=\"Cartopy Logo\"></img>\n",
"```{image} images/logos/cartopy.jpeg\n",
":alt: Cartopy logo\n",
":width: 250px\n",
"```\n",
"\n",
"Cartopy is a Python package for plotting data on the globe. It is the go-to package for plotting maps, dealing with different projections, and adding surface features to your plot. Cartopy is buit on top of [PROJ](https://proj.org/en/9.2/), NumPy and [Shapely](https://shapely.readthedocs.io/en/stable/manual.html), and Matplotlib. To learn more about what Cartopy can do, check out the [Cartopy documentation](https://scitools.org.uk/cartopy/docs/latest/) and the [Pythia foundations Cartopy chapter](https://foundations.projectpythia.org/core/cartopy.html).\n",
"Cartopy is a Python package for plotting data on the globe. It is the go-to package for plotting maps, dealing with different projections, and adding surface features to your plot. Cartopy is buit on top of [PROJ](https://proj.org/en/9.2/), NumPy, [Shapely](https://shapely.readthedocs.io/en/stable/manual.html), and Matplotlib. To learn more about what Cartopy can do, check out the [Cartopy documentation](https://scitools.org.uk/cartopy/docs/latest/) and the [Pythia Foundations Cartopy Chapter](https://foundations.projectpythia.org/core/cartopy.html).\n",
"\n",
"You may have heard about [Basemap](https://matplotlib.org/basemap/index.html), another geoscience plotting library, which was deprecated in favor of Cartopy.\n",
"\n",
Expand All @@ -122,9 +122,12 @@
"source": [
"## GeoCAT-Viz\n",
"\n",
"<img src=\"images/logos/geocat.png\" width=250 alt=\"GeoCAT Logo\"></img>\n",
"```{image} images/logos/geocat.png\n",
":alt: GeoCAT logo\n",
":width: 250px\n",
"```\n",
"\n",
"The GeoCAT team at the National Center for Atmospheric Research (NCAR) aims to help scientists transitioning from [NCL](https://www.ncl.ucar.edu/) to Python. Out of this team come three different visualization aids: the [GeoCAT-examples Visualization Gallery](https://geocat-examples.readthedocs.io/en/latest/) which contains tons of different plotting examples that you can use as a starting place for your figures, [GeoCAT-applications](https://ncar.github.io/geocat-applications/) which is designed to be a quick reference guide demonstrating capabilities within the scientific Python ecosystem, and the [GeoCAT-Viz package (documentation)](https://geocat-viz.readthedocs.io/en/latest/) which contains many convenience functions that formerly existed in NCL or for making Python plots look publication-ready.\n",
"The GeoCAT team at the NSF National Center for Atmospheric Research (NSF NCAR) aims to help scientists transitioning from [NCL](https://www.ncl.ucar.edu/) to Python. Out of this team come three different visualization aids: the [GeoCAT-examples visualization gallery](https://geocat-examples.readthedocs.io/en/latest/) which contains tons of different plotting examples that you can use as a starting place for your figures, [GeoCAT-applications](https://ncar.github.io/geocat-applications/) which is designed to be a quick reference guide demonstrating capabilities within the scientific Python ecosystem, and the [GeoCAT-viz package (documentation)](https://geocat-viz.readthedocs.io/en/latest/) which contains many convenience functions that formerly existed in NCL and/or for making Python plots look publication-ready.\n",
"\n",
"Here is a simple example of a GeoCAT-viz convenience function:"
]
Expand Down Expand Up @@ -178,9 +181,12 @@
"source": [
"## MetPy\n",
"\n",
"<img src=\"images/logos/metpy.png\" width=250 alt=\"Metpy Logo\"></img>\n",
"```{image} images/logos/metpy.png\n",
":alt: MetPy logo\n",
":width: 250px\n",
"```\n",
"\n",
"Metpy is a collection of tools for data reading, analysis, and visualization with weather data. Matplotlib offers some useful functionality for unique plots such as Skew-T diagrams, as well as declaritive plotting functionality. Check out the [MetPy documentation](https://unidata.github.io/MetPy/latest/index.html).\n",
"MetPy is a collection of tools for data I/O, analysis, and visualization with weather data. MetPy offers some useful functionality for unique plots such as Skew-T diagrams, as well as declaritive plotting functionality. Check out the [MetPy documentation](https://unidata.github.io/MetPy/latest/index.html).\n",
"\n",
"Here is a simple Skew-T plot from their [Getting Started documentation](https://unidata.github.io/MetPy/latest/userguide/startingguide.html):"
]
Expand Down Expand Up @@ -236,9 +242,12 @@
"source": [
"## VAPOR\n",
"\n",
"<img src=\"images/logos/vapor.png\" width=250 alt=\"VAPOR Logo\"></img>\n",
"```{image} images/logos/vapor.png\n",
":alt: VAPOR logo\n",
":width: 250px\n",
"```\n",
"\n",
"VAPOR stands for the Visualization and Analysis Platform for Ocean, Atmosphere, and Solar Researchers and is another project from NCAR. VAPOR provides an interactive 3D visualization environment. Learn more at the [VAPOR documentation](https://www.vapor.ucar.edu/). VAPOR requires a GPU-enabled environment to run."
"VAPOR stands for the Visualization and Analysis Platform for Ocean, Atmosphere, and Solar Researchers and is another project from NCAR. VAPOR provides an interactive 3D visualization environment. Traditionally users interacted through a graphical user interface (GUI), but it now has a Python API as well. Learn more at the [VAPOR documentation](https://www.vapor.ucar.edu/). Note that VAPOR requires a GPU-enabled environment to run."
]
},
{
Expand All @@ -255,14 +264,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Interactive visualization libraries such as Plotly, UXarray, seaborn, bokeh, and hvplot will be explored in a separate interactive plotting Cookbook."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---"
"Interactive visualization libraries such as Plotly, Seaborn, Bokeh, and hvPlot will be explored in a separate interactive plotting cookbook."
]
},
{
Expand All @@ -287,10 +289,10 @@
"\n",
"- [Matplotlib documentation](https://matplotlib.org/)\n",
"- [Cartopy documentation](https://scitools.org.uk/cartopy/docs/latest/)\n",
"- [GeoCat-examples Visualization Gallery](https://geocat-examples.readthedocs.io/en/latest/)\n",
"- [GeoCAT-Viz documentation](https://geocat-viz.readthedocs.io/en/latest/)\n",
"- [GeoCAT-examples visualization gallery](https://geocat-examples.readthedocs.io/en/latest/)\n",
"- [GeoCAT-viz documentation](https://geocat-viz.readthedocs.io/en/latest/)\n",
"- [MetPy documentation](https://unidata.github.io/MetPy/latest/index.html)\n",
"- [Vapor documentation](https://www.vapor.ucar.edu/)\n",
"- [VAPOR documentation](https://www.vapor.ucar.edu/)\n",
"- [Plotly Python documentation](https://plotly.com/python/)\n",
"- [Seaborn documentation](https://seaborn.pydata.org/)\n",
"- [Bokeh documentation](https://bokeh.org/)\n",
Expand All @@ -303,7 +305,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "advanced-viz-cookbook",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -317,7 +319,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
"version": "3.12.8"
},
"nbdime-conflicts": {
"local_diff": [
Expand Down
Loading

0 comments on commit f945ea6

Please sign in to comment.