20. Taylor Diagram — METplotpy v3.0.0-beta5 documentation (2024)

20.1. Description

The Taylor diagram was invented byKarl E. Taylor in 1994 and is useful in quantifying the correspondence betweenmodels and a “reference” based on the Pearson correlation coefficient, the root-mean-squareerror (RMSE), and the standard deviation. Taylor diagrams have been widely used for climate and otherEarth science models but can be useful in the evaluation of models from other domains.

For more information on Taylor diagrams, please refer to theMETviewer documentation.

Examples of Taylor diagrams are shown below.

A Taylor diagram of sample Downward Longwave Radiative Flux (DLWR) data displaying only positive correlationvalues:

20. Taylor Diagram — METplotpy v3.0.0-beta5 documentation (1)

A Taylor diagram of sample Downward Longwave Radiative Flux (DLWR) data displaying negative andpositive correlation values:

20. Taylor Diagram — METplotpy v3.0.0-beta5 documentation (2)

20.2. Example

20.2.1. Sample Data

The continuous statistics line type CNT, from the MET tool’s Point-Stat or Grid-Stattools is required for creating a Taylor diagram, where the data is text output in columnar format andthe FSTDEV, OSTDEV, and PR_CORR statistics are available for plotting.

The sample data used to create these plots is available in the METplotpyrepository, where the Taylor diagram scripts are located:

$METPLOTPY_BASE/test/taylor_diagram/dlwr_sample.data

$METPLOTPY_BASE is the directory where the METplotpy code is saved:

e.g.

/usr/path/to/METplotpy if the source code was cloned or forked from the Github repository

or

/usr/path/to/METplotpy-x.y.z if the source code was downloaded as a zip or gzip’d tar file from the Release link ofthe Github repository. The x.y.z is the release number.

20.2.2. Configuration Files

The Taylor diagram utilizes YAML configuration files to indicate whereinput data is located and to set plot attributes. These plot attributescorrespond to values that can be set via the METviewer tool. YAML is arecursive acronym for “YAML Ain’t Markup Language” and according toyaml.org,it is a “human-friendly data serialization language. It is commonly used forconfiguration files and in applications where data is being stored ortransmitted. Two configuration files are required. The first is adefault configuration file, taylor_diagram_defaults.yaml,which is found in the$METPLOTPY_BASE/metplotpy/plots/config directory.$METPLOTPY_BASE indicates the directory where the METplotpysource code has been saved. All defaultconfiguration files are located in the$METPLOTPY_BASE/metplotpy/plots/config directory.Default configuration files are automatically loaded by theplotting code and do not need to be explicitly specified whengenerating a plot.

The second required configuration file is a user-supplied “custom”configuration file. This file is used to customize/override the defaultsettings in the taylor_diagram_defaults.yaml file. The customconfiguration file can be an empty file if all default settings are tobe applied.

20.3. METplus Configuration

20.3.1. Default Configuration File

The following is the mandatory, taylor_diagram_defaults.yamlconfiguration file, which serves as a starting point for creating aTaylor diagram plot, as it represents the default values set in METviewer.

NOTE: This default configuration file is automatically loaded bytaylor_diagram.py.

---# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!# "Default" settings for the Taylor diagram plot# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!# caption settingsplot_caption: "Caption -Taylor Diagram default settings"caption_weight: 4caption_col: "#333333"# relative magnification of caption sizecaption_size: "8"# axis perpendicular location adjustment# (up/down)caption_offset: 0# axis parallel location adjustment (left/right)caption_align: 0# hexadecimal or color namecolors: - "#ff0000" # red - "#ffd400" # goldenrod - "#55ff00" # lime green - "#00ff7f" # green - "#00aaff" # light blue - "#1500ff" # royal blue - "#7f00ff" # purple# Not supported, set as fcst_var under the series_val_1 settingfcst_var_val_1: {}legend_box: 'box'legend_inset: x: 0.1 y: -0.25legend_ncol: 4legend_size: 0.8log_filename: STDOUTlog_level: ERROR# Turn on/off plotting of specific points/seriesplot_disp: - 'True' - 'True' - 'True' - 'True' - 'True' - 'True' - 'True'# output file/plotplot_filename: ./taylor_diagram_default.png# size and resolution of the plot.plot_width: 11plot_height: 9# plot resolution in dpi (dots per inch)plot_res: 72series_order: - 1 - 2 - 3 - 4 - 5 - 6 - 7# Other supported symbols: small circle = ".", ring/hexagon = "H", rhombus/diamond="d"series_symbols: # point - "d" - "." - "." - "." - "." - "." - "."series_val_1: # series_var_1 model: - suite3_MEDIAN # series_var2 vx_mask: - Bondville - Desert_Rock - Fort_Peck - Goodwin_Creek - Penn_State - Sioux_Falls - Table_Mountain fcst_var: - DLWRF# input filestat_input: ../../../test/taylor_diagram/plot_dlwr_sample.data# Draw the standard deviation arcs on the diagramtaylor_show_gamma: 'True'# Show only positive values of correlationtaylor_voc: 'False'title: Downward Longwave Radiative Flux Taylor Diagramtitle_weight: 4title_size: 1.8# legend settingsuser_legend: - "" - "" - "" - "" - "" - "" - ""## UNSUPPORTED or UNUSED settings BUT REQUIRED/USED by METviewer# Do not modify the settings below this section## Unsupported actions by Matplotlib.# Matplotlib align choices are left, right, center (default) and# offset is automatically chosen to avoid labels and ticks on the topmost# x-axis# To work around what METviewer is expecting (a numerical value),# set title_align to -1.5 for 'left', 1.5 for 'right', any other value for 'center'title_align: 0.5title_offset: -2# x-axis ticks#these are unsupportedxtlab_orient: 1xtlab_size: 1xtlab_perp: -0.75xtlab_horiz: 0.5xtlab_freq: 0x2tlab_orient: 1x2tlab_size: 0.8x2tlab_perp: 1x2tlab_horiz: 0.5# y-axis ticks# these are unsupportedytlab_perp: 0.5ytlab_horiz: 0.5y2tlab_orient: 1y2tlab_perp: 0.5y2tlab_horiz: 0.5y2tlab_size: 1# second y-axis ticks# these are unsupported as this diagram doesn't have# a second y-axisy2lab_size: 1y2lab_offset: 1y2lab_align: 0.5# second x-axis settings, not necessary# for this diagram, expected by METviewerx2lab_size: 0.8x2lab_offset: -0.5x2lab_align: 0.5# magnificationcex: 1# margins (Matplotlib doesn't have this level of granularity for margins)mar: - 8 - 4 - 5 - 4# create html relevant only for Plotly interactivity in METviewer, not# applicable for Matplotlib plotting.create_html: 'False'# Event equalization to check for missing data# not applicable for this plot, but METviewer expects this# settingevent_equal: 'False'dump_points_1: 'False'dump_points_2: 'False'# not relevant since there aren't any intermediate files being# createdpoints_path: ''vert_plot: 'False'x_reverse: 'False'num_stats: 'False'indy1_stag: 'False'indy2_stag: 'False'sync_axes: 'False'log_y1: 'False'log_y2: 'False'# used in the calculation of confidence intervals but not used herevariance_inflation_factor: Falseseries_type: - "b" - "b" - "b" - "b" - "b" - "b" - "b"# line width (no lines in Taylor diagram, only points)lwd: - 5 - 5 - 5 - 5 - 5 - 5 - 5# x-axis labelsxaxis: Standard Deviationxlab_size: 1#up-down positioningxlab_align: .5#left-right positioningxlab_offset: 2# text weight: plain text, bold, italic, bold italicxlab_weight: 1# y-axis labelsyaxis_1: Standard Deviationylab_size: 1#left-right positioningylab_align: 0.5#up-down positioningylab_offset: -2# text weight: plain text, bold, italic, bold italicylab_weight: 1# y-axis ticksytlab_orient: 1ytlab_size: 1.3# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!# The underlying Taylor diagram (grid lines, etc.)# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!## These are expected/used by METviewer but cannot# be applied to the underlying Taylor diagram plot. Grid# linestyle and colors cannot be changed.grid_lty: "--"# Hexadecimal value or color namegrid_col: "#cccccc"grid_linewidth: 1grid_x: "listX"# other option is mm (millimeters)plot_units: in# only png plots are generated, this setting is expected by METviewerplot_type: png16mplot_ci:# No confidence intervals plotted in Taylor diagram, so these settings have no effect - None - None - None - None - None - None - Nonecon_series:# Only useful for line plots where consecutive points may be interspersed with NA values# these values have no use for the Taylor diagram. - 1 - 1 - 1 - 1 - 1 - 1 - 1# not relevant for this plot, these values are expected by METviewershow_signif: - 'False' - 'False' - 'False' - 'False' - 'False' - 'False' - 'False'

In the default config file, logging is set to stdout and the log level is ERROR (i.e. only log messagesof type ERROR will be logged). If the log_filename and log_level arenot specified in the custom configuration file, these settings will be used.

20.3.2. Custom Configuration File

A second, mandatory configuration file is required, which isused to customize the settings to the Taylor diagram plot.The taylor_diagram_custom.yaml file is included with thesource code and looks like the following:

---# custom config file to override some of the settings in the# default config file taylor_diagram_defaults.yamlstat_input: !ENV '${TEST_DIR}/plot_dlwr_sample.data'plot_filename: !ENV '${TEST_DIR}/taylor_diagram_custom.png'# change the caption textplot_caption: "Custom caption"# change the titletitle: Custom Taylor Diagram - DLWRtitle_weight: 1title_size: 1.2# change the symbols# Other supported symbols: small circle = ".", ring/hexagon = "H", rhombus/diamond="d"series_symbols: # point - "H" - "." - "." - "d" - "." - "." - "H"# To save your log output to a file, specify a path and filename and uncomment the line below. Make sure you have# permissions to the directory you specify. The default, as specified in the default config file is stdout.#log_filename: ./taylor_diagram.log# To change the log level, specify a log level: debug, info, warning, error and uncomment the line below.# The debug and info log levels will produce more log output.#log_level: WARNING

Copy this custom config file from the directory where the sourcecode was saved to the working directory:

cp $METPLOTPY_BASE/test/taylor_diagram/taylor_diagram_custom.yaml $WORKING_DIR/taylor_diagram_custom.yaml

Modify the stat_input setting in the$METPLOTPY_BASE/test/taylor_diagram/taylor_diagram_custom.yamlfile to explicitly point to the$METPLOTPY_BASE/test/taylor_diagram/taylor_diagramdirectory (where the custom config files and sample data reside).Replace the relative path ./dlwr_sample.datawith the full path$METPLOTPY_BASE/test/taylor_diagram/dlwr_sample.data(including replacing $METPLOTPY_BASE with the full path to the METplotpyinstallation on the system).Modify the plot_filename setting to point to the output path where theplot will be saved, including the name of the plot.

For example:

stat_input: /username/myworkspace/METplotpy/test/taylor_diagram/dlwr_sample.data

plot_filename: /username/working_dir/output_plots/taylor_diagram_custom.png

This is where /username/myworkspace/METplotpy is $METPLOTPY_BASE and/username/working_dir is $WORKING_DIR. Make sure that the$WORKING_DIR directory that is specified exists and has theappropriate read and write permissions. The path listed forplot_filename may be changed to the output directory of one’s choosing.If this is not set, then theplot_filename setting specified in the$METPLOTPY_BASE/metplotpy/plots/config/taylor_diagram_defaults.yamlconfiguration file will be used.

No intermediate files (i.e. .points1 file) are generated by the Taylor diagram.The dump_points_1 setting is expected by METviewer and is set to False in the configuration file.

To save the log output to a file, uncomment the log_filename entry and specify the path andname of the log file. Select a directory with the appropriate read and writeprivileges. To modify the verbosity of logging than what is set in the default configfile, uncomment the log_level entry and specify the log level (debug and info are higher verbosity, warning and errorare lower verbosity).

20.3.3. Using Defaults

To use the default settings defined in thetaylor_diagram_defaults.yamlfile, specify a minimal custom configuration file(minimal_taylor_diagram_defaults.yaml), which consists of onlya comment block, but it can be any empty file (write permissions for theoutput filename path corresponding to the plot_filename setting inthe default configuration file will be needed. Otherwise, specifya plot_filename in the minimal_taylor_diagram.yaml file):

# minimal yaml file, replace the path-to to thestat_input: path-to/plot_dlwr_sample.dataplot_filename: path-to/plot_dlwr_sample.png

Copy this file to the working directory:

cp $METPLOTPY_BASE/test/taylor_diagram/minimal_taylor_diagram.yaml $WORKING_DIR/minimal_taylor_diagram.yaml

If the stat_input and plot_filename settings (output file/plot path) are missing, addthese settings to the $WORKING_DIR/minimal_taylor_diagram.yamlfile (anywhere below the comment block). The stat_input settingexplicitly indicates where the sample data and custom configurationfiles are located. Set the stat_input to$METPLOTPY_BASE/test/taylor_diagram/dlwr_sample.data and set theplot_filename to$WORKING_DIR/output_plots/taylor_diagram_default.png:

stat_input: $METPLOTPY_BASE/test/taylor_diagram/dlwr_sample.data

plot_filename: $WORKING_DIR/output_plots/taylor_diagram_default.png

$WORKING_DIR is the working directory where all ofthe custom configuration files are being saved.NOTE: The plot_filename (output directory) may be specifiedto a directory other than the $WORKING_DIR/output_plots, as long asit is an existing directory where the author has read and write permissions.

20.4. Run from the Command Line

To generate a default Taylor diagram (i.e. using settings in thetaylor_diagram_defaults.yaml configuration file),perform the following:

  • If using the conda environment, verify the conda environmentis running and has has the required Python packages outlined in therequirements section.

  • Set the METPLOTPY_BASE environment variable to point to$METPLOTPY_BASE.

    For the ksh environment:

    export METPLOTPY_BASE=$METPLOTPY_BASE

    For the csh environment:

    setenv METPLOTPY_BASE $METPLOTPY_BASE

    Replacing the $METPLOTPY_BASE with the directory where theMETplotpy source code was saved.

  • Run the following on the command line:

    python $METPLOTPY_BASE/metplotpy/plots/taylor_diagram/taylor_diagram.py $WORKING_DIR/minimal_taylor_diagram.yaml

    This will create a PNG file, taylor_diagram_default.png,in the directory that was specified in the plot_filenamesetting of the minimal_taylor_diagram.yaml config file:

    20. Taylor Diagram — METplotpy v3.0.0-beta5 documentation (3)

    To generate a slightly modified, customized plot, run thecommand (below) using the taylor_diagram_custom.yaml file:

    python $METPLOTPY_BASE/metplotpy/plots/taylor_diagram/taylor_diagram.py $WORKING_DIR/taylor_diagram_custom.yaml
  • A taylor_diagram_custom.png output file will be created inthe directory that was specified in the plot_filename config settingin the taylor_diagram_custom.yaml config file. This customized plot has a differentoutput filename, title text, title size, title font style, caption text, and different symbols than the defaultplot, as shown below:

20. Taylor Diagram — METplotpy v3.0.0-beta5 documentation (4)
20. Taylor Diagram — METplotpy v3.0.0-beta5 documentation (2024)

FAQs

How to interpret Taylor diagram? ›

Interpretation of the Taylor Diagram

If the simulation point is close to the observed point, it means that they are similar in terms of standard deviation, their correlation is high, and their CRMSE is close to zero. There is also a black dashed line that represents the standard deviation of the observed time series.

How to make a Taylor diagram? ›

In a Taylor diagram, various statistical indicators for each model are combined within a single quadrant. The x-axis represents the RMSE (Root Mean Square Error) or normalized RMSE, while the y-axis represents standard deviation values or their normalized counterparts.

What are the components of the Taylor diagram? ›

Taylor diagrams indicating the standard deviation, the correlation coefficient, and the centered root mean square for single runs. Black dots imply single runs; the gray cross represents the mean of all runs.

What is the normalized standard deviation of the Taylor diagram? ›

- Normalized Taylor Diagram: In a normalized Taylor diagram, the radial distance represents the normalized standard deviation (σ*) of the model or dataset. The normalization is achieved by dividing the standard deviation of the model (σM) by the standard deviation of the observed data (σo).

How do you plot a model in Python? ›

  1. import matplotlib. pyplot as.
  2. from tensorflow. keras. utils.
  3. import plot_model.
  4. ____(____, to_file=____)
  5. data = ____
  6. plt. show()

How do you run a model in Python? ›

Syntax: How to Run a Saved Python Model

Use the RUN_MODEL function if the predictor field names are the same in the model and the data. COMPUTE fieldname / fmt = RUN_MODEL(' app / modelname '); Use the RUN_MODEL2 function if the predictor field names are not the same in the model and the data.

How do you run a graph in Python? ›

1. Line Graph
  1. from matplotlib import pyplot as plt.
  2. x = [1,2,3]
  3. y = [10,11,12]
  4. plt.plot(x,y)
  5. plt.title("Line graph")
  6. plt.ylabel('Y axis')
  7. plt.xlabel('X axis')
  8. plt.show()

What is centered root mean square error? ›

Root Mean Square Error (RMSE) is the standard deviation of the residuals (prediction errors). Residuals are a measure of how far from the regression line data points are; RMSE is a measure of how spread out these residuals are. In other words, it tells you how concentrated the data is around the line of best fit.

How do you implement Taylor series in Python? ›

First, we coded each term of the Taylor series individually. Next, we used a for loop to calculate n terms in the Taylor Series expansion. We then refactored the code with the for loop into a function and parameterized our function so that we could calculate e raised to any number calculated out to any number of terms.

How do you make an AXY graph in Python? ›

To create a line graph using Matplotlib, it's as simple as just declaring the x-axis and y-axis values attribute in the exact order within the plt. plot function. Basically the plt. plot function in its default state draws a line from point to point, so it automatically recognises data as a line graph.

How do you make a grid graph in Python? ›

Grid lines

This can be added using the grid function in pyplot . By default the grid lines are applied to both the x- and y-axes, but this can be specified with the axis keyword argument, e.g., axis="x" to just add a grid on the x-axis.

How do you create a class diagram in Python project? ›

In the Project tool window, right-click an item for which you want to create a diagram and select Diagrams | Show Diagram Ctrl Alt Shift 0U ). In the list that opens, select Python Class Diagram. PyCharm generates a UML diagram for classes and their dependencies.

Top Articles
Latest Posts
Article information

Author: Lidia Grady

Last Updated:

Views: 5903

Rating: 4.4 / 5 (45 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Lidia Grady

Birthday: 1992-01-22

Address: Suite 493 356 Dale Fall, New Wanda, RI 52485

Phone: +29914464387516

Job: Customer Engineer

Hobby: Cryptography, Writing, Dowsing, Stand-up comedy, Calligraphy, Web surfing, Ghost hunting

Introduction: My name is Lidia Grady, I am a thankful, fine, glamorous, lucky, lively, pleasant, shiny person who loves writing and wants to share my knowledge and understanding with you.