Skip to content

Commit

Permalink
if fcst/obs field lists cannot be built by using the opposite (fcst v…
Browse files Browse the repository at this point in the history
…s. obs) list of files and template, then try to get the list of times from its own file
  • Loading branch information
georgemccabe committed Nov 6, 2023
1 parent 07fac45 commit 99653f4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions metplus/wrappers/series_analysis_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,13 @@ def get_formatted_fields(self, var_info, fcst_path, obs_path):
fcst_field_list = self._get_field_list('fcst', var_info, obs_path)
obs_field_list = self._get_field_list('obs', var_info, fcst_path)

# if the field lists could not be built by using the opposite (fcst/obs) file list,
# then try to build them using its own file list
if not fcst_field_list:
fcst_field_list = self._get_field_list('fcst', var_info, fcst_path, other='FCST')
if not obs_field_list:
obs_field_list = self._get_field_list('obs', var_info, obs_path, other='OBS')

if not fcst_field_list or not obs_field_list:
return None, None

Expand All @@ -1051,8 +1058,10 @@ def get_formatted_fields(self, var_info, fcst_path, obs_path):

return fcst_fields, obs_fields

def _get_field_list(self, data_type, var_info, file_list_path):
other = 'OBS' if data_type == 'fcst' else 'FCST'
def _get_field_list(self, data_type, var_info, file_list_path, other=None):
if other is None:
other = 'OBS' if data_type == 'fcst' else 'FCST'

# check if time filename template tags are used in field level
if not self._has_time_tag(var_info[f'{data_type}_level']):
# get field info for a single field to pass to the MET config file
Expand Down

0 comments on commit 99653f4

Please sign in to comment.