Skip to content

Commit 1bcfb19

Browse files
committed
Further fix to attribute ordering.
1 parent d853a80 commit 1bcfb19

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
@@ -1687,25 +1687,25 @@ def _set_cf_var_attributes(self, cf_var, element):
16871687
# whereas for data-variables (aka Cubes) it is the other way around.
16881688
# Needed now that this routine is also called from _create_cf_data_variable.
16891689
# TODO: when we can break things, rationalise these to be the same.
1690-
def add_units():
1690+
def add_units_attr():
16911691
if cf_units.as_unit(units_str).is_udunits():
16921692
_setncattr(cf_var, "units", units_str)
16931693

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

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

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

0 commit comments

Comments
 (0)