Skip to content

Commit

Permalink
Merge pull request #361 from forsyth2/fix_yrs_averaged
Browse files Browse the repository at this point in the history
Fix yrs_averaged
  • Loading branch information
forsyth2 authored Dec 1, 2020
2 parents 2e9600c + 2ca4b29 commit 66951bb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion acme_diags/driver/utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ def get_name_and_yrs(parameters, dataset, season=''):

name = get_name(parameters, dataset)
yrs_averaged = get_yrs(dataset, season)
name_yrs = '{} ({})'.format(name, yrs_averaged)
if yrs_averaged:
name_yrs = '{} ({})'.format(name, yrs_averaged)
else:
name_yrs = name

return name_yrs

Expand All @@ -86,6 +89,7 @@ def get_yrs(dataset, season=''):
yrs_averaged = dataset.get_attr_from_climo('yrs_averaged', season)
except:
print("No 'yrs_averaged' exists in the global attributes.")
yrs_averaged = ''
else:
start_yr, end_yr = dataset.get_start_and_end_years()
yrs_averaged = '{}-{}'.format(start_yr, end_yr)
Expand Down

0 comments on commit 66951bb

Please sign in to comment.