From 4baeb37f155ce097faef267b4573a61a141ff26e Mon Sep 17 00:00:00 2001 From: EddyCMWF Date: Fri, 21 Jun 2024 08:33:10 +0100 Subject: [PATCH] optional level encoding --- cfgrib/dataset.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cfgrib/dataset.py b/cfgrib/dataset.py index f4054d1c..d87f1b53 100644 --- a/cfgrib/dataset.py +++ b/cfgrib/dataset.py @@ -463,7 +463,8 @@ 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) - coords_map.extend(VERTICAL_KEYS) + if "level" in encode_cf: + coords_map.extend(VERTICAL_KEYS) coords_map.extend(SPECTRA_KEYS) return coords_map