Skip to content

Commit

Permalink
Update plotting_functions.py
Browse files Browse the repository at this point in the history
Removed commented out lines of code that didn't need to be there any longer.
  • Loading branch information
shawnusaf authored Nov 12, 2024
1 parent 09ed447 commit b8c9ff0
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions lib/plotting_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,6 @@ def make_polar_plot(wks, case_nickname, base_nickname,
dif = difference

if pctchange is None:
#pct = (abs(d2 - d1)/((d2 + d1)/2.0))*100.0
pct = (d2 - d1) / np.abs(d1) * 100.0
else:
pct = pctchange
Expand Down Expand Up @@ -700,7 +699,6 @@ def make_polar_plot(wks, case_nickname, base_nickname,
maxval = np.max([np.max(d1), np.max(d2)])
absmaxdif = np.max(np.abs(dif))
absmaxpct = np.max(np.abs(pct))
#print('absmaxpct: ',absmaxpct)

if 'colormap' in kwargs:
cmap1 = kwargs['colormap']
Expand Down Expand Up @@ -739,8 +737,6 @@ def make_polar_plot(wks, case_nickname, base_nickname,
else:
# set levels for difference plot (with a symmetric color bar):
levelspctdiff = np.linspace(-1*absmaxpct, absmaxpct, 15)

#print("levelspctdiff=======",levelspctdiff)

#NOTE: Sometimes the contour levels chosen in the defaults file
#can result in the "contourf" software stack generating a
Expand All @@ -763,9 +759,6 @@ def make_polar_plot(wks, case_nickname, base_nickname,
if max(np.abs(levelsdiff)) > 10*absmaxdif:
levelsdiff = np.linspace(-1*absmaxdif, absmaxdif, 12)

#don't do this for the percent difference.
#if max(np.abs(levelspctdiff)) > 10*absmaxpct:
# levelspctdiff = np.linspace(-1*absmaxpct, absmaxpct, 12)

#End if
#-------------------------------
Expand Down Expand Up @@ -1338,18 +1331,8 @@ def plot_map_and_save(wks, case_nickname, base_nickname,
# set rmse title:
ax[3].set_title(f"RMSE: {d_rmse:.3f}", fontsize=tiFontSize)
ax[3].set_title("$\mathbf{Test} - \mathbf{Baseline}$", loc='left', fontsize=tiFontSize)
#ax[2].set_title("$\mathbf{Test} % \mathbf{Diff} \mathbf{Baseline}$", loc='left', fontsize=tiFontSize)
ax[2].set_title("Test % Diff Baseline", loc='left', fontsize=tiFontSize,fontweight="bold")

#if "units" in kwargs:
#ax[1].set_ylabel(f"[{kwargs['units']}]")
#ax[2].set_ylabel(f"[{kwargs['units']}]")
#ax[3].set_ylabel(f"[{kwargs['units']}]")
#else:
# ax[1].set_ylabel(f"{mdlfld.units}")
# ax[2].set_ylabel(f"{mdlfld.units}")
# ax[3].set_ylabel(f"{mdlfld.units}")

for a in ax:
a.spines['geo'].set_linewidth(1.5) #cartopy's recommended method
a.coastlines()
Expand Down Expand Up @@ -1967,7 +1950,6 @@ def prep_contour_plot(adata, bdata, diffdata, pctdata, **kwargs):

# color normalization for percent difference
if "pct_diff_contour_levels" in kwargs:
#normpct = mpl.colors.Normalize(vmin=np.min(levelspctdiff), vmax=np.max(levelspctdiff))
normpct = mpl.colors.BoundaryNorm(levelspctdiff,256)
else :
normpct = mpl.colors.Normalize(vmin=np.min(levelspctdiff), vmax=np.max(levelspctdiff))
Expand Down Expand Up @@ -2073,7 +2055,6 @@ def plot_zonal_mean_and_save(wks, case_nickname, base_nickname,
diff = azm - bzm

# calculate the percent change
#pct = (np.abs(azm - bzm)/((azm + bzm)/2.0))*100.0
pct = (azm - bzm) / np.abs(bzm) * 100.0
#check if pct has NaN's or Inf values and if so set them to 0 to prevent plotting errors
pct = pct.where(np.isfinite(pct), np.nan)
Expand Down Expand Up @@ -2143,7 +2124,6 @@ def plot_zonal_mean_and_save(wks, case_nickname, base_nickname,
diff = azm - bzm

# calculate the percent change
#pct = (np.abs(azm - bzm)/((azm + bzm)/2.0))*100.0
pct = (azm - bzm) / np.abs(bzm) * 100.0
#check if pct has NaN's or Inf values and if so set them to 0 to prevent plotting errors
pct = pct.where(np.isfinite(pct), np.nan)
Expand Down Expand Up @@ -2295,7 +2275,6 @@ def plot_meridional_mean_and_save(wks, case_nickname, base_nickname,
diff = adata - bdata

# calculate the percent change
#pct = (np.abs(adata - bdata)/((adata + bdata)/2.0))*100.0
pct = (adata - bdata) / np.abs(bdata) * 100.0
#check if pct has NaN's or Inf values and if so set them to 0 to prevent plotting errors
pct = pct.where(np.isfinite(pct), np.nan)
Expand Down Expand Up @@ -2508,7 +2487,6 @@ def square_contour_difference(fld1, fld2, **kwargs):

diff = fld1 - fld2

#pct = (np.abs(fld1 - fld2)/((fld1 + fld2)/2.0))*100.0
pct = (fld1 - fld2) / np.abs(fld2) * 100.0
#check if pct has NaN's or Inf values and if so set them to 0 to prevent plotting errors
pct = pct.where(np.isfinite(pct), np.nan)
Expand Down

0 comments on commit b8c9ff0

Please sign in to comment.