diff --git a/internal/tests/pytests/wrappers/pcp_combine/test_pcp_combine_wrapper.py b/internal/tests/pytests/wrappers/pcp_combine/test_pcp_combine_wrapper.py index 725278c393..19be7d9b24 100644 --- a/internal/tests/pytests/wrappers/pcp_combine/test_pcp_combine_wrapper.py +++ b/internal/tests/pytests/wrappers/pcp_combine/test_pcp_combine_wrapper.py @@ -189,13 +189,23 @@ def test_setup_sum_method(metplus_config): assert pcw.setup_sum_method(time_info, lookback, data_src) +@pytest.mark.parametrize( + 'custom', [ + False, True, + ] +) @pytest.mark.wrapper -def test_setup_subtract_method(metplus_config): +def test_setup_subtract_method(metplus_config, custom): data_src = "FCST" pcw = pcp_combine_wrapper(metplus_config, data_src) task_info = {} task_info['valid'] = datetime.strptime("201609050000", '%Y%m%d%H%M') task_info['lead_hours'] = 9 + if custom: + task_info['custom'] = 'file' + temp = pcw.config.getraw('config', 'FCST_PCP_COMBINE_INPUT_TEMPLATE') + temp = temp.replace('file.', '{custom}.') + pcw.config.set('config', 'FCST_PCP_COMBINE_INPUT_TEMPLATE', temp) time_info = ti_calculate(task_info) lookback = 6 * 3600 files_found = pcw.setup_subtract_method(time_info, lookback, data_src) diff --git a/metplus/wrappers/pcp_combine_wrapper.py b/metplus/wrappers/pcp_combine_wrapper.py index 8afbc171a6..8f476647b0 100755 --- a/metplus/wrappers/pcp_combine_wrapper.py +++ b/metplus/wrappers/pcp_combine_wrapper.py @@ -391,8 +391,7 @@ def setup_subtract_method(self, time_info, accum, data_src): 'lead': lead2} time_info2 = ti_calculate(input_dict2) time_info2['level'] = accum - if hasattr(time_info, 'custom'): - time_info2['custom'] = time_info['custom'] + time_info2['custom'] = time_info.get('custom', '') filepath2 = do_string_sub(full_template, **time_info2) file2 = util.preprocess_file(filepath2,