From 8bfc40324c67d8be61def1c0066b5d94186602c7 Mon Sep 17 00:00:00 2001 From: George McCabe <23407799+georgemccabe@users.noreply.github.com> Date: Wed, 8 Nov 2023 17:24:20 -0700 Subject: [PATCH] per #2412, fix bug in GenVxMask to put quotes around argument so a grid specification string with spaces will be an accepted value --- .../tests/pytests/wrappers/gen_vx_mask/test_gen_vx_mask.py | 6 +++--- metplus/wrappers/gen_vx_mask_wrapper.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/tests/pytests/wrappers/gen_vx_mask/test_gen_vx_mask.py b/internal/tests/pytests/wrappers/gen_vx_mask/test_gen_vx_mask.py index d92a79c8ee..f4973a55b7 100644 --- a/internal/tests/pytests/wrappers/gen_vx_mask/test_gen_vx_mask.py +++ b/internal/tests/pytests/wrappers/gen_vx_mask/test_gen_vx_mask.py @@ -39,7 +39,7 @@ def test_run_gen_vx_mask_once(metplus_config): wrap.run_at_time_once(time_info) - expected_cmd = f"{wrap.app_path} 2018020100_ZENITH LAT {wrap.config.getdir('OUTPUT_BASE')}/GenVxMask_test/2018020100_ZENITH_LAT_MASK.nc -type lat -thresh 'ge30&&le50' -v 2" + expected_cmd = f"{wrap.app_path} \"2018020100_ZENITH\" LAT {wrap.config.getdir('OUTPUT_BASE')}/GenVxMask_test/2018020100_ZENITH_LAT_MASK.nc -type lat -thresh 'ge30&&le50' -v 2" for cmd, _ in wrap.all_commands: print(f"COMMAND:{cmd}") @@ -64,8 +64,8 @@ def test_run_gen_vx_mask_twice(metplus_config): wrap.run_at_time_once(time_info) - expected_cmds = [f"{wrap.app_path} 2018020100_ZENITH LAT {wrap.config.getdir('OUTPUT_BASE')}/stage/gen_vx_mask/temp_0.nc {cmd_args[0]} -v 2", - f"{wrap.app_path} {wrap.config.getdir('OUTPUT_BASE')}/stage/gen_vx_mask/temp_0.nc LON {wrap.config.getdir('OUTPUT_BASE')}/GenVxMask_test/2018020100_ZENITH_LAT_LON_MASK.nc {cmd_args[1]} -v 2"] + expected_cmds = [f"{wrap.app_path} \"2018020100_ZENITH\" LAT {wrap.config.getdir('OUTPUT_BASE')}/stage/gen_vx_mask/temp_0.nc {cmd_args[0]} -v 2", + f"{wrap.app_path} \"{wrap.config.getdir('OUTPUT_BASE')}/stage/gen_vx_mask/temp_0.nc\" LON {wrap.config.getdir('OUTPUT_BASE')}/GenVxMask_test/2018020100_ZENITH_LAT_LON_MASK.nc {cmd_args[1]} -v 2"] test_passed = True diff --git a/metplus/wrappers/gen_vx_mask_wrapper.py b/metplus/wrappers/gen_vx_mask_wrapper.py index 6f9018598d..8eb4a21ab3 100755 --- a/metplus/wrappers/gen_vx_mask_wrapper.py +++ b/metplus/wrappers/gen_vx_mask_wrapper.py @@ -14,7 +14,7 @@ from ..util import getlist, get_lead_sequence, skip_time, ti_calculate, mkdir_p from . import LoopTimesWrapper -from ..util import do_string_sub +from ..util import do_string_sub, remove_quotes '''!@namespace GenVxMaskWrapper @brief Wraps the GenVxMask tool to reformat ascii format to NetCDF @@ -201,7 +201,7 @@ def find_input_files(self, time_info, temp_file): return False # add input and mask file to input file list - self.infiles.append(input_path) + self.infiles.append(f'"{remove_quotes(input_path)}"') self.infiles.append(mask_file) return True