From 3876ceeb7ddb04df6d1984e1e1fef7bd94443eb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brei=20Soli=C3=B1o?= Date: Fri, 16 Jun 2023 13:24:50 +0200 Subject: [PATCH] Add variable long names to provenance record in monitoring diagnostics (#3222) --- doc/sphinx/source/community/diagnostic.rst | 1 + esmvaltool/diag_scripts/monitor/monitor_base.py | 1 + esmvaltool/diag_scripts/monitor/multi_datasets.py | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/doc/sphinx/source/community/diagnostic.rst b/doc/sphinx/source/community/diagnostic.rst index 94e8ae03be..641a2da892 100644 --- a/doc/sphinx/source/community/diagnostic.rst +++ b/doc/sphinx/source/community/diagnostic.rst @@ -226,6 +226,7 @@ It is also possible to add more information for the implemented diagnostics usin - :code:`domains` a list of spatial coverage of the dataset - :code:`plot_types` a list of plot types if the diagnostic created a plot, e.g. error bar - :code:`statistics` a list of types of the statistic, e.g. anomaly +- :code:`long_names` a list of long names of used variables, e.g. Air Temperature Arbitrarily named other items are also supported. diff --git a/esmvaltool/diag_scripts/monitor/monitor_base.py b/esmvaltool/diag_scripts/monitor/monitor_base.py index 265443d022..135027f374 100644 --- a/esmvaltool/diag_scripts/monitor/monitor_base.py +++ b/esmvaltool/diag_scripts/monitor/monitor_base.py @@ -222,6 +222,7 @@ def record_plot_provenance(self, filename, var_info, plot_type, **kwargs): prov = self.get_provenance_record( ancestor_files=[var_info['filename']], plot_type=plot_type, + long_names=[var_info[names.LONG_NAME]], **kwargs, ) provenance_logger.log(filename, prov) diff --git a/esmvaltool/diag_scripts/monitor/multi_datasets.py b/esmvaltool/diag_scripts/monitor/multi_datasets.py index c57d09b9e6..6ac399652b 100644 --- a/esmvaltool/diag_scripts/monitor/multi_datasets.py +++ b/esmvaltool/diag_scripts/monitor/multi_datasets.py @@ -1261,6 +1261,7 @@ def create_timeseries_plot(self, datasets, short_name): 'authors': ['schlund_manuel'], 'caption': caption, 'plot_types': ['line'], + 'long_names': [var_attrs['long_name']], } with ProvenanceLogger(self.cfg) as provenance_logger: provenance_logger.log(plot_path, provenance_record) @@ -1332,6 +1333,7 @@ def create_annual_cycle_plot(self, datasets, short_name): 'authors': ['schlund_manuel'], 'caption': caption, 'plot_types': ['seas'], + 'long_names': [var_attrs['long_name']], } with ProvenanceLogger(self.cfg) as provenance_logger: provenance_logger.log(plot_path, provenance_record) @@ -1406,6 +1408,7 @@ def create_map_plot(self, datasets, short_name): 'authors': ['schlund_manuel'], 'caption': caption, 'plot_types': ['map'], + 'long_names': [dataset['long_name']], } with ProvenanceLogger(self.cfg) as provenance_logger: provenance_logger.log(plot_path, provenance_record) @@ -1483,6 +1486,7 @@ def create_zonal_mean_profile_plot(self, datasets, short_name): 'authors': ['schlund_manuel'], 'caption': caption, 'plot_types': ['vert'], + 'long_names': [dataset['long_name']], } with ProvenanceLogger(self.cfg) as provenance_logger: provenance_logger.log(plot_path, provenance_record) @@ -1585,6 +1589,7 @@ def create_1d_profile_plot(self, datasets, short_name): 'authors': ['schlund_manuel', 'winterstein_franziska'], 'caption': caption, 'plot_types': ['line'], + 'long_names': [var_attrs['long_name']], } with ProvenanceLogger(self.cfg) as provenance_logger: provenance_logger.log(plot_path, provenance_record)