From 3c4262d821110d92ca5e51be5d68fa3689d14967 Mon Sep 17 00:00:00 2001 From: lauratomkins Date: Wed, 4 May 2022 16:55:18 -0400 Subject: [PATCH 1/5] Create plot_nexrad_image_muted_reflectivity.py --- .../plot_nexrad_image_muted_reflectivity.py | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 examples/plotting/plot_nexrad_image_muted_reflectivity.py diff --git a/examples/plotting/plot_nexrad_image_muted_reflectivity.py b/examples/plotting/plot_nexrad_image_muted_reflectivity.py new file mode 100644 index 0000000000..f0d6eae1e0 --- /dev/null +++ b/examples/plotting/plot_nexrad_image_muted_reflectivity.py @@ -0,0 +1,55 @@ +""" +======================================= +Create an image-muted reflectivity plot +======================================= +An example which creates an image-muted PPI plot from a NEXRAD file. + +Image muting reduces the visual prominence of the reflectivities within identified +melting and mixed precipitation features in winter storms. Reflectivities corresponding to +melting and mixed precipitation features are deemphasized using a gray scale and the regions +with just snow and just rain are depicted in a corresponding full-color scale. +The ultimate utility of image muting radar reflectivity is to reduce the misinterpretation +of regions of melting or mixed precipitation as opposed to heavy snow or heavy rain + +""" + +print(__doc__) + +#Author: Laura Tomkins (lmtomkin@ncsu.edu) +#License: BSD 3 clause +#citation: Tomkins et al., Image Muting of Mixed Precipitation to Improve Identification of +# Regions of Heavy Snow in Radar Data, 2022, in prep. + +import pyart +import numpy as np +import matplotlib.pyplot as plt +import matplotlib.colors as mcolors + +# Read in file +nexrad_file = 's3://noaa-nexrad-level2/2020/02/07/KBGM/KBGM20200207_132642_V06' +radar = pyart.io.read_nexrad_archive(nexrad_file) + +# Mute radar object +radar = pyart.util.image_mute_radar(radar, field='reflectivity', mute_field='cross_correlation_ratio', + mute_threshold=0.97, field_threshold=20) + +# adjust colormaps for visual separation +# this example uses perceptually uniform colormaps +magma_cmap = plt.get_cmap('magma_r') +grays_cmap = plt.get_cmap('gray_r') + +nonmuted_cmap = mcolors.LinearSegmentedColormap.from_list('nonmuted_cmap', magma_cmap(np.linspace(0, 0.9, magma_cmap.N))) +muted_cmap = mcolors.LinearSegmentedColormap.from_list('muted_cmap', grays_cmap(np.linspace(0, 0.7, grays_cmap.N))) + +# create plot using RadarDisplay +display = pyart.graph.RadarDisplay(radar) + +fig = plt.figure() +ax = plt.axes() +display.plot('nonmuted_reflectivity', 0, vmin=5, vmax=45, cmap=nonmuted_cmap) +display.plot('muted_reflectivity', 0, vmin=5, vmax=45, cmap=muted_cmap) +display.set_limits((-300,300), (-300,300)) +ax.set_aspect('equal') +plt.show() + + From e9eb1d089c7983b3e4ad22255a006b740d994c9c Mon Sep 17 00:00:00 2001 From: lauratomkins Date: Thu, 5 May 2022 11:38:47 -0400 Subject: [PATCH 2/5] Update plot_nexrad_image_muted_reflectivity.py --- examples/plotting/plot_nexrad_image_muted_reflectivity.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/plotting/plot_nexrad_image_muted_reflectivity.py b/examples/plotting/plot_nexrad_image_muted_reflectivity.py index f0d6eae1e0..2c832a2e47 100644 --- a/examples/plotting/plot_nexrad_image_muted_reflectivity.py +++ b/examples/plotting/plot_nexrad_image_muted_reflectivity.py @@ -5,11 +5,12 @@ An example which creates an image-muted PPI plot from a NEXRAD file. Image muting reduces the visual prominence of the reflectivities within identified -melting and mixed precipitation features in winter storms. Reflectivities corresponding to -melting and mixed precipitation features are deemphasized using a gray scale and the regions +melting and mixed precipitation features in winter storms (i.e. regions with low +correlation coefficient values). Reflectivities corresponding to melting and mixed +precipitation features are deemphasized using a gray scale and the regions with just snow and just rain are depicted in a corresponding full-color scale. The ultimate utility of image muting radar reflectivity is to reduce the misinterpretation -of regions of melting or mixed precipitation as opposed to heavy snow or heavy rain +of regions of melting or mixed precipitation as opposed to heavy snow or heavy rain. """ From fd09f266e6e3b50e6dbb8bdb1c7e5efd65920a83 Mon Sep 17 00:00:00 2001 From: lauratomkins Date: Thu, 5 May 2022 12:49:02 -0400 Subject: [PATCH 3/5] Add comment about muting --- examples/plotting/plot_nexrad_image_muted_reflectivity.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/plotting/plot_nexrad_image_muted_reflectivity.py b/examples/plotting/plot_nexrad_image_muted_reflectivity.py index 2c832a2e47..c7c69232e3 100644 --- a/examples/plotting/plot_nexrad_image_muted_reflectivity.py +++ b/examples/plotting/plot_nexrad_image_muted_reflectivity.py @@ -31,6 +31,7 @@ radar = pyart.io.read_nexrad_archive(nexrad_file) # Mute radar object +# Regions where rhoHV < 0.97 and reflectivity > 20 will be muted radar = pyart.util.image_mute_radar(radar, field='reflectivity', mute_field='cross_correlation_ratio', mute_threshold=0.97, field_threshold=20) From 8b7ee81a694c07336e6554ba0260c89eb2742ecc Mon Sep 17 00:00:00 2001 From: lauratomkins Date: Thu, 5 May 2022 14:44:38 -0400 Subject: [PATCH 4/5] Remove whitespace --- examples/plotting/plot_nexrad_image_muted_reflectivity.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/plotting/plot_nexrad_image_muted_reflectivity.py b/examples/plotting/plot_nexrad_image_muted_reflectivity.py index c7c69232e3..2ec22e6660 100644 --- a/examples/plotting/plot_nexrad_image_muted_reflectivity.py +++ b/examples/plotting/plot_nexrad_image_muted_reflectivity.py @@ -53,5 +53,3 @@ display.set_limits((-300,300), (-300,300)) ax.set_aspect('equal') plt.show() - - From cc58af908c27e05688fbc4aa7450e36d42eb3b1e Mon Sep 17 00:00:00 2001 From: lauratomkins Date: Wed, 26 Oct 2022 11:45:13 -0400 Subject: [PATCH 5/5] Add full image muting citation --- examples/plotting/plot_nexrad_image_muted_reflectivity.py | 6 ++++-- pyart/util/radar_utils.py | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/examples/plotting/plot_nexrad_image_muted_reflectivity.py b/examples/plotting/plot_nexrad_image_muted_reflectivity.py index 2ec22e6660..ba38970d3c 100644 --- a/examples/plotting/plot_nexrad_image_muted_reflectivity.py +++ b/examples/plotting/plot_nexrad_image_muted_reflectivity.py @@ -18,8 +18,10 @@ #Author: Laura Tomkins (lmtomkin@ncsu.edu) #License: BSD 3 clause -#citation: Tomkins et al., Image Muting of Mixed Precipitation to Improve Identification of -# Regions of Heavy Snow in Radar Data, 2022, in prep. +#citation: Tomkins, L. M., Yuter, S. E., Miller, M. A., and Allen, L. R., 2022: +# Image muting of mixed precipitation to improve identification of regions +# of heavy snow in radar data. Atmos. Meas. Tech., 15, 5515–5525, +# https://doi.org/10.5194/amt-15-5515-2022 import pyart import numpy as np diff --git a/pyart/util/radar_utils.py b/pyart/util/radar_utils.py index 1f9117aa97..6c37d266fc 100644 --- a/pyart/util/radar_utils.py +++ b/pyart/util/radar_utils.py @@ -483,6 +483,13 @@ def image_mute_radar( radar : Radar Radar object with 2 new fields from input field, one muted and one not muted. + References + ---------- + Tomkins, L. M., Yuter, S. E., Miller, M. A., and Allen, L. R., 2022: + Image muting of mixed precipitation to improve identification of regions + of heavy snow in radar data. Atmos. Meas. Tech., 15, 5515–5525, + https://doi.org/10.5194/amt-15-5515-2022 + """ # add checks for field availability if field not in radar.fields.keys():