Skip to content

Commit

Permalink
Per #1735, print a warning message is the continuous filtering logic …
Browse files Browse the repository at this point in the history
…results in 0 matched pairs. Also, match existing logic to NOT WRITE any output, not even header rows, when the output AsciiTable contains no results.
  • Loading branch information
JohnHalleyGotway committed Apr 14, 2021
1 parent 020ddb5 commit fb6ed66
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
20 changes: 18 additions & 2 deletions met/src/tools/core/stat_analysis/aggr_stat_line.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3506,7 +3506,15 @@ void mpr_to_cnt(STATAnalysisJob &job, const AggrMPRInfo &info,
//
// If there are no matched pairs to process, return
//
if(pd_thr.f_na.n() == 0 || pd_thr.o_na.n() == 0) return;
if(pd_thr.f_na.n() == 0 || pd_thr.o_na.n() == 0) {
mlog << Warning << "\nmpr_to_cnt() -> "
<< "no MPR lines retained for -out_fcst_thresh "
<< job.out_fcst_thresh[i_thresh].get_str() << " -out_obs_thresh "
<< job.out_obs_thresh[i_thresh].get_str() << " -out_cnt_logic "
<< setlogic_to_string(job.out_cnt_logic)
<< "\n\n";
return;
}

//
// Set the precip flag based on fcst_var and obs_var
Expand Down Expand Up @@ -3566,7 +3574,15 @@ void mpr_to_psum(STATAnalysisJob &job, const AggrMPRInfo &info,
//
// If there are no matched pairs to process, return
//
if(pd_thr.f_na.n() == 0 || pd_thr.o_na.n() == 0) return;
if(pd_thr.f_na.n() == 0 || pd_thr.o_na.n() == 0) {
mlog << Warning << "\nmpr_to_psum() -> "
<< "no MPR lines retained for -out_fcst_thresh "
<< job.out_fcst_thresh[i_thresh].get_str() << " -out_obs_thresh "
<< job.out_obs_thresh[i_thresh].get_str() << " -out_cnt_logic "
<< setlogic_to_string(job.out_cnt_logic)
<< "\n\n";
return;
}

//
// Initialize counts
Expand Down
10 changes: 10 additions & 0 deletions met/src/tools/core/stat_analysis/stat_analysis_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3329,6 +3329,11 @@ void write_job_aggr_mpr(STATAnalysisJob &job, STATLineType lt,
}
} // end for it

//
// Discard contents of an empty AsciiTable
//
if(r == 1) at.clear();

return;
}

Expand Down Expand Up @@ -4201,6 +4206,11 @@ void setup_table(AsciiTable &at, int n_hdr_cols, int prec) {

void write_table(AsciiTable &at, ofstream *sa_out) {

//
// Do not write an empty table
//
if(at.nrows() == 0 && at.ncols() == 0) return;

if(sa_out) *(sa_out) << at << "\n" << flush;
else cout << at << "\n" << flush;

Expand Down

0 comments on commit fb6ed66

Please sign in to comment.