From 8b396500436522e01ae68a7b0937c5803b93fe27 Mon Sep 17 00:00:00 2001 From: TatianaBurek Date: Tue, 25 Oct 2022 15:04:56 -0600 Subject: [PATCH] add SEEPS #422 --- java/edu/ucar/metviewer/MVUtil.java | 14 +++++++++++++- .../db/mysql/MysqlAppDatabaseManager.java | 17 ++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/java/edu/ucar/metviewer/MVUtil.java b/java/edu/ucar/metviewer/MVUtil.java index 49b10b85..199db613 100644 --- a/java/edu/ucar/metviewer/MVUtil.java +++ b/java/edu/ucar/metviewer/MVUtil.java @@ -105,6 +105,7 @@ public class MVUtil { public static final Map statsGrad = new HashMap<>(); public static final Map statsMctc = new HashMap<>(); public static final Map statsSsidx = new HashMap<>(); + public static final Map statsSeeps = new HashMap<>(); public static final int MAX_STR_LEN = 500; @@ -178,7 +179,9 @@ public class MVUtil { "relp", "ecnt", "dmap", - "rps" + "rps", + "seeps", + "seeps_mpr" }; static { @@ -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}); @@ -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 ""; } diff --git a/java/edu/ucar/metviewer/db/mysql/MysqlAppDatabaseManager.java b/java/edu/ucar/metviewer/db/mysql/MysqlAppDatabaseManager.java index 0f1df57e..f69d94c7 100644 --- a/java/edu/ucar/metviewer/db/mysql/MysqlAppDatabaseManager.java +++ b/java/edu/ucar/metviewer/db/mysql/MysqlAppDatabaseManager.java @@ -191,7 +191,9 @@ public List 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) { @@ -199,7 +201,7 @@ public List getListStat(String strFcstVar, String[] currentDBName) { 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(); @@ -310,6 +312,9 @@ public List getListStat(String strFcstVar, String[] currentDBName) { case 25://ssidx statNames.addAll(MVUtil.statsSsidx.keySet()); break; + case 26://seeps + statNames.addAll(MVUtil.statsSeeps.keySet()); + break; default: } @@ -1856,9 +1861,11 @@ public List 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); }