Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add temp try/except for plotting errors #280

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/plotting_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,11 @@ def plot_map_and_save(wks, case_nickname, base_nickname,
img.append(ax[i].contourf(lons,lats,a,colors="w",transform=ccrs.PlateCarree()))
ax[i].text(0.4, 0.4, empty_message, transform=ax[i].transAxes, bbox=props)
else:
img.append(ax[i].contourf(lons, lats, a, levels=levels, cmap=cmap, norm=norm, transform=ccrs.PlateCarree(), **cp_info['contourf_opt']))
try:
img.append(ax[i].contourf(lons, lats, a, levels=levels, cmap=cmap, norm=norm, transform=ccrs.PlateCarree(), **cp_info['contourf_opt']))
except:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would only except for TypeError, as that is the specific type of error that is being raised. Otherwise if a different kind of error shows up we might not see it and thus miss a potential bug-fix.

Suggested change
except:
except TypeError:

print("Something went wrong with plotting, this plot will be skipped.")
return
#End if
ax[i].set_title("AVG: {0:.3f}".format(area_avg[i]), loc='right', fontsize=11)

Expand Down