Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding mods to derive PRECT #260

Merged
merged 9 commits into from
Nov 3, 2023
2 changes: 1 addition & 1 deletion .github/scripts/pylint_threshold_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def pylint_check(pyfile_list, rcfile, threshold=10.0):

#Run linter:
lint_results = lint.Run([rcstr, '--exit-zero', pyfile],
reporter=pylint_report, do_exit=False)
reporter=pylint_report, exit=False)

#Extract linter score:
lint_score = lint_results.linter.stats.global_note
Expand Down
8 changes: 7 additions & 1 deletion lib/adf_diag.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,10 +946,16 @@ def derive_variables(self,vars_to_derive=None,ts_dir=None):
if var == "PRECT":
# PRECT can be found by simply adding PRECL and PRECC
# grab file names for the PRECL and PRECC files from the case ts directory
if len(glob.glob(os.path.join(ts_dir,"*PRECC*"))) and len(glob.glob(os.path.join(ts_dir,"*PRECL*"))):
# if len(glob.glob(os.path.join(ts_dir,"*PRECC*"))) and len(glob.glob(os.path.join(ts_dir,"*PRECL*"))):
# constit_files=sorted(glob.glob(os.path.join(ts_dir,"*PREC*")))
# else:
# ermsg = "PRECC and PRECL were not both present; PRECT cannot be calculated."
# raise FileNotFoundError(ermsg)
nusbaume marked this conversation as resolved.
Show resolved Hide resolved
if glob.glob(os.path.join(ts_dir,"*PRECC*")) and glob.glob(os.path.join(ts_dir,"*PRECL*")):
constit_files=sorted(glob.glob(os.path.join(ts_dir,"*PREC*")))
else:
ermsg = "PRECC and PRECL were not both present; PRECT cannot be calculated."
ermsg += " Please remove PRECT from diag_var_list or find the relevant CAM files."
raise FileNotFoundError(ermsg)
# create new file name for PRECT
prect_file = constit_files[0].replace('PRECC','PRECT')
Expand Down