Skip to content

Commit fcb22ee

Browse files
committed
improve standard name lookup guard
1 parent 82d4e97 commit fcb22ee

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/cchdo/params/core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,13 +268,13 @@ def get_nc_attrs(self, error=False):
268268
if self.whp_unit is not None:
269269
attrs["whp_unit"] = self.whp_unit
270270

271-
if self.cf_name is not None:
272-
standard_name = f"{self.cf.name}"
271+
if (cf_name := self.cf) is not None:
272+
standard_name = f"{cf_name.name}"
273273
if error is True:
274274
standard_name = f"{standard_name} standard_error"
275275

276276
attrs["standard_name"] = standard_name
277-
attrs["units"] = self.cf.canonical_units
277+
attrs["units"] = cf_name.canonical_units
278278

279279
if self.cf_unit is not None:
280280
attrs["units"] = self.cf_unit

0 commit comments

Comments
 (0)