Skip to content

Commit 1102f10

Browse files
authored
Merge pull request #81 from jukent/cape
add more to viz and vapor sections
2 parents 8f28785 + acf429b commit 1102f10

File tree

1 file changed

+59
-4
lines changed

1 file changed

+59
-4
lines changed

notebooks/1-comparison.ipynb

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"\n",
3131
"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",
3232
"\n",
33-
"Missing a plotting library that you use and want others to know more about? [Let us know!]()\n"
33+
"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"
3434
]
3535
},
3636
{
@@ -129,7 +129,52 @@
129129
"\n",
130130
"<img src=\"images/logos/geocat.png\" width=250 alt=\"GeoCAT Logo\"></img>\n",
131131
"\n",
132-
"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."
132+
"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",
133+
"\n",
134+
"Here is a simple example of a GeoCAT-viz convenience function:"
135+
]
136+
},
137+
{
138+
"cell_type": "code",
139+
"execution_count": null,
140+
"metadata": {},
141+
"outputs": [],
142+
"source": [
143+
"import xarray as xr\n",
144+
"import matplotlib.pyplot as plt\n",
145+
"import numpy as np\n",
146+
"import geocat.datafiles as gdf\n",
147+
"import geocat.viz as gv\n",
148+
"\n",
149+
"# Open a netCDF data file using xarray default engine and load the data into xarrays\n",
150+
"ds = xr.open_dataset(gdf.get(\"netcdf_files/mxclim.nc\"))\n",
151+
"U = ds.U[0, :, :]\n",
152+
"\n",
153+
"# Generate figure (set its size (width, height) in inches) and axes\n",
154+
"plt.figure(figsize=(6, 6))\n",
155+
"ax = plt.axes()\n",
156+
"\n",
157+
"# Set y-axis to have log-scale\n",
158+
"plt.yscale('log')\n",
159+
"\n",
160+
"# Specify which contours should be drawn\n",
161+
"levels = np.linspace(-55, 55, 23)\n",
162+
"\n",
163+
"# Plot contour lines\n",
164+
"lines = U.plot.contour(ax=ax,\n",
165+
" levels=levels,\n",
166+
" colors='black',\n",
167+
" linewidths=0.5,\n",
168+
" linestyles='solid',\n",
169+
" add_labels=False)\n",
170+
"\n",
171+
"# Invert y-axis\n",
172+
"ax.invert_yaxis()\n",
173+
"\n",
174+
"# Create second y-axis to show geo-potential height.\n",
175+
"axRHS = gv.add_height_from_pressure_axis(ax, heights=[4, 8])\n",
176+
"\n",
177+
"plt.show();"
133178
]
134179
},
135180
{
@@ -198,7 +243,17 @@
198243
"\n",
199244
"<img src=\"images/logos/vapor.png\" width=250 alt=\"VAPOR Logo\"></img>\n",
200245
"\n",
201-
"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."
246+
"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."
247+
]
248+
},
249+
{
250+
"cell_type": "markdown",
251+
"metadata": {},
252+
"source": [
253+
"```{admonition} Info\n",
254+
":class: tip\n",
255+
"\n",
256+
"For more VAPOR content, be sure to check out the [VAPOR Pythia Cookbook](https://projectpythia.org/vapor-python-cookbook/README.html). "
202257
]
203258
},
204259
{
@@ -365,7 +420,7 @@
365420
],
366421
"metadata": {
367422
"kernelspec": {
368-
"display_name": "Python 3 (ipykernel)",
423+
"display_name": "advanced-viz-cookbook",
369424
"language": "python",
370425
"name": "python3"
371426
},

0 commit comments

Comments
 (0)