diff --git a/satpy/cf/attrs.py b/satpy/cf/attrs.py index cdec8500d4..adcc2ba60a 100644 --- a/satpy/cf/attrs.py +++ b/satpy/cf/attrs.py @@ -128,8 +128,8 @@ def _encode_to_cf(obj): return _encode_python_objects(obj) -def _encode_nc_attrs(attrs): - """Encode dataset attributes in a netcdf compatible datatype. +def encode_attrs_to_cf(attrs): + """Encode dataset attributes as a netcdf compatible datatype. Args: attrs (dict): @@ -161,7 +161,7 @@ def preprocess_attrs( if flatten_attrs: data_arr.attrs = flatten_dict(data_arr.attrs) - data_arr.attrs = _encode_nc_attrs(data_arr.attrs) + data_arr.attrs = encode_attrs_to_cf(data_arr.attrs) return data_arr @@ -224,7 +224,7 @@ def preprocess_header_attrs(header_attrs, flatten_attrs=False): if header_attrs is not None: if flatten_attrs: header_attrs = flatten_dict(header_attrs) - header_attrs = _encode_nc_attrs(header_attrs) # OrderedDict + header_attrs = encode_attrs_to_cf(header_attrs) # OrderedDict else: header_attrs = {} header_attrs = _add_history(header_attrs) diff --git a/satpy/tests/cf_tests/test_attrs.py b/satpy/tests/cf_tests/test_attrs.py index 082dea602c..4772d5e428 100644 --- a/satpy/tests/cf_tests/test_attrs.py +++ b/satpy/tests/cf_tests/test_attrs.py @@ -24,14 +24,14 @@ class TestCFAttributeEncoding: def test__encode_nc_attrs(self): """Test attributes encoding.""" - from satpy.cf.attrs import _encode_nc_attrs + from satpy.cf.attrs import encode_attrs_to_cf from satpy.tests.cf_tests._test_data import get_test_attrs from satpy.tests.utils import assert_dict_array_equality attrs, expected, _ = get_test_attrs() # Test encoding - encoded = _encode_nc_attrs(attrs) + encoded = encode_attrs_to_cf(attrs) assert_dict_array_equality(expected, encoded) # Test decoding of json-encoded attributes