Skip to content

Commit adf4229

Browse files
committed
Further fix to attribute ordering.
1 parent 5a5a07f commit adf4229

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lib/iris/fileformats/netcdf/saver.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,25 +1688,25 @@ def _set_cf_var_attributes(self, cf_var, element):
16881688
# whereas for data-variables (aka Cubes) it is the other way around.
16891689
# Needed now that this routine is also called from _create_cf_data_variable.
16901690
# TODO: when we can break things, rationalise these to be the same.
1691-
def add_units():
1691+
def add_units_attr():
16921692
if cf_units.as_unit(units_str).is_udunits():
16931693
_setncattr(cf_var, "units", units_str)
16941694

1695-
def add_stdname():
1695+
def add_names_attrs():
16961696
standard_name = element.standard_name
16971697
if standard_name is not None:
16981698
_setncattr(cf_var, "standard_name", standard_name)
16991699

1700+
long_name = element.long_name
1701+
if long_name is not None:
1702+
_setncattr(cf_var, "long_name", long_name)
1703+
17001704
if isinstance(element, Cube):
1701-
add_stdname()
1702-
add_units()
1705+
add_names_attrs()
1706+
add_units_attr()
17031707
else:
1704-
add_units()
1705-
add_stdname()
1706-
1707-
long_name = element.long_name
1708-
if long_name is not None:
1709-
_setncattr(cf_var, "long_name", long_name)
1708+
add_units_attr()
1709+
add_names_attrs()
17101710

17111711
# Add the CF-netCDF calendar attribute.
17121712
if element.units.calendar:

0 commit comments

Comments
 (0)