From 47afcc069c643d6b196d8035bd15e186857bfbd2 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Wed, 14 Oct 2020 11:09:10 -0600 Subject: [PATCH] Per #1508, refine logic further to handle lists with length > 10. --- .../vx_data2d_factory/parse_file_list.cc | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/met/src/libcode/vx_data2d_factory/parse_file_list.cc b/met/src/libcode/vx_data2d_factory/parse_file_list.cc index ab8165ed45..93ae285016 100644 --- a/met/src/libcode/vx_data2d_factory/parse_file_list.cc +++ b/met/src/libcode/vx_data2d_factory/parse_file_list.cc @@ -165,30 +165,38 @@ while(f_in >> file_name) { // // Keep track of the number of missing files. - // After too many missing files, assume this is not a file list - // and return an empty list. // if ( check_files_exist ) { if ( !is_regular_file(file_name.c_str()) ) n_missing++; - if ( n_missing >= max_missing ) { + if ( n_missing >= max_missing ) break; - mlog << Debug(5) << "parse_ascii_file_list() -> " - << "File \"" << path << "\" is not an ASCII file list " - << "since there are too many missing files.\n"; + } +} + +// +// Check for too many missing files: +// - A small number of files that are all missing +// - A large number of files with a least 10 missing +// - a.clear(); +if ( check_files_exist ) { - break; - } + if ( ( a.n() < max_missing && n_missing == a.n() ) || + ( a.n() >= max_missing && n_missing >= max_missing ) ) { + + mlog << Debug(5) << "parse_ascii_file_list() -> " + << "File \"" << path << "\" is not an ASCII file list " + << "since there are too many missing files.\n"; + + a.clear(); } } f_in.close(); - return(a); }