From 61aa0357b130c4a62465df5f195e0af7a9522544 Mon Sep 17 00:00:00 2001 From: George McCabe <23407799+georgemccabe@users.noreply.github.com> Date: Wed, 30 Oct 2024 12:30:57 -0600 Subject: [PATCH] Per #2742, main_v5.1 -- fix StatAnalysis to set fcst_lev and obs_lev instead of fcst_level and obs_level to match actual MET config variable names. Added unit tests to ensure correct behavior occurs --- .../pytests/wrappers/stat_analysis/test_stat_analysis.py | 6 ++++++ metplus/wrappers/stat_analysis_wrapper.py | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/tests/pytests/wrappers/stat_analysis/test_stat_analysis.py b/internal/tests/pytests/wrappers/stat_analysis/test_stat_analysis.py index 9da87d0faa..ee4c3bab6a 100644 --- a/internal/tests/pytests/wrappers/stat_analysis/test_stat_analysis.py +++ b/internal/tests/pytests/wrappers/stat_analysis/test_stat_analysis.py @@ -172,6 +172,12 @@ def set_minimum_config_settings(config): 'MODEL1': '{custom}', 'MODEL_LIST': '{custom}'}, {'METPLUS_MODEL': 'model = ["CUSTOM_MODEL"];'}), + # 17 - fcst_lev + ({'FCST_LEVEL_LIST': 'R5'}, + {'METPLUS_FCST_LEVEL': 'fcst_lev = ["R5"];'}), + # 17 - obs_lev + ({'OBS_LEVEL_LIST': 'R7'}, + {'METPLUS_OBS_LEVEL': 'obs_lev = ["R7"];'}), ] ) @pytest.mark.wrapper_d diff --git a/metplus/wrappers/stat_analysis_wrapper.py b/metplus/wrappers/stat_analysis_wrapper.py index 180908f542..f8b7f2a94d 100755 --- a/metplus/wrappers/stat_analysis_wrapper.py +++ b/metplus/wrappers/stat_analysis_wrapper.py @@ -332,7 +332,8 @@ def _run_stat_analysis_job(self, runtime_settings): value = f'"{value}"' else: value = f'[{value}]' - value = f'{item.lower()} = {value};' + item = item.lower().replace('_level', '_lev') + value = f'{item} = {value};' self.env_var_dict[key] = value # send environment variables to logger