# 2 Basic visualization of radar scans

## 2.1 The structure of polar volumes

# Let's first download the NEXRAD polar volume files for the KHGX radar (Houston)
# for a 15 minute period in 2017:
# store the filenames in my_pvolfiles
my_pvolfiles <- list.files("./data_pvol", recursive = TRUE, full.names = TRUE, pattern="KHGX")
# print to console our files:
my_pvolfiles
my_pvol <- read_pvolfile(my_pvolfiles[1])

# let's extract the scan collected at 1.5 degree elevation from our polar volume:
my_scan <- get_scan(my_pvol, 0.5)
my_scan
# let's plot the reflectivity factor parameter of the scan in a range - azimuth coordinate system:
plot(my_scan, param = "DBZH")

Exercise 1: Plot the radial velocity parameters of the 1.5 degree elevation scan in a range - azimuth coordinate system. (See manual page of the read_pvolfile() function for the nomenclature of various available quantities).

Usually it is easier to visually explore radar scans as a PPI (plan position indicator), which is a projection of the scan on a Cartesian (X,Y) or (lat,lon) grid:

# before we can plot the scan, we need to project it on a Cartesian grid,
# i.e. we need to make a Plan Position Indicator (PPI)
my_ppi <- project_as_ppi(my_scan)
my_ppi
# you can see we projected it on a 500 meter grid
# (check the manual of the project_as_ppi function to see how you can
# change the grid size (argument grid_size) and the maximum distance
# from the radar up to where to plot data (argument range_max))
#
# Now we are ready to plot the ppi, for example let's plot reflectivity factor DBZH:
plot(my_ppi, param = "DBZH")

Exercise 2: This case shows an incoming precipitation front, characterized by localized but intense thunderstorms, as well as biological scattering. Make also a ppi plot of the correlation coefficient (RHOHV) and radial velocity (VRADH). Verify which regions are precipitation, and infer from those patterns the (approximate) direction of movement of biology and precipitation.

Exercise 3: Based on the radial velocity image, are the biological scatterers birds or insects? Why?

## 2.3 Overlaying radar scans on maps

# It is often informative to plot radar data on a base layer.
map(my_ppi, map = basemap, param = "DBZH", zlim = c(-20, 40))