Skip to content

Commit

Permalink
per #1842, change logic to handle padding HHMMSS values to still supp…
Browse files Browse the repository at this point in the history
…ort HHHMMSS (3 digits of hour). Updated tests to handle example from removed configuration file in internal/tests/pytests/plotting
  • Loading branch information
georgemccabe committed Oct 3, 2022
1 parent 3bc2e88 commit d97ceb9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@ def stat_analysis_wrapper(metplus_config):
('', []),
('0,1,2,3', ['"000000"', '"010000"', '"020000"', '"030000"']),
('01', ['"010000"']),
('010000', ['"010000"']),
('begin_end_incr(0,3,1)', ['"000000"', '"010000"',
'"020000"', '"030000"']),
('24, 48, 72, 96, 120, 144, 168, 192, 216, 240',
['"240000"', '"480000"', '"720000"', '"960000"', '"1200000"',
'"1440000"', '"1680000"', '"1920000"', '"2160000"', '"2400000"']),
]
)
@pytest.mark.wrapper_d
def test_handle_format_lists(metplus_config, input, expected_output):
config = metplus_config([TEST_CONF])
config.set('config', 'FCST_LEAD_LIST', input)
config.set('config', 'LOOP_LIST_ITEMS', 'FCST_LEAD_LIST')
wrapper = StatAnalysisWrapper(config)
assert wrapper.c_dict['FCST_LEAD_LIST'] == expected_output

Expand Down
6 changes: 4 additions & 2 deletions metplus/wrappers/stat_analysis_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ def _format_conf_list(self, conf_list):

@staticmethod
def _format_hms(value):
return value.zfill(2).ljust(6, '0')
padded_value = value.zfill(2)
return padded_value.ljust(len(padded_value) + 4, '0')

def c_dict_error_check(self, c_dict):

Expand Down Expand Up @@ -399,7 +400,8 @@ def set_lists_loop_or_group(self, c_dict):

return c_dict

def format_thresh(self, thresh_str):
@staticmethod
def format_thresh(thresh_str):
"""! Format thresholds for file naming
Args:
Expand Down

0 comments on commit d97ceb9

Please sign in to comment.