From 748813173586f22aee61d83983f0feab24ba6687 Mon Sep 17 00:00:00 2001 From: Manuel Schlund <32543114+schlunma@users.noreply.github.com> Date: Tue, 30 Apr 2024 17:43:13 +0200 Subject: [PATCH] Ignored iris warnings about global attributes (#2400) --- esmvalcore/preprocessor/_io.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/esmvalcore/preprocessor/_io.py b/esmvalcore/preprocessor/_io.py index 5894b73ace..900d026943 100644 --- a/esmvalcore/preprocessor/_io.py +++ b/esmvalcore/preprocessor/_io.py @@ -432,7 +432,19 @@ def save(cubes, logger.debug('Changing var_name from %s to %s', cube.var_name, alias) cube.var_name = alias - iris.save(cubes, **kwargs) + + # Ignore some warnings when saving + with catch_warnings(): + filterwarnings( + 'ignore', + message=( + ".* is being added as CF data variable attribute, but .* " + "should only be a CF global attribute" + ), + category=UserWarning, + module='iris', + ) + iris.save(cubes, **kwargs) return filename