Skip to content

Commit 425e233

Browse files
lukruhdiegokambettina-gierschlunmabouweandela
authored
Added Python portrait plot diagnostic (#3551)
Co-authored-by: Diego Cammarano <diegocamm@gmail.com> Co-authored-by: Bettina Gier <gier@uni-bremen.de> Co-authored-by: Manuel Schlund <32543114+schlunma@users.noreply.github.com> Co-authored-by: Bouwe Andela <b.andela@esciencecenter.nl> Co-authored-by: Manuel Schlund <manuel.schlund@dlr.de>
1 parent 5a3d3e7 commit 425e233

File tree

10 files changed

+1079
-22
lines changed

10 files changed

+1079
-22
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
.. _api.esmvaltool.diag_scripts.portrait_plot:
3+
4+
Portrait Plot
5+
=============
6+
7+
8+
.. automodule:: esmvaltool.diag_scripts.portrait_plot
9+
:no-members:
10+
:no-inherited-members:
11+
:no-show-inheritance:

doc/sphinx/source/api/esmvaltool.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ Diagnostic Scripts
2929
esmvaltool.diag_scripts.ocean
3030
esmvaltool.diag_scripts.psyplot_diag
3131
esmvaltool.diag_scripts.seaborn_diag
32+
esmvaltool.diag_scripts.portrait_plot
Loading

doc/sphinx/source/recipes/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ large variety of input data.
2323

2424
recipe_model_evaluation
2525
recipe_monitor
26+
recipe_portrait
2627
recipe_psyplot
2728
recipe_seaborn
2829

doc/sphinx/source/recipes/recipe_perfmetrics.rst

Lines changed: 72 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,27 @@
33
Performance metrics for essential climate parameters
44
====================================================
55

6+
.. note::
7+
Some of the results of this diagnostics can also be reproduced utilizing
8+
python diagnostics:
9+
Portrait plot: :ref:`recipe_portrait`
10+
Monitoring: :ref:`recipe_monitor`
11+
612
Overview
713
--------
814

9-
The goal is to create a standard recipe for the calculation of performance metrics to quantify the ability of the models to reproduce the climatological mean annual cycle for selected "Essential Climate Variables" (ECVs) plus some additional corresponding diagnostics and plots to better understand and interpret the results.
15+
The goal is to create a standard recipe for the calculation of performance
16+
metrics to quantify the ability of the models to reproduce the climatological
17+
mean annual cycle for selected "Essential Climate Variables" (ECVs) plus some
18+
additional corresponding diagnostics and plots to better understand and
19+
interpret the results.
20+
21+
The recipe can be used to calculate performance metrics at different vertical
22+
levels (e.g., 5, 30, 200, 850 hPa as in
23+
`Gleckler et al. (2008) <http://dx.doi.org/10.1029/2007JD008972>`_) and in
24+
different regions. As an additional reference, we consider
25+
`Righi et al. (2015) <https://doi.org/10.5194/gmd-8-733-2015>`_.
1026

11-
The recipe can be used to calculate performance metrics at different vertical levels (e.g., 5, 30, 200, 850 hPa as in `Gleckler et al. (2008) <http://dx.doi.org/10.1029/2007JD008972>`_ and in different regions. As an additional reference, we consider `Righi et al. (2015) <https://doi.org/10.5194/gmd-8-733-2015>`_.
1227

1328
Available recipes and diagnostics
1429
-----------------------------------
@@ -21,12 +36,19 @@ Recipes are stored in recipes/
2136

2237
Diagnostics are stored in diag_scripts/perfmetrics/
2338

24-
* main.ncl: calculates and (optionally) plots annual/seasonal cycles, zonal means, lat-lon fields and time-lat-lon fields. The calculated fields can also be plotted as difference w.r.t. a given reference dataset. main.ncl also calculates RMSD, bias and taylor metrics. Input data have to be regridded to a common grid in the preprocessor. Each plot type is created by a separated routine, as detailed below.
39+
* main.ncl: calculates and (optionally) plots annual/seasonal cycles, zonal
40+
means, lat-lon fields and time-lat-lon fields. The calculated fields can also
41+
be plotted as difference w.r.t. a given reference dataset. main.ncl also
42+
calculates RMSD, bias and taylor metrics. Input data have to be regridded to
43+
a common grid in the preprocessor. Each plot type is created by a separated
44+
routine, as detailed below.
2545
* cycle.ncl: creates an annual/seasonal cycle plot.
2646
* zonal.ncl: creates a zonal (lat-pressure) plot.
2747
* latlon.ncl: creates a lat-lon plot.
28-
* cycle_latlon.ncl: precalculates the metrics for a time-lat-lon field, with different options for normalization.
29-
* collect.ncl: collects and plots the metrics previously calculated by cycle_latlon.ncl.
48+
* cycle_latlon.ncl: precalculates the metrics for a time-lat-lon field, with
49+
different options for normalization.
50+
* collect.ncl: collects and plots the metrics previously calculated by
51+
cycle_latlon.ncl.
3052

3153
User settings in recipe
3254
-----------------------
@@ -37,9 +59,12 @@ User settings in recipe
3759

3860
*Required settings (scripts)*
3961

40-
* plot_type: cycle (time), zonal (plev, lat), latlon (lat, lon), cycle_latlon (time, lat, lon), cycle_zonal (time, plev, lat)
62+
* plot_type: cycle (time), zonal (plev, lat), latlon (lat, lon), cycle_latlon
63+
(time, lat, lon), cycle_zonal (time, plev, lat)
4164
* time_avg: type of time average (monthlyclim, seasonalclim, annualclim)
42-
* region: selected region (global, trop, nhext, shext, nhtrop, shtrop, nh, sh, nhmidlat, shmidlat, nhpolar, shpolar, eq)
65+
* region: selected region (global, trop, nhext, shext, nhtrop, shtrop, nh,
66+
sh, nhmidlat, shmidlat, nhpolar, shpolar, eq)
67+
4368

4469
*Optional settings (scripts)*
4570

@@ -51,9 +76,12 @@ User settings in recipe
5176
* projection: map projection for plot_type latlon (default: CylindricalEquidistant)
5277
* plot_diff: draws difference plots (default: False)
5378
* calc_grading: calculates grading metrics (default: False)
54-
* stippling: uses stippling to mark statistically significant differences (default: False = mask out non-significant differences in gray)
55-
* show_global_avg: diplays the global avaerage of the input field as string at the top-right of lat-lon plots (default: False)
56-
* annots: choose the annotation style, e.g. ```alias``` which would display the alias of the dataset as title (applies to plot_type zonal and cycle_zonal)
79+
* stippling: uses stippling to mark statistically significant differences
80+
(default: False = mask out non-significant differences in gray)
81+
* show_global_avg: displays the global avaerage of the input field as string
82+
at the top-right of lat-lon plots (default: False)
83+
* annots: choose the annotation style, e.g. ```alias``` which would display
84+
the alias of the dataset as title (applies to plot_type zonal and cycle_zonal)
5785
* metric: chosen grading metric(s) (if calc_grading is True)
5886
* normalization: metric normalization (for RMSD and BIAS metrics only)
5987
* abs_levs: list of contour levels for absolute plot
@@ -114,8 +142,8 @@ User settings in recipe
114142

115143
*Optional settings (scripts)*
116144

117-
* label_lo: adds lower triange for values outside range
118-
* label_hi: adds upper triange for values outside range
145+
* label_lo: adds lower triangle for values outside range
146+
* label_hi: adds upper triangle for values outside range
119147
* cm_interval: min and max color of the color table
120148
* cm_reverse: reverses the color table
121149
* sort: sorts datasets in alphabetic order (excluding MMM)
@@ -157,14 +185,21 @@ Variables
157185
Observations and reformat scripts
158186
---------------------------------
159187

160-
The following list shows the currently used observational data sets for this recipe with their variable names and the reference to their respective reformat scripts in parentheses. Please note that obs4MIPs data can be used directly without any reformating. For non-obs4MIPs data use `esmvaltool data info DATASET` or see headers of cmorization scripts (in `/esmvaltool/cmorizers/data/formatters/datasets/
161-
<https://github.com/ESMValGroup/ESMValTool/blob/main/esmvaltool/cmorizers/data/formatters/datasets/>`_) for downloading and processing instructions.
188+
The following list shows the currently used observational data sets for this
189+
recipe with their variable names and the reference to their respective reformat
190+
scripts in parentheses. Please note that obs4MIPs data can be used directly
191+
without any reformatitng. For non-obs4MIPs data use `esmvaltool data info DATASET`
192+
or see headers of cmorization scripts (in `/esmvaltool/cmorizers/data/formatters/datasets/
193+
<https://github.com/ESMValGroup/ESMValTool/blob/main/esmvaltool/cmorizers/data/formatters/datasets/>`_)
194+
for downloading and processing instructions.
195+
162196
#. recipe_perfmetrics_CMIP5.yml
163197

164198
* AIRS (hus - obs4MIPs)
165199
* CERES-EBAF (rlut, rlutcs, rsut, rsutcs - obs4MIPs)
166200
* ERA-Interim (tas, ta, ua, va, zg, hus - esmvaltool/cmorizers/data/formatters/datasets/era-interim.py)
167-
* ESACCI-AEROSOL (od550aer, od870aer, od550abs, od550lt1aer - esmvaltool/cmorizers/data/formatters/datasets/esacci-aerosol.ncl)
201+
* ESACCI-AEROSOL (od550aer, od870aer, od550abs, od550lt1aer -
202+
esmvaltool/cmorizers/data/formatters/datasets/esacci-aerosol.ncl)
168203
* ESACCI-CLOUD (clt - esmvaltool/cmorizers/data/formatters/datasets/esacci-cloud.ncl)
169204
* ESACCI-OZONE (toz - esmvaltool/cmorizers/data/formatters/datasets/esacci-ozone.ncl)
170205
* ESACCI-SOILMOISTURE (sm - esmvaltool/cmorizers/data/formatters/datasets/esacci_soilmoisture.ncl)
@@ -190,27 +225,38 @@ The following list shows the currently used observational data sets for this rec
190225
References
191226
----------
192227

193-
* Gleckler, P. J., K. E. Taylor, and C. Doutriaux, Performance metrics for climate models, J. Geophys. Res., 113, D06104, doi: 10.1029/2007JD008972 (2008).
228+
* Gleckler, P. J., K. E. Taylor, and C. Doutriaux, Performance metrics for climate models, J.
229+
Geophys. Res., 113, D06104, doi: 10.1029/2007JD008972 (2008).
230+
231+
* Righi, M., Eyring, V., Klinger, C., Frank, F., Gottschaldt, K.-D., Jöckel, P.,
232+
and Cionni, I.: Quantitative evaluation of ozone and selected climate parameters in a set of EMAC simulations,
233+
Geosci. Model Dev., 8, 733, doi: 10.5194/gmd-8-733-2015 (2015).
194234

195-
* Righi, M., Eyring, V., Klinger, C., Frank, F., Gottschaldt, K.-D., Jöckel, P., and Cionni, I.: Quantitative evaluation of oone and selected climate parameters in a set of EMAC simulations, Geosci. Model Dev., 8, 733, doi: 10.5194/gmd-8-733-2015 (2015).
196235

197236
Example plots
198237
-------------
199238

200239
.. figure:: /recipes/figures/perfmetrics/perfmetrics_fig_1.png
201240
:width: 90%
202241

203-
Annual cycle of globally averaged temperature at 850 hPa (time period 1980-2005) for different CMIP5 models (historical simulation) (thin colored lines) in comparison to ERA-Interim (thick yellow line) and NCEP-NCAR-R1 (thick black dashed line) reanalysis data.
242+
Annual cycle of globally averaged temperature at 850 hPa (time period 1980-2005)
243+
for different CMIP5 models (historical simulation) (thin colored lines) in comparison to
244+
ERA-Interim (thick yellow line) and NCEP-NCAR-R1 (thick black dashed line) reanalysis data.
204245

205246
.. figure:: /recipes/figures/perfmetrics/perfmetrics_fig_2.png
206247
:width: 90%
207248

208-
Taylor diagram of globally averaged temperature at 850 hPa (ta) and longwave cloud radiative effect (lwcre) for different CMIP5 models (historical simulation, 1980-2005). Reference data (REF) are ERA-Interim for temperature (1980-2005) and CERES-EBAF (2001-2012) for longwave cloud radiative effect.
249+
Taylor diagram of globally averaged temperature at 850 hPa (ta) and longwave cloud
250+
radiative effect (lwcre) for different CMIP5 models (historical simulation, 1980-2005).
251+
Reference data (REF) are ERA-Interim for temperature (1980-2005) and CERES-EBAF (2001-2012)
252+
for longwave cloud radiative effect.
209253

210254
.. figure:: /recipes/figures/perfmetrics/perfmetrics_fig_3.png
211255
:width: 90%
212256

213-
Difference in annual mean of zonally averaged temperature (time period 1980-2005) between the CMIP5 model MPI-ESM-MR (historical simulation) and ERA-Interim. Stippled areas indicdate differences that are statistically significant at a 95% confidence level.
257+
Difference in annual mean of zonally averaged temperature (time period 1980-2005) between the
258+
CMIP5 model MPI-ESM-MR (historical simulation) and ERA-Interim. Stippled areas indicdate
259+
differences that are statistically significant at a 95% confidence level.
214260

215261
.. figure:: /recipes/figures/perfmetrics/perfmetrics_fig_4.png
216262
:width: 90%
@@ -221,4 +267,9 @@ Example plots
221267
:width: 90%
222268
:align: center
223269

224-
Relative space-time root-mean-square deviation (RMSD) calculated from the climatological seasonal cycle of CMIP5 simulations. A relative performance is displayed, with blue shading indicating better and red shading indicating worse performance than the median of all model results. A diagonal split of a grid square shows the relative error with respect to the reference data set (lower right triangle) and the alternative data set (upper left triangle). White boxes are used when data are not available for a given model and variable.
270+
Relative space-time root-mean-square deviation (RMSD) calculated from the climatological
271+
seasonal cycle of CMIP5 simulations. A relative performance is displayed, with blue shading
272+
indicating better and red shading indicating worse performance than the median of all model results.
273+
A diagonal split of a grid square shows the relative error with respect to the reference data set
274+
(lower right triangle) and the alternative data set (upper left triangle).
275+
White boxes are used when data are not available for a given model and variable.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
.. _recipe_portrait:
2+
3+
Portrait plot
4+
=============
5+
6+
7+
Overview
8+
--------
9+
Portrait plots are a flexible way to visualize performance metrics for multiple
10+
datasets and up to four references. In this recipe ``recipe_portrait_CMIP.yml``
11+
the normalized Root Mean Squared Deviation (RMSD) of global mean seasonal
12+
climatologies is calculated for a selection of CMIP models.
13+
In the example recipe, for each variable up to two observation based datasets
14+
are used as reference.
15+
See :ref:`variables` for complete list of references.
16+
The recipe uses preprocessor functions (distance metrics, global mean,
17+
climate statistics) to calculate a scalar metric for each combination of
18+
dataset, variable and reference, which is plotted by the ``portrait_plot.py``
19+
diagnostic script.
20+
21+
22+
User settings in recipe
23+
-----------------------
24+
25+
By default cells are plotted for combinations of ``short_name``,
26+
``dataset``, ``project`` and ``split``,
27+
where ``split`` is an optional extra_facet for variables.
28+
However, this can be customized using the ``x_by``,
29+
``y_by``, ``group_by`` and ``split_by`` script settings.
30+
For a complete and detailed list of settings, see the
31+
:doc:`diagnostic documentation </api/esmvaltool.diag_scripts.portrait_plot>`.
32+
While this allows very flexible use for any kind of data, there are some
33+
limitations as well: The grouping (subplots) and normalization is always
34+
applied along the x-axis.
35+
With default settings this means normalizing all metrics for each variable
36+
and grouping all datasets by project.
37+
38+
To plot distance metrics like RMSE, pearson R, bias etc. the
39+
:func:`distance_metric <esmvalcore.preprocessor.distance_metric>` preprocessor
40+
or custom diagnostics can be used.
41+
42+
43+
44+
.. _variables:
45+
46+
Variables and Datasets
47+
------------------------
48+
49+
.. note::
50+
51+
The recipe generally works for any variable that is preprocessed correctly.
52+
To use different preprocessors or reference datasets it could be useful
53+
to create different variable groups and link them with the same extra_facet
54+
like ``variable_name``. See recipe for examples. Listed below are the variables
55+
used to produce the example figure.
56+
57+
58+
The following list shows which observational dataset is used as reference for
59+
each variable in this recipe. All variables are atmospheric monthly means.
60+
For 3D variables the selected pressure level is specified in parentheses.
61+
62+
* clt (Ref1: ESACCI-CLOUD, Ref2: PATMOS-x)
63+
* pr (Ref1: GPCP-V2.2)
64+
* rlut, rsut (Ref1: CERES-EBAF)
65+
* tas (Ref1: ERA-Interim, Ref2: NCEP-NCAR-R1)
66+
* ts (Ref1: ESACCI-SST, Ref2: HadISST)
67+
* ua (200 hPa, Ref1: ERA-Interim, Ref2: NCEP-NCAR-R1)
68+
* zg (500 hPa, Ref1: ERA-Interim, Ref2: NCEP-NCAR-R1)
69+
70+
71+
References
72+
----------
73+
74+
* Gleckler, P. J., K. E. Taylor, and C. Doutriaux, Performance metrics for climate models, J.
75+
Geophys. Res., 113, D06104, doi: 10.1029/2007JD008972 (2008).
76+
77+
* Righi, M., Eyring, V., Klinger, C., Frank, F., Gottschaldt, K.-D., Jöckel, P.,
78+
and Cionni, I.: Quantitative evaluation of ozone and selected climate parameters in a set of EMAC simulations,
79+
Geosci. Model Dev., 8, 733, doi: 10.5194/gmd-8-733-2015 (2015).
80+
81+
82+
Example plots
83+
-------------
84+
85+
.. _fig_portrait_plot:
86+
87+
.. figure:: /recipes/figures/portrait/portrait_plot.png
88+
:width: 90%
89+
:align: center
90+
91+
92+
Relative space-time root-mean-square deviation (RMSD) calculated from the climatological
93+
seasonal cycle of CMIP5 and CMIP6 simulations. A relative performance is displayed, with blue shading
94+
indicating better and red shading indicating worse performance than the median of all model results.
95+
A diagonal split of a grid square shows the relative error with respect to the reference data set.

esmvaltool/config-references.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ authors:
2424
institute: DLR, Germany
2525
email: bjoern.broetz@dlr.de
2626
orcid:
27+
cammarano_diego:
28+
name: Cammarano, Diego
29+
institute: DLR, Germany
30+
email: diego.cammarano@dlr.de
31+
github: diegokam
32+
orcid:
2733
debeire_kevin:
2834
name: Debeire, Kevin
2935
institute: DLR, Germany
@@ -241,7 +247,7 @@ authors:
241247
name: Gillett, Nathan
242248
institute: CCCma, ECCC, Canada
243249
orcid: https://orcid.org/0000-0002-2957-0002
244-
github: npgillett
250+
github: npgillett
245251
gonzalez-reviriego_nube:
246252
name: Gonzalez-Reviriego, Nube
247253
institute: BSC, Spain

0 commit comments

Comments
 (0)