diff --git a/src/libcode/vx_seeps/seeps.cc b/src/libcode/vx_seeps/seeps.cc index af64edbdca..1fd500cc4e 100644 --- a/src/libcode/vx_seeps/seeps.cc +++ b/src/libcode/vx_seeps/seeps.cc @@ -102,11 +102,12 @@ void SeepsAggScore::clear() { n_obs = 0; c_odfl = c_odfh = c_olfd = c_olfh = c_ohfd = c_ohfl = 0; - s_odfl = s_odfh = s_olfd = s_olfh = s_ohfd = s_ohfl = 0.; - pv1 = pv2 = pv3 = 0.; - pf1 = pf2 = pf3 = 0.; - mean_fcst = mean_obs = bad_data_double; - weighted_score = score = bad_data_double; + s_odfl = s_odfh = s_olfd = s_olfh = s_ohfd = s_ohfl = 0.0; + pv1 = pv2 = pv3 = 0.0; + pf1 = pf2 = pf3 = 0.0; + mean_fcst = mean_fcst_wgt = bad_data_double; + mean_obs = mean_obs_wgt = bad_data_double; + score = score_wgt = bad_data_double; } @@ -152,11 +153,14 @@ SeepsAggScore & SeepsAggScore::operator+=(const SeepsAggScore &c) { pf2 = weighted_average(pf2, w1, c.pf2, w2); pf3 = weighted_average(pf3, w1, c.pf3, w2); - mean_fcst = weighted_average(mean_fcst, w1, c.mean_fcst, w2); - mean_obs = weighted_average(mean_obs, w1, c.mean_obs, w2); + mean_fcst = weighted_average(mean_fcst, w1, c.mean_fcst, w2); + mean_fcst_wgt = weighted_average(mean_fcst_wgt, w1, c.mean_fcst_wgt, w2); - score = weighted_average(score, w1, c.score, w2); - weighted_score = weighted_average(weighted_score, w1, c.weighted_score, w2); + mean_obs = weighted_average(mean_obs, w1, c.mean_obs, w2); + mean_obs_wgt = weighted_average(mean_obs_wgt, w1, c.mean_obs_wgt, w2); + + score = weighted_average(score, w1, c.score, w2); + score_wgt = weighted_average(score_wgt, w1, c.score_wgt, w2); return *this; } diff --git a/src/libcode/vx_seeps/seeps.h b/src/libcode/vx_seeps/seeps.h index f38b3e375c..46a6ac90ff 100644 --- a/src/libcode/vx_seeps/seeps.h +++ b/src/libcode/vx_seeps/seeps.h @@ -100,9 +100,11 @@ struct SeepsAggScore { // For SEEPS double pf2; double pf3; double mean_fcst; + double mean_fcst_wgt; double mean_obs; + double mean_obs_wgt; double score; - double weighted_score; + double score_wgt; }; //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_stat_out/stat_columns.cc b/src/libcode/vx_stat_out/stat_columns.cc index 4b2443f549..3a7e9a8b67 100644 --- a/src/libcode/vx_stat_out/stat_columns.cc +++ b/src/libcode/vx_stat_out/stat_columns.cc @@ -4187,10 +4187,9 @@ void write_seeps_cols(const SeepsAggScore *seeps, at.set_entry(r, c+11, seeps->pv2); // pv2 at.set_entry(r, c+12, seeps->pv3); // pv3 - at.set_entry(r, c+13, seeps->mean_fcst); // mean_fcst - at.set_entry(r, c+14, seeps->mean_obs); // mean_obs - - at.set_entry(r, c+15, (use_weighted_seeps ? seeps->weighted_score : seeps->score)); // SEEPS score/weighted score + at.set_entry(r, c+13, (use_weighted_seeps ? seeps->mean_fcst_wgt : seeps->mean_fcst)); // MEAN_FCST + at.set_entry(r, c+14, (use_weighted_seeps ? seeps->mean_obs_wgt : seeps->mean_obs)); // MEAN_OBS + at.set_entry(r, c+15, (use_weighted_seeps ? seeps->score_wgt : seeps->score)); // SEEPS return; } diff --git a/src/libcode/vx_statistics/compute_stats.cc b/src/libcode/vx_statistics/compute_stats.cc index 27c242c289..cee5b0eded 100644 --- a/src/libcode/vx_statistics/compute_stats.cc +++ b/src/libcode/vx_statistics/compute_stats.cc @@ -1429,10 +1429,10 @@ void compute_aggregated_seeps(const PairDataPoint *pd, SeepsAggScore *seeps_agg) SeepsScore *seeps_mpr = nullptr; int count, count_diagonal; int c_odfl, c_odfh, c_olfd, c_olfh, c_ohfd, c_ohfl; - double score_sum, weight_obs_sum, weight_fcst_sum, obs_sum, fcst_sum; + double score_sum, obs_sum_wgt, fcst_sum_wgt, obs_sum, fcst_sum; vector seeps_mprs; - score_sum = obs_sum = weight_obs_sum = fcst_sum = weight_fcst_sum = 0.0; + score_sum = obs_sum = obs_sum_wgt = fcst_sum = fcst_sum_wgt = 0.; count = count_diagonal = c_odfl = c_odfh = c_olfd = c_olfh = c_ohfd = c_ohfl = 0; for(int i=0; in_obs; i++) { if (i >= pd->seeps_mpr.size()) break; @@ -1464,25 +1464,26 @@ void compute_aggregated_seeps(const PairDataPoint *pd, SeepsAggScore *seeps_agg) vector density_vector; double pvf[SEEPS_MATRIX_SIZE]; double svf[SEEPS_MATRIX_SIZE]; - double weighted_score, weight_sum, weight[count]; + double score_sum_wgt, weight_sum, weight[count]; mlog << Debug(9) << method_name << "Categories c_odfl, c_odfh, c_olfd, c_ohfd, c_ohfl => " << c_odfl << " " << c_odfh << " " << c_olfd << " " << c_olfh << " " << c_ohfd << " " << c_ohfl << "\n"; + // Unweighted means seeps_agg->n_obs = count; seeps_agg->mean_fcst = fcst_sum / count; seeps_agg->mean_obs = obs_sum / count; seeps_agg->score = score_sum / count; mlog << Debug(9) << method_name - << "mean_fcst, mean_obs, mean_seeps => " + << "unweighted mean_fcst, mean_obs, mean_seeps => " << seeps_agg->mean_fcst << " " << seeps_agg->mean_obs << " " << seeps_agg->score << "\n"; - weighted_score = 0.; + score_sum_wgt = 0.; for (int i=0; i " << i << " " << seeps_mpr->score << " " << weight[i] << " " << seeps_mpr->s_idx << "\n"; - weighted_score += seeps_mpr->score * weight[i]; - weight_obs_sum += pd->o_na[i] * weight[i]; - weight_fcst_sum += pd->f_na[i] * weight[i]; + score_sum_wgt += seeps_mpr->score * weight[i]; + obs_sum_wgt += pd->o_na[i] * weight[i]; + fcst_sum_wgt += pd->f_na[i] * weight[i]; mlog << Debug(9) << method_name - << "weighted_score (seeps_mpr*weight) => " - << weighted_score << "\n"; + << "score_sum_wgt (seeps_mpr*weight) => " + << score_sum_wgt << "\n"; //IDL: svf(cat{i)) = svf(cat{i)) + c(4+cat(i) * w{i) //IDL: pvf(cat{i)) = pvf(cat{i)) + w{i) pvf[seeps_mpr->s_idx] += weight[i]; @@ -1536,10 +1537,7 @@ void compute_aggregated_seeps(const PairDataPoint *pd, SeepsAggScore *seeps_agg) } density_vector.clear(); - seeps_mprs.clear(); - seeps_agg->mean_obs = weight_obs_sum; - seeps_agg->mean_fcst = weight_fcst_sum; // The weight for odfl to ohfl come from climo file seeps_agg->pv1 = pvf[0] + pvf[3] + pvf[6]; // sum by column for obs @@ -1548,16 +1546,18 @@ void compute_aggregated_seeps(const PairDataPoint *pd, SeepsAggScore *seeps_agg) seeps_agg->pf1 = pvf[0] + pvf[1] + pvf[2]; // sum by row for forecast seeps_agg->pf2 = pvf[3] + pvf[4] + pvf[5]; // sum by row for forecast seeps_agg->pf3 = pvf[6] + pvf[7] + pvf[8]; // sum by row for forecast - seeps_agg->s_odfl = svf[3]; - seeps_agg->s_odfh = svf[6]; - seeps_agg->s_olfd = svf[1]; - seeps_agg->s_olfh = svf[7]; - seeps_agg->s_ohfd = svf[2]; - seeps_agg->s_ohfl = svf[5]; - seeps_agg->weighted_score = weighted_score; + seeps_agg->s_odfl = (is_eq(svf[3], 0.0) ? 0.0 : svf[3]); + seeps_agg->s_odfh = (is_eq(svf[6], 0.0) ? 0.0 : svf[6]); + seeps_agg->s_olfd = (is_eq(svf[1], 0.0) ? 0.0 : svf[1]); + seeps_agg->s_olfh = (is_eq(svf[7], 0.0) ? 0.0 : svf[7]); + seeps_agg->s_ohfd = (is_eq(svf[2], 0.0) ? 0.0 : svf[2]); + seeps_agg->s_ohfl = (is_eq(svf[5], 0.0) ? 0.0 : svf[5]); + seeps_agg->mean_fcst = fcst_sum_wgt; + seeps_agg->mean_obs = obs_sum_wgt; + seeps_agg->score_wgt = score_sum_wgt; mlog << Debug(7) << method_name - << "SEEPS score=" << seeps_agg->score << " weighted_score=" << weighted_score + << "SEEPS score=" << seeps_agg->score << " score_wgt=" << seeps_agg->score_wgt << " pv1=" << seeps_agg->pv1 << " pv2=" << seeps_agg->pv2 << " pv3=" << seeps_agg->pv3 << " pf1=" << seeps_agg->pf1 << " pf2=" << seeps_agg->pf2 << " pf3=" << seeps_agg->pf3 << "\n"; @@ -1693,7 +1693,7 @@ void compute_aggregated_seeps_grid(const DataPlane &fcst_dp, const DataPlane &ob << dp_size << " " << nan_count << " " << bad_count << "\n"; int cell_count = dp_size - nan_count - bad_count; if (cell_count > 0) { - seeps_agg->weighted_score = seeps_score_sum/cell_count; + seeps_agg->score_wgt = seeps_score_sum/cell_count; for (int i=0; ic_ohfl = c_ohfl; if (seeps_count > 0) { - seeps_agg->mean_fcst = fcst_sum / seeps_count; - seeps_agg->mean_obs = obs_sum / seeps_count; - seeps_agg->pv1 = pvf[0] + pvf[3] + pvf[6]; // sum by column for obs seeps_agg->pv2 = pvf[1] + pvf[4] + pvf[7]; // sum by column for obs seeps_agg->pv3 = pvf[2] + pvf[5] + pvf[8]; // sum by column for obs seeps_agg->pf1 = pvf[0] + pvf[1] + pvf[2]; // sum by row for forecast seeps_agg->pf2 = pvf[3] + pvf[4] + pvf[5]; // sum by row for forecast seeps_agg->pf3 = pvf[6] + pvf[7] + pvf[8]; // sum by row for forecast - seeps_agg->s_odfl = svf[3]; - seeps_agg->s_odfh = svf[6]; - seeps_agg->s_olfd = svf[1]; - seeps_agg->s_olfh = svf[7]; - seeps_agg->s_ohfd = svf[2]; - seeps_agg->s_ohfl = svf[5]; - seeps_agg->score = seeps_score_sum / seeps_count; + + seeps_agg->s_odfl = (is_eq(svf[3], 0.0) ? 0.0 : svf[3]); + seeps_agg->s_odfh = (is_eq(svf[6], 0.0) ? 0.0 : svf[6]); + seeps_agg->s_olfd = (is_eq(svf[1], 0.0) ? 0.0 : svf[1]); + seeps_agg->s_olfh = (is_eq(svf[7], 0.0) ? 0.0 : svf[7]); + seeps_agg->s_ohfd = (is_eq(svf[2], 0.0) ? 0.0 : svf[2]); + seeps_agg->s_ohfl = (is_eq(svf[5], 0.0) ? 0.0 : svf[5]); + + seeps_agg->mean_fcst = fcst_sum / seeps_count; + seeps_agg->mean_obs = obs_sum / seeps_count; + seeps_agg->score = seeps_score_sum / seeps_count; } mlog << Debug(6) << method_name << "SEEPS score=" << seeps_agg->score - << " weighted_score=" << seeps_agg->weighted_score + << " score_wgt=" << seeps_agg->score_wgt << " pv1=" << seeps_agg->pv1 << " pv2=" << seeps_agg->pv2 << " pv3=" << seeps_agg->pv3 << " pf1=" << seeps_agg->pf1 << " pf2=" << seeps_agg->pf2 << " pf3=" << seeps_agg->pf3 << "\n"; diff --git a/src/tools/core/stat_analysis/parse_stat_line.cc b/src/tools/core/stat_analysis/parse_stat_line.cc index d66b3e819e..81b7fdc5f1 100644 --- a/src/tools/core/stat_analysis/parse_stat_line.cc +++ b/src/tools/core/stat_analysis/parse_stat_line.cc @@ -615,11 +615,12 @@ void parse_seeps_line(STATLine &l, SeepsAggScore &agg_score) { agg_score.pv2 = atof(l.get_item("PV2")); agg_score.pv3 = atof(l.get_item("PV3")); - agg_score.mean_fcst = atof(l.get_item("MEAN_FCST")); - agg_score.mean_obs = atof(l.get_item("MEAN_OBS")); - - agg_score.score = atof(l.get_item("SEEPS")); - agg_score.weighted_score = agg_score.score; + agg_score.mean_fcst = atof(l.get_item("MEAN_FCST")); + agg_score.mean_fcst_wgt = agg_score.mean_fcst; + agg_score.mean_obs = atof(l.get_item("MEAN_OBS")); + agg_score.mean_obs_wgt = agg_score.mean_fcst; + agg_score.score = atof(l.get_item("SEEPS")); + agg_score.score_wgt = agg_score.score; return; }