Skip to content

Commit

Permalink
code cleanup round 3
Browse files Browse the repository at this point in the history
  • Loading branch information
bitterbark committed Apr 4, 2024
1 parent b86bb76 commit ca08a56
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/adf_diag.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
# Check that "scripts" directory actually exists:
if not os.path.isdir(_DIAG_SCRIPTS_PATH):
# If not, then raise error:
err_msg = f"'{_DIAG_SCRIPTS_PATH}' directory not found. Has 'AdfDiag.py' been moved?"
raise FileNotFoundError(err_msg)
error_message = f"'{_DIAG_SCRIPTS_PATH}' directory not found. Has 'AdfDiag.py' been moved?"
raise FileNotFoundError(error_message)

# Walk through all sub-directories in "scripts" directory:
for root, dirs, files in os.walk(_DIAG_SCRIPTS_PATH):
Expand Down Expand Up @@ -1053,9 +1053,9 @@ def derive_variables(self, vars_to_derive=None, ts_dir=None, overwrite=None):
):
constit_files = sorted(glob.glob(os.path.join(ts_dir, "*PREC*")))
else:
err_msg = "PRECC and PRECL were not both present; PRECT cannot be calculated."
err_msg += " Please remove PRECT from diag_var_list or find the relevant CAM files."
raise FileNotFoundError(err_msg)
error_message = "PRECC and PRECL were not both present; PRECT cannot be calculated."
error_message += " Please remove PRECT from diag_var_list or find the relevant CAM files."
raise FileNotFoundError(error_message)
# create new file name for PRECT
prect_file = constit_files[0].replace("PRECC", "PRECT")
if Path(prect_file).is_file():
Expand Down Expand Up @@ -1086,9 +1086,9 @@ def derive_variables(self, vars_to_derive=None, ts_dir=None, overwrite=None):
for elem in input_files:
constit_files += elem
else:
err_msg = "FSNT and FLNT were not both present; RESTOM cannot be calculated."
err_msg += " Please remove RESTOM from diag_var_list or find the relevant CAM files."
raise FileNotFoundError(err_msg)
error_message = "FSNT and FLNT were not both present; RESTOM cannot be calculated."
error_message += " Please remove RESTOM from diag_var_list or find the relevant CAM files."
raise FileNotFoundError(error_message)
# create new file name for RESTOM
derived_file = constit_files[0].replace("FLNT", "RESTOM")
if Path(derived_file).is_file():
Expand Down

0 comments on commit ca08a56

Please sign in to comment.