METplus Practical Session Guide (Version 5.0) | Session 6: Track and Intensity > METplus Use Case: Track and Intensity Plotting

METplus Use Case: Track and Intensity TCMPR (Tropical Cyclone Matched Pair) Plotter

This is a wrapper to the MET plot_tcmpr.R, based on R-project Statistical package Rscript.  This Rscript will be deprecated in a future METplus release.

 

Review: Take a look at the following settings.

 

The default image resolution for the plot_tcmpr.R Rscript is set to 300, for print quality, but quite large for display purposes. The following is an R config file that is passed to the Rscript and changes the default and reduces the image size. It is a simple one line file, but go and take a look.

less ${METPLUS_BUILD_BASE}/parm/use_cases/met_tool_wrapper/TCMPRPlotter/TCMPRPlotter.conf

The plot_tcmpr.R script knows to read this TCMPRPlotterConfig_Customize R config file since it is defined in the TCMPRPlotter.conf file.

TCMPR_PLOTTER_CONFIG_FILE = {PARM_BASE}/use_cases/met_tool_wrapper/TCMPRPlotter/TCMPRPlotterConfig_Customize

Note: If you modify the TCMPR_PLOTTER_CONFIG_FILE variable and leave it undefined (not set), then no configuration file will be read by the R script and the default setting of img_res=300 will be used.

 

TCMPR_PLOT_OUT_DIR - directory where the final plots will be stored. 
TCMPR_DATA - the path to the input data, in this example, we are using the data in the TC_PAIRS_DIR directory. 
MODEL_DATA_DIR - path to the METplus input data. 
TRACK_DATA_DIR - path to the METplus input data.

Optional, Refer to the TC-Stat tool example section of the MET Users Guide for a description of plot_tcmpr.R 
If you wish, refer to the Format Information for TCMPR output line type table, for a tabular description of the TC-Pairs output TCST format. After running this Track and Intensity example, you can view the TC-Pairs TCST output files generate by this example under your ${METPLUS_TUTORIAL_DIR}/output/track_and_intensity/tc_pairs directory while comparing to the information in the table.

The tcmpr defaults are used for any conf settings left as, unset, For example as: XLAB = 
The current settings in the conf files are ok and no changes are required.
 However, after running the exercise feel free to experiment with these settings.

The R script that Track and Intensity runs is located in the MET installation; share/met/Rscripts/plot_tcmpr.R. The usage statement with a short description of the options for plot_tcmpr.R can be obtained by typing:

Rscript plot_tcmpr.R

with no additional arguments. The usage statement can be helpful when setting some of the option in METplus, below is a description of these settings. 

  • CONFIG_FILE is a plotting configuration file 
  • PREFIX is the output file name prefix. 
  • TITLE overrides the default plot title. Bug:  CAN_NOT_HAVE_SPACES 
  • SUBTITLE overrides the default plot subtitle. 
  • XLAB overrides the default plot x-axis label. 
  • YLAB overrides the default plot y-axis label. 
  • XLIM is the min,max bounds for plotting the X-axis. 
  • YLIM is the min,max bounds for plotting the Y-axis. 
  • FILTER is a list of filtering options for the tc_stat tool. 
  • FILTERED_TCST_DATA_FILE is a tcst data file to be used instead of running the tc_stat tool. 
  • DEP_VARS is a comma-separated list of dependent variable columns to plot. 
  • SCATTER_X is a comma-separated list of x-axis variable columns to plot. 
  • SCATTER_Y is a comma-separated list of y-axis variable columns to plot. 
  • SKILL_REF is the identifier for the skill score reference. 
  • LEGEND is a comma-separted list of strings to be used in the legend. 
  • LEAD is a comma-separted list of lead times (h) to be plotted. 
  • RP_DIFF is a comma-separated list of thresholds to specify meaningful differences for the relative performance plot. 
  • DEMO_YR is the demo year 
  • HFIP_BASELINE is a string indicating whether to add the HFIP baseline and which version (no, 0, 5, 10 year goal) 
  • FOOTNOTE_FLAG to disable footnote (date). 
  • PLOT_CONFIG_OPTS to read model-specific plotting options from a configuration file. 
  • SAVE_DATA to save the filtered track data to a file instead of deleting it. 
  • PLOT_TYPES is a comma-separated list of plot types to create: 
    • BOXPLOT, POINT, MEAN, MEDIAN, RELPERF, RANK, SKILL_MN, SKILL_MD 
    • for this example, set to MEAN,MEDIAN to generate MEAN and MEDIAN plots.
  • SERIES is the column whose unique values define the series on the plot,  optionally followed by a comma-separated list of values, including: 
    ALL, OTHER, and colon-separated groups.
  • SERIES_CI is a list of true/false for confidence intervals.  Optionally followed by a comma-separated list of values, including: 
    ALL, OTHER, and colon-separated groups.

