Skip to content

Commit

Permalink
Per #2883, update logic of parse_file_list_type() function to handle …
Browse files Browse the repository at this point in the history
…python input strings. Also update pcp_combine to parse the type of input files being read and log non-missing python input files expected.
  • Loading branch information
JohnHalleyGotway committed May 14, 2024
1 parent e50cfd3 commit 96d0d67
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/libcode/vx_data2d_factory/parse_file_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,18 @@ GrdFileType ftype = FileType_None;

for ( int i=0; i<file_list.n(); i++ ) {

//
// check for python inputs
//

bool is_python = (file_list[i].find(conf_val_python_xarray) == 0) ||
(file_list[i].find(conf_val_python_numpy) == 0);

//
// skip missing files
//

if( !file_exists(file_list[i].c_str()) ) continue;
if( !file_exists(file_list[i].c_str()) && !is_python ) continue;

//
// get the current file type
Expand Down
13 changes: 12 additions & 1 deletion src/tools/core/pcp_combine/pcp_combine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ static ConcatString pcp_reg_exp = (string)default_reg_exp;

// Variables for the derive command
static StringArray file_list;
static GrdFileType file_list_type = FileType_None;
static StringArray field_list;
static StringArray derive_list;

Expand Down Expand Up @@ -479,6 +480,11 @@ void process_add_sub_derive_args(const CommandLine & cline) {
//
n_files = file_list.n();

//
// Determine the type of input files.
//
file_list_type = parse_file_list_type(file_list);

return;
}

Expand Down Expand Up @@ -1237,7 +1243,12 @@ bool get_field(const char *filename, const char *cur_field,
ftype = parse_conf_file_type(&config);

//
// Check that the file exists.
// If not set by the config string, use the file list type.
//
if(ftype == FileType_None) ftype = file_list_type;

//
// Check for missing non-python input files.
//
if(!file_exists(filename) &&
!is_python_grdfiletype(ftype)) {
Expand Down

0 comments on commit 96d0d67

Please sign in to comment.