Skip to content

Commit

Permalink
add quotes around input files to plot_point_obs command to allow supp…
Browse files Browse the repository at this point in the history
…ort for Python Embedding as input
  • Loading branch information
georgemccabe committed Nov 7, 2022
1 parent d674824 commit 185e90e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,19 +235,19 @@ def test_plot_point_obs(metplus_config, config_overrides, env_var_values):
out_dir = wrapper.c_dict.get('OUTPUT_DIR')
expected_cmds = [
(f"{app_path} {verbosity} "
f"{input_dir}/pb2nc/ndas.20120409.t12z.prepbufr.tm00.nc "
f'"{input_dir}/pb2nc/ndas.20120409.t12z.prepbufr.tm00.nc" '
f"{out_dir}/nam_and_ndas.20120409.t12z.prepbufr_CONFIG.ps"),
(f"{app_path} {verbosity} "
f"{input_dir}/pb2nc/ndas.20120410.t00z.prepbufr.tm00.nc "
f'"{input_dir}/pb2nc/ndas.20120410.t00z.prepbufr.tm00.nc" '
f"{out_dir}/nam_and_ndas.20120410.t00z.prepbufr_CONFIG.ps"),
]

# add -point_obs argument if template has 2 items
if ('PLOT_POINT_OBS_INPUT_TEMPLATE' in config_overrides and
len(config_overrides['PLOT_POINT_OBS_INPUT_TEMPLATE'].split(',')) > 1):
common_str = f' -point_obs {input_dir}/ascii2nc/trmm_'
expected_cmds[0] += f'{common_str}2012040912_3hr.nc'
expected_cmds[1] += f'{common_str}2012041000_3hr.nc'
common_str = f' -point_obs "{input_dir}/ascii2nc/trmm_'
expected_cmds[0] += f'{common_str}2012040912_3hr.nc"'
expected_cmds[1] += f'{common_str}2012041000_3hr.nc"'

# add -plot_grid argument if provided
if 'PLOT_POINT_OBS_GRID_INPUT_TEMPLATE' in config_overrides:
Expand Down
4 changes: 2 additions & 2 deletions metplus/wrappers/plot_point_obs_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def create_c_dict(self):

def get_command(self):
return (f"{self.app_path} -v {self.c_dict['VERBOSITY']}"
f" {self.infiles[0]} {self.get_output_path()}"
f' "{self.infiles[0]}" {self.get_output_path()}'
f" {' '.join(self.args)}")

def run_at_time_once(self, time_info):
Expand Down Expand Up @@ -243,7 +243,7 @@ def set_command_line_arguments(self, time_info):
"""
# if more than 1 input file was found, add them with -point_obs
for infile in self.infiles[1:]:
self.args.append(f'-point_obs {infile}')
self.args.append(f'-point_obs "{infile}"')

if self.c_dict.get('GRID_INPUT_PATH'):
grid_file = do_string_sub(self.c_dict['GRID_INPUT_PATH'],
Expand Down

0 comments on commit 185e90e

Please sign in to comment.