Issue #2060 fix FFG processing
Change-Id: I2338c4b311e1d660bc53933633c645e07a1687b0 Former-commit-id:acfcaea04e
[formerly2d19ee46e5
] [formerly8cbea21f32
] [formerly9b19f95d24
[formerly8cbea21f32
[formerly 14ce9854abc51b2791b5f93756ae12cbe69b8589]]] Former-commit-id:9b19f95d24
Former-commit-id: 94b4ede51617e66b1e18ddaa60775457c6b2c3ad [formerlya33ca4e3ac
] Former-commit-id:9a2c674142
This commit is contained in:
parent
3c2ff2733b
commit
65ad418a94
4 changed files with 26 additions and 174 deletions
|
@ -59,7 +59,8 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfigData;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 11, 2013 2085 njensen Initial creation
|
||||
* Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL
|
||||
* Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL
|
||||
* Apr 30, 2014 2060 njensen Safety checks for null guidance
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -200,7 +201,7 @@ public class FFMPRowGenerator implements Runnable {
|
|||
|
||||
mouseOverText = metabasin.getBasinId() + "\n" + lid + "-"
|
||||
+ fvgmbd.getName();
|
||||
|
||||
|
||||
if (!huc.equals(FFMPRecord.ALL)) {
|
||||
sb.append("-").append(fvgmbd.getName());
|
||||
}
|
||||
|
@ -905,26 +906,25 @@ public class FFMPRowGenerator implements Runnable {
|
|||
forced = forceResult.isForced();
|
||||
}
|
||||
|
||||
if (!forcedPfafs.isEmpty() || forced || !pfafList.isEmpty()) {
|
||||
// Recalculate guidance using the forced value(s)
|
||||
guidance = guidRecords
|
||||
.get(guidType)
|
||||
.getBasinData()
|
||||
.getAverageGuidanceValue(pfafList,
|
||||
resource.getGuidanceInterpolators().get(guidType),
|
||||
guidance, forcedPfafs,
|
||||
resource.getGuidSourceExpiration(guidType));
|
||||
} else {
|
||||
FFMPRecord grec = guidRecords.get(guidType);
|
||||
if (grec != null) {
|
||||
if (!forcedPfafs.isEmpty() || forced || !pfafList.isEmpty()) {
|
||||
// Recalculate guidance using the forced value(s)
|
||||
guidance = grec.getBasinData().getAverageGuidanceValue(
|
||||
pfafList,
|
||||
resource.getGuidanceInterpolators().get(guidType),
|
||||
guidance, forcedPfafs,
|
||||
resource.getGuidSourceExpiration(guidType));
|
||||
} else {
|
||||
FFMPGuidanceBasin ffmpGuidBasin = (FFMPGuidanceBasin) grec
|
||||
.getBasinData().get(cBasinPfaf);
|
||||
guidance = resource.getGuidanceValue(ffmpGuidBasin,
|
||||
paintRefTime, guidType);
|
||||
|
||||
FFMPGuidanceBasin ffmpGuidBasin = (FFMPGuidanceBasin) guidRecords
|
||||
.get(guidType).getBasinData().get(cBasinPfaf);
|
||||
guidance = resource.getGuidanceValue(ffmpGuidBasin, paintRefTime,
|
||||
guidType);
|
||||
|
||||
if (guidance < 0.0f) {
|
||||
guidance = Float.NaN;
|
||||
if (guidance < 0.0f) {
|
||||
guidance = Float.NaN;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return new FFMPTableCellData(FIELDS.GUIDANCE, guidance, forced);
|
||||
|
|
|
@ -19,26 +19,19 @@
|
|||
**/
|
||||
package com.raytheon.uf.edex.dat.utils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
||||
import com.raytheon.uf.common.dataplugin.ffmp.FFMPVirtualGageBasin;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
|
||||
import com.raytheon.uf.common.dataplugin.shef.util.ShefConstants;
|
||||
import com.raytheon.uf.common.datastorage.IDataStore;
|
||||
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
|
||||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||
import com.raytheon.uf.common.monitor.processing.IMonitorProcessing;
|
||||
import com.raytheon.uf.common.monitor.xml.SCANModelParameterXML;
|
||||
import com.raytheon.uf.common.monitor.xml.SourceXML;
|
||||
import com.raytheon.uf.edex.database.dao.CoreDao;
|
||||
import com.raytheon.uf.edex.database.dao.DaoConfig;
|
||||
import com.raytheon.uf.edex.database.plugin.PluginDao;
|
||||
import com.raytheon.uf.edex.database.plugin.PluginFactory;
|
||||
|
||||
|
@ -97,16 +90,9 @@ public class DATUtils {
|
|||
* @return
|
||||
*/
|
||||
public static GridRecord getGridRecord(String uri) throws PluginException {
|
||||
|
||||
GridRecord gr = new GridRecord(uri);
|
||||
PluginDao gd = PluginFactory.getInstance().getPluginDao(
|
||||
gr.getPluginName());
|
||||
gr = (GridRecord) gd.getMetadata(uri);
|
||||
|
||||
if (gr != null) {
|
||||
populateGridRecord(gr);
|
||||
} else {
|
||||
logger.error("URI: " + uri + " Not in Database...");
|
||||
}
|
||||
|
||||
return gr;
|
||||
|
@ -136,104 +122,6 @@ public class DATUtils {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value for an accumulating Virtual Gage Basin
|
||||
*
|
||||
* @param lid
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @return
|
||||
* @deprecated Nothing seems to be calling this....
|
||||
*/
|
||||
@Deprecated
|
||||
public static FFMPVirtualGageBasin getVirtualBasinData(String lid,
|
||||
FFMPVirtualGageBasin vgb, String endTime, String startTime) {
|
||||
|
||||
// According to the AWIPS I code
|
||||
|
||||
SimpleDateFormat dateFmt = new SimpleDateFormat("MMM dd yy HH:mm:ss");
|
||||
CoreDao dao = new CoreDao(DaoConfig.forDatabase(ShefConstants.IHFS));
|
||||
|
||||
String sql1 = "SELECT dur, value, ts FROM curpc WHERE lid = '" + lid
|
||||
+ "' AND obstime >= '" + startTime + "' AND obstime < '"
|
||||
+ endTime + "' AND pe = 'PC' ORDER BY obstime DESC, ts ASC";
|
||||
String sql2 = "SELECT dur, value, ts FROM curpp WHERE lid = '"
|
||||
+ lid
|
||||
+ "' AND obstime >= '"
|
||||
+ startTime
|
||||
+ "' AND obstime < '"
|
||||
+ endTime
|
||||
+ "' AND pe = 'PP' AND dur <= 1001 AND value >=0 ORDER BY dur ASC, obstime DESC, ts ASC";
|
||||
|
||||
dao = new CoreDao(DaoConfig.forDatabase(ShefConstants.IHFS));
|
||||
|
||||
try {
|
||||
// 15 min accumulation
|
||||
Object[] results = dao.executeSQLQuery(sql1.toString());
|
||||
Object[] tsresults = null;
|
||||
String ts = null;
|
||||
|
||||
if (results.length > 0) {
|
||||
if (results.length > 1) {
|
||||
// Gets the highest ranked
|
||||
String sql3 = "SELECT ts, ts_rank FROM ingestfilter WHERE lid = '"
|
||||
+ lid
|
||||
+ "' AND pe = 'PC' ORDER BY ts_rank ASC limit 1";
|
||||
tsresults = dao.executeSQLQuery(sql3.toString());
|
||||
}
|
||||
} else {
|
||||
results = dao.executeSQLQuery(sql2.toString());
|
||||
|
||||
if (results.length > 0) {
|
||||
if (results.length > 1) {
|
||||
String sql3 = "SELECT ts, ts_rank FROM ingestfilter WHERE lid = '"
|
||||
+ lid
|
||||
+ "' AND pe = 'PP' ORDER BY ts_rank ASC limit 1";
|
||||
tsresults = dao.executeSQLQuery(sql3.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// parse through getting rid of undesireable types
|
||||
if (tsresults != null && tsresults.length > 0) {
|
||||
ArrayList<Integer> durations = new ArrayList<Integer>();
|
||||
ArrayList<Float> values = new ArrayList<Float>();
|
||||
|
||||
for (int i = 0; i < results.length; i++) {
|
||||
Object[] obs = (Object[]) tsresults[i];
|
||||
|
||||
if (obs[2] != null) {
|
||||
if (((String) obs[2]).equals(ts)) {
|
||||
|
||||
if (obs[0] != null) {
|
||||
durations.add((Integer) obs[0]);
|
||||
}
|
||||
if (obs[1] != null) {
|
||||
values.add(((Number) obs[1]).floatValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float totalVals = 0.0f;
|
||||
for (float val : values) {
|
||||
totalVals += val;
|
||||
}
|
||||
|
||||
float avVal = totalVals / values.size();
|
||||
|
||||
vgb.setValue(dateFmt.parse(endTime), avVal);
|
||||
} else {
|
||||
vgb.setValue(dateFmt.parse(endTime), 0.0f);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("No Virual Gage Basin found.....");
|
||||
}
|
||||
|
||||
return vgb;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Check status of cached model data
|
||||
*
|
||||
|
|
|
@ -428,9 +428,10 @@ public class FFMPConfig {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
sources = null;
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Couldn't create FFMP Config... Improper source configuration detected."
|
||||
+ e);
|
||||
statusHandler
|
||||
.handle(Priority.PROBLEM,
|
||||
"Couldn't create FFMP Config... Improper source configuration detected.",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,10 +27,8 @@ import java.util.List;
|
|||
|
||||
import org.geotools.referencing.GeodeticCalculator;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
||||
import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord;
|
||||
import com.raytheon.uf.common.dataplugin.binlightning.impl.LtgStrikeType;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
|
||||
|
@ -38,9 +36,6 @@ import com.raytheon.uf.common.dataplugin.radar.util.RadarConstants;
|
|||
import com.raytheon.uf.common.dataplugin.scan.data.CellTableDataRow;
|
||||
import com.raytheon.uf.common.dataplugin.scan.data.ScanTableData;
|
||||
import com.raytheon.uf.common.dataplugin.scan.data.ScanTableDataRow;
|
||||
import com.raytheon.uf.common.datastorage.IDataStore;
|
||||
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
|
||||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||
import com.raytheon.uf.common.geospatial.ISpatialQuery;
|
||||
import com.raytheon.uf.common.geospatial.SpatialException;
|
||||
import com.raytheon.uf.common.geospatial.SpatialQueryFactory;
|
||||
|
@ -49,8 +44,6 @@ import com.raytheon.uf.common.monitor.scan.ScanUtils;
|
|||
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.edex.database.plugin.PluginDao;
|
||||
import com.raytheon.uf.edex.database.plugin.PluginFactory;
|
||||
import com.raytheon.uf.edex.plugin.scan.ScanURIFilter;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.GeometryFactory;
|
||||
|
@ -63,7 +56,8 @@ import com.vividsolutions.jts.geom.GeometryFactory;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 05/07/2009 2037 dhladky Initial Creation.
|
||||
* 05/07/2009 2037 dhladky Initial Creation.
|
||||
* Apr 30, 2014 2060 njensen Updates for removal of grid dataURI column
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -72,9 +66,6 @@ import com.vividsolutions.jts.geom.GeometryFactory;
|
|||
*/
|
||||
public abstract class ScanProduct implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public String dataType = null;
|
||||
|
@ -244,34 +235,6 @@ public abstract class ScanProduct implements Serializable {
|
|||
return cwa;
|
||||
}
|
||||
|
||||
/**
|
||||
* get Populated grib record
|
||||
*
|
||||
* @param uri
|
||||
* @return
|
||||
*/
|
||||
public static GridRecord getGridRecord(String uri) throws PluginException {
|
||||
|
||||
GridRecord gr = new GridRecord(uri);
|
||||
PluginDao gd = PluginFactory.getInstance().getPluginDao(
|
||||
gr.getPluginName());
|
||||
gr = (GridRecord) gd.getMetadata(uri);
|
||||
IDataStore dataStore = gd.getDataStore(gr);
|
||||
|
||||
try {
|
||||
IDataRecord[] dataRec = dataStore.retrieve(uri);
|
||||
for (int i = 0; i < dataRec.length; i++) {
|
||||
if (dataRec[i] instanceof FloatDataRecord) {
|
||||
gr.setMessageData(dataRec[i]);
|
||||
}
|
||||
}
|
||||
} catch (Exception se) {
|
||||
se.printStackTrace();
|
||||
}
|
||||
|
||||
return gr;
|
||||
}
|
||||
|
||||
/**
|
||||
* process lightning
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue