Skip to content

Commit

Permalink
Per #1289, add support for explicit file list file path for finding e…
Browse files Browse the repository at this point in the history
…nsemble members (EnsembleStat and GenEnsProd)
  • Loading branch information
georgemccabe committed Jan 31, 2022
1 parent 00622e1 commit 8e1c549
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions metplus/wrappers/command_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,11 +831,6 @@ def find_input_files_ensemble(self, time_info):
@param time_info dictionary containing timing information
@returns True on success
"""
# get list of ensemble files to process
input_files = self.find_model(time_info, return_list=True)
if not input_files:
self.log_error("Could not find any input files")
return False

# get control file if requested
if self.c_dict.get('CTRL_INPUT_TEMPLATE'):
Expand All @@ -847,6 +842,28 @@ def find_input_files_ensemble(self, time_info):

self.args.append(f'-ctrl {ctrl_file}')

# if explicit file list file is specified, use it and
# bypass logic to error check model files
if self.c_dict.get('FCST_INPUT_FILE_LIST'):
file_list_path = do_string_sub(self.c_dict['FCST_INPUT_FILE_LIST'],
**time_info)
self.logger.debug(f"Explicit file list file: {file_list_path}")
if not os.path.exists(file_list_path):
self.log_error("Could not find file list file")
return False

self.infiles.append(file_list_path)
return True

# get list of ensemble files to process
input_files = self.find_model(time_info, return_list=True)
if not input_files:
self.log_error("Could not find any input files")
return False

# if control file is requested, remove it from input list
if self.c_dict.get('CTRL_INPUT_TEMPLATE'):

# check if control file is found in ensemble list
if ctrl_file in input_files:
# warn and remove control file if found
Expand Down

0 comments on commit 8e1c549

Please sign in to comment.