From 332a0acd2af75b253533f4da15dd5ad9b7e64c4d Mon Sep 17 00:00:00 2001 From: Cameron Scott Bodine Date: Mon, 2 Jan 2023 09:26:57 -0700 Subject: [PATCH] Issue deleting variables that don't exist (#43) --- src/class_sonObj.py | 3 ++- src/main_readFiles.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/class_sonObj.py b/src/class_sonObj.py index 368089b..cd90b60 100644 --- a/src/class_sonObj.py +++ b/src/class_sonObj.py @@ -1304,6 +1304,7 @@ def _fixNoDat(self, dfA, beams): df.iloc[-1, df.columns.get_loc('f')] = np.nan # df.iloc[-1, df.columns.get_loc('ping_cnt')] = np.nan df.iloc[-1, df.columns.get_loc('beam')] = beam + del beam # reset b for k, v in b.items(): @@ -1315,7 +1316,7 @@ def _fixNoDat(self, dfA, beams): b[cRow['beam'].values[0]] = c c+=1 - del beam, beams, noDat, dfA, cRow, bCnt, c, b + del beams, noDat, dfA, cRow, bCnt, c, b return df diff --git a/src/main_readFiles.py b/src/main_readFiles.py index 6d773f0..c4d6cea 100644 --- a/src/main_readFiles.py +++ b/src/main_readFiles.py @@ -661,7 +661,9 @@ def read_master_func(humFile='', print("{:<15s} | {:<15s}".format(key.split(".")[0], key.split(".")[1])) print("\n*******************************\n****WARNING: INVALID VALUES****\n*******************************") print("\nPING-Mapper detected issues with\nthe values stored in the above\nsonar channels and attributes.") - del invalid, beam, beams + del invalid, beam + if fixNoDat: + del beams print("\nDone!")