From 88ef5ecd46d6e2cec31ce5041fecd03c561cf5af Mon Sep 17 00:00:00 2001 From: George McCabe <23407799+georgemccabe@users.noreply.github.com> Date: Thu, 26 Jan 2023 10:34:35 -0700 Subject: [PATCH] Per #2026, removed check to only allow STAT_ANALYSIS_RUNTIME_FREQ=RUN_ONCE and added logic to set runtime frequency to once per init/valid if LOOP_ORDER=times and start/end times are not equal to warn users that LOOP_ORDER has been deprecated --- metplus/wrappers/stat_analysis_wrapper.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/metplus/wrappers/stat_analysis_wrapper.py b/metplus/wrappers/stat_analysis_wrapper.py index 503869948d..c45ca4a657 100755 --- a/metplus/wrappers/stat_analysis_wrapper.py +++ b/metplus/wrappers/stat_analysis_wrapper.py @@ -146,13 +146,6 @@ def create_c_dict(self): c_dict['VERBOSITY']) ) - if not c_dict['RUNTIME_FREQ']: - c_dict['RUNTIME_FREQ'] = 'RUN_ONCE' - - if c_dict['RUNTIME_FREQ'] != 'RUN_ONCE': - self.log_error('Only RUN_ONCE is currently supported for ' - 'STAT_ANALYSIS_RUNTIME_FREQ') - # skip RuntimeFreq wrapper logic to find files c_dict['FIND_FILES'] = False @@ -183,6 +176,18 @@ def create_c_dict(self): c_dict['DATE_BEG'] = start_dt c_dict['DATE_END'] = end_dt + if not c_dict['RUNTIME_FREQ']: + # if start and end times are not equal and + # LOOP_ORDER = times (legacy), set frequency to once per init/valid + if (start_dt != end_dt and + self.config.has_option('LOOP_ORDER') and + self.config.getraw('config', 'LOOP_ORDER') == 'times'): + self.logger.warning('LOOP_ORDER has been deprecated. Please ' + 'set STAT_ANALYSIS_RUNTIME_FREQ instead') + c_dict['RUNTIME_FREQ'] = 'RUN_ONCE_PER_INIT_OR_VALID' + else: + c_dict['RUNTIME_FREQ'] = 'RUN_ONCE' + # read jobs from STAT_ANALYSIS_JOB or legacy JOB_NAME/ARGS if unset c_dict['JOBS'] = self._read_jobs_from_config()