Skip to content

Commit

Permalink
per feedback in PR #2872, modify wrapper behavior to change output pa…
Browse files Browse the repository at this point in the history
…th from a directory to a filename base that will be used to write output files with various extensions, e.g. _mpr.txt or .stat
  • Loading branch information
georgemccabe committed Jan 27, 2025
1 parent f74c08d commit bbbc39e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion docs/Users_Guide/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13285,7 +13285,8 @@ METplus Configuration Glossary
| *Used by:* PairStat

PAIR_STAT_OUTPUT_TEMPLATE
Sets the subdirectories below :term:`PAIR_STAT_OUTPUT_DIR` using a template to allow run time information.
Sets the subdirectories and output file name base below
:term:`PAIR_STAT_OUTPUT_DIR` using a template to allow run time information.

| *Used by:* PairStat

Expand Down
3 changes: 2 additions & 1 deletion metplus/wrappers/compare_gridded_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ def process_fields(self, time_info):
self.set_current_field_config()

# set up output dir with time info
if not self.find_and_check_output_file(time_info, is_directory=True):
is_dir = self.c_dict.get('OUTPUT_PATH_IS_DIR', True)
if not self.find_and_check_output_file(time_info, is_directory=is_dir):
return

# set command line arguments
Expand Down
6 changes: 4 additions & 2 deletions metplus/wrappers/pair_stat_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ def create_c_dict(self):
c_dict['VERBOSITY'])
)

# set variable to override how output path is handled
c_dict['OUTPUT_PATH_IS_DIR'] = False

c_dict['OFFSETS'] = getlistint(
self.config.getstr('config', 'PAIR_STAT_OFFSETS', '0')
)
Expand All @@ -112,7 +115,6 @@ def create_c_dict(self):
)

c_dict['OUTPUT_DIR'] = self.config.getdir('PAIR_STAT_OUTPUT_DIR', '')

c_dict['OUTPUT_TEMPLATE'] = self.config.getraw('config', 'PAIR_STAT_OUTPUT_TEMPLATE')

c_dict['FORMAT'] = self.config.getraw('config', 'PAIR_STAT_FORMAT')
Expand Down Expand Up @@ -243,4 +245,4 @@ def get_command(self):
return (f"{self.app_path} {' '.join(self.infiles)}"
f" -format {self.c_dict['FORMAT']} -config {self.param}"
f"{' ' + ' '.join(self.args) if self.args else ''}"
f" -out {self.outdir} -v {self.c_dict['VERBOSITY']}")
f" -out {self.get_output_path()} -v {self.c_dict['VERBOSITY']}")
2 changes: 1 addition & 1 deletion parm/use_cases/met_tool_wrapper/PairStat/PairStat.conf
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ PAIR_STAT_PAIRS_INPUT_TEMPLATE = point_stat_{lead?fmt=%H%M%S}L_{valid?fmt=%Y%m%d
#PAIR_STAT_OFFSETS = 0

PAIR_STAT_OUTPUT_DIR = {OUTPUT_BASE}/pair_stat
#PAIR_STAT_OUTPUT_TEMPLATE =
PAIR_STAT_OUTPUT_TEMPLATE = {valid?fmt=%Y%m%d_%H}_out

#PAIR_STAT_CLIMO_MEAN_INPUT_DIR =
#PAIR_STAT_CLIMO_MEAN_INPUT_TEMPLATE =
Expand Down

0 comments on commit bbbc39e

Please sign in to comment.