Skip to content

Commit

Permalink
Issue #517 reformatted code and added columns for the VL1L2, VAL1L2, …
Browse files Browse the repository at this point in the history
…and ECNT linetypes.
  • Loading branch information
bikegeek committed Aug 13, 2024
1 parent 29f2daf commit cbebd85
Showing 1 changed file with 46 additions and 44 deletions.
90 changes: 46 additions & 44 deletions java/edu/ucar/metviewer/scorecard/db/AggDatabaseManagerMySQL.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,56 +19,58 @@
*/
public class AggDatabaseManagerMySQL extends DatabaseManagerSql {

private static final Logger logger = LogManager.getLogger("AggDatabaseManagerMySQL");
private static final Logger logger = LogManager.getLogger("AggDatabaseManagerMySQL");


public AggDatabaseManagerMySQL(final Scorecard scorecard,
final MysqlDatabaseManager databaseManager) throws SQLException {
super(scorecard, databaseManager);
aggStatDataFilePath = scorecard.getWorkingFolders().getDataDir() + scorecard.getAggStatDataFile();
public AggDatabaseManagerMySQL(final Scorecard scorecard,
final MysqlDatabaseManager databaseManager) throws SQLException {
super(scorecard, databaseManager);
aggStatDataFilePath = scorecard.getWorkingFolders().getDataDir() + scorecard.getAggStatDataFile();

}
}

@Override
protected String getSelectFields(String table, Integer thresh) {
String result = "";
if (table.endsWith(MVUtil.CTC)) {
result = "total, fy_oy,fy_on,fn_oy,fn_on";
} else if (table.endsWith(MVUtil.SL1L2)) {
result = "total,fbar,obar,fobar,ffbar,oobar,mae";
} else if (table.endsWith(MVUtil.GRAD)) {
result = "total,fgbar,ogbar,mgbar,egbar";
} else if (table.endsWith(MVUtil.SAL1L2)) {
result = "total,fabar,oabar,foabar,ffabar,ooabar,mae";
} else if (table.endsWith(MVUtil.VL1L2)) {
result = "total,ufbar,vfbar,uobar,vobar,uvfobar,uvffbar,uvoobar";
} else if (table.endsWith(MVUtil.VAL1L2)) {
result = "total,ufabar,vfabar,uoabar,voabar,uvfoabar,uvffabar,uvooabar";
} else if (table.endsWith(MVUtil.ECNT)) {
result = "total,me,rmse,crps,crpss,ign,spread,me_oerr,rmse_oerr,spread_oerr,spread_plus_oerr,crpscl,crps_emp,crpscl_emp ,crpss_emp";
} else if (table.endsWith(MVUtil.RPS)) {
result = "total,rps,rpss, rps_comp";
} else if (table.endsWith("nbrcnt")) {
result = "total,fbs,fss";
} else if (table.endsWith(MVUtil.PCT)) {
result = "total,(line_data_pct.n_thresh - 1)";
for (int i = 1; i < thresh; i++) {
result += ",";
if (i < thresh - 1) {
result += " FORMAT((ldt" + i + ".thresh_i + ldt" + (i + 1) + ".thresh_i)/2, 3),";
} else {
result += " FORMAT((ldt" + i + ".thresh_i + 1)/2, 3),";
@Override
protected String getSelectFields(String table, Integer thresh) {
String result = "";
if (table.endsWith(MVUtil.CTC)) {
result = "total, fy_oy,fy_on,fn_oy,fn_on";
} else if (table.endsWith(MVUtil.SL1L2)) {
result = "total,fbar,obar,fobar,ffbar,oobar,mae";
} else if (table.endsWith(MVUtil.GRAD)) {
result = "total,fgbar,ogbar,mgbar,egbar";
} else if (table.endsWith(MVUtil.SAL1L2)) {
result = "total,fabar,oabar,foabar,ffabar,ooabar,mae";
} else if (table.endsWith(MVUtil.VL1L2)) {
result = "total,ufbar,vfbar,uobar,vobar,uvfobar,uvffbar,uvoobar, f_speed_bar, o_speed_bar, total_dir, dir_me, dir_mae, dir_mse";
} else if (table.endsWith(MVUtil.VAL1L2)) {
result = "total,ufabar,vfabar,uoabar,voabar,uvfoabar,uvffabar,uvooabar, fa_speed_bar, oa_speed_bar, total_dir, dira_me, dira_mae, dira_mse";
} else if (table.endsWith(MVUtil.ECNT)) {
result = "total,me,rmse,crps,crpss,ign,spread,me_oerr,rmse_oerr,spread_oerr,spread_plus_oerr,crpscl," +
"crps_emp,crpscl_emp,crpss_emp,crpss_emp_fair,spread_md,mae,mae_oerr,bias_ratio,n_ge_obs, " +
"me_ge_obs,n_lt_obs,me_lt_obs,ign_conv_oerr,ign_corr_oerr";
} else if (table.endsWith(MVUtil.RPS)) {
result = "total,rps,rpss, rps_comp";
} else if (table.endsWith("nbrcnt")) {
result = "total,fbs,fss";
} else if (table.endsWith(MVUtil.PCT)) {
result = "total,(line_data_pct.n_thresh - 1)";
for (int i = 1; i < thresh; i++) {
result += ",";
if (i < thresh - 1) {
result += " FORMAT((ldt" + i + ".thresh_i + ldt" + (i + 1) + ".thresh_i)/2, 3),";
} else {
result += " FORMAT((ldt" + i + ".thresh_i + 1)/2, 3),";
}
result += " ldt" + i + ".oy_i," +
" ldt" + i + ".on_i";
}
}
result += " ldt" + i + ".oy_i," +
" ldt" + i + ".on_i";
}
return result;
}
return result;
}

@Override
protected String getStatValue(String table, String stat) {
return "";
}
@Override
protected String getStatValue(String table, String stat) {
return "";
}

}

0 comments on commit cbebd85

Please sign in to comment.