Skip to content

Commit

Permalink
GitHub Issue #322. Merge branch 'feature_322_tcmpr_plotter' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
bikegeek committed Nov 18, 2019
2 parents e32b831 + 9e3ee3f commit 2fdc282
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 105 deletions.
Original file line number Diff line number Diff line change
@@ -1,46 +1,69 @@
To run the track and intensity example (the default/easiest example), run the following configuration files in the following order:

-c <path/to/METplus>/parm/use_cases/track_and_intensity/track_and_intensity.conf
-c <path/to>/my_custom.conf
*-c <path/to/METplus>/parm/use_cases/track_and_intensity/track_and_intensity.conf*

*-c <path/to>/my_custom.conf*

This will run the TcPairs wrapper on ADeck and BDeck files from which a default plot of track errors will be generated (.png file). The TCMPRPlotter wrapper invokes the MET tcmpr_plotter.R script to generate these plots.

The my_custom.conf is your custom config file where you define
the following under the [dir] header/family:

PROJ_DIR =
INPUT_BASE =
OUTPUT_BASE =
MET_INSTALL_DIR =
PROJ_DIR =

INPUT_BASE =

OUTPUT_BASE =

MET_INSTALL_DIR =

TMP_DIR =

Description of settings:
=======================

PROJ_DIR - the base directory of where output and intermediate files will be saved.

INPUT_BASE - the directory where the ADECK and BDECK input data resides.

OUTPUT_BASE - the location of the final output files.
MET_INSTALL_DIR - the directory where the version of MET you are using is located (i.e. /usr/local/met-8.1).

MET_INSTALL_DIR - the directory where the version of MET you are using is located (i.e. /usr/local/met-X-Y-Z).

TMP_DIR - the directory where temporary files are to be stored.


To generate the mean and median plots made from the MET tcmpr_plotter.R script, run the following configuration files in the following order:
-c <path/to/METplus>/parm/use_cases/track_and_intensity.conf
-c <path/to/METplus>/parm/use_cases/examples/tcmpr_mean_median.conf
-c <path/to>/my_custom.conf

*-c <path/to/METplus>/parm/use_cases/track_and_intensity.conf*

*-c <path/to/METplus>/parm/use_cases/examples/tcmpr_mean_median.conf*

*-c <path/to>/my_custom.conf*

where the my_custom.conf custom config file has the following values defined (under the [dir] header/family):
PROJ_DIR =
INPUT_BASE =
OUTPUT_BASE =
MET_INSTALL_DIR =

PROJ_DIR =

INPUT_BASE =

OUTPUT_BASE =

MET_INSTALL_DIR =

TMP_DIR =

Six .png files are created in the {OUTPUT_BASE}/tcmpr_plots directory:

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

which were generated based on the settings defined in the tcmpr_mean_median.conf file.
61 changes: 31 additions & 30 deletions parm/use_cases/track_and_intensity/examples/tcmpr_mean_median.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,42 @@ PROCESS_LIST = TcPairs, TCMPRPlotter

# Plot_TCMPR options, if left unset, default values that are
# pre-defined in the R utility (packaged with MET) will be used.
CONFIG_FILE = {METPLUS_BASE}/parm/use_cases/track_and_intensity/tcmpr_customize.conf
PREFIX =
TITLE =
SUBTITLE = Your subtitle goes here
XLAB =
YLAB = Your y-label goes here
XLIM =
YLIM =
FILTER =
FILTERED_TCST_DATA_FILE =
TCMPR_PLOTTER_CONFIG_FILE = {METPLUS_BASE}/parm/use_cases/track_and_intensity/tcmpr_customize.conf
TCMPR_PLOTTER_PREFIX =
TCMPR_PLOTTER_TITLE =
TCMPR_PLOTTER_SUBTITLE = Your subtitle goes here
TCMPR_PLOTTER_XLAB =
TCMPR_PLOTTER_YLAB = Your y-label goes here
TCMPR_PLOTTER_XLIM =
TCMPR_PLOTTER_YLIM =
TCMPR_PLOTTER_FILTER =
# the tcst data file to be used instead of running the MET tc_stat tool.
TCMPR_PLOTTER_FILTERED_TCST_DATA_FILE =

