Skip to content

Commit

Permalink
Merge pull request #81 from jukent/cape
Browse files Browse the repository at this point in the history
add more to viz and vapor sections
  • Loading branch information
jukent authored Dec 18, 2024
2 parents 8f28785 + acf429b commit 1102f10
Showing 1 changed file with 59 additions and 4 deletions.
63 changes: 59 additions & 4 deletions notebooks/1-comparison.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"\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",
"\n",
"Missing a plotting library that you use and want others to know more about? [Let us know!]()\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 Down Expand Up @@ -129,7 +129,52 @@
"\n",
"<img src=\"images/logos/geocat.png\" width=250 alt=\"GeoCAT Logo\"></img>\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 two 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, 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."
"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",
"\n",
"Here is a simple example of a GeoCAT-viz convenience function:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import xarray as xr\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import geocat.datafiles as gdf\n",
"import geocat.viz as gv\n",
"\n",
"# Open a netCDF data file using xarray default engine and load the data into xarrays\n",
"ds = xr.open_dataset(gdf.get(\"netcdf_files/mxclim.nc\"))\n",
"U = ds.U[0, :, :]\n",
"\n",
"# Generate figure (set its size (width, height) in inches) and axes\n",
"plt.figure(figsize=(6, 6))\n",
"ax = plt.axes()\n",
"\n",
"# Set y-axis to have log-scale\n",
"plt.yscale('log')\n",
"\n",
"# Specify which contours should be drawn\n",
"levels = np.linspace(-55, 55, 23)\n",
"\n",
"# Plot contour lines\n",
"lines = U.plot.contour(ax=ax,\n",
" levels=levels,\n",
" colors='black',\n",
" linewidths=0.5,\n",
" linestyles='solid',\n",
" add_labels=False)\n",
"\n",
"# Invert y-axis\n",
"ax.invert_yaxis()\n",
"\n",
"# Create second y-axis to show geo-potential height.\n",
"axRHS = gv.add_height_from_pressure_axis(ax, heights=[4, 8])\n",
"\n",
"plt.show();"
]
},
{
Expand Down Expand Up @@ -198,7 +243,17 @@
"\n",
"<img src=\"images/logos/vapor.png\" width=250 alt=\"VAPOR Logo\"></img>\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/) and the [VAPOR Pythia Cookbook](https://projectpythia.org/vapor-python-cookbook/README.html). 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. Learn more at the [VAPOR documentation](https://www.vapor.ucar.edu/). VAPOR requires a GPU-enabled environment to run."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"```{admonition} Info\n",
":class: tip\n",
"\n",
"For more VAPOR content, be sure to check out the [VAPOR Pythia Cookbook](https://projectpythia.org/vapor-python-cookbook/README.html). "
]
},
{
Expand Down Expand Up @@ -365,7 +420,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "advanced-viz-cookbook",
"language": "python",
"name": "python3"
},
Expand Down

0 comments on commit 1102f10

Please sign in to comment.