1:Argonne National Laboratory

```
In [1]:
```#first we do some imports and check the version of Py-ART for consistency
import pyart
from matplotlib import pyplot as plt
import numpy as np
%matplotlib inline
print pyart.__version__

```
```

read the data into our data model

```
In [2]:
```#you can grab the data here: http://engineering.arm.gov/~collis/KAMX_20140417_1056
filename = 'data/KAMX_20140417_1056'
radar = pyart.io.read(filename)

Lets see what data we get with this radar

```
In [3]:
```print radar.fields.keys()

```
```

To save some memory we are going to only store the first two sweeps from this radar volume.

```
In [4]:
```radar = radar.extract_sweeps([0, 1])

```
In [5]:
```#create an instance of the class using our radar
display = pyart.graph.RadarMapDisplay(radar)
#create a Matplotlib figure
f = plt.figure(figsize = [17,4])
#now we are going to do a three panel plot, resolution is a basemap parameter and determines the resolution of
#the coastline.. here we set to intermediate or 'i' ('h' for high 'l' for low)
plt.subplot(1, 3, 1)
display.plot_ppi_map('differential_reflectivity', max_lat = 26.5, min_lat =25.4, min_lon = -81., max_lon = -79.5,
vmin = -7, vmax = 7, lat_lines = np.arange(20,28,.2), lon_lines = np.arange(-82, -79, .5),
resolution = 'i')
plt.subplot(1, 3, 2)
display.plot_ppi_map('reflectivity', max_lat = 26.5, min_lat =25.4, min_lon = -81., max_lon = -79.5,
vmin = -8, vmax = 64, lat_lines = np.arange(20,28,.2), lon_lines = np.arange(-82, -79, .5),
resolution = 'i')
plt.subplot(1, 3, 3)
display.plot_ppi_map('velocity', sweep = 1, max_lat = 26.5, min_lat =25.4, min_lon = -81., max_lon = -79.5,
vmin = -15, vmax = 15, lat_lines = np.arange(20,28,.2), lon_lines = np.arange(-82, -79, .5),
resolution = 'i')

```
```

```
In [ ]:
```# First we create an independant copy of one of our radar fields.. we need to make sure changes made do not
# infer back onto the object it was copied from (common cause of issues in Python)
smooth_zdr = radar.fields['differential_reflectivity']['data'].copy()
# Now for each of the radials in the volume we want to do an 8-point smooth by convolving the data with a Hanning window..
# rather than write out the code here we are going to use Py-ART's smooth and trim function which also makes sure
# the returned array has the same size as the original array..
# Check here: https://github.com/ARM-DOE/pyart/blob/master/pyart/correct/phase_proc.py#L242
for i in range(smooth_zdr.shape[0]):
smooth_zdr[i,:] = pyart.correct.phase_proc.smooth_and_trim(smooth_zdr[i,:], 8)
# Now that we have add this data as a new field, using the same metadata as the
# differential_reflectivity field.
radar.add_field_like('differential_reflectivity', 'differential_reflectivity_smooth', smooth_zdr)

** visualization routines simply work!**

```
In [ ]:
```f = plt.figure(figsize = [17,4])
plt.subplot(1, 3, 1)
display.plot_ppi_map('differential_reflectivity_smooth', max_lat = 26.5, min_lat =25.4, min_lon = -81., max_lon = -79.5,
vmin = -7, vmax = 7, lat_lines = np.arange(20,28,.2), lon_lines = np.arange(-82, -79, .5),
resolution = 'i')
plt.subplot(1, 3, 2)
display.plot_ppi_map('reflectivity', max_lat = 26.5, min_lat =25.4, min_lon = -81., max_lon = -79.5,
vmin = -8, vmax = 64, lat_lines = np.arange(20,28,.2), lon_lines = np.arange(-82, -79, .5),
resolution = 'i')
plt.subplot(1, 3, 3)
display.plot_ppi_map('velocity', sweep = 1, max_lat = 26.5, min_lat =25.4, min_lon = -81., max_lon = -79.5,
vmin = -15, vmax = 15, lat_lines = np.arange(20,28,.2), lon_lines = np.arange(-82, -79, .5),
resolution = 'i')

```
In [ ]:
```display = pyart.graph.RadarMapDisplay(radar)
f = plt.figure(figsize = [17,4])
plt.subplot(1, 3, 1)
display.plot_ppi_map('differential_reflectivity_smooth', max_lat = 26.4, min_lat =26, min_lon = -80.75, max_lon = -80.25,
vmin = -7, vmax = 7, lat_lines = np.arange(20,28,.1), lon_lines = np.arange(-82, -79, .2),
resolution = 'c')
plt.subplot(1, 3, 2)
display.plot_ppi_map('reflectivity', max_lat = 26.4, min_lat =26, min_lon = -80.75, max_lon = -80.25,
vmin = -8, vmax = 64, lat_lines = np.arange(20,28,.1), lon_lines = np.arange(-82, -79, .2),
resolution = 'c')
plt.subplot(1, 3, 3)
display.plot_ppi_map('velocity', sweep = 1, max_lat = 26.4, min_lat =26, min_lon = -80.75, max_lon = -80.25,
vmin = -15, vmax = 15, lat_lines = np.arange(20,28,.1), lon_lines = np.arange(-82, -79, .2),
resolution = 'c')

Nice Signature... Lets google this and see what we find! Here:

Take a read of the BAMS article by Zirnic and Ryzhkov: http://journals.ametsoc.org/doi/pdf/10.1175/1520-0477%281999%29080%3C0389%3APFWSR%3E2.0.CO%3B2

Should also be a $\delta_{dp}$ signal on top of $\phi_{dp}$.. Lets take a look

```
In [ ]:
```f = plt.figure(figsize = [17,4])
plt.subplot(1, 3, 1)
display.plot_ppi_map('differential_reflectivity_smooth', max_lat = 26.4, min_lat =26, min_lon = -80.75, max_lon = -80.25,
vmin = -7, vmax = 7, lat_lines = np.arange(20,28,.1), lon_lines = np.arange(-82, -79, .2),
resolution = 'l')
plt.subplot(1, 3, 2)
display.plot_ppi_map('reflectivity', max_lat = 26.4, min_lat =26, min_lon = -80.75, max_lon = -80.25,
vmin = -8, vmax = 64, lat_lines = np.arange(20,28,.1), lon_lines = np.arange(-82, -79, .2),
resolution = 'l')
plt.subplot(1, 3, 3)
display.plot_ppi_map('differential_phase', sweep = 0, max_lat = 26.4, min_lat =26, min_lon = -80.75, max_lon = -80.25,
vmin = 0, vmax = 360, lat_lines = np.arange(20,28,.1), lon_lines = np.arange(-82, -79, .2),
resolution = 'l')

finally, now that we have gone to the trouble to do some value adding lets save the data out...

```
In [ ]:
```pyart.io.write_cfradial('data/roostring.nc', radar)

And we can use ncdump to ensure it is a CF-Radial netCDF file

```
In [ ]:
```!ncdump -h data/roostring.nc