Skip to content

Commit

Permalink
add SEEPS #422
Browse files Browse the repository at this point in the history
  • Loading branch information
TatianaBurek committed Oct 25, 2022
1 parent fafc4f7 commit 8b39650
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
14 changes: 13 additions & 1 deletion java/edu/ucar/metviewer/MVUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public class MVUtil {
public static final Map<String, String[]> statsGrad = new HashMap<>();
public static final Map<String, String[]> statsMctc = new HashMap<>();
public static final Map<String, String[]> statsSsidx = new HashMap<>();
public static final Map<String, String[]> statsSeeps = new HashMap<>();


public static final int MAX_STR_LEN = 500;
Expand Down Expand Up @@ -178,7 +179,9 @@ public class MVUtil {
"relp",
"ecnt",
"dmap",
"rps"
"rps",
"seeps",
"seeps_mpr"
};

static {
Expand Down Expand Up @@ -659,6 +662,13 @@ public class MVUtil {
static {
statsSsidx.put("SS_INDEX", new String[]{});
}
static {
statsSeeps.put("SEEPS_MEAN_FCST", new String[]{});
statsSeeps.put("SEEPS_MEAN_OBS", new String[]{});
statsSeeps.put("SEEPS", new String[]{});
}



static {
statsNbrcts.put("NBR_BASER", new String[]{"nc", "bc", NBRCTC});
Expand Down Expand Up @@ -1716,6 +1726,8 @@ public static String getStatTable(final String strStat) {
return "line_data_grad";
} else if (statsSsidx.containsKey(strStat)) {
return "line_data_ssidx";
} else if (statsSeeps.containsKey(strStat)) {
return "line_data_seeps";
} else {
return "";
}
Expand Down
17 changes: 12 additions & 5 deletions java/edu/ucar/metviewer/db/mysql/MysqlAppDatabaseManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,17 @@ public List<String> getListStat(String strFcstVar, String[] currentDBName) {
+ "UNION ALL ( SELECT IFNULL( (SELECT ld.stat_header_id 'mctc' FROM "
+ "line_data_mctc ld, stat_header h WHERE h.fcst_var = ? AND h.stat_header_id = ld.stat_header_id limit 1) ,-9999) mctc)\n"
+ "UNION ALL ( SELECT IFNULL( (SELECT ld.stat_header_id 'ssidx' FROM "
+ "line_data_ssidx ld, stat_header h WHERE h.fcst_var = ? AND h.stat_header_id = ld.stat_header_id limit 1) ,-9999) ssidx)\n";
+ "line_data_ssidx ld, stat_header h WHERE h.fcst_var = ? AND h.stat_header_id = ld.stat_header_id limit 1) ,-9999) ssidx)\n"
+ "UNION ALL ( SELECT IFNULL( (SELECT ld.stat_header_id 'seeps' FROM "
+ "line_data_seeps ld, stat_header h WHERE h.fcst_var = ? AND h.stat_header_id = ld.stat_header_id limit 1) ,-9999) seeps)\n";


for (String database : currentDBName) {
ResultSet res = null;
try (Connection con = getConnection(database);
PreparedStatement stmt = con.prepareStatement(strSql, ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY)) {
for (int i = 1; i <= 26; i++) {
for (int i = 1; i <= 27; i++) {
stmt.setString(i, strFcstVar);
}
res = stmt.executeQuery();
Expand Down Expand Up @@ -310,6 +312,9 @@ public List<String> getListStat(String strFcstVar, String[] currentDBName) {
case 25://ssidx
statNames.addAll(MVUtil.statsSsidx.keySet());
break;
case 26://seeps
statNames.addAll(MVUtil.statsSeeps.keySet());
break;
default:

}
Expand Down Expand Up @@ -1856,9 +1861,11 @@ public List<String> buildPlotSql(
} else if (MVUtil.statsPerc.containsKey(strStat)) {
tableStats = MVUtil.statsPerc;
statTable = "line_data_perc ld\n";
} else if (MVUtil.statsSsidx.containsKey(strStat)) {
tableStats = MVUtil.statsSsidx;
statTable = "line_data_ssidx ld\n";

} else if (MVUtil.statsSeeps.containsKey(strStat)) {
tableStats = MVUtil.statsSeeps;
statTable = "line_data_seeps ld\n";
statField = strStat.replace("SEEPS_", "").toLowerCase();
} else {
throw new ValidationException("unrecognized stat: " + strStat);
}
Expand Down

0 comments on commit 8b39650

Please sign in to comment.