Run METplus: Run Track and Intensity use case.

Examples: Run the track and intensity plotting script
Generates plots using the MET plot_tcmpr.R Rscript.

Example 1: 
In this case, the TCMPRPlotter.conf file is configured to generate MEAN and MEDIAN plot types with TCMPR_PLOTTER_PLOT_TYPES.
Run the following command:

run_metplus.py \
${METPLUS_BUILD_BASE}/parm/use_cases/met_tool_wrapper/TCMPRPlotter/TCMPRPlotter.conf \
${METPLUS_TUTORIAL_DIR}/tutorial.conf \
config.OUTPUT_BASE=${METPLUS_TUTORIAL_DIR}/output/track_and_intensity

The following directory lists the files generated from running these use cases:

ls ${METPLUS_TUTORIAL_DIR}/output/track_and_intensity/tcmpr_plots
AMAX_WIND-BMAX_WIND_boxplot.log
AMAX_WIND-BMAX_WIND_boxplot.png
AMAX_WIND-BMAX_WIND_mean.png
AMAX_WIND-BMAX_WIND_median.png
AMSLP-BMSLP_mean.png
AMSLP-BMSLP_median.png
TK_ERR_mean.png
TK_ERR_median.png

Example 2: 
Copy the TCMPRPlotter.conf file to the user_config directory:

cp ${METPLUS_BUILD_BASE}/parm/use_cases/met_tool_wrapper/TCMPRPlotter/TCMPRPlotter.conf \
${METPLUS_TUTORIAL_DIR}/user_config/TCMPRPlotter_boxplot.conf

Open the new conf file with an editor and change the list of plot types to only include BOXPLOT.

vi ${METPLUS_TUTORIAL_DIR}/user_config/TCMPRPlotter_boxplot.conf

Change this line (around line 65):

TCMPR_PLOTTER_PLOT_TYPES = MEAN, MEDIAN

to

TCMPR_PLOTTER_PLOT_TYPES = BOXPLOT

Close the file and rerun METplus:

run_metplus.py \
${METPLUS_TUTORIAL_DIR}/user_config/TCMPRPlotter_boxplot.conf \
${METPLUS_TUTORIAL_DIR}/tutorial.conf \
config.OUTPUT_BASE=${METPLUS_TUTORIAL_DIR}/output/track_and_intensity_boxplot

The following directory lists the additional files generated from running this use case:

ls ${METPLUS_TUTORIAL_DIR}/output/track_and_intensity_boxplot/tcmpr_plots
AMAX_WIND-BMAX_WIND_boxplot.log
AMAX_WIND-BMAX_WIND_boxplot.png
AMSLP-BMSLP_boxplot.log
AMSLP-BMSLP_boxplot.png
TK_ERR_boxplot.log
TK_ERR_boxplot.png

To view the png images generated by running these examples, use the display command. 
cd to your OUTPUT_BASE/tcmpr_plots directory.

cd ${METPLUS_TUTORIAL_DIR}/output/track_and_intensity_boxplot/tcmpr_plots
display AMAX_WIND-BMAX_WIND_mean.png &
display AMAX_WIND-BMAX_WIND_median.png &
display AMAX_WIND-BMAX_WIND_boxplot.png> &