Hey y’all, Max sent me here to open a discussion on imshow vs. pcolormesh when plotting data. While imshow is the default for its speed, some purists like me get bothered by the way it smooths/blurs the data (image attached; I had to get creative since I got a “new posters can only send one image” warning)
After reading the docs, I figured setting Raster = True instead of False would fix this for me, but it had no effect on the image. So, Max showed me that extracting the data (radar.get_field() and radar.get_gate_lat_lon_alt()) and plotting it manually via pcolormesh would best preserve the data. I personally gave up after struggling with the data being transposed.
So now I figure a simple kwarg for plotting in pcolormesh (or an example on how to plot in pcolormesh) would help folks like me who just want their data to look as realistic as possible.
I am hooked on this package and what I can do with it, and I appreciate y’all’s time in advance!
Pretty cool to see that a topic that I brought up on Twitter made it here. I have always wondered since I first saw this interpolated style if it actually improves the quality of the data overall? It generally looks like it pulls more out of the legacy 1km and 1° azimuth resolution.
@nixoncameronj if you are interested in using a discrete colormap (like some other visualization tools), you can use the following:
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
# Read in a sample radar
radar = pyart.io.read(pyart.testing.CFRADIAL_PPI_FILE)
# Grab a colorbar from Py-ART
cmap = pyart.graph.cm_colorblind.HomeyerRainbow
# Set your minimum, maximum, and interval for your bins
bounds = np.arange(-10, 75, 5)
# Configure the normalization for matplotlib
norm = mpl.colors.BoundaryNorm(bounds, cmap.N, extend='both')
# Setup the radar map display
graph = pyart.graph.RadarMapDisplay(radar)
# Plot the reflectivity field
graph.plot_ppi_map('reflectivity_horizontal', cmap=cmap, norm=norm)