diff --git a/src/libcode/vx_stat_out/stat_columns.cc b/src/libcode/vx_stat_out/stat_columns.cc index e5ce2f5f6e..f78db442c0 100644 --- a/src/libcode/vx_stat_out/stat_columns.cc +++ b/src/libcode/vx_stat_out/stat_columns.cc @@ -101,19 +101,19 @@ ConcatString append_climo_bin(const ConcatString &mask_name, void write_header_row(const char * const * cols, int n_cols, int hdr_flag, AsciiTable &at, int r, int c) { - int i; // Write the header column names if requested if(hdr_flag) { - for(i=0; in_obs; i++) { + for(int i=0; in_obs; i++) { // Set the observation valid time shc.set_obs_valid_beg(pd_ptr->vld_ta[i]); @@ -1700,7 +1699,6 @@ void write_isc_row(StatHdrColumns &shc, const ISCInfo &isc_info, STATOutputType out_type, AsciiTable &stat_at, int &stat_row, AsciiTable &txt_at, int &txt_row) { - int i; // ISC line type shc.set_line_type(stat_isc_str); @@ -1714,7 +1712,7 @@ void write_isc_row(StatHdrColumns &shc, const ISCInfo &isc_info, // Write a line for each scale plus one for the thresholded binary // field and one for the father wavelet - for(i=-1; i<=isc_info.n_scale; i++) { + for(int i=-1; i<=isc_info.n_scale; i++) { // Write the header columns write_header_cols(shc, stat_at, stat_row); @@ -1902,7 +1900,6 @@ void write_orank_row(StatHdrColumns &shc, const PairDataEnsemble *pd_ptr, STATOutputType out_type, AsciiTable &stat_at, int &stat_row, AsciiTable &txt_at, int &txt_row) { - int i; // Observation Rank line type shc.set_line_type(stat_orank_str); @@ -1914,7 +1911,7 @@ void write_orank_row(StatHdrColumns &shc, const PairDataEnsemble *pd_ptr, shc.set_alpha(bad_data_double); // Write a line for each ensemble pair - for(i=0; in_obs; i++) { + for(int i=0; in_obs; i++) { // Set the observation valid time shc.set_obs_valid_beg(pd_ptr->vld_ta[i]); @@ -1947,7 +1944,6 @@ void write_ssvar_row(StatHdrColumns &shc, const PairDataEnsemble *pd_ptr, double alpha, STATOutputType out_type, AsciiTable &stat_at, int &stat_row, AsciiTable &txt_at, int &txt_row) { - int i; // SSVAR line type shc.set_line_type(stat_ssvar_str); @@ -1961,7 +1957,7 @@ void write_ssvar_row(StatHdrColumns &shc, const PairDataEnsemble *pd_ptr, shc.set_alpha(alpha); // Write a line for each ssvar bin - for(i=0; issvar_bins[0].n_bin; i++) { + for(int i=0; issvar_bins[0].n_bin; i++) { // Write the header columns write_header_cols(shc, stat_at, stat_row); @@ -2805,7 +2801,7 @@ void write_cnt_cols(const CNTInfo &cnt_info, int i, void write_mctc_cols(const MCTSInfo &mcts_info, AsciiTable &at, int r, int c) { - int i, j, col; + int col; // // Multi-Category Contingency Table Counts @@ -2821,8 +2817,8 @@ void write_mctc_cols(const MCTSInfo &mcts_info, // // Loop through the contingency table rows and columns // - for(i=0, col=c+2; irhist_na.n_elements(); i++) { + for(int i=0, col=c+2; irhist_na.n_elements(); i++) { at.set_entry(r, col, // RANK_i nint(pd_ptr->rhist_na[i])); @@ -4481,7 +4477,7 @@ void write_rhist_cols(const PairDataEnsemble *pd_ptr, void write_phist_cols(const PairDataEnsemble *pd_ptr, AsciiTable &at, int r, int c) { - int i, col; + int col; // // Probability Integral Transform Histogram @@ -4500,7 +4496,7 @@ void write_phist_cols(const PairDataEnsemble *pd_ptr, // // Write BIN_i count for each bin // - for(i=0, col=c+3; iphist_na.n_elements(); i++) { + for(int i=0, col=c+3; iphist_na.n_elements(); i++) { at.set_entry(r, col, // BIN_i nint(pd_ptr->phist_na[i])); @@ -4514,7 +4510,7 @@ void write_phist_cols(const PairDataEnsemble *pd_ptr, void write_orank_cols(const PairDataEnsemble *pd_ptr, int i, AsciiTable &at, int r, int c) { - int j, col; + int col; // // Ensemble Observation Rank Matched Pairs @@ -4568,7 +4564,7 @@ void write_orank_cols(const PairDataEnsemble *pd_ptr, int i, // // Write ENS_j for each ensemble member // - for(j=0, col=c+12; jn_ens; j++) { + for(int j=0, col=c+12; jn_ens; j++) { at.set_entry(r, col, // ENS_j pd_ptr->e_na[j][i]); @@ -4762,7 +4758,7 @@ void write_ssvar_cols(const PairDataEnsemble *pd_ptr, int i, void write_relp_cols(const PairDataEnsemble *pd_ptr, AsciiTable &at, int r, int c) { - int i, col; + int col; // // Relative Position @@ -4778,7 +4774,7 @@ void write_relp_cols(const PairDataEnsemble *pd_ptr, // // Write RELP_i count for each bin // - for(i=0, col=c+2; irelp_na.n_elements(); i++) { + for(int i=0, col=c+2; irelp_na.n_elements(); i++) { at.set_entry(r, col, // RELP_i pd_ptr->relp_na[i]); diff --git a/src/libcode/vx_statistics/compute_ci.cc b/src/libcode/vx_statistics/compute_ci.cc index 8296cc5d76..3633d61acb 100644 --- a/src/libcode/vx_statistics/compute_ci.cc +++ b/src/libcode/vx_statistics/compute_ci.cc @@ -61,14 +61,14 @@ void compute_normal_ci(double v, double alpha, double se, // //////////////////////////////////////////////////////////////////////// -void compute_proportion_ci(double p, int n, double alpha, double vif, +void compute_proportion_ci(double p, int n_pairs, double alpha, double vif, double &p_cl, double &p_cu) { // // Compute the confidence interval using the Wilson method for all // sizes of n, since it provides a better approximation // - compute_wilson_ci(p, n, alpha, vif, p_cl, p_cu); + compute_wilson_ci(p, n_pairs, alpha, vif, p_cl, p_cu); return; } @@ -81,7 +81,7 @@ void compute_proportion_ci(double p, int n, double alpha, double vif, // //////////////////////////////////////////////////////////////////////// -void compute_wald_ci(double p, int n, double alpha, double vif, +void compute_wald_ci(double p, int n_pairs, double alpha, double vif, double &p_cl, double &p_cu) { double v, cv_normal_l, cv_normal_u; @@ -100,7 +100,7 @@ void compute_wald_ci(double p, int n, double alpha, double vif, // // Compute the upper and lower bounds of the confidence interval // - v = vif*p*(1.0-p)/n; + v = vif*p*(1.0-p)/n_pairs; if(v < 0.0) { p_cl = bad_data_double; @@ -122,10 +122,10 @@ void compute_wald_ci(double p, int n, double alpha, double vif, // //////////////////////////////////////////////////////////////////////// -void compute_wilson_ci(double p, int n_int, double alpha, double vif, +void compute_wilson_ci(double p, int n_pairs, double alpha, double vif, double &p_cl, double &p_cu) { double v, cv_normal_l, cv_normal_u; - long long n = n_int; + long long n = n_pairs; if(is_bad_data(p)) { p_cl = p_cu = bad_data_double; diff --git a/src/libcode/vx_statistics/compute_ci.h b/src/libcode/vx_statistics/compute_ci.h index ddaf68d36a..5617ced8f3 100644 --- a/src/libcode/vx_statistics/compute_ci.h +++ b/src/libcode/vx_statistics/compute_ci.h @@ -28,13 +28,13 @@ static const int wald_sample_threshold = 100; extern void compute_normal_ci(double x, double alpha, double se, double &cl, double &cu); -extern void compute_proportion_ci(double p, int n, double alpha, +extern void compute_proportion_ci(double p, int n_pairs, double alpha, double vif, double &p_cl, double &p_cu); -extern void compute_wald_ci(double p, int n, double alpha, +extern void compute_wald_ci(double p, int n_pairs, double alpha, double vif, double &p_cl, double &p_cu); -extern void compute_wilson_ci(double p, int n, double alpha, +extern void compute_wilson_ci(double p, int n_pairs, double alpha, double vif, double &p_cl, double &p_cu); extern void compute_woolf_ci(double odds, double alpha, diff --git a/src/libcode/vx_statistics/contable.h b/src/libcode/vx_statistics/contable.h index bce3ad20fc..27e054c73a 100644 --- a/src/libcode/vx_statistics/contable.h +++ b/src/libcode/vx_statistics/contable.h @@ -31,7 +31,10 @@ class TTContingencyTable; class ContingencyTable { - protected: + friend class TTContingencyTable; + friend class Nx2ContingencyTable; + + private: void init_from_scratch(); diff --git a/src/libcode/vx_statistics/contable_stats.cc b/src/libcode/vx_statistics/contable_stats.cc index 5fca124ad2..9cf18107d3 100644 --- a/src/libcode/vx_statistics/contable_stats.cc +++ b/src/libcode/vx_statistics/contable_stats.cc @@ -41,7 +41,7 @@ double TTContingencyTable::baser_ci(double alpha, v = baser(); - compute_proportion_ci(v, total(), alpha, 1.0, cl, cu); + compute_proportion_ci(v, Npairs, alpha, 1.0, cl, cu); return v; } @@ -60,7 +60,7 @@ double TTContingencyTable::fmean_ci(double alpha, v = fmean(); - compute_proportion_ci(v, total(), alpha, 1.0, cl, cu); + compute_proportion_ci(v, Npairs, alpha, 1.0, cl, cu); return v; } @@ -79,7 +79,7 @@ double TTContingencyTable::accuracy_ci(double alpha, v = accuracy(); - compute_proportion_ci(v, total(), alpha, 1.0, cl, cu); + compute_proportion_ci(v, Npairs, alpha, 1.0, cl, cu); return v; } @@ -112,7 +112,7 @@ double TTContingencyTable::pod_yes_ci(double alpha, v = pod_yes(); - compute_proportion_ci(v, total(), alpha, 1.0, cl, cu); + compute_proportion_ci(v, Npairs, alpha, 1.0, cl, cu); return v; } @@ -131,7 +131,7 @@ double TTContingencyTable::pod_no_ci(double alpha, v = pod_no(); - compute_proportion_ci(v, total(), alpha, 1.0, cl, cu); + compute_proportion_ci(v, Npairs, alpha, 1.0, cl, cu); return v; } @@ -157,7 +157,7 @@ double TTContingencyTable::pofd_ci(double alpha, v = pofd(); - compute_proportion_ci(v, total(), alpha, 1.0, cl, cu); + compute_proportion_ci(v, Npairs, alpha, 1.0, cl, cu); return v; } @@ -180,7 +180,7 @@ double TTContingencyTable::far_ci(double alpha, v = far(); - compute_proportion_ci(v, total(), alpha, 1.0, cl, cu); + compute_proportion_ci(v, Npairs, alpha, 1.0, cl, cu); return v; } @@ -203,7 +203,7 @@ double TTContingencyTable::csi_ci(double alpha, v = csi(); - compute_proportion_ci(v, total(), alpha, 1.0, cl, cu); + compute_proportion_ci(v, Npairs, alpha, 1.0, cl, cu); return v; } diff --git a/src/libcode/vx_statistics/met_stats.cc b/src/libcode/vx_statistics/met_stats.cc index f40827f606..c1e88d28de 100644 --- a/src/libcode/vx_statistics/met_stats.cc +++ b/src/libcode/vx_statistics/met_stats.cc @@ -380,21 +380,21 @@ void CTSInfo::compute_ci() { // Compute confidence intervals for the scores based on // proportions // - compute_proportion_ci(baser.v, cts.total(), alpha[i], baser.vif, + compute_proportion_ci(baser.v, cts.n_pairs(), alpha[i], baser.vif, baser.v_ncl[i], baser.v_ncu[i]); - compute_proportion_ci(fmean.v, cts.total(), alpha[i], fmean.vif, + compute_proportion_ci(fmean.v, cts.n_pairs(), alpha[i], fmean.vif, fmean.v_ncl[i], fmean.v_ncu[i]); - compute_proportion_ci(acc.v, cts.total(), alpha[i], acc.vif, + compute_proportion_ci(acc.v, cts.n_pairs(), alpha[i], acc.vif, acc.v_ncl[i], acc.v_ncu[i]); - compute_proportion_ci(pody.v, cts.total(), alpha[i], pody.vif, + compute_proportion_ci(pody.v, cts.n_pairs(), alpha[i], pody.vif, pody.v_ncl[i], pody.v_ncu[i]); - compute_proportion_ci(podn.v, cts.total(), alpha[i], podn.vif, + compute_proportion_ci(podn.v, cts.n_pairs(), alpha[i], podn.vif, podn.v_ncl[i], podn.v_ncu[i]); - compute_proportion_ci(pofd.v, cts.total(), alpha[i], pofd.vif, + compute_proportion_ci(pofd.v, cts.n_pairs(), alpha[i], pofd.vif, pofd.v_ncl[i], pofd.v_ncu[i]); - compute_proportion_ci(far.v, cts.total(), alpha[i], far.vif, + compute_proportion_ci(far.v, cts.n_pairs(), alpha[i], far.vif, far.v_ncl[i], far.v_ncu[i]); - compute_proportion_ci(csi.v, cts.total(), alpha[i], csi.vif, + compute_proportion_ci(csi.v, cts.n_pairs(), alpha[i], csi.vif, csi.v_ncl[i], csi.v_ncu[i]); // @@ -814,7 +814,7 @@ void MCTSInfo::compute_ci() { // Compute confidence intervals for the scores based on // proportions // - compute_proportion_ci(acc.v, cts.total(), alpha[i], acc.vif, + compute_proportion_ci(acc.v, cts.n_pairs(), alpha[i], acc.vif, acc.v_ncl[i], acc.v_ncu[i]); } // end for i @@ -3293,7 +3293,7 @@ void PCTInfo::compute_ci() { // for(i=0; i::iterator it; // @@ -860,7 +862,7 @@ void aggr_ctc_lines(LineDataFile &f, STATAnalysisJob &job, // // Build the map key for the current line // - key = job.get_case_info(line); + ConcatString key(job.get_case_info(line)); // // Add a new map entry, if necessary @@ -964,7 +966,8 @@ void aggr_ctc_lines(LineDataFile &f, STATAnalysisJob &job, // // Sort the valid times // - n = it->second.valid_ts.rank_array(n_ties); + int n_ties; + int n = it->second.valid_ts.rank_array(n_ties); if(n_ties > 0 || n != it->second.valid_ts.n()) { mlog << Error << "\naggr_ctc_lines() -> " @@ -1012,9 +1015,7 @@ void aggr_mctc_lines(LineDataFile &f, STATAnalysisJob &job, STATLine line; AggrMCTCInfo aggr; MCTSInfo cur; - ConcatString key; unixtime ut; - int i, k, n, n_ties; map::iterator it; // @@ -1049,7 +1050,7 @@ void aggr_mctc_lines(LineDataFile &f, STATAnalysisJob &job, // // Build the map key for the current line // - key = job.get_case_info(line); + ConcatString key(job.get_case_info(line)); // // Add a new map entry, if necessary @@ -1086,8 +1087,8 @@ void aggr_mctc_lines(LineDataFile &f, STATAnalysisJob &job, // // Increment the counts // - for(i=0; isecond.valid_ts.rank_array(n_ties); + int n_ties; + int n = it->second.valid_ts.rank_array(n_ties); if(n_ties > 0 || n != it->second.valid_ts.n()) { mlog << Error << "\naggr_mctc_lines() -> " @@ -1192,9 +1194,7 @@ void aggr_pct_lines(LineDataFile &f, STATAnalysisJob &job, STATLine line; AggrPCTInfo aggr; PCTInfo cur; - ConcatString key; unixtime ut; - int i, n, n_ties; map::iterator it; // @@ -1229,7 +1229,7 @@ void aggr_pct_lines(LineDataFile &f, STATAnalysisJob &job, // // Build the map key for the current line // - key = job.get_case_info(line); + ConcatString key(job.get_case_info(line)); // // Add a new map entry, if necessary @@ -1318,7 +1318,8 @@ void aggr_pct_lines(LineDataFile &f, STATAnalysisJob &job, // // Sort the valid times // - n = it->second.valid_ts.rank_array(n_ties); + int n_ties; + int n = it->second.valid_ts.rank_array(n_ties); if(n_ties > 0 || n != it->second.valid_ts.n()) { mlog << Error << "\naggr_pct_lines() -> " @@ -1355,9 +1356,7 @@ void aggr_psum_lines(LineDataFile &f, STATAnalysisJob &job, VL1L2Info cur_vl1l2; NBRCNTInfo cur_nbrcnt; CNTInfo cur_cnt; - ConcatString key; unixtime ut; - int n, n_ties; map::iterator it; // @@ -1423,7 +1422,7 @@ void aggr_psum_lines(LineDataFile &f, STATAnalysisJob &job, // // Build the map key for the current line // - key = job.get_case_info(line); + ConcatString key(job.get_case_info(line)); // // Add a new map entry, if necessary @@ -1519,7 +1518,8 @@ void aggr_psum_lines(LineDataFile &f, STATAnalysisJob &job, // // Sort the valid times // - n = it->second.valid_ts.rank_array(n_ties); + int n_ties; + int n = it->second.valid_ts.rank_array(n_ties); if(n_ties > 0 || n != it->second.valid_ts.n()) { mlog << Error << "\naggr_psum_lines() -> " @@ -1555,7 +1555,6 @@ void aggr_grad_lines(LineDataFile &f, STATAnalysisJob &job, STATLine line; AggrGRADInfo aggr; GRADInfo cur; - ConcatString key; map::iterator it; // @@ -1586,7 +1585,7 @@ void aggr_grad_lines(LineDataFile &f, STATAnalysisJob &job, // // Build the map key for the current line // - key = job.get_case_info(line); + ConcatString key(job.get_case_info(line)); // // Add a new map entry, if necessary @@ -1645,8 +1644,10 @@ void aggr_wind_lines(LineDataFile &f, STATAnalysisJob &job, STATLine line; AggrWindInfo aggr; VL1L2Info cur; - ConcatString key; - double uf, vf, uo, vo; + double uf; + double vf; + double uo; + double vo; // // Process the STAT lines @@ -1701,7 +1702,7 @@ void aggr_wind_lines(LineDataFile &f, STATAnalysisJob &job, // // Build the map key for the current line // - key = job.get_case_info(line); + ConcatString key(job.get_case_info(line)); // // Add a new map entry, if necessary @@ -1751,14 +1752,7 @@ void aggr_mpr_wind_lines(LineDataFile &f, STATAnalysisJob &job, AggrWindInfo aggr; VL1L2Info v_info; MPRData cur; - ConcatString hdr, key; - double uf, uo, ufcmn, ufcsd, uocmn, uocsd; - double vf, vo, vfcmn, vfcsd, vocmn, vocsd; - double fcst_wind, obs_wind; - double fcmn_wind, fcsd_wind; - double ocmn_wind, ocsd_wind; - bool is_ugrd; - int i; + ConcatString hdr; map::iterator it; // @@ -1775,19 +1769,19 @@ void aggr_mpr_wind_lines(LineDataFile &f, STATAnalysisJob &job, job.dump_stat_line(line); parse_mpr_line(line, cur); - is_ugrd = (cur.fcst_var == ugrd_abbr_str); - uf = (is_ugrd ? cur.fcst : bad_data_double); - uo = (is_ugrd ? cur.obs : bad_data_double); - ufcmn = (is_ugrd ? cur.fcst_climo_mean : bad_data_double); - ufcsd = (is_ugrd ? cur.fcst_climo_stdev : bad_data_double); - uocmn = (is_ugrd ? cur.obs_climo_mean : bad_data_double); - uocsd = (is_ugrd ? cur.obs_climo_stdev : bad_data_double); - vf = (is_ugrd ? bad_data_double : cur.fcst); - vo = (is_ugrd ? bad_data_double : cur.obs); - vfcmn = (is_ugrd ? bad_data_double : cur.fcst_climo_mean); - vfcsd = (is_ugrd ? bad_data_double : cur.fcst_climo_stdev); - vocmn = (is_ugrd ? bad_data_double : cur.obs_climo_mean); - vocsd = (is_ugrd ? bad_data_double : cur.obs_climo_stdev); + bool is_ugrd = (cur.fcst_var == ugrd_abbr_str); + double uf = (is_ugrd ? cur.fcst : bad_data_double); + double uo = (is_ugrd ? cur.obs : bad_data_double); + double ufcmn = (is_ugrd ? cur.fcst_climo_mean : bad_data_double); + double ufcsd = (is_ugrd ? cur.fcst_climo_stdev : bad_data_double); + double uocmn = (is_ugrd ? cur.obs_climo_mean : bad_data_double); + double uocsd = (is_ugrd ? cur.obs_climo_stdev : bad_data_double); + double vf = (is_ugrd ? bad_data_double : cur.fcst); + double vo = (is_ugrd ? bad_data_double : cur.obs); + double vfcmn = (is_ugrd ? bad_data_double : cur.fcst_climo_mean); + double vfcsd = (is_ugrd ? bad_data_double : cur.fcst_climo_stdev); + double vocmn = (is_ugrd ? bad_data_double : cur.obs_climo_mean); + double vocsd = (is_ugrd ? bad_data_double : cur.obs_climo_stdev); // // Build header string for matching UGRD and VGRD lines @@ -1816,7 +1810,7 @@ void aggr_mpr_wind_lines(LineDataFile &f, STATAnalysisJob &job, // // Build the map key for the current line // - key = job.get_case_info(line); + ConcatString key(job.get_case_info(line)); // // Add a new map entry, if necessary @@ -1863,6 +1857,7 @@ void aggr_mpr_wind_lines(LineDataFile &f, STATAnalysisJob &job, // // Add data for existing header entry // + int i; if(m[key].hdr_sa.has(hdr, i)) { // @@ -1945,7 +1940,7 @@ void aggr_mpr_wind_lines(LineDataFile &f, STATAnalysisJob &job, // // Loop over the pairs for the current map entry // - for(i=0; isecond.hdr_sa.n(); i++) { + for(int i=0; isecond.hdr_sa.n(); i++) { // // Check for missing UGRD data @@ -1976,18 +1971,18 @@ void aggr_mpr_wind_lines(LineDataFile &f, STATAnalysisJob &job, job.out_obs_wind_thresh.get_type() != thresh_na) { // Compute wind speeds - fcst_wind = convert_u_v_to_wind(it->second.pd_u.f_na[i], - it->second.pd_v.f_na[i]); - obs_wind = convert_u_v_to_wind(it->second.pd_u.o_na[i], - it->second.pd_v.o_na[i]); - fcmn_wind = convert_u_v_to_wind(it->second.pd_u.fcmn_na[i], - it->second.pd_v.fcmn_na[i]); - fcsd_wind = convert_u_v_to_wind(it->second.pd_u.fcsd_na[i], - it->second.pd_v.fcsd_na[i]); - ocmn_wind = convert_u_v_to_wind(it->second.pd_u.ocmn_na[i], - it->second.pd_v.ocmn_na[i]); - ocsd_wind = convert_u_v_to_wind(it->second.pd_u.ocsd_na[i], - it->second.pd_v.ocsd_na[i]); + double fcst_wind = convert_u_v_to_wind(it->second.pd_u.f_na[i], + it->second.pd_v.f_na[i]); + double obs_wind = convert_u_v_to_wind(it->second.pd_u.o_na[i], + it->second.pd_v.o_na[i]); + double fcmn_wind = convert_u_v_to_wind(it->second.pd_u.fcmn_na[i], + it->second.pd_v.fcmn_na[i]); + double fcsd_wind = convert_u_v_to_wind(it->second.pd_u.fcsd_na[i], + it->second.pd_v.fcsd_na[i]); + double ocmn_wind = convert_u_v_to_wind(it->second.pd_u.ocmn_na[i], + it->second.pd_v.ocmn_na[i]); + double ocsd_wind = convert_u_v_to_wind(it->second.pd_u.ocsd_na[i], + it->second.pd_v.ocsd_na[i]); // Store climo data ClimoPntInfo cpi(fcmn_wind, fcsd_wind, ocmn_wind, ocsd_wind); @@ -2050,8 +2045,12 @@ void aggr_mpr_wind_lines(LineDataFile &f, STATAnalysisJob &job, // ClimoPntInfo cpi; aggr.hdr_sa.add(it->second.hdr_sa[i]); + double uf; + double vf; convert_u_v_to_unit(it->second.pd_u.f_na[i], it->second.pd_v.f_na[i], uf, vf); + double uo; + double vo; convert_u_v_to_unit(it->second.pd_u.o_na[i], it->second.pd_v.o_na[i], uo, vo); aggr.pd_u.add_grid_pair(uf, uo, cpi, default_grid_weight); @@ -2075,7 +2074,6 @@ void aggr_mpr_lines(LineDataFile &f, STATAnalysisJob &job, STATLine line; AggrMPRInfo aggr; MPRData cur; - ConcatString key; // // Process the STAT lines @@ -2113,7 +2111,7 @@ void aggr_mpr_lines(LineDataFile &f, STATAnalysisJob &job, // // Build the map key for the current line // - key = job.get_case_info(line); + ConcatString key(job.get_case_info(line)); // // Add a new map entry, if necessary @@ -2204,9 +2202,8 @@ void aggr_isc_lines(LineDataFile &ldf, STATAnalysisJob &job, STATLine line; AggrISCInfo aggr; ISCInfo cur; - ConcatString key; - int i, k, iscale; - double total, w, den, baser_fbias_sum; + int iscale; + double den; map::iterator it; // @@ -2245,7 +2242,7 @@ void aggr_isc_lines(LineDataFile &ldf, STATAnalysisJob &job, // // Build the map key for the current line // - key = job.get_case_info(line); + ConcatString key(job.get_case_info(line)); // // Add a new map entry, if necessary @@ -2354,20 +2351,20 @@ void aggr_isc_lines(LineDataFile &ldf, STATAnalysisJob &job, // Get the sum of the totals, compute the weight, and sum the // weighted scores // - for(i=0; isecond.isc_info.n_scale+2; i++) { + for(int i=0; isecond.isc_info.n_scale+2; i++) { // Total number of points for this scale - total = it->second.total_na[i].sum(); + double total = it->second.total_na[i].sum(); // Initialize - baser_fbias_sum = 0.0; + double baser_fbias_sum = 0.0; // Loop through all scores for this scale - for(k=0; ksecond.total_na[i].n(); k++) { + for(int k=0; ksecond.total_na[i].n(); k++) { // Compute the weight for each score to be aggregated // based on the number of points it represents - w = it->second.total_na[i][k]/total; + double w = it->second.total_na[i][k]/total; // Sum scores for the binary fields if(i == 0) { @@ -2463,8 +2460,7 @@ void aggr_ecnt_lines(LineDataFile &f, STATAnalysisJob &job, STATLine line; AggrENSInfo aggr; ECNTData cur; - ConcatString key; - double crps_emp, crps_emp_fair, spread_md, crpscl_emp, crps_gaus, crpscl_gaus, v; + double v; map::iterator it; // @@ -2496,7 +2492,7 @@ void aggr_ecnt_lines(LineDataFile &f, STATAnalysisJob &job, // // Build the map key for the current line // - key = job.get_case_info(line); + ConcatString key(job.get_case_info(line)); // // Add a new map entry, if necessary @@ -2582,12 +2578,12 @@ void aggr_ecnt_lines(LineDataFile &f, STATAnalysisJob &job, v = it->second.mse_oerr_na.wmean(it->second.ens_pd.wgt_na); it->second.ens_pd.rmse_oerr = (is_bad_data(v) ? bad_data_double : sqrt(v)); - crps_emp = it->second.ens_pd.crps_emp_na.wmean(it->second.ens_pd.wgt_na); - crps_emp_fair = it->second.ens_pd.crps_emp_fair_na.wmean(it->second.ens_pd.wgt_na); - spread_md = it->second.ens_pd.spread_md_na.wmean(it->second.ens_pd.wgt_na); - crpscl_emp = it->second.ens_pd.crpscl_emp_na.wmean(it->second.ens_pd.wgt_na); - crps_gaus = it->second.ens_pd.crps_gaus_na.wmean(it->second.ens_pd.wgt_na); - crpscl_gaus = it->second.ens_pd.crpscl_gaus_na.wmean(it->second.ens_pd.wgt_na); + double crps_emp = it->second.ens_pd.crps_emp_na.wmean(it->second.ens_pd.wgt_na); + double crps_emp_fair = it->second.ens_pd.crps_emp_fair_na.wmean(it->second.ens_pd.wgt_na); + double spread_md = it->second.ens_pd.spread_md_na.wmean(it->second.ens_pd.wgt_na); + double crpscl_emp = it->second.ens_pd.crpscl_emp_na.wmean(it->second.ens_pd.wgt_na); + double crps_gaus = it->second.ens_pd.crps_gaus_na.wmean(it->second.ens_pd.wgt_na); + double crpscl_gaus = it->second.ens_pd.crpscl_gaus_na.wmean(it->second.ens_pd.wgt_na); // Compute aggregated empirical CRPSS it->second.ens_pd.crpss_emp = @@ -2612,7 +2608,6 @@ void aggr_rps_lines(LineDataFile &f, STATAnalysisJob &job, STATLine line; AggrRPSInfo aggr; RPSInfo cur; - ConcatString key; map::iterator it; // @@ -2647,7 +2642,7 @@ void aggr_rps_lines(LineDataFile &f, STATAnalysisJob &job, // // Build the map key for the current line // - key = job.get_case_info(line); + ConcatString key(job.get_case_info(line)); // // Add a new map entry, if necessary @@ -2706,8 +2701,6 @@ void aggr_rhist_lines(LineDataFile &f, STATAnalysisJob &job, STATLine line; AggrENSInfo aggr; RHISTData cur; - ConcatString key; - int i; map::iterator it; // @@ -2739,14 +2732,14 @@ void aggr_rhist_lines(LineDataFile &f, STATAnalysisJob &job, // // Build the map key for the current line // - key = job.get_case_info(line); + ConcatString key(job.get_case_info(line)); // // Add a new map entry, if necessary // if(m.count(key) == 0) { aggr.clear(); - for(i=0; i::iterator it; // @@ -2829,7 +2820,7 @@ void aggr_phist_lines(LineDataFile &f, STATAnalysisJob &job, // // Build the map key for the current line // - key = job.get_case_info(line); + ConcatString key(job.get_case_info(line)); // // Add a new map entry, if necessary @@ -2862,7 +2853,7 @@ void aggr_phist_lines(LineDataFile &f, STATAnalysisJob &job, // // Aggregate the probability integral transform histogram counts // - for(i=0; i::iterator it; // @@ -2920,7 +2909,7 @@ void aggr_relp_lines(LineDataFile &f, STATAnalysisJob &job, // // Build the map key for the current line // - key = job.get_case_info(line); + ConcatString key(job.get_case_info(line)); // // Add a new map entry, if necessary @@ -2952,7 +2941,7 @@ void aggr_relp_lines(LineDataFile &f, STATAnalysisJob &job, // // Aggregate the RELP histogram counts // - for(i=0; i::iterator it; // @@ -3012,7 +2998,7 @@ void aggr_orank_lines(LineDataFile &f, STATAnalysisJob &job, // // Build the map key for the current line // - key = job.get_case_info(line); + ConcatString key(job.get_case_info(line)); // // Skip missing data @@ -3029,10 +3015,10 @@ void aggr_orank_lines(LineDataFile &f, STATAnalysisJob &job, aggr.ens_pd.obs_error_flag = !is_bad_data(cur.ens_mean_oerr); aggr.ens_pd.set_ens_size(cur.n_ens); aggr.ens_pd.extend(cur.total); - for(i=0; i thresh(n); - for(i=0; i