# Comma-separated, no whitespace.
# Intensities for minimum SLP and max wind and track error
DEP_VARS = AMSLP-BMSLP,AMAX_WIND-BMAX_WIND,TK_ERR
SCATTER_X =
SCATTER_Y =
SKILL_REF =
SERIES =
SERIES_CI =
LEGEND = Your legend text goes here...
LEAD =
TCMPR_PLOTTER_DEP_VARS = AMSLP-BMSLP,AMAX_WIND-BMAX_WIND,TK_ERR
TCMPR_PLOTTER_SCATTER_X =
TCMPR_PLOTTER_SCATTER_Y =
TCMPR_PLOTTER_SKILL_REF =
TCMPR_PLOTTER_SERIES =
TCMPR_PLOTTER_SERIES_CI =
TCMPR_PLOTTER_LEGEND = Your legend text goes here...
TCMPR_PLOTTER_LEAD =
# Mean and median plots. These override the plot_tcmpr.R default of box plot.
# If box plot is desired, this needs to be explicitly indicated.
PLOT_TYPES = MEAN,MEDIAN
RP_DIFF =
DEMO_YR =
HFIP_BASELINE =
FOOTNOTE_FLAG =
PLOT_CONFIG_OPTS =
SAVE_DATA =
TCMPR_PLOTTER_PLOT_TYPES = MEAN,MEDIAN
TCMPR_PLOTTER_RP_DIFF =
TCMPR_PLOTTER_DEMO_YR =
TCMPR_PLOTTER_HFIP_BASELINE =
TCMPR_PLOTTER_FOOTNOTE_FLAG =
TCMPR_PLOTTER_PLOT_CONFIG_OPTS =
TCMPR_PLOTTER_SAVE_DATA =

# TCMPR FLAGS no == (don't set flag), yes == (set flag)
NO_EE = no
NO_LOG = no
SAVE = no
TCMPR_PLOTTER_NO_EE = no
TCMPR_PLOTTER_NO_LOG = no
TCMPR_PLOTTER_SAVE = no

#
# DIRECTORIES
Expand All @@ -65,8 +66,8 @@ MET_BIN = {MET_INSTALL_DIR}/bin
# TCMPR Input data, This can be a directory that contains the input data
# to be plotted, or it can be a specific file.
TC_PAIRS_OUTPUT_DIR = {OUTPUT_BASE}/tc_pairs
TCMPR_DATA_DIR = {TC_PAIRS_OUTPUT_DIR}
TCMPR_PLOTTER_TCMPR_DATA_DIR = {TC_PAIRS_OUTPUT_DIR}

# location of TCMPR finished plots (the subdirectories will have the same
# name of the input files without the filename extension)
TCMPR_PLOT_OUTPUT_DIR = {OUTPUT_BASE}/tcmpr_plots
TCMPR_PLOTTER_PLOT_OUTPUT_DIR = {OUTPUT_BASE}/tcmpr_plots
61 changes: 31 additions & 30 deletions parm/use_cases/track_and_intensity/track_and_intensity.conf
Original file line number Diff line number Diff line change
Expand Up @@ -83,40 +83,41 @@ TC_PAIRS_MISSING_VAL = -9999
# Config file used to customize the plot, the tcmpr_customize.conf
# file is used to resize the plot that is produced so that it doesn't
# fill the entire screen.
CONFIG_FILE = {PARM_BASE}/use_cases/track_and_intensity/tcmpr_customize.conf
PREFIX =
TITLE =
SUBTITLE =
XLAB =
YLAB =
XLIM =
YLIM =
FILTER =
FILTERED_TCST_DATA_FILE =
TCMPR_PLOTTER_CONFIG_FILE = {PARM_BASE}/use_cases/track_and_intensity/tcmpr_customize.conf
TCMPR_PLOTTER_PREFIX =
TCMPR_PLOTTER_TITLE =
TCMPR_PLOTTER_SUBTITLE =
TCMPR_PLOTTER_XLAB =
TCMPR_PLOTTER_YLAB =
TCMPR_PLOTTER_XLIM =
TCMPR_PLOTTER_YLIM =
TCMPR_PLOTTER_FILTER =
# The tcst data file to be used instead of running the MET tc_stat tool
TCMPR_PLOTTER_FILTERED_TCST_DATA_FILE =
# Comma separated, no whitespace. Default is TK_ERR (track error) unless
# otherwise indicated.
DEP_VARS =
SCATTER_X =
SCATTER_Y =
SKILL_REF =
SERIES =
SERIES_CI =
LEGEND =
LEAD =
TCMPR_PLOTTER_DEP_VARS =
TCMPR_PLOTTER_SCATTER_X =
TCMPR_PLOTTER_SCATTER_Y =
TCMPR_PLOTTER_SKILL_REF =
TCMPR_PLOTTER_SERIES =
TCMPR_PLOTTER_SERIES_CI =
TCMPR_PLOTTER_LEGEND =
TCMPR_PLOTTER_LEAD =
# Default plot is boxplot, unless otherwise indicated. If box plot is needed
# in addition to other plots, this needs to be indicated.
PLOT_TYPES =
RP_DIFF =
DEMO_YR =
HFIP_BASELINE =
FOOTNOTE_FLAG =
PLOT_CONFIG_OPTS =
SAVE_DATA =
TCMPR_PLOTTER_PLOT_TYPES =
TCMPR_PLOTTER_RP_DIFF =
TCMPR_PLOTTER_DEMO_YR =
TCMPR_PLOTTER_HFIP_BASELINE =
TCMPR_PLOTTER_FOOTNOTE_FLAG =
TCMPR_PLOTTER_PLOT_CONFIG_OPTS =
TCMPR_PLOTTER_SAVE_DATA =

# TCMPR FLAGS no == (don't set flag), yes == (set flag)
NO_EE = no
NO_LOG = no
SAVE = no
TCMPR_PLOTTER_NO_EE = no
TCMPR_PLOTTER_NO_LOG = no
TCMPR_PLOTTER_SAVE = no


# OVERWRITE OPTIONS
Expand Down Expand Up @@ -155,8 +156,8 @@ TC_PAIRS_BDECK_INPUT_DIR = {TC_PAIRS_ADECK_INPUT_DIR}
TC_PAIRS_REFORMAT_DIR = {OUTPUT_BASE}/track_data_atcf
TC_PAIRS_OUTPUT_DIR = {OUTPUT_BASE}/tc_pairs

TCMPR_DATA_DIR = {TC_PAIRS_OUTPUT_DIR}
TCMPR_PLOT_OUTPUT_DIR = {OUTPUT_BASE}/tcmpr_plots
TCMPR_PLOTTER_TCMPR_DATA_DIR = {TC_PAIRS_OUTPUT_DIR}
TCMPR_PLOTTER_PLOT_OUTPUT_DIR = {OUTPUT_BASE}/tcmpr_plots

# REGEX PATTERNS
#
Expand Down
60 changes: 30 additions & 30 deletions ush/tcmpr_plotter_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,42 +57,42 @@ def __init__(self, config, logger):

# The only required argument for plot_tcmpr.R, the name of
# the tcst file to plot.
self.input_data = self.config.getdir('TCMPR_DATA_DIR')
self.input_data = self.config.getdir('TCMPR_PLOTTER_TCMPR_DATA_DIR')

# Optional arguments
self.plot_config_file = self.config.getstr('config', 'CONFIG_FILE')
self.output_base_dir = self.config.getdir('TCMPR_PLOT_OUTPUT_DIR')
self.prefix = self.config.getstr('config', 'PREFIX')
self.title = self.config.getstr('config', 'TITLE')
self.subtitle = self.config.getstr('config', 'SUBTITLE')
self.xlab = self.config.getstr('config', 'XLAB')
self.ylab = self.config.getstr('config', 'YLAB')
self.xlim = self.config.getstr('config', 'XLIM')
self.ylim = self.config.getstr('config', 'YLIM')
self.filter = self.config.getstr('config', 'FILTER')
self.plot_config_file = self.config.getstr('config', 'TCMPR_PLOTTER_CONFIG_FILE')
self.output_base_dir = self.config.getdir('TCMPR_PLOTTER_PLOT_OUTPUT_DIR')
self.prefix = self.config.getstr('config', 'TCMPR_PLOTTER_PREFIX')
self.title = self.config.getstr('config', 'TCMPR_PLOTTER_TITLE')
self.subtitle = self.config.getstr('config', 'TCMPR_PLOTTER_SUBTITLE')
self.xlab = self.config.getstr('config', 'TCMPR_PLOTTER_XLAB')
self.ylab = self.config.getstr('config', 'TCMPR_PLOTTER_YLAB')
self.xlim = self.config.getstr('config', 'TCMPR_PLOTTER_XLIM')
self.ylim = self.config.getstr('config', 'TCMPR_PLOTTER_YLIM')
self.filter = self.config.getstr('config', 'TCMPR_PLOTTER_FILTER')
self.filtered_tcst_data = self.config.getstr('config',
'FILTERED_TCST_DATA_FILE')
self.dep_vars = util.getlist(self.config.getstr('config', 'DEP_VARS'))
self.scatter_x = self.config.getstr('config', 'SCATTER_X')
self.scatter_y = self.config.getstr('config', 'SCATTER_Y')
self.skill_ref = self.config.getstr('config', 'SKILL_REF')
self.series = self.config.getstr('config', 'SERIES')
self.series_ci = self.config.getstr('config', 'SERIES_CI')
self.legend = self.config.getstr('config', 'LEGEND')
self.lead = self.config.getstr('config', 'LEAD')
self.plot_types = util.getlist(self.config.getstr('config', 'PLOT_TYPES'))
self.rp_diff = self.config.getstr('config', 'RP_DIFF')
self.demo_year = self.config.getstr('config', 'DEMO_YR')
self.hfip_baseline = self.config.getstr('config', 'HFIP_BASELINE')
self.footnote_flag = self.config.getstr('config', 'FOOTNOTE_FLAG')
self.plot_config_options = self.config.getstr('config', 'PLOT_CONFIG_OPTS')
self.save_data = self.config.getstr('config', 'SAVE_DATA')
'TCMPR_PLOTTER_FILTERED_TCST_DATA_FILE')
self.dep_vars = util.getlist(self.config.getstr('config', 'TCMPR_PLOTTER_DEP_VARS'))
self.scatter_x = self.config.getstr('config', 'TCMPR_PLOTTER_SCATTER_X')
self.scatter_y = self.config.getstr('config', 'TCMPR_PLOTTER_SCATTER_Y')
self.skill_ref = self.config.getstr('config', 'TCMPR_PLOTTER_SKILL_REF')
self.series = self.config.getstr('config', 'TCMPR_PLOTTER_SERIES')
self.series_ci = self.config.getstr('config', 'TCMPR_PLOTTER_SERIES_CI')
self.legend = self.config.getstr('config', 'TCMPR_PLOTTER_LEGEND')
self.lead = self.config.getstr('config', 'TCMPR_PLOTTER_LEAD')
self.plot_types = util.getlist(self.config.getstr('config', 'TCMPR_PLOTTER_PLOT_TYPES'))
self.rp_diff = self.config.getstr('config', 'TCMPR_PLOTTER_RP_DIFF')
self.demo_year = self.config.getstr('config', 'TCMPR_PLOTTER_DEMO_YR')
self.hfip_baseline = self.config.getstr('config', 'TCMPR_PLOTTER_HFIP_BASELINE')
self.footnote_flag = self.config.getstr('config', 'TCMPR_PLOTTER_FOOTNOTE_FLAG')
self.plot_config_options = self.config.getstr('config', 'TCMPR_PLOTTER_PLOT_CONFIG_OPTS')
self.save_data = self.config.getstr('config', 'TCMPR_PLOTTER_SAVE_DATA')

# Optional flags, by default these will be set to False in the
# produtil config files.
self.no_ee = self.config.getbool('config', 'NO_EE')
self.no_log = self.config.getbool('config', 'NO_LOG')
self.save = self.config.getbool('config', 'SAVE')
self.no_ee = self.config.getbool('config', 'TCMPR_PLOTTER_NO_EE')
self.no_log = self.config.getbool('config', 'TCMPR_PLOTTER_NO_LOG')
self.save = self.config.getbool('config', 'TCMPR_PLOTTER_SAVE')

def _init_tcmpr_script(self):
"""! Called by the constructor to set up the environment variables
Expand Down

0 comments on commit 2fdc282

Please sign in to comment.