From 48c63358e572d003bed2a02fe4ac32356c8eb58f Mon Sep 17 00:00:00 2001 From: BrettHoover-NOAA Date: Mon, 2 Dec 2024 12:13:32 -0500 Subject: [PATCH 1/2] modified scripts/plot_proftrace.py to close figures after saving to file --- scripts/plot_proftrace.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/plot_proftrace.py b/scripts/plot_proftrace.py index a601500..cc981e0 100644 --- a/scripts/plot_proftrace.py +++ b/scripts/plot_proftrace.py @@ -1074,12 +1074,14 @@ def plot_cpen_traces(penList, countList, nameList, dateList, plt.ioff() fig_prof.savefig(errProName, bbox_inches='tight', facecolor='w') + plt.close() if penProName is not None: fig_prof = plot_cpen_profiles(cpen_profs, nobs_profs, name_list, levl_profs) plt.ioff() fig_prof.savefig(penProName, bbox_inches='tight', facecolor='w') + plt.close() # # Generate trace plots # @@ -1090,6 +1092,7 @@ def plot_cpen_traces(penList, countList, nameList, dateList, plt.ioff() fig_trace.savefig(errTraName, bbox_inches='tight', facecolor='w') + plt.close() if penTraName is not None: fig_trace = plot_cpen_traces(cpen_trace, nobs_trace, name_list, date_trace, @@ -1097,6 +1100,7 @@ def plot_cpen_traces(penList, countList, nameList, dateList, plt.ioff() fig_trace.savefig(penTraName, bbox_inches='tight', facecolor='w') + plt.close() ############################################################## else: print('No Figure Cards Found, Exiting...') From 1fdfefe375b35182f0f35cad08455a1471b012c7 Mon Sep 17 00:00:00 2001 From: BrettHoover-NOAA Date: Mon, 2 Dec 2024 16:56:01 -0500 Subject: [PATCH 2/2] Modified scripts/plot_proftrace.py to use isinstance() format for testing input types --- scripts/plot_proftrace.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/plot_proftrace.py b/scripts/plot_proftrace.py index cc981e0..89a63e8 100644 --- a/scripts/plot_proftrace.py +++ b/scripts/plot_proftrace.py @@ -297,13 +297,13 @@ def collect_statistics(setdict): # entries in a list # if they are not a list, assert them as a list it = sd['it'] - it = [it] if type(it) != list else it + it = [it] if not isinstance(it, list) else it use = sd['use'] - use = [use] if type(use) != list else use + use = [use] if not isinstance(use, list) else use typ = sd['typ'] - typ = [typ] if type(typ) != list else typ + typ = [typ] if not isinstance(typ, list) else typ styp = sd['styp'] - styp = [styp] if type(styp) != list else styp + styp = [styp] if not isinstance(styp, list) else styp # extract variable from gdas stat = gdas.extract(var) # t, uv, q, etc. # date it obs use