diff --git a/met/src/tools/tc_utils/tc_gen/tc_gen.cc b/met/src/tools/tc_utils/tc_gen/tc_gen.cc index 3e948efac4..483fcdaca5 100644 --- a/met/src/tools/tc_utils/tc_gen/tc_gen.cc +++ b/met/src/tools/tc_utils/tc_gen/tc_gen.cc @@ -95,7 +95,7 @@ static int find_genesis_match (const GenesisInfo &, const GenesisInfoArray &, const TrackInfoArray &, bool, double, int, int); -static void find_probgen_match (ProbGenInfo &, +static int find_probgen_match (const ProbGenInfo &, const GenesisInfoArray &, const TrackInfoArray &, bool, double, int, int); @@ -737,8 +737,9 @@ void do_probgen_pct(const TCGenVxOpt &vx_opt, const GenesisInfoArray &best_ga, const TrackInfoArray &oper_ta, ProbGenPCTInfo &pgi) { - int i, j, time_diff; + int i, i_bga, j, time_diff; bool is_event; + const GenesisInfo *bgi; // Initialize pgi.clear(); @@ -748,18 +749,23 @@ void do_probgen_pct(const TCGenVxOpt &vx_opt, for(i=0; igenesis_time() - + if(bgi) { + time_diff = bgi->genesis_time() - model_pa.prob_gen(i).init(); is_event = time_diff >= 0 && time_diff <= (model_pa.prob_gen(i).prob_item(j) * sec_per_hour); @@ -769,7 +775,7 @@ void do_probgen_pct(const TCGenVxOpt &vx_opt, } // Store pair info - pgi.add(model_pa.prob_gen(i), j, is_event); + pgi.add(model_pa.prob_gen(i), j, bgi, is_event); } // end for j } // end for i @@ -780,9 +786,9 @@ void do_probgen_pct(const TCGenVxOpt &vx_opt, //////////////////////////////////////////////////////////////////////// -int find_genesis_match(const GenesisInfo &fcst_gi, +int find_genesis_match(const GenesisInfo &fcst_gi, const GenesisInfoArray &bga, - const TrackInfoArray &ota, + const TrackInfoArray &ota, bool point2track, double rad, int beg, int end) { int i, j, i_best, i_oper; @@ -868,11 +874,11 @@ int find_genesis_match(const GenesisInfo &fcst_gi, //////////////////////////////////////////////////////////////////////// -void find_probgen_match(ProbGenInfo &prob_gi, - const GenesisInfoArray &bga, - const TrackInfoArray &ota, - bool point2track, double rad, - int beg, int end) { +int find_probgen_match(const ProbGenInfo &prob_gi, + const GenesisInfoArray &bga, + const TrackInfoArray &ota, + bool point2track, double rad, + int beg, int end) { int i, j, i_best, i_oper; ConcatString case_cs; @@ -950,11 +956,7 @@ void find_probgen_match(ProbGenInfo &prob_gi, << " has NO MATCH in the BEST or operational tracks.\n"; } - // Store a pointer to the match - if(!is_bad_data(i_best)) prob_gi.set_best_gen(&bga[i_best]); - else prob_gi.set_best_gen((GenesisInfo *) 0); - - return; + return(i_best); } @@ -1903,11 +1905,11 @@ void write_pct_genmpr_row(StatHdrColumns &shc, shc.set_alpha(bad_data_double); // Write a line for each matched pair - for(i=0; ibest_gen(); + const ProbGenInfo *fgi = pgi.FcstGenMap[lead_hr][i]; + const GenesisInfo *bgi = pgi.BestGenMap[lead_hr][i]; // Store timing info shc.set_fcst_lead_sec(fgi->genesis_lead()); @@ -1949,9 +1951,10 @@ void write_pct_genmpr_row(StatHdrColumns &shc, AsciiTable &at, int r, int c) { // Pointers for current case - const ProbGenInfo *fgi = pgi.PGIMap[lead_hr][index]; - const GenesisInfo *bgi = fgi->best_gen(); - int i_prob = pgi.IdxMap[lead_hr][index]; + const ProbGenInfo *fgi = pgi.FcstGenMap[lead_hr][index]; + const GenesisInfo *bgi = pgi.BestGenMap[lead_hr][index]; + + int i_prob = pgi.FcstIdxMap[lead_hr][index]; // // Genesis Matched Pairs (GENMPR): @@ -1965,7 +1968,7 @@ void write_pct_genmpr_row(StatHdrColumns &shc, // at.set_entry(r, c+0, // Total number of pairs - (int) pgi.PGIMap[lead_hr].size()); + (int) pgi.FcstGenMap[lead_hr].size()); at.set_entry(r, c+1, // Index of current pair index+1); @@ -2016,7 +2019,7 @@ void write_pct_genmpr_row(StatHdrColumns &shc, na_str); at.set_entry(r, c+17, // Operational category - (pgi.EvtMap[lead_hr][index] ? "FY_OY" : "FY_ON" )); + (pgi.BestEvtMap[lead_hr][index] ? "FYOY" : "FYON" )); return; } diff --git a/met/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc b/met/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc index d32528073b..0592c667b4 100644 --- a/met/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc +++ b/met/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc @@ -1246,9 +1246,10 @@ void ProbGenPCTInfo::clear() { BestBeg = BestEnd = (unixtime) 0; PCTMap.clear(); - PGIMap.clear(); - IdxMap.clear(); - EvtMap.clear(); + FcstGenMap.clear(); + FcstIdxMap.clear(); + BestGenMap.clear(); + BestEvtMap.clear(); VxOpt = (const TCGenVxOpt *) 0; LeadTimes.clear(); @@ -1275,45 +1276,51 @@ void ProbGenPCTInfo::set_vx_opt(const TCGenVxOpt *vx_opt) { //////////////////////////////////////////////////////////////////////// -void ProbGenPCTInfo::add(const ProbGenInfo &pgi, int index, bool is_event) { +void ProbGenPCTInfo::add(const ProbGenInfo &fgi, int index, + const GenesisInfo *bgi, bool is_event) { int i; + unixtime ut; // Store the model name - if(Model.empty()) Model = pgi.technique(); + if(Model.empty()) Model = fgi.technique(); // Track the range of forecast initalization times - if(InitBeg == 0 || InitBeg > pgi.init()) InitBeg = pgi.init(); - if(InitEnd == 0 || InitEnd < pgi.init()) InitEnd = pgi.init(); + ut = fgi.init(); + if(InitBeg == 0 || InitBeg > ut) InitBeg = ut; + if(InitEnd == 0 || InitEnd < ut) InitEnd = ut; // Track the range of verifying BEST genesis events - if(pgi.best_gen()) { - unixtime ut = pgi.best_gen()->genesis_time(); + if(bgi) { + ut = bgi->genesis_time(); if(BestBeg == 0 || BestBeg > ut) BestBeg = ut; if(BestEnd == 0 || BestEnd < ut) BestEnd = ut; } // Current lead time and probability value - int lead_hr = nint(pgi.prob_item(index)); - double prob = pgi.prob(index) / 100.0; + int lead_hr = nint(fgi.prob_item(index)); + double prob = fgi.prob(index) / 100.0; // Add new map entries, if needed if(!LeadTimes.has(lead_hr)) { LeadTimes.add(lead_hr); - vector empty_pgi; + vector empty_fgi; vector empty_idx; + vector empty_bgi; vector empty_evt; - PCTMap[lead_hr] = DefaultPCT; - PGIMap[lead_hr] = empty_pgi; - IdxMap[lead_hr] = empty_idx; - EvtMap[lead_hr] = empty_evt; + PCTMap [lead_hr] = DefaultPCT; + FcstGenMap[lead_hr] = empty_fgi; + FcstIdxMap[lead_hr] = empty_idx; + BestGenMap[lead_hr] = empty_bgi; + BestEvtMap[lead_hr] = empty_evt; } // Update map entries - PGIMap[lead_hr].push_back(&pgi); - IdxMap[lead_hr].push_back(index); - EvtMap[lead_hr].push_back(is_event); + FcstGenMap[lead_hr].push_back(&fgi); + FcstIdxMap[lead_hr].push_back(index); + BestGenMap[lead_hr].push_back(bgi); + BestEvtMap[lead_hr].push_back(is_event); // Increment counts if(is_event) PCTMap[lead_hr].pct.inc_event (prob); diff --git a/met/src/tools/tc_utils/tc_gen/tc_gen_conf_info.h b/met/src/tools/tc_utils/tc_gen/tc_gen_conf_info.h index a1cb9b5b24..fe1b3c3f57 100644 --- a/met/src/tools/tc_utils/tc_gen/tc_gen_conf_info.h +++ b/met/src/tools/tc_utils/tc_gen/tc_gen_conf_info.h @@ -340,9 +340,10 @@ class ProbGenPCTInfo { map PCTMap; // Map of lead times to vectors of pair info - map> PGIMap; - map> IdxMap; - map> EvtMap; + map> FcstGenMap; + map> FcstIdxMap; + map> BestGenMap; + map> BestEvtMap; ////////////////////////////////////////////////////////////////// @@ -350,7 +351,8 @@ class ProbGenPCTInfo { void set_vx_opt(const TCGenVxOpt *); - void add(const ProbGenInfo &, int, bool); + void add(const ProbGenInfo &, int, + const GenesisInfo *, bool); };