You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Something like the following, replacing Exception with CDMSError, and printing var rather than v.
exceptions = []
for var in vars:
print(var)
try:
v = ts.globalAnnual(var)
exp["annual"][var] = v
if "year" not in exp["annual"]:
time = v.getTime()
exp["annual"]["year"] = [x.year for x in time.asComponentTime()]
except Exception:
exceptions.append(v)
if exceptions:
raise Exception(exceptions)
Currently, errors in
ts.globalAnnual(var)
(https://github.com/E3SM-Project/zppy/blob/main/zppy/templates/coupled_global.py#L192) will raiseCDMSError("No such variable, " + id) cdms2.error.CDMSError: No such variable
. If the variable is added to theglb
ts
task, the error goes away, but may be replaced by the same error with a new variable.By catching the exceptions in the loop and creating a list of exceptions, we could catch all of these at once.
The text was updated successfully, but these errors were encountered: