From 2ca4b2924da4143f38918e5e1a169ea9c004e0af Mon Sep 17 00:00:00 2001 From: Ryan Forsyth Date: Tue, 1 Dec 2020 15:56:37 -0800 Subject: [PATCH] Fix yrs_averaged --- acme_diags/driver/utils/general.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/acme_diags/driver/utils/general.py b/acme_diags/driver/utils/general.py index e821a97868ab..3aa95fa10105 100644 --- a/acme_diags/driver/utils/general.py +++ b/acme_diags/driver/utils/general.py @@ -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 @@ -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)