From 7094e0a613d354d894119900327837b6da143644 Mon Sep 17 00:00:00 2001 From: George McCabe <23407799+georgemccabe@users.noreply.github.com> Date: Thu, 11 Nov 2021 16:29:32 -0700 Subject: [PATCH] feature 1252 allow dictionary value for time_summary.width (#1253) --- internal_tests/pytests/ascii2nc/test_ascii2nc_wrapper.py | 8 ++++++++ metplus/wrappers/command_builder.py | 9 +++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/internal_tests/pytests/ascii2nc/test_ascii2nc_wrapper.py b/internal_tests/pytests/ascii2nc/test_ascii2nc_wrapper.py index 641c4d3599..8db28911a4 100644 --- a/internal_tests/pytests/ascii2nc/test_ascii2nc_wrapper.py +++ b/internal_tests/pytests/ascii2nc/test_ascii2nc_wrapper.py @@ -88,6 +88,14 @@ def ascii2nc_wrapper(metplus_config, config_path=None, config_overrides=None): 'grib_code = [11, 204, 211];obs_var = [];' 'type = ["min", "max", "range", "mean", "stdev", "median", "p80"];' 'vld_freq = 0;vld_thresh = 0.0;}')}), + # width as dictionary + ({'ASCII2NC_TIME_SUMMARY_WIDTH': '{ beg = -21600; end = 0; }'}, + {'METPLUS_TIME_SUMMARY_DICT': + ('time_summary = {flag = FALSE;raw_data = FALSE;beg = "000000";' + 'end = "235959";step = 300;width = { beg = -21600; end = 0; };' + 'grib_code = [11, 204, 211];obs_var = [];' + 'type = ["min", "max", "range", "mean", "stdev", "median", "p80"];' + 'vld_freq = 0;vld_thresh = 0.0;}')}), ({'ASCII2NC_TIME_SUMMARY_GRIB_CODES': '12, 203, 212'}, {'METPLUS_TIME_SUMMARY_DICT': diff --git a/metplus/wrappers/command_builder.py b/metplus/wrappers/command_builder.py index 64bdc9c255..9e22aa6642 100755 --- a/metplus/wrappers/command_builder.py +++ b/metplus/wrappers/command_builder.py @@ -2012,10 +2012,11 @@ def handle_time_summary_dict(self, c_dict, remove_bracket_list=None): 'step', 'TIME_SUMMARY_STEP') - self.set_met_config_int(tmp_dict, - f'{app}_TIME_SUMMARY_WIDTH', - 'width', - 'TIME_SUMMARY_WIDTH') + self.set_met_config_string(tmp_dict, + f'{app}_TIME_SUMMARY_WIDTH', + 'width', + 'TIME_SUMMARY_WIDTH', + remove_quotes=True) self.set_met_config_list(tmp_dict, [f'{app}_TIME_SUMMARY_GRIB_CODES',