From 242d4e9423eacc952cfd7c5571ac1908c4dfad4f Mon Sep 17 00:00:00 2001 From: justin-richling Date: Tue, 9 Jul 2024 10:53:07 -0600 Subject: [PATCH] Clean up search for h0 strings --- scripts/plotting/tape_recorder.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/plotting/tape_recorder.py b/scripts/plotting/tape_recorder.py index 11d65ccca..13f899e6b 100644 --- a/scripts/plotting/tape_recorder.py +++ b/scripts/plotting/tape_recorder.py @@ -46,16 +46,15 @@ def tape_recorder(adfobj): cam_hist_strs = adfobj.hist_string["test_hist_str"] # Filter the list to include only strings that are exactly in the possible h0 strings - # - Search for either h0 of h0a - substrings = ["cam.h0","cam.h0a"] + # - Search for either h0 or h0a + substrings = {"cam.h0","cam.h0a"} case_hist_strs = [] - for i,cam_case_str in enumerate(cam_hist_strs): - cam_hist_str = [] + for cam_case_str in cam_hist_strs: # Check each possible h0 string for string in cam_case_str: if string in substrings: - cam_hist_str.append(string) - case_hist_strs.append(cam_hist_str[0]) + case_hist_strs.append(string) + break #Grab test case climo years start_years = adfobj.climo_yrs["syears"]