Skip to content

Commit

Permalink
Fix mismatch between number of labels and ticks, silence warnings. (#488
Browse files Browse the repository at this point in the history
)
  • Loading branch information
danielabdi-noaa authored Nov 17, 2022
1 parent 2e08cce commit 47aebbe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ush/Python/plot_allvars.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import pyproj
import argparse
import cartopy
import warnings

#--------------Define some functions ------------------#

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

# Throw away python warnings (mostly depreciation.)
warnings.simplefilter("ignore")

# Read date/time, forecast hour, and directory paths from command line
ymdh = str(sys.argv[1])
ymd = ymdh[0:8]
Expand Down
10 changes: 8 additions & 2 deletions ush/Python/plot_allvars_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
import pyproj
import argparse
import cartopy
import warnings

#--------------Define some functions ------------------#

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

# Throw away python warnings (mostly depreciation.)
warnings.simplefilter("ignore")

# Read date/time, forecast hour, and directory paths from command line
ymdh = str(sys.argv[1])
ymd = ymdh[0:8]
Expand Down Expand Up @@ -960,7 +964,8 @@ def plot_all(dom):
cs_1.cmap.set_over('pink')
cbar1 = plt.colorbar(cs_1,ax=ax1,orientation='horizontal',pad=0.05,shrink=0.6,extend='max')
cbar1.set_label(units,fontsize=6)
cbar1.ax.set_xticklabels([0.1,0.5,1,1.5,2,3,5,10,20])
#cbar1.ax.set_xticklabels([0.1,0.5,1,1.5,2,3,5,10,20])
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])
cbar1.ax.tick_params(labelsize=6)
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'))

Expand All @@ -969,7 +974,8 @@ def plot_all(dom):
cs_2.cmap.set_over('pink')
cbar2 = plt.colorbar(cs_2,ax=ax2,orientation='horizontal',pad=0.05,shrink=0.6,extend='max')
cbar2.set_label(units,fontsize=6)
cbar2.ax.set_xticklabels([0.1,0.5,1,1.5,2,3,5,10,20])
#cbar2.ax.set_xticklabels([0.1,0.5,1,1.5,2,3,5,10,20])
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])
cbar2.ax.tick_params(labelsize=6)
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'))

Expand Down

0 comments on commit 47aebbe

Please sign in to comment.