From 529168e54a1928bdd0942cd025ffaa5edfea21d8 Mon Sep 17 00:00:00 2001 From: Zach Sherman Date: Wed, 29 Jun 2022 16:00:49 -0500 Subject: [PATCH] MNT: Added warning catch for axes. (#1191) --- pyart/graph/gridmapdisplay.py | 8 ++++++-- pyart/graph/radarmapdisplay.py | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pyart/graph/gridmapdisplay.py b/pyart/graph/gridmapdisplay.py index 01924386e7..1d54314863 100644 --- a/pyart/graph/gridmapdisplay.py +++ b/pyart/graph/gridmapdisplay.py @@ -202,7 +202,9 @@ def plot_grid(self, field, level=0, vmin=None, vmax=None, + " Overridding defined axes and using default " + "axes with projection Mercator.", UserWarning) - ax = plt.axes(projection=projection) + with warnings.catch_warnings(): + warnings.filterwarnings("ignore") + ax = plt.axes(projection=projection) # Define GeoAxes if None is provided. else: @@ -215,7 +217,9 @@ def plot_grid(self, field, level=0, vmin=None, vmax=None, + " Overridding defined axes and using default " + "axes with projection Mercator.", UserWarning) - ax = plt.axes(projection=projection) + with warnings.catch_warnings(): + warnings.filterwarnings("ignore") + ax = plt.axes(projection=projection) # plot the grid using xarray if norm is not None: # if norm is set do not override with vmin/vmax diff --git a/pyart/graph/radarmapdisplay.py b/pyart/graph/radarmapdisplay.py index d4496a2a5f..c0f39192c5 100644 --- a/pyart/graph/radarmapdisplay.py +++ b/pyart/graph/radarmapdisplay.py @@ -267,7 +267,9 @@ def plot_ppi_map( + " Overridding defined axes and using default " + "axes with projection Lambert Conformal.", UserWarning) - ax = plt.axes(projection=projection) + with warnings.catch_warnings(): + warnings.filterwarnings("ignore") + ax = plt.axes(projection=projection) # Define GeoAxes if None is provided. else: @@ -281,7 +283,9 @@ def plot_ppi_map( + " Overridding defined axes and using default " + "axes with projection Lambert Conformal.", UserWarning) - ax = plt.axes(projection=projection) + with warnings.catch_warnings(): + warnings.filterwarnings("ignore") + ax = plt.axes(projection=projection) if min_lon: ax.set_extent([min_lon, max_lon, min_lat, max_lat],