Skip to content

Commit

Permalink
Merge pull request #4 from mgrover1/add-pyart-section
Browse files Browse the repository at this point in the history
ADD: Add revised py-art section with data
  • Loading branch information
mgrover1 authored Nov 9, 2023
2 parents 572d854 + 47a6fa1 commit 8ac4217
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 1,169 deletions.
Binary file not shown.
Binary file added notebooks/images/logos/arm_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
130 changes: 33 additions & 97 deletions notebooks/pyart/pyart-basics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<img src=\"../../images/logos/arm_logo.png\" width=500 alt=\"ARM Logo\"></img>"
"<img src=\"../images/logos/arm_logo.png\" width=500 alt=\"ARM Logo\"></img>"
]
},
{
Expand Down Expand Up @@ -71,7 +71,6 @@
"\n",
"\n",
"import pyart\n",
"from pyart.testing import get_test_data\n",
"\n",
"warnings.filterwarnings('ignore')"
]
Expand Down Expand Up @@ -172,7 +171,7 @@
},
"outputs": [],
"source": [
"file = \"../../data/uah-armor/RAW_NA_000_125_20080411182229\"\n",
"file = \"../data/cacti/radar/corcsapr2cmacppiM1.c1.20190125.200003.nc\"\n",
"radar = pyart.io.read(file)\n",
"radar"
]
Expand All @@ -198,24 +197,27 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"metadata": {},
"outputs": [],
"source": [
"radar.fields.keys()"
"list(radar.fields)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Extract the array for reflectivity values\n",
"There is a field for reflectivity, that has been quality controlled!"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"metadata": {},
"outputs": [],
"source": [
"reflectivity = radar.fields['reflectivity']['data']\n",
"print(type(reflectivity), reflectivity)"
"reflectivity = radar.fields[\"attenuation_corrected_reflectivity_h\"][\"data\"]"
]
},
{
Expand All @@ -228,12 +230,10 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"metadata": {},
"outputs": [],
"source": [
"reflectivity.shape"
"reflectivity"
]
},
{
Expand Down Expand Up @@ -323,7 +323,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Once we have a figure, let's add our `RadarMapDisplay`"
"Once we have a figure, let's add our `RadarDisplay`"
]
},
{
Expand All @@ -335,14 +335,14 @@
"outputs": [],
"source": [
"fig = plt.figure(figsize=[10, 10])\n",
"display = pyart.graph.RadarMapDisplay(radar)"
"display = pyart.graph.RadarDisplay(radar)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Adding our map display without specifying a field to plot **won't do anything** we need to specifically add a field to field using `.plot_ppi_map()`"
"Adding our map display without specifying a field to plot **won't do anything** we need to specifically add a field to field using `.plot_ppi()`"
]
},
{
Expand All @@ -353,7 +353,7 @@
},
"outputs": [],
"source": [
"display.plot_ppi_map('reflectivity')"
"display.plot_ppi('attenuation_corrected_reflectivity_h')"
]
},
{
Expand All @@ -378,40 +378,21 @@
},
"outputs": [],
"source": [
"fig = plt.figure(figsize=[12, 12])\n",
"display = pyart.graph.RadarMapDisplay(radar)\n",
"display.plot_ppi_map('reflectivity',\n",
" sweep=3,\n",
" vmin=-20,\n",
" vmax=60,\n",
" projection=ccrs.PlateCarree(),\n",
" cmap='pyart_HomeyerRainbow')\n",
"fig = plt.figure(figsize=[8, 6])\n",
"display = pyart.graph.RadarDisplay(radar)\n",
"display.plot_ppi('attenuation_corrected_reflectivity_h',\n",
" sweep=3,\n",
" vmin=-20,\n",
" vmax=60,\n",
" cmap='pyart_HomeyerRainbow')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can change many parameters in the graph by changing the arguments to plot_ppi_map. As you can recall from earlier. simply view these arguments in a Jupyter notebook by typing:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"display.plot_ppi_map?"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For example, let's change the colormap to something different"
"You can change many parameters in the graph by changing the arguments to plot_ppi. As you can recall from earlier. simply view these arguments in a Jupyter notebook by typing:"
]
},
{
Expand All @@ -422,68 +403,23 @@
},
"outputs": [],
"source": [
"fig = plt.figure(figsize=[12, 12])\n",
"display = pyart.graph.RadarMapDisplay(radar)\n",
"display.plot_ppi_map('reflectivity',\n",
" sweep=3,\n",
" vmin=-20,\n",
" vmax=60,\n",
" projection=ccrs.PlateCarree(),\n",
" cmap='pyart_Carbone42')\n",
"plt.show()"
"display.plot_ppi?"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Or, let's view a different elevation scan! To do this, change the sweep parameter in the plot_ppi_map function."
"### Challenge: Create a new map of your own!\n",
"- Plot the `corrected_velocity` field with suitable minimum and maximum values, with a colorbar of your choosing."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"fig = plt.figure(figsize=[12, 12])\n",
"display = pyart.graph.RadarMapDisplay(radar)\n",
"display.plot_ppi_map('reflectivity',\n",
" sweep=0,\n",
" vmin=-20,\n",
" vmax=60,\n",
" projection=ccrs.PlateCarree(),\n",
" cmap='pyart_Carbone42')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's take a look at a different field - for example, correlation coefficient (`corr_coeff`)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"fig = plt.figure(figsize=[12, 12])\n",
"display = pyart.graph.RadarMapDisplay(radar)\n",
"display.plot_ppi_map('cross_correlation_ratio',\n",
" sweep=0,\n",
" vmin=0.8,\n",
" vmax=1.,\n",
" projection=ccrs.PlateCarree(),\n",
" cmap='pyart_Carbone42')\n",
"plt.show()"
]
"source": []
},
{
"cell_type": "markdown",
Expand All @@ -494,7 +430,7 @@
"Within this notebook, we covered the basics of working with radar data using `pyart`, including:\n",
"- Reading in a file using `pyart.io`\n",
"- Investigating the `Radar` object\n",
"- Visualizing radar data using the `RadarMapDisplay`\n",
"- Visualizing radar data using the `RadarDisplay`\n",
"\n",
"### What's Next\n",
"In the next few notebooks, we walk through gridding radar data, applying data cleaning methods, and advanced visualization methods!"
Expand Down
1,129 changes: 57 additions & 1,072 deletions notebooks/pyart/pyart-gridding.ipynb

Large diffs are not rendered by default.

0 comments on commit 8ac4217

Please sign in to comment.