Sample MET 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 strongly encouraged to submit their own analysis scripts via met_help@ucar.edu to be posted on this page.

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:
    • 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.
    • 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 file were generated by running the same case through MODE applying combinations of 29 different convolution radii and 30 different convolution thresholds.
  • Preprocessing TRMM data:
    • The trmm2nc.R (Updated 12/06/2011) script may be run to reformat select TRMM precipitation analysis products into a gridded NetCDF format that the MET tools can read. Users should first retrieve either 3-hourly or daily TRMM data through the NASA TOVAS interface in ASCII format. See the Observation Data page for additional links. The gridded NetCDF output of this conversion may be used as input to any of the MET statistics tools.