From 258d27d9d6751d15afc37813c4ce6992caa49551 Mon Sep 17 00:00:00 2001 From: George McCabe <23407799+georgemccabe@users.noreply.github.com> Date: Fri, 1 Nov 2024 09:47:51 -0600 Subject: [PATCH] Feature #2742 develop fix StatAnalysis to set fcst_lev/obs_lev (#2760) --- .../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 9dc06f9f88..6483aa4826 100644 --- a/internal/tests/pytests/wrappers/stat_analysis/test_stat_analysis.py +++ b/internal/tests/pytests/wrappers/stat_analysis/test_stat_analysis.py @@ -173,6 +173,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"];'}), ] ) diff --git a/metplus/wrappers/stat_analysis_wrapper.py b/metplus/wrappers/stat_analysis_wrapper.py index 4f7525fcff..60ba1dea8b 100755 --- a/metplus/wrappers/stat_analysis_wrapper.py +++ b/metplus/wrappers/stat_analysis_wrapper.py @@ -342,7 +342,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