Skip to content

Commit

Permalink
Per #2699, swap in a more resonable unit test for tc_pairs consensus …
Browse files Browse the repository at this point in the history
…of diagnostics, work on log messages, and also make sure that the TCDIAG output columns are all populated.
  • Loading branch information
JohnHalleyGotway committed Nov 13, 2023
1 parent 2bc96ce commit cf6e80b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
8 changes: 4 additions & 4 deletions internal/test_unit/config/TCPairsConfig_DIAGNOSTICS_CONSENSUS
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//
// Models
//
model = [ "GFSI", "EMXI" ];
model = [ "GFSO", "HWRF", "HMON" ];

//
// Description
Expand Down Expand Up @@ -96,11 +96,11 @@ interp12 = NONE;
//
consensus = [
{
name = "GFEX_CONS";
members = [ "GFSI", "EMXI" ];
name = "GFSO_HWRF_HMON_CONS";
members = [ "GFSO", "HWRF", "HMON" ];
required = [];
min_req = 2;
diag_required = [];
diag_required = [ TRUE, FALSE, FALSE ];
diag_min_req = 2;
write_members = TRUE;
}
Expand Down
5 changes: 3 additions & 2 deletions internal/test_unit/xml/unit_tc_pairs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,9 @@
<param> \
-adeck &DATA_DIR;/adeck/aal092022.dat \
-bdeck &DATA_DIR;/bdeck/bal092022.dat \
-diag CIRA_DIAG_RT &DATA_DIR;/diag/cira_diag_rt/2022/GFSI/sal092022_avni_doper_20220926*_diag.dat \
-diag CIRA_DIAG_RT &DATA_DIR;/diag/cira_diag_rt/2022/EMXI/sal092022_emxi_doper_20220926*_diag.dat \
-diag CIRA_DIAG_RT &DATA_DIR;/diag/cira_diag_rt/2022/sal092022_avno_doper_20220926*_diag.dat \
-diag CIRA_DIAG_RT &DATA_DIR;/diag/cira_diag_rt/2022/sal092022_hmon_doper_20220926*_diag.dat \
-diag CIRA_DIAG_RT &DATA_DIR;/diag/cira_diag_rt/2022/sal092022_hwrf_doper_20220926*_diag.dat \
-config &CONFIG_DIR;/TCPairsConfig_DIAGNOSTICS_CONSENSUS \
-out &OUTPUT_DIR;/tc_pairs/al092022_20220926_DIAGNOSTICS_CONSENSUS \
-log &OUTPUT_DIR;/tc_pairs/tc_pairs_DIAGNOSTICS_CONSENSUS.log \
Expand Down
17 changes: 14 additions & 3 deletions src/libcode/vx_tc_util/track_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,11 @@ TrackInfo consensus(const TrackInfoArray &tracks,
tavg.set_init(tracks[0].init());
tavg.set_storm_id();

// Diagnostic information
tavg.set_diag_source(tracks[0].diag_source());
tavg.set_track_source(tracks[0].track_source().c_str());
tavg.set_field_source(tracks[0].field_source().c_str());

// Loop through the tracks and build a list of lead times
for(i=0; i<tracks.n(); i++) {

Expand All @@ -1027,6 +1032,15 @@ TrackInfo consensus(const TrackInfoArray &tracks,
<< tracks[i].technique_number() << ").\n\n";
}

// Warning if the diagnostic data source changes
if(tavg.diag_source() != tracks[i].diag_source()) {
mlog << Warning
<< "\nTrackInfoArray::consensus() -> "
<< "the diagnostic type has changed ("
<< diagtype_to_string(tavg.diag_source()) << "!="
<< diagtype_to_string(tracks[i].diag_source()) << ").\n\n";
}

// Store unique diag_names in tavg object, unless they're all skipped
if(!skip_all_diag) {
for(j=0; j<tracks[i].diag_name().n(); j++) {
Expand Down Expand Up @@ -1175,9 +1189,6 @@ TrackInfo consensus(const TrackInfoArray &tracks,
// Loop over the diag name and the input track points and
// compute the mean across all members with the diag value
for(j=0; j<tavg.diag_name().n(); j++) {

mlog << Debug(4) << "Computing consensus \""
<< tavg.diag_name()[j] << "\" diagnostic value.\n";

// Store diag_vals for one diag_name across all track points
NumArray diag_vals;
Expand Down
3 changes: 2 additions & 1 deletion src/tools/tc_utils/tc_pairs/tc_pairs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,8 @@ int derive_consensus(TrackInfoArray &tracks) {
} // end for i

mlog << Debug(3)
<< "Building consensus track(s) for " << case_list.n()
<< "Building " << conf_info.NConsensus
<< " consensus track(s) for " << case_list.n()
<< " cases.\n";

// Loop through the cases and process each consensus model
Expand Down

0 comments on commit cf6e80b

Please sign in to comment.