Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix #1884 develop PCPCombine {custom} in subtract method #1887

Merged
merged 2 commits into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions metplus/wrappers/pcp_combine_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down