Model Evaluation Tools (MET) | Sample Analysis Scripts

This page provides sample scripts that may be run on MET output files to analyze, summarize, and/or plot the data. Feel free to modify these sample scripts to perform the type of analysis you need.

Users are encouraged to submit their own analysis scripts to be posted on this page by creating a new discussion in the Tips and Tricks section of the METplus GitHub Discussion page.

Python Scripts

Support for passing data to the MET tools in memory was added in MET version 8.0 as described in Appendix F of the MET User's Guide. Listed below are examples of using Python to pass data (ASCII, NetCDF, and Binary) to MET's plot_data_plane utility:

 

R Scripts

R is an extremely powerful statistical analysis and graphics package freely available for many platforms.

NOTE: The scripts provided below are meant purely as examples of using R to read and plot output from MET. Users are strongly encouraged to adapt these scripts for their own needs.

  • Point-Stat and Grid-Stat Output:
    • [UPDATED 02/03/2021] The plot_mpr.R script may be run to read matched pair (MPR) output lines from Point-Stat and generate histograms, scatter plots, and q-q plots. You may pass this script one or more ".stat" files, matched pair files (*_mpr.txt), or the output of a Stat-Analysis filter type job.
      This sample PDF contains plots generated by running this script on the output of the Point-Stat test script.
    • [UPDATED 02/03/2021] The plot_cnt.R script may be run to read continuous statistics (CNT) output lines from Point-Stat and Grid-Stat. By default, it will create boxplots and time series plots of RMSE for each case. But a command line argument may be used to specify other CNT statistics to be plotted. You may pass this script one or more ".stat" files, continuous statistics files (*_cnt.txt), or the output of a Stat-Analysis filter type job.
      This sample PDF contains plots generated by running this script.
  • MODE Output:
    • The mode_summary.R script may be run to summarize the object statistics files from one or more MODE runs. The script keeps running sums of the counts and areas for the matched/unmatched forecast/observation objects. For each simple object identified, the script records its maximum interest value. It then dumps out the median value of those maximum interest values found.
      This sample output summarizes a single MODE run. 
    • The mode_quilt_plot.R script may be run to generate a quilt plot summarizing MODE output for several scales. A quilt plot may be generated when a single case is run using a variety of choices of convolution radii and thresholds. A quilt plot is an image where each box represents a summary measure of MODE for a given choice of radius and threshold.
      The quilt plots shown in this sample PDF were generated by running the same case through MODE applying combinations of 29 different convolution radii and 30 different convolution thresholds.

NCL Scripts

The NCAR Command Language (NCL) is commonly used to create plots of NetCDF data. Many users of NCL are migrating towards using Python instead. Here are some examples of NCL scripts that are used to plot MET output:

  • MODE Output:
    • Takes netCDF output from MODE and plots the frequency of objects on a map using the following command, designed for use on climate data: