diff --git a/cfgrib/dataset.py b/cfgrib/dataset.py index d87f1b53..f4054d1c 100644 --- a/cfgrib/dataset.py +++ b/cfgrib/dataset.py @@ -463,8 +463,7 @@ def encode_cf_first(data_var_attrs, encode_cf=("parameter", "time"), time_dims=( raise ValueError("time_dims %r not a subset of %r" % (time_dims, ALL_REF_TIME_KEYS)) else: coords_map.extend(DATA_TIME_KEYS) - if "level" in encode_cf: - coords_map.extend(VERTICAL_KEYS) + coords_map.extend(VERTICAL_KEYS) coords_map.extend(SPECTRA_KEYS) return coords_map diff --git a/tests/test_30_dataset.py b/tests/test_30_dataset.py index 83f0392f..08329b5a 100644 --- a/tests/test_30_dataset.py +++ b/tests/test_30_dataset.py @@ -135,7 +135,7 @@ def test_build_dataset_components_ignore_keys() -> None: stream = messages.FileStream(TEST_DATA_UKMO, "warn") index = dataset.open_fileindex(stream, messages.DEFAULT_INDEXPATH, dataset.INDEX_KEYS) assert "subCentre" in index.index_keys - index = dataset.open_fileindex(stream, messages.DEFAULT_INDEXPATH, index_keys, ignore_keys=["subCentre"]) + index = dataset.open_fileindex(stream, messages.DEFAULT_INDEXPATH, dataset.INDEX_KEYS, ignore_keys=["subCentre"]) assert "subCentre" not in index.index_keys def test_Dataset() -> None: