Skip to content

Commit 47aebbe

Browse files
Fix mismatch between number of labels and ticks, silence warnings. (#488)
1 parent 2e08cce commit 47aebbe

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

ush/Python/plot_allvars.py

+4
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
import pyproj
6363
import argparse
6464
import cartopy
65+
import warnings
6566

6667
#--------------Define some functions ------------------#
6768

@@ -234,6 +235,9 @@ def rotate_wind(true_lat,lov_lon,earth_lons,uin,vin,proj,inverse=False):
234235
parser.add_argument("Name of native domain used in forecast (and in constructing post file names)")
235236
args = parser.parse_args()
236237

238+
# Throw away python warnings (mostly depreciation.)
239+
warnings.simplefilter("ignore")
240+
237241
# Read date/time, forecast hour, and directory paths from command line
238242
ymdh = str(sys.argv[1])
239243
ymd = ymdh[0:8]

ush/Python/plot_allvars_diff.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
import pyproj
6767
import argparse
6868
import cartopy
69+
import warnings
6970

7071
#--------------Define some functions ------------------#
7172

@@ -239,6 +240,9 @@ def rotate_wind(true_lat,lov_lon,earth_lons,uin,vin,proj,inverse=False):
239240
parser.add_argument("Name of native domain used in forecasts (and in constructing post file names)")
240241
args = parser.parse_args()
241242

243+
# Throw away python warnings (mostly depreciation.)
244+
warnings.simplefilter("ignore")
245+
242246
# Read date/time, forecast hour, and directory paths from command line
243247
ymdh = str(sys.argv[1])
244248
ymd = ymdh[0:8]
@@ -960,7 +964,8 @@ def plot_all(dom):
960964
cs_1.cmap.set_over('pink')
961965
cbar1 = plt.colorbar(cs_1,ax=ax1,orientation='horizontal',pad=0.05,shrink=0.6,extend='max')
962966
cbar1.set_label(units,fontsize=6)
963-
cbar1.ax.set_xticklabels([0.1,0.5,1,1.5,2,3,5,10,20])
967+
#cbar1.ax.set_xticklabels([0.1,0.5,1,1.5,2,3,5,10,20])
968+
cbar1.ax.set_xticklabels([0.1, 0.3, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5, 7.5, 10, 15, 17.5, 20])
964969
cbar1.ax.tick_params(labelsize=6)
965970
ax1.text(.5,1.03,'FV3-LAM '+fhour+'-hr Accumulated Precipitation ('+units+') \n initialized: '+itime+' valid: '+vtime + ' (f'+fhour+')',horizontalalignment='center',fontsize=6,transform=ax1.transAxes,bbox=dict(facecolor='white',alpha=0.85,boxstyle='square,pad=0.2'))
966971

@@ -969,7 +974,8 @@ def plot_all(dom):
969974
cs_2.cmap.set_over('pink')
970975
cbar2 = plt.colorbar(cs_2,ax=ax2,orientation='horizontal',pad=0.05,shrink=0.6,extend='max')
971976
cbar2.set_label(units,fontsize=6)
972-
cbar2.ax.set_xticklabels([0.1,0.5,1,1.5,2,3,5,10,20])
977+
#cbar2.ax.set_xticklabels([0.1,0.5,1,1.5,2,3,5,10,20])
978+
cbar2.ax.set_xticklabels([0.1, 0.3, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5, 7.5, 10, 15, 17.5, 20])
973979
cbar2.ax.tick_params(labelsize=6)
974980
ax2.text(.5,1.03,'FV3-LAM-2 '+fhour+'-hr Accumulated Precipitation ('+units+') \n initialized: '+itime+' valid: '+vtime + ' (f'+fhour+')',horizontalalignment='center',fontsize=6,transform=ax2.transAxes,bbox=dict(facecolor='white',alpha=0.85,boxstyle='square,pad=0.2'))
975981

0 commit comments

Comments
 (0)