Skip to content

Commit

Permalink
per #2412, fix bug in GenVxMask to put quotes around argument so a gr…
Browse files Browse the repository at this point in the history
…id specification string with spaces will be an accepted value
  • Loading branch information
georgemccabe committed Nov 9, 2023
1 parent be6e120 commit 8bfc403
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions metplus/wrappers/gen_vx_mask_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 8bfc403

Please sign in to comment.