Skip to content

Commit

Permalink
feature 1057 pass directory to tcmpr plot script (#1085)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgemccabe authored Aug 16, 2021
1 parent eab50ae commit 487bc3f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/Users_Guide/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7858,3 +7858,10 @@ METplus Configuration Glossary
Specify the value for 'hss_ec_value' in the MET configuration file for StatAnalysis.

| *Used by:* StatAnalysis
TCMPR_PLOTTER_READ_ALL_FILES
If True, pass in input directory set by :term:`TCMPR_PLOTTER_TCMPR_DATA_DIR`
to the script. If False, a list of all files that end with .tcst in the input
directory is gathered and passed into the script. Defaults to False.

| *Used by:* TCMPRPlotter
1 change: 1 addition & 0 deletions docs/Users_Guide/wrappers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6517,6 +6517,7 @@ METplus Configuration
| :term:`TCMPR_PLOTTER_SAVE_DATA`
| :term:`TCMPR_PLOTTER_DEP_LABELS`
| :term:`TCMPR_PLOTTER_PLOT_LABELS`
| :term:`TCMPR_PLOTTER_READ_ALL_FILES`
|
The following are TCMPR flags, if set to 'no', then don't set flag, if
Expand Down
9 changes: 9 additions & 0 deletions metplus/wrappers/tcmpr_plotter_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ def create_c_dict(self):
c_dict['LOOP_INFO'] = self.read_loop_info()
c_dict['LOOP_ARGS'] = {}

# get option to pass input directory instead of finding .tcst files
c_dict['READ_ALL_FILES'] = (
self.config.getbool('config', 'TCMPR_PLOTTER_READ_ALL_FILES', False)
)

return c_dict

def read_optional_args(self):
Expand Down Expand Up @@ -272,6 +277,10 @@ def get_input_files(self):

# input is directory, so find all tcst files to process
self.logger.debug(f'Plotting all files in: {input_data}')
if self.c_dict['READ_ALL_FILES']:
self.logger.debug('Passing in directory to R script')
return [input_data]

input_files = util.get_files(input_data, ".*.tcst")
self.logger.debug(f"Number of files: {len(input_files)}")
return sorted(input_files)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ INIT_INCREMENT = 6H
TCMPR_PLOTTER_TCMPR_DATA_DIR = {INPUT_BASE}/met_test/tc_pairs/{date?fmt=%Y%m}
TCMPR_PLOTTER_PLOT_OUTPUT_DIR = {OUTPUT_BASE}/tcmpr_plots

#TCMPR_PLOTTER_READ_ALL_FILES = True

# Plot_TCMPR options, if left unset, default values that are
# pre-defined in the R utility (packaged with MET) will be used.
Expand Down

0 comments on commit 487bc3f

Please sign in to comment.