Skip to content

Commit eae2148

Browse files
committed
Changed exp key in metadata.yml for concatenated experiments
1 parent 9760b59 commit eae2148

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

esmvaltool/_data_finder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def get_output_file(variable, preproc_dir):
269269
cfg = get_project_config(variable['project'])
270270

271271
# Join different experiment names
272-
if isinstance(variable['exp'], (list, tuple)):
272+
if isinstance(variable.get('exp'), (list, tuple)):
273273
variable = dict(variable)
274274
variable['exp'] = '-'.join(variable['exp'])
275275

esmvaltool/preprocessor/_io.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ def write_metadata(products, write_ncl=False):
216216
)
217217
metadata = OrderedDict()
218218
for product in sorted_products:
219+
if isinstance(product.attributes.get('exp'), (list, tuple)):
220+
product.attributes = dict(product.attributes)
221+
product.attributes['exp'] = '-'.join(product.attributes['exp'])
219222
metadata[product.filename] = product.attributes
220223

221224
output_filename = os.path.join(output_dir, 'metadata.yml')

0 commit comments

Comments
 (0)