Skip to content

Commit

Permalink
Add try/except to saving figure to avoid errors.
Browse files Browse the repository at this point in the history
Remove an import used for debugging.
  • Loading branch information
matthew-gaddes committed Jan 17, 2022
1 parent d8630f2 commit 24a4cf7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 9 additions & 3 deletions icasar/aux.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,16 @@ def xticks_every_3months(ax_to_update, day0_date, time_values, include_tick_labe
if figures == 'window': # possibly save the output
pass
elif figures == "png":
fig1.savefig(f"{png_path}/{title}.png")
plt.close()
try:
fig1.savefig(f"{png_path}/{title}.png")
plt.close()
except:
print(f"Failed to save the figure. Trying to continue. ")
elif figures == 'png+window':
fig1.savefig(f"{png_path}/{title}.png")
try:
fig1.savefig(f"{png_path}/{title}.png")
except:
print(f"Failed to save the figure. Trying to continue. ")
else:
pass

Expand Down
6 changes: 3 additions & 3 deletions icasar/icasar_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ def ICASAR(n_comp, spatial_data = None, temporal_data = None, figures = "window"
plt.switch_backend('Qt5Agg')
import sys
import pdb
print(f"\n\n\nDEBUG IMPORT\n\n\n")
sys.path.append("/home/matthew/university_work/python_stuff/python_scripts")
from small_plot_functions import matrix_show
# print(f"\n\n\nDEBUG IMPORT\n\n\n")
# sys.path.append("/home/matthew/university_work/python_stuff/python_scripts")
# from small_plot_functions import matrix_show



Expand Down

0 comments on commit 24a4cf7

Please sign in to comment.