Issue #1569 Switched aggregate record writing to pypies. General sweep of ingestDAT

Change-Id: I693debea540667cfda6efe1496dd1084b8d0e950

Former-commit-id: 7b3a310f67 [formerly 7b3a310f67 [formerly 2ea8409800917d8c9a4c76c3b63492a2eb1f2c62]]
Former-commit-id: 381aec5976
Former-commit-id: 5c66cbcd27
This commit is contained in:
Dave Hladky 2013-02-14 09:24:17 -06:00
parent 355e96d4cd
commit 7dad108a93
51 changed files with 850 additions and 1017 deletions

View file

@ -91,7 +91,8 @@ import com.raytheon.uf.viz.monitor.listeners.IMonitorListener;
* 04/03/10 4494 D. Hladky Initial release
* 12/07/12 1353 rferrel Changes for non-blocking FFMPSplash.
* 01/10/13 1475 D. Hladky Cleaned up some logging.
* 01/27/13 1478 D. Hladky revamped cache file format, removed duplicate times
* 01/27/13 1478 D. Hladky revamped cache file format, removed duplicate times
* 02/01/13 1569 D. Hladky updated constants
*
* </pre>
*
@ -538,7 +539,7 @@ public class FFMPMonitor extends ResourceMonitor {
if (sourceXML.getSourceType().equals(
SOURCE_TYPE.GAGE.getSourceType())
&& phuc.equals("ALL")) {
&& phuc.equals(FFMPRecord.ALL)) {
ffmpRec.retrieveVirtualBasinFromDataStore(dataStore,
dataUri, getTemplates(siteKey), ffmpRec
.getDataTime().getRefTime(), basin);
@ -946,14 +947,12 @@ public class FFMPMonitor extends ResourceMonitor {
FFMPResourceData frd = resource.getResourceData();
if (loadType == LOADER_TYPE.SECONDARY) {
// hucsToLoad.remove("ALL");
// hucsToLoad.remove(getConfig().getFFMPConfigData().getLayer());
timeBack = new Date(resource.getMostRecentTime().getTime()
- (6 * 1000 * 24));
- (6 * TimeUtil.MILLIS_PER_HOUR));
frd.timeBack = timeBack;
} else if (loadType == LOADER_TYPE.TERTIARY) {
hucsToLoad.clear();
hucsToLoad.add("ALL");
hucsToLoad.add(FFMPRecord.ALL);
timeBack = new Date(resource.getMostRecentTime().getTime()
- (TimeUtil.MILLIS_PER_HOUR * 24));
}
@ -1466,7 +1465,7 @@ public class FFMPMonitor extends ResourceMonitor {
if (basin != null) {
fgb = (FFMPGuidanceBasin) basin;
} else {
fgb = new FFMPGuidanceBasin(pfaf, !phuc.equals("ALL"));
fgb = new FFMPGuidanceBasin(pfaf, !phuc.equals(FFMPRecord.ALL));
basin = fgb;
}
@ -2391,7 +2390,7 @@ public class FFMPMonitor extends ResourceMonitor {
if ((sourceXML != null)
&& sourceXML.getSourceType().equals(
SOURCE_TYPE.GAGE.getSourceType())
&& fhuc.equals("ALL")) {
&& fhuc.equals(FFMPRecord.ALL)) {
try {
curRecord.retrieveVirtualMapFromDataStore(
dataStore, dataUri, getTemplates(fsiteKey),

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.viz.monitor.ffmp.ui.rsc;
import java.util.ArrayList;
import java.util.List;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceInterpolation;
@ -39,6 +40,7 @@ import com.raytheon.uf.common.monitor.xml.SourceXML;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 20, 2011 mpduff Initial creation
* 01/14/13 1569 dhladky changed arraylist to list
*
* </pre>
*
@ -49,9 +51,9 @@ import com.raytheon.uf.common.monitor.xml.SourceXML;
public class FFFGForceUtil {
private boolean forced = false;
private ArrayList<Long> forcedPfafList = new ArrayList<Long>();
private List<Long> forcedPfafList = new ArrayList<Long>();
private ArrayList<Long> pfafList = new ArrayList<Long>();
private List<Long> pfafList = new ArrayList<Long>();
private FFMPResource resource;
@ -115,7 +117,7 @@ public class FFFGForceUtil {
forceIt(ft, cBasin);
}
public void calculateForcings(ArrayList<Long> pfafList, FFMPTemplates ft,
public void calculateForcings(List<Long> pfafList, FFMPTemplates ft,
FFMPBasin cBasin) {
this.pfafList = pfafList;
forceIt(ft, cBasin);
@ -213,15 +215,15 @@ public class FFFGForceUtil {
}
private ArrayList<Long> getForcedBasins(String source,
ArrayList<Long> pfafList, FFMPTemplates ft) {
List<Long> pfafList2, FFMPTemplates ft) {
FFFGDataMgr fdm = FFFGDataMgr.getInstance();
ArrayList<Long> forcedList = new ArrayList<Long>();
long prevCtyFips = 0l;
for (int i = 0; i < pfafList.size(); i++) {
if (pfafList.get(i) == null) {
for (int i = 0; i < pfafList2.size(); i++) {
if (pfafList2.get(i) == null) {
continue;
}
long pfaf = pfafList.get(i);
long pfaf = pfafList2.get(i);
long countyFips = ft.getCountyFipsByPfaf(pfaf);
if (countyFips != prevCtyFips) {
@ -240,8 +242,8 @@ public class FFFGForceUtil {
return forcedList;
}
public float getAvgForcedValue(ArrayList<Long> pfafList,
ArrayList<Long> forcedPfafs,
public float getAvgForcedValue(List<Long> pfafList,
List<Long> forcedPfafs,
FFMPGuidanceInterpolation interpolation,
long expiration, FFMPTemplates templates) {
float tvalue = 0.0f;
@ -283,7 +285,7 @@ public class FFFGForceUtil {
/**
* @return the forcedPfafList
*/
public ArrayList<Long> getForcedPfafList() {
public List<Long> getForcedPfafList() {
return forcedPfafList;
}
@ -298,7 +300,7 @@ public class FFFGForceUtil {
/**
* @return the pfafList
*/
public ArrayList<Long> getPfafList() {
public List<Long> getPfafList() {
return pfafList;
}

View file

@ -22,6 +22,7 @@ package com.raytheon.uf.viz.monitor.ffmp.ui.rsc;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinData;
@ -29,6 +30,7 @@ import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinMetaData;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPCacheRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceBasin;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceInterpolation;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord.FIELDS;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPTemplates;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPUtils;
@ -64,6 +66,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfigData;
* ------------ ---------- ----------- --------------------------
* Jul 20, 2009 dhladky Initial creation
* Jan 25, 2012 DR 13839 gzhang Use paintTime for QPF
* Feb 1, 2013 DR 1569 dhladky Switched to using pypies records instead of files
* </pre>
*
* @author dhladky
@ -76,7 +79,7 @@ public class FFMPDataGenerator {
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(FFMPDataGenerator.class);
private final String ALL = "ALL";
private final String ALL = FFMPRecord.ALL;
private final String NA = "NA";
@ -412,8 +415,8 @@ public class FFMPDataGenerator {
int i = 0;
for (String guidType : guidBasins.keySet()) {
ArrayList<Long> pfafList = new ArrayList<Long>();
ArrayList<Long> forcedPfafs = new ArrayList<Long>();
List<Long> pfafList = new ArrayList<Long>();
List<Long> forcedPfafs = new ArrayList<Long>();
guidance = Float.NaN;
boolean forced = false;
FFFGForceUtil forceUtil = forceUtils.get(guidType);
@ -596,8 +599,8 @@ public class FFMPDataGenerator {
// run over each guidance type
int i = 0;
for (String guidType : guidBasins.keySet()) {
ArrayList<Long> pfafList = new ArrayList<Long>();
ArrayList<Long> forcedPfafs = new ArrayList<Long>();
List<Long> pfafList = new ArrayList<Long>();
List<Long> forcedPfafs = new ArrayList<Long>();
guidance = Float.NaN;
boolean forced = false;
FFFGForceUtil forceUtil = forceUtils.get(guidType);
@ -743,8 +746,8 @@ public class FFMPDataGenerator {
private float getForcedAvg(FFFGForceUtil forceUtil, String domain,
FFMPBasin cBasin, String guidType) {
FFFGDataMgr fdm = FFFGDataMgr.getInstance();
ArrayList<Long> forcedPfafs;
ArrayList<Long> pfafList = new ArrayList<Long>();
List<Long> forcedPfafs;
List<Long> pfafList = new ArrayList<Long>();
float guidance = Float.NaN;
boolean forced = false;
@ -923,7 +926,7 @@ public class FFMPDataGenerator {
forceUtil.calculateForcings(pfafs, ft, cBasin);
ArrayList<Long> forcedPfafs = forceUtil
List<Long> forcedPfafs = forceUtil
.getForcedPfafList();
boolean forced = forceUtil.isForced();
@ -1004,7 +1007,7 @@ public class FFMPDataGenerator {
FFMPBasinData guidBasin = guidBasins.get(guidType);
ArrayList<Long> pfafList = new ArrayList<Long>();
List<Long> pfafList = new ArrayList<Long>();
if ((guidBasin != null)
&& (guidBasin.getBasins().size() > 0)) {
if (cBasin.getAggregated()) {
@ -1015,7 +1018,7 @@ public class FFMPDataGenerator {
}
boolean forced = false;
ArrayList<Long> forcedPfafs = new ArrayList<Long>();
List<Long> forcedPfafs = new ArrayList<Long>();
FFFGDataMgr fdm = FFFGDataMgr.getInstance();
if (fdm.isForcingConfigured()) {
@ -1058,11 +1061,11 @@ public class FFMPDataGenerator {
}
if (!qpe.isNaN() && (guidance > 0.0f)) {
ArrayList<Float> qpes = qpeBasin.getAccumValues(pfafs,
List<Float> qpes = qpeBasin.getAccumValues(pfafs,
monitor.getQpeWindow().getAfterTime(), monitor
.getQpeWindow().getBeforeTime(),
expirationTime, isRate);
ArrayList<Float> guids = null;
List<Float> guids = null;
if (guidBasin != null) {
guids = guidBasin.getGuidanceValues(pfafs, resource
.getGuidanceInterpolators().get(guidType),
@ -1158,7 +1161,7 @@ public class FFMPDataGenerator {
forceUtil.calculateForcings(pfafs, ft, cBasin);
ArrayList<Long> forcedPfafs = forceUtil
List<Long> forcedPfafs = forceUtil
.getForcedPfafList();
boolean forced = forceUtil.isForced();

View file

@ -19,32 +19,32 @@
**/
package com.raytheon.uf.viz.monitor.ffmp.ui.rsc;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.NavigableMap;
import java.util.zip.GZIPInputStream;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPAggregateRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPUtils;
import com.raytheon.uf.common.datastorage.DataStoreFactory;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.datastorage.Request;
import com.raytheon.uf.common.datastorage.records.ByteDataRecord;
import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.common.monitor.config.FFMPRunConfigurationManager;
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager;
import com.raytheon.uf.common.monitor.xml.FFMPRunXML;
import com.raytheon.uf.common.monitor.xml.ProductRunXML;
import com.raytheon.uf.common.monitor.xml.ProductXML;
import com.raytheon.uf.common.monitor.xml.SourceXML;
import com.raytheon.uf.common.ohd.AppsDefaults;
import com.raytheon.uf.common.serialization.DynamicSerializationManager;
import com.raytheon.uf.common.serialization.DynamicSerializationManager.SerializationType;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.monitor.ffmp.FFMPMonitor;
import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FFMPConfig;
@ -63,6 +63,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.listeners.FFMPLoaderEvent;
* 28 Feb, 2011 7587 dhladky Initial creation
* 25 Jan, 2012 DR13839 gzhang Handle Uris and Huc processing
* 01/27/13 1478 D. Hladky revamped the cache file format to help NAS overloading
* 02/01/13 1569 D. Hladky Changed to reading aggregate records from pypies
* </pre>
*
* @author dhladky
@ -72,8 +73,6 @@ public class FFMPDataLoader extends Thread {
private static final IUFStatusHandler statusHandler = UFStatus.getHandler(FFMPDataLoader.class);
private String sharePath = null;
private ProductXML product = null;
private FFMPRunXML runner = null;
@ -104,9 +103,6 @@ public class FFMPDataLoader extends Thread {
Date mostRecentTime, LOADER_TYPE loadType,
ArrayList<String> hucsToLoad) {
sharePath = AppsDefaults.getInstance().getToken("apps_dir")
+ File.separator + "ffmp" + File.separator;
this.product = resourceData.getProduct();
this.siteKey = resourceData.siteKey;
this.dataKey = resourceData.dataKey;
@ -152,10 +148,13 @@ public class FFMPDataLoader extends Thread {
@Override
public void run() {
long time = System.currentTimeMillis();
try {
resourceData.setLoader(loadType);
FFMPMonitor monitor = getMonitor();
FFMPSourceConfigurationManager sourceConfig = monitor.getSourceConfig();
ProductRunXML productRun = runner.getProduct(siteKey);
ArrayList<String> qpfSources = new ArrayList<String>();
@ -165,11 +164,11 @@ public class FFMPDataLoader extends Thread {
if ((loadType == LOADER_TYPE.INITIAL)
|| (loadType == LOADER_TYPE.GENERAL)) {
rateURI = getMonitor().getAvailableUri(siteKey, dataKey,
rateURI = monitor.getAvailableUri(siteKey, dataKey,
product.getRate(), mostRecentTime);
}
NavigableMap<Date, List<String>> qpeURIs = getMonitor()
NavigableMap<Date, List<String>> qpeURIs = monitor
.getAvailableUris(siteKey, dataKey, product.getQpe(),
timeBack);
@ -183,11 +182,11 @@ public class FFMPDataLoader extends Thread {
Date qpfTime = timeBack;
if (loadType == LOADER_TYPE.GENERAL) {
qpfTime = getMonitor().getPreviousQueryTime(siteKey,
qpfTime = monitor.getPreviousQueryTime(siteKey,
qpfSource.getSourceName());
}
qpfURIs = getMonitor().getAvailableUris(siteKey, dataKey,
qpfURIs = monitor.getAvailableUris(siteKey, dataKey,
qpfSource.getSourceName(), qpfTime);
if (qpfURIs != null && !qpfURIs.isEmpty()) {
@ -197,7 +196,7 @@ public class FFMPDataLoader extends Thread {
}
}
NavigableMap<Date, List<String>> virtualURIs = getMonitor()
NavigableMap<Date, List<String>> virtualURIs = monitor
.getAvailableUris(siteKey, dataKey, product.getVirtual(),
timeBack);
@ -211,11 +210,11 @@ public class FFMPDataLoader extends Thread {
Date guidTime = timeBack;
if (loadType == LOADER_TYPE.GENERAL) {
guidTime = getMonitor().getPreviousQueryTime(siteKey,
guidTime = monitor.getPreviousQueryTime(siteKey,
guidSource.getSourceName());
}
iguidURIs = getMonitor().getAvailableUris(siteKey, dataKey,
iguidURIs = monitor.getAvailableUris(siteKey, dataKey,
guidSource.getSourceName(), guidTime);
if (iguidURIs != null && !iguidURIs.isEmpty()) {
@ -227,7 +226,7 @@ public class FFMPDataLoader extends Thread {
// range
if (loadType == LOADER_TYPE.TERTIARY) {
hucsToLoad.clear();
hucsToLoad.add("ALL");
hucsToLoad.add(FFMPRecord.ALL);
}
if (isDone) {
@ -239,7 +238,7 @@ public class FFMPDataLoader extends Thread {
fireLoaderEvent(loadType, "Processing " + product.getRate(),
isDone);
for (String phuc : hucsToLoad) {
getMonitor().processUri(isProductLoad, rateURI, siteKey,
monitor.processUri(isProductLoad, rateURI, siteKey,
product.getRate(), timeBack, phuc);
}
fireLoaderEvent(loadType, product.getRate(), isDone);
@ -251,13 +250,13 @@ public class FFMPDataLoader extends Thread {
if (loadType == LOADER_TYPE.INITIAL) {
SourceXML source = getMonitor().getSourceConfig().getSource(
SourceXML source = sourceConfig.getSource(
product.getQpe());
qpeCache = readCacheFile(source, dataKey, wfo);
qpeCache = readAggregateRecord(source, dataKey, wfo);
if (qpeCache != null) {
getMonitor().insertFFMPData(qpeCache, siteKey,
monitor.insertFFMPData(qpeCache, siteKey,
product.getQpe());
}
}
@ -266,8 +265,8 @@ public class FFMPDataLoader extends Thread {
if (!qpeURIs.isEmpty() && qpeCache == null) {
for (String phuc : hucsToLoad) {
if (phuc.equals(layer)
|| phuc.equals("ALL")) {
getMonitor().processUris(qpeURIs, isProductLoad,
|| phuc.equals(FFMPRecord.ALL)) {
monitor.processUris(qpeURIs, isProductLoad,
siteKey, product.getQpe(), timeBack, phuc);
}
}
@ -284,22 +283,23 @@ public class FFMPDataLoader extends Thread {
if (loadType == LOADER_TYPE.INITIAL) {
SourceXML source = getMonitor().getSourceConfig()
SourceXML source = sourceConfig
.getSource(qpfSources.get(i));
String pdataKey = findQPFHomeDataKey(source);
qpfCache = readCacheFile(source, pdataKey, wfo);
qpfCache = readAggregateRecord(source, pdataKey, wfo);
if (qpfCache != null) {
for (String phuc : hucsToLoad) {
if ((phuc.equals(layer) || phuc.equals("ALL"))
if ((phuc.equals(layer) || phuc.equals(FFMPRecord.ALL))
&& loadType == LOADER_TYPE.INITIAL
&& source.getSourceName().equals(
config.getFFMPConfigData()
.getIncludedQPF())) {
.getIncludedQPF())) {
if (!qpfURIs.isEmpty()) {
getMonitor().processUris(qpfURIs,
monitor.processUris(qpfURIs,
isProductLoad, siteKey,
source.getSourceName(), timeBack,
phuc);
@ -307,7 +307,7 @@ public class FFMPDataLoader extends Thread {
}
}
getMonitor().insertFFMPData(qpfCache, siteKey,
monitor.insertFFMPData(qpfCache, siteKey,
source.getSourceName());
}
}
@ -317,13 +317,13 @@ public class FFMPDataLoader extends Thread {
if ((qpfCache == null) && !qpfURIs.isEmpty()) {
for (String phuc : hucsToLoad) {
if (phuc.equals(layer)
|| phuc.equals("ALL")) { // old
|| phuc.equals(FFMPRecord.ALL)) { // old
// code:
// keep
// for
// reference*/
// if (isHucProcessNeeded(phuc)) {/*DR13839*/
getMonitor().processUris(qpfURIs, isProductLoad,
monitor.processUris(qpfURIs, isProductLoad,
siteKey, product.getQpf(i), timeBack, phuc);
}
}
@ -340,22 +340,22 @@ public class FFMPDataLoader extends Thread {
if (loadType == LOADER_TYPE.INITIAL) {
SourceXML source = getMonitor().getSourceConfig().getSource(
SourceXML source = sourceConfig.getSource(
product.getVirtual());
vgbCache = readCacheFile(source, dataKey, wfo);
vgbCache = readAggregateRecord(source, dataKey, wfo);
if (vgbCache != null) {
getMonitor().insertFFMPData(vgbCache, siteKey,
monitor.insertFFMPData(vgbCache, siteKey,
product.getVirtual());
}
}
// Use this method of Virtual data retrieval if you don't have cache files
if ((vgbCache == null) && !virtualURIs.isEmpty()) {
getMonitor().processUris(virtualURIs, isProductLoad, siteKey,
product.getVirtual(), timeBack, "ALL");
monitor.processUris(virtualURIs, isProductLoad, siteKey,
product.getVirtual(), timeBack, FFMPRecord.ALL);
}
fireLoaderEvent(loadType, product.getVirtual(), isDone);
@ -373,8 +373,8 @@ public class FFMPDataLoader extends Thread {
fireLoaderEvent(loadType,
"Processing " + guidSource.getSourceName(), isDone);
getMonitor().processUris(iguidURIs, isProductLoad, siteKey,
guidSource.getSourceName(), timeBack, "ALL");
monitor.processUris(iguidURIs, isProductLoad, siteKey,
guidSource.getSourceName(), timeBack, FFMPRecord.ALL);
fireLoaderEvent(loadType, guidSource.getSourceName(),
isDone);
@ -459,83 +459,27 @@ public class FFMPDataLoader extends Thread {
* @param wfo
* @return
*/
private FFMPAggregateRecord readCacheFile(SourceXML source, String pdataKey, String wfo) {
private FFMPAggregateRecord readAggregateRecord(SourceXML source,
String pdataKey, String wfo) throws Exception {
long time = System.currentTimeMillis();
String sourceName = source.getSourceName();
File file = new File(sharePath + wfo + File.separator + sourceName
+ "-" + siteKey + "-" + pdataKey + ".bin");
File lockFile = new File(sharePath + wfo + File.separator + sourceName
+ "-" + siteKey + "-" + pdataKey + ".lock");
FFMPAggregateRecord record = null;
String sourceSiteDataKey = getSourceSiteDataKey(source, pdataKey);
while (lockFile.exists()) {
for (int i = 0; i < 4; i++) {
try {
sleep(100);
i++;
} catch (InterruptedException e) {
statusHandler.handle(Priority.ERROR,"Took to long to load Cache Record", e);
}
}
try {
break;
File hdf5File = FFMPUtils.getHdf5File(wfo, sourceSiteDataKey);
IDataStore dataStore = DataStoreFactory.getDataStore(hdf5File);
IDataRecord rec = dataStore.retrieve(wfo, sourceSiteDataKey,
Request.ALL);
byte[] bytes = ((ByteDataRecord) rec).getByteData();
record = SerializationUtil.transformFromThrift(
FFMPAggregateRecord.class, bytes);
} catch (Exception e) {
statusHandler.handle(Priority.WARN,
"Couldn't read Aggregate Record" + sourceSiteDataKey);
}
System.out.println("Cache File expected path: "
+ file.getAbsolutePath());
FFMPAggregateRecord cacheRecord = null;
if (file.exists()) {
System.out.println("Last mod: " + new Date(file.lastModified()));
if (file.lastModified() > (System.currentTimeMillis() - (6 * TimeUtil.MILLIS_PER_HOUR))) {
while (lockFile.exists()) {
for (int i = 0; i < 4; i++) {
try {
System.out.println("Waiting for new file: "
+ file.getAbsolutePath());
sleep(100);
i++;
} catch (InterruptedException e) {
statusHandler.handle(Priority.ERROR,"ERROR in Loading Cache Record", e);
}
}
break;
}
GZIPInputStream gis = null;
try {
System.out.println("Loading file: " + file.getName());
gis = new GZIPInputStream(new BufferedInputStream(new FileInputStream(file)));
DynamicSerializationManager dsm = DynamicSerializationManager
.getManager(SerializationType.Thrift);
cacheRecord = (FFMPAggregateRecord) dsm.deserialize(gis);
} catch (SerializationException e) {
statusHandler.handle(Priority.ERROR,"Serialization ERROR in Loading Cache Record", e);
} catch (IOException e) {
statusHandler.handle(Priority.ERROR,"IO ERROR in Loading Cache Record", e);
} finally {
if (gis != null) {
try {
gis.close();
} catch (IOException e) {
statusHandler.handle(Priority.ERROR,"GENRAL ERROR in Loading Cache Record", e);
}
}
}
}
}
long time2 = System.currentTimeMillis();
System.out.println("FFMP Cache file Load took: "+ (time2 - time) + " ms");
return cacheRecord;
return record;
}
/**
@ -550,16 +494,33 @@ public class FFMPDataLoader extends Thread {
.getInstance();
for (ProductRunXML product : runManager.getProducts()) {
File file = new File(sharePath + wfo + File.separator
+ source.getSourceName() + "-" + siteKey + "-"
+ product.getProductKey() + ".bin");
if (file.exists()) {
return product.getProductKey();
try {
// we are just checking if it exists or not
String pdataKey = product.getProductKey();
String sourceSiteDataKey = getSourceSiteDataKey(source, pdataKey);
File hdf5File = FFMPUtils.getHdf5File(wfo, sourceSiteDataKey);
DataStoreFactory.getDataStore(hdf5File);
return pdataKey;
} catch (Exception e) {
// not the right key, doesn't exist
continue;
}
}
return siteKey;
}
/**
* Get the sourceSiteDataKey for this piece of data
* @param source
* @param pdataKey
* @return
*/
private String getSourceSiteDataKey(SourceXML source, String pdataKey) {
return source.getSourceName() + "-" + siteKey + "-"
+ pdataKey;
}
}

View file

@ -1,5 +1,25 @@
package com.raytheon.uf.viz.monitor.ffmp.ui.rsc;
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
@ -25,6 +45,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FFMPTableData;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/23/10 4494 D. Hladky Initial release
* 02/01/13 1569 D. Hladky Added constants
*
* </pre>
*

View file

@ -26,6 +26,24 @@ import java.util.Set;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin;
/**
* Graph data object used to display 24 hour graph info
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/23/10 4494 D. Hladky Initial release
* 02/01/13 1569 D. Hladky Added constants
*
* </pre>
*
* @author dhladky
* @version 1
*/
public class FFMPGraphData {
private HashMap<Double, Double> qpes = new HashMap<Double, Double>();

View file

@ -23,16 +23,10 @@ package com.raytheon.uf.viz.monitor.ffmp.ui.rsc;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.SortedSet;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPUtils;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.vividsolutions.jts.geom.GeometryFactory;
/**
@ -45,6 +39,7 @@ import com.vividsolutions.jts.geom.GeometryFactory;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 08/29/09 2152 D. Hladky Initial release
* 02/01/13 1569 D. Hladky Added constants
*
* </pre>
*
@ -55,77 +50,7 @@ import com.vividsolutions.jts.geom.GeometryFactory;
public class FFMPGuiUtils {
public static GeometryFactory factory = new GeometryFactory();
/**
* Gets the upstream basins for the visualization
*
* @param cwa
* @return
*/
public static Set<Integer> getUpStreamBasins(Long pfaf) {
String sql = "select upstream1, upstream2, upstream3, upstream4, upstream5, upstream6 from "
+ FFMPUtils.FFMP_TABLE + " where pfaf_id = '" + pfaf + "'";
Set<Integer> basinIds = null;
try {
List<Object[]> results = DirectDbQuery.executeQuery(sql,
FFMPUtils.MAPS_DB, QueryLanguage.SQL);
if (results.size() > 0) {
basinIds = new HashSet<Integer>(
(int) (results.size() * 1.3) + 1);
Object[] results2 = results.get(0);
for (int i = 0; i < results2.length; i++) {
if (((Long) results2[i]).intValue() != 0) {
basinIds.add(((Long) results2[i]).intValue());
}
}
}
} catch (VizException e) {
e.printStackTrace();
}
return basinIds;
}
/**
* Gets the downstream basins for the visualization
*
* @param cwa
* @return
*/
public static Set<Long> getDownStreamBasins(int basin_id) {
String sql = "select pfaf_id from " + FFMPUtils.FFMP_TABLE
+ " where upstream1 = '" + basin_id + "' OR upstream2 = '"
+ basin_id + "' OR upstream3 = '" + basin_id
+ "' OR upstream4 = '" + basin_id + "' OR upstream5 = '"
+ basin_id + "' OR upstream6 = '" + basin_id + "'";
Set<Long> pfafIds = null;
try {
List<Object[]> results = DirectDbQuery.executeQuery(sql,
FFMPUtils.MAPS_DB, QueryLanguage.SQL);
if (results.size() > 0) {
pfafIds = new HashSet<Long>((int) (results.size() * 1.3) + 1);
Object[] results2 = results.get(0);
for (int i = 0; i < results2.length; i++) {
if (((String) results2[i]) != null) {
pfafIds.add(Long.parseLong((String) results2[i]));
}
}
}
} catch (VizException e) {
e.printStackTrace();
}
return pfafIds;
}
public static HashMap<Double, Integer> getTimeOffsets(
ArrayList<FFMPRecord> records) {
HashMap<Double, Integer> ctimes = new HashMap<Double, Integer>();
@ -176,7 +101,7 @@ public class FFMPGuiUtils {
* @return
*/
public static Date get1HourForward(Date timeIn) {
return new Date(timeIn.getTime() + (3600 * 1000));
return new Date(timeIn.getTime() + (TimeUtil.MILLIS_PER_HOUR));
}
/**
@ -186,7 +111,7 @@ public class FFMPGuiUtils {
* @return
*/
public static Date getHourDisplacement(Date timeIn, double hour) {
return new Date(timeIn.getTime() - (int) (3600 * 1000 * hour));
return new Date(timeIn.getTime() - (int) (TimeUtil.MILLIS_PER_HOUR * hour));
}
}

View file

@ -1,7 +1,45 @@
package com.raytheon.uf.viz.monitor.ffmp.ui.rsc;
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPDataLoader.LOADER_TYPE;
/**
* Loader status for FFMP
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/23/10 4494 D. Hladky Initial release
* 02/01/13 1569 D. Hladky Added constants
*
* </pre>
*
* @author dhladky
* @version 1
*/
public class FFMPLoaderStatus {
private LOADER_TYPE loaderType = null;

View file

@ -154,7 +154,8 @@ import com.vividsolutions.jts.geom.Point;
* 14 Sep 2012 1048 njensen Code cleanup
* 07 Dec 2012 1353 rferrel Changes for non-blocking FFMPSplash dialog.
* 10 Jan 2013 1475 dhladky Some cleanup
* 27 Jan 2013 1478 dhladky Changed gap collection to a generic list insted of Arraylist
* 27 Jan 2013 1478 dhladky Changed gap collection to a generic list instead of Arraylist
* 02/01/13 1569 D. Hladky Added constants
* </pre>
*
* @author dhladky
@ -166,9 +167,6 @@ public class FFMPResource extends
IResourceDataChanged, IFFMPResourceListener, FFMPListener,
FFMPLoadListener {
// TODO move ALL constant to common plugin
private static final String ALL = "ALL";
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(FFMPResource.class);
@ -324,7 +322,7 @@ public class FFMPResource extends
public Object centeredAggregationKey = null;
/** aggregate Pfaf list **/
public ArrayList<Long> centeredAggregatePfafList = null;
public List<Long> centeredAggregatePfafList = null;
/** table slider time **/
private Date tableTime = null;
@ -382,7 +380,7 @@ public class FFMPResource extends
private RGB basinBoundaryColor = null;
/** ordered list of times **/
private ArrayList<Date> timeOrderedKeys = new ArrayList<Date>();
private List<Date> timeOrderedKeys = new ArrayList<Date>();
private boolean toKeysInitialized = false;
@ -590,7 +588,7 @@ public class FFMPResource extends
if (aggregate) {
huc = getHuc();
} else {
huc = ALL;
huc = FFMPRecord.ALL;
}
basin = getRecord(bfield, recentTime).getBasinData(huc).getBasins()
.get(key);
@ -612,7 +610,7 @@ public class FFMPResource extends
double value = Double.NaN;
if (centeredAggregationKey != null) {
if (getHuc().equals(ALL)) {
if (getHuc().equals(FFMPRecord.ALL)) {
value = getBasinValue(key, recentTime, false);
return getColorUtil().colorByValue(value);
} else {
@ -654,7 +652,7 @@ public class FFMPResource extends
try {
if (aggregate && isWorstCase()) {
ArrayList<Long> pfafs = monitor.getTemplates(getSiteKey())
List<Long> pfafs = monitor.getTemplates(getSiteKey())
.getAggregatePfafs(key, getSiteKey(), getHuc());
switch (field) {
@ -667,12 +665,12 @@ public class FFMPResource extends
break;
}
case RATE: {
value = getRateRecord(recentTime).getBasinData(ALL)
value = getRateRecord(recentTime).getBasinData(FFMPRecord.ALL)
.getMaxValue(pfafs, recentTime);
break;
}
case QPF: {
value = getQpfRecord(recentTime).getBasinData(ALL)
value = getQpfRecord(recentTime).getBasinData(FFMPRecord.ALL)
.getAverageMaxValue(pfafs, recentTime,
getQpfSourceExpiration());
break;
@ -681,14 +679,14 @@ public class FFMPResource extends
long fips = monitor.getTemplates(getSiteKey())
.getCountyFipsByPfaf(pfafs.get(0));
value = getGuidanceRecord().getBasinData(ALL)
value = getGuidanceRecord().getBasinData(FFMPRecord.ALL)
.getMaxGuidanceValue(pfafs,
getGuidanceInterpolation(getFFGName()),
getGuidSourceExpiration(), fips);
break;
}
case QPE: {
value = getQpeRecord().getBasinData(ALL).getAccumMaxValue(
value = getQpeRecord().getBasinData(FFMPRecord.ALL).getAccumMaxValue(
pfafs, recentTime, getTableTime(),
getQpeSourceExpiration(),
getResourceData().getPrimarySourceXML().isRate());
@ -772,7 +770,7 @@ public class FFMPResource extends
return value;
}
private float forceValue(ArrayList<Long> pfafs, FFMPBasin basin,
private float forceValue(List<Long> pfafs, FFMPBasin basin,
float unforcedValue) {
float value = unforcedValue;
@ -786,17 +784,17 @@ public class FFMPResource extends
forceUtil.calculateForcings(pfafs,
monitor.getTemplates(getSiteKey()), basin);
ArrayList<Long> forcedPfafs = forceUtil.getForcedPfafList();
ArrayList<Long> pfafList = forceUtil.getPfafList();
List<Long> forcedPfafs = forceUtil.getForcedPfafList();
List<Long> pfafList = forceUtil.getPfafList();
boolean forced = forceUtil.isForced();
if ((forcedPfafs.size() > 0) && forced) {
// Recalculate the guidance using the forced value(s)
value = guidRecord.getBasinData(ALL).getAverageGuidanceValue(
value = guidRecord.getBasinData(FFMPRecord.ALL).getAverageGuidanceValue(
pfafList, this.getGuidanceInterpolation(getFFGName()),
new Float(value), forcedPfafs,
getGuidSourceExpiration());
} else if (forcedPfafs.size() > 0) {
value = guidRecord.getBasinData(ALL).getAverageGuidanceValue(
value = guidRecord.getBasinData(FFMPRecord.ALL).getAverageGuidanceValue(
pfafList, this.getGuidanceInterpolation(getFFGName()),
Float.NaN, forcedPfafs, getGuidSourceExpiration());
}
@ -868,7 +866,7 @@ public class FFMPResource extends
private String getHucIfWorstCase() {
String huc = null;
if (isWorstCase()) {
huc = ALL;
huc = FFMPRecord.ALL;
} else {
huc = getHuc();
}
@ -992,7 +990,7 @@ public class FFMPResource extends
if ((virtualRecord == null) && isNewVirtual) {
virtualRecord = monitor.getVirtualRecord(getProduct(),
getSiteKey(), getDataKey(), getPrimarySource(),
getTableTime(), ALL, false);
getTableTime(), FFMPRecord.ALL, false);
isNewVirtual = false;
}
@ -1244,7 +1242,7 @@ public class FFMPResource extends
lastExtent = expandedExtent;
}
boolean isAllHuc = getHuc().equals(ALL);
boolean isAllHuc = getHuc().equals(FFMPRecord.ALL);
for (DomainXML domain : getDomains()) {
String cwa = domain.getCwa();
if (isShaded) {
@ -1576,7 +1574,7 @@ public class FFMPResource extends
try {
FFMPBasinMetaData metaBasin = monitor.getTemplates(getSiteKey())
.findBasinByLatLon(getSiteKey(), coord.asLatLon());
if (getHuc().equals(ALL) || centeredAggregationKey != null) {
if (getHuc().equals(FFMPRecord.ALL) || centeredAggregationKey != null) {
pfaf = metaBasin.getPfaf();
if (isMaintainLayer) {
pfaf = monitor.getTemplates(getSiteKey())
@ -1689,7 +1687,7 @@ public class FFMPResource extends
int mapWidth = getDescriptor().getMapWidth() / 1000;
FFMPTemplates templates = monitor.getTemplates(getSiteKey());
String huc = getHuc();
boolean isAllHuc = huc.equals(ALL);
boolean isAllHuc = huc.equals(FFMPRecord.ALL);
if (centeredAggregationKey == null) {
centeredAggregationKey = fz.getKey();
@ -1833,7 +1831,7 @@ public class FFMPResource extends
* @return
*/
private double getDiff(Long key, boolean aggregate, Date recentTime,
ArrayList<Long> pfafs) {
List<Long> pfafs) {
float qpe = 0.0f;
float guid = 0.0f;
@ -1842,15 +1840,15 @@ public class FFMPResource extends
try {
if (aggregate) {
if (isWorstCase()) {
ArrayList<Float> qpes = null;
ArrayList<Float> guids = null;
List<Float> qpes = null;
List<Float> guids = null;
if ((getQpeRecord() != null)
&& (getGuidanceRecord() != null)) {
qpes = getQpeRecord().getBasinData(ALL).getAccumValues(
qpes = getQpeRecord().getBasinData(FFMPRecord.ALL).getAccumValues(
pfafs, getTableTime(), recentTime,
getQpeSourceExpiration(), isRate());
guids = getGuidanceRecord().getBasinData(ALL)
guids = getGuidanceRecord().getBasinData(FFMPRecord.ALL)
.getGuidanceValues(pfafs,
getGuidanceInterpolation(getFFGName()),
getGuidSourceExpiration());
@ -1882,14 +1880,14 @@ public class FFMPResource extends
} else {
if ((getQpeRecord() != null) && (getGuidanceRecord() != null)) {
qpe = getQpeRecord()
.getBasinData(ALL)
.getBasinData(FFMPRecord.ALL)
.get(key)
.getAccumValue(getTableTime(), recentTime,
getQpeSourceExpiration(), isRate());
guid = getGuidanceValue(
(FFMPGuidanceBasin) getGuidanceRecord()
.getBasinData(ALL).get(key), recentTime,
.getBasinData(FFMPRecord.ALL).get(key), recentTime,
getFFGName());
guid = forceValue(pfafs,
getBasin(key, getField(), recentTime, aggregate),
@ -1911,7 +1909,7 @@ public class FFMPResource extends
* @return
*/
private double getRatio(Long key, boolean aggregate, Date recentTime,
ArrayList<Long> pfafs) {
List<Long> pfafs) {
float qpe = 0.0f;
float guid = 0.0f;
@ -1920,15 +1918,15 @@ public class FFMPResource extends
try {
if (aggregate) {
if (isWorstCase()) {
ArrayList<Float> qpes = null;
ArrayList<Float> guids = null;
List<Float> qpes = null;
List<Float> guids = null;
if (getQpeRecord() != null) {
qpes = getQpeRecord().getBasinData(ALL).getAccumValues(
qpes = getQpeRecord().getBasinData(FFMPRecord.ALL).getAccumValues(
pfafs, getTableTime(), recentTime,
getQpeSourceExpiration(), isRate());
}
if (getGuidanceRecord() != null) {
guids = getGuidanceRecord().getBasinData(ALL)
guids = getGuidanceRecord().getBasinData(FFMPRecord.ALL)
.getGuidanceValues(pfafs,
getGuidanceInterpolation(getFFGName()),
getGuidSourceExpiration());
@ -1958,13 +1956,13 @@ public class FFMPResource extends
} else {
if ((getQpeRecord() != null) && (getGuidanceRecord() != null)) {
qpe = getQpeRecord()
.getBasinData(ALL)
.getBasinData(FFMPRecord.ALL)
.get(key)
.getAccumValue(getTableTime(), recentTime,
getQpeSourceExpiration(), isRate());
guid = getGuidanceValue(
(FFMPGuidanceBasin) getGuidanceRecord()
.getBasinData(ALL).get(key), recentTime,
.getBasinData(FFMPRecord.ALL).get(key), recentTime,
getFFGName());
ratio = FFMPUtils.getRatioValue(qpe, guid);
}
@ -2037,7 +2035,7 @@ public class FFMPResource extends
public void clearAllHuc() {
if (drawables != null) {
for (Entry<DataTime, FFMPDrawable> entry : drawables.entrySet()) {
entry.getValue().removeTable(ALL);
entry.getValue().removeTable(FFMPRecord.ALL);
}
}
}
@ -2190,7 +2188,7 @@ public class FFMPResource extends
for (DomainXML domain : getDomains()) {
try {
Map<Long, Geometry> map = hucGeomFactory.getGeometries(
templates, getSiteKey(), domain.getCwa(), ALL);
templates, getSiteKey(), domain.getCwa(), FFMPRecord.ALL);
if (map.containsKey(pfaf)) {
center = map.get(pfaf).getCentroid().getCoordinate();
@ -2330,40 +2328,40 @@ public class FFMPResource extends
private float getVGBValue(Long pfaf, Date recentTime) {
float value = 0.0f;
if (getField() == FIELDS.RATE) {
value = getVirtualRecord().getBasinsMap().get(ALL).get(pfaf)
value = getVirtualRecord().getBasinsMap().get(FFMPRecord.ALL).get(pfaf)
.getValue(recentTime);
} else if (getField() == FIELDS.QPE) {
value = getVirtualRecord()
.getBasinsMap()
.get(ALL)
.get(FFMPRecord.ALL)
.get(pfaf)
.getAccumValue(getTableTime(), getMostRecentTime(),
getQpeSourceExpiration(), isRate());
} else if (getField() == FIELDS.RATIO) {
float qpe = getVirtualRecord()
.getBasinsMap()
.get(ALL)
.get(FFMPRecord.ALL)
.get(pfaf)
.getAccumValue(getTableTime(), getMostRecentTime(),
getQpeSourceExpiration(), isRate());
float guidance = getGuidanceValue(
((FFMPGuidanceBasin) getGuidanceRecord().getBasinsMap()
.get(ALL).get(pfaf)), recentTime, getFFGName());
.get(FFMPRecord.ALL).get(pfaf)), recentTime, getFFGName());
value = FFMPUtils.getRatioValue(qpe, guidance);
} else if (getField() == FIELDS.DIFF) {
float qpe = getVirtualRecord()
.getBasinsMap()
.get(ALL)
.get(FFMPRecord.ALL)
.get(pfaf)
.getAccumValue(getTableTime(), getMostRecentTime(),
getQpeSourceExpiration(), isRate());
float guidance = getGuidanceValue(
((FFMPGuidanceBasin) getGuidanceRecord().getBasinsMap()
.get(ALL).get(pfaf)), recentTime, getFFGName());
.get(FFMPRecord.ALL).get(pfaf)), recentTime, getFFGName());
value = FFMPUtils.getDiffValue(qpe, guidance);
} else if (getField() == FIELDS.GUIDANCE) {
value = getGuidanceValue(((FFMPGuidanceBasin) getGuidanceRecord()
.getBasinsMap().get(ALL).get(pfaf)), recentTime,
.getBasinsMap().get(FFMPRecord.ALL).get(pfaf)), recentTime,
getFFGName());
}
return value;
@ -2509,7 +2507,7 @@ public class FFMPResource extends
.getTemplates(getSiteKey());
String phuc = getHuc();
boolean isAllPhuc = phuc.equals(ALL);
boolean isAllPhuc = phuc.equals(FFMPRecord.ALL);
FIELDS field = getField();
if (getResourceData().tableLoad) {
@ -2635,7 +2633,7 @@ public class FFMPResource extends
if (isParent()) {
allPfafs = templates.getMap(
getSiteKey(), cwa, ALL)
getSiteKey(), cwa, FFMPRecord.ALL)
.keySet();
} else {
allPfafs = (List<Long>) (templates
@ -2649,29 +2647,29 @@ public class FFMPResource extends
.getGeometries(
templates,
getSiteKey(),
cwa, ALL);
cwa, FFMPRecord.ALL);
IColormapShadedShape shape = shadedShapes
.getShape(cwa, ALL,
.getShape(cwa, FFMPRecord.ALL,
req.target,
descriptor);
shadedHuc = ALL;
shadedHuc = FFMPRecord.ALL;
for (Long allPfaf : allPfafs) {
generateShapes(templates,
ALL, allPfaf,
FFMPRecord.ALL, allPfaf,
allGeomMap, req,
shape, colorMap);
}
}
} else if (!isMaintainLayer()
&& !isParent()
&& !ALL.equals(phuc)
&& !FFMPRecord.ALL.equals(phuc)
&& pfaf.equals(centeredAggr)) {
Collection<Long> allPfafs = templates
.getMap(getSiteKey(), cwa,
ALL).keySet();
FFMPRecord.ALL).keySet();
if (allPfafs != null) {
@ -2679,19 +2677,19 @@ public class FFMPResource extends
.getGeometries(
templates,
getSiteKey(),
cwa, ALL);
cwa, FFMPRecord.ALL);
IColormapShadedShape shape = shadedShapes
.getShape(cwa, ALL,
.getShape(cwa, FFMPRecord.ALL,
req.target,
descriptor);
shadedHuc = ALL;
shadedHuc = FFMPRecord.ALL;
for (Long allPfaf : allPfafs) {
generateShapes(templates,
ALL, allPfaf,
FFMPRecord.ALL, allPfaf,
allGeomMap, req,
shape, colorMap);
}
@ -2718,16 +2716,16 @@ public class FFMPResource extends
Map<Long, Geometry> allGeomMap = hucGeomFactory
.getGeometries(templates,
getSiteKey(), cwa, ALL);
getSiteKey(), cwa, FFMPRecord.ALL);
IColormapShadedShape shape = shadedShapes
.getShape(cwa, ALL, req.target,
.getShape(cwa, FFMPRecord.ALL, req.target,
descriptor);
shadedHuc = ALL;
shadedHuc = FFMPRecord.ALL;
for (Long allPfaf : pfafsToProcess) {
generateShapes(templates, ALL,
generateShapes(templates, FFMPRecord.ALL,
allPfaf, allGeomMap, req,
shape, colorMap);
}
@ -2843,7 +2841,7 @@ public class FFMPResource extends
try {
color = getColor(pfaf, req.time.getRefTime(),
!ALL.equals(huc));
!FFMPRecord.ALL.equals(huc));
if (color != null) {
if (!shape.getColorKeys().contains(pfaf)) {
@ -2918,7 +2916,7 @@ public class FFMPResource extends
Map<Long, Geometry> geomMap = hucGeomFactory
.getGeometries(templates, getSiteKey(), cwa,
ALL);
FFMPRecord.ALL);
for (Long pfaf : streamPfafIds) {
// TODO: streamPfafIds should be ordered by
@ -2977,7 +2975,7 @@ public class FFMPResource extends
for (DomainXML domains : templates.getDomains()) {
String cwa = domains.getCwa();
Map<Long, Geometry> geomMap = hucGeomFactory.getGeometries(
templates, getSiteKey(), cwa, ALL);
templates, getSiteKey(), cwa, FFMPRecord.ALL);
if (geomMap != null) {
for (Long pfaf : geomMap.keySet()) {
@ -3258,7 +3256,7 @@ public class FFMPResource extends
try {
rateBasin = monitor.getGraphRateBasin(getProduct(), getSiteKey(),
getDataKey(), fvgbmd == null ? getProduct().getRate()
: getProduct().getVirtual(), oldestRefTime, ALL,
: getProduct().getVirtual(), oldestRefTime, FFMPRecord.ALL,
dataId);
ArrayList<Double> rateTimes = new ArrayList<Double>();
@ -3282,7 +3280,7 @@ public class FFMPResource extends
try {
qpeBasin = monitor.getGraphQPEBasin(getProduct(), getSiteKey(),
getDataKey(), fvgbmd == null ? getProduct().getQpe()
: getProduct().getVirtual(), oldestRefTime, ALL,
: getProduct().getVirtual(), oldestRefTime, FFMPRecord.ALL,
dataId);
ArrayList<Double> qpeTimes = new ArrayList<Double>();
@ -3312,7 +3310,7 @@ public class FFMPResource extends
try {
qpfBasin = monitor.getGraphQPFBasin(getProduct(), getSiteKey(),
getDataKey(), null, oldestRefTime, ALL, basinPfaf);
getDataKey(), null, oldestRefTime, FFMPRecord.ALL, basinPfaf);
Float qpfFloat = qpfBasin.getValue(monitor.getQpfWindow()
.getBeforeTime(), monitor.getQpfWindow().getAfterTime());
@ -3357,7 +3355,7 @@ public class FFMPResource extends
guidBasin = (FFMPGuidanceBasin) monitor.getGraphGuidanceBasin(
getProduct(), getSiteKey(), getDataKey(), null,
oldestRefTime, ALL, basinPfaf);
oldestRefTime, FFMPRecord.ALL, basinPfaf);
ArrayList<Double> guidTimes = new ArrayList<Double>();
for (SourceXML ffgSource : getProduct().getGuidanceSourcesByType(
ffgGraphType)) {
@ -3672,7 +3670,7 @@ public class FFMPResource extends
*/
public Date getOldestTime() {
synchronized (timeOrderedKeys) {
ArrayList<Date> times = getTimeOrderedKeys();
List<Date> times = getTimeOrderedKeys();
if (times != null) {
return times.get(0);
}
@ -3690,7 +3688,7 @@ public class FFMPResource extends
if (mostRecentTime == null) {
if (getTimeOrderedKeys() != null) {
synchronized (timeOrderedKeys) {
ArrayList<Date> times = getTimeOrderedKeys();
List<Date> times = getTimeOrderedKeys();
if (times != null) {
mostRecentTime = times.get(times.size() - 1);
return mostRecentTime;
@ -3712,7 +3710,7 @@ public class FFMPResource extends
* @param set
* @return ordered dates
*/
public synchronized ArrayList<Date> getTimeOrderedKeys() {
public synchronized List<Date> getTimeOrderedKeys() {
if (timeOrderedKeys == null || !toKeysInitialized) {
toKeysInitialized = true;
@ -3809,7 +3807,7 @@ public class FFMPResource extends
interpolationMap = new HashMap<String, FFMPGuidanceInterpolation>();
if (getProduct() != null) {
ArrayList<String> guidTypes = monitor.getRunConfig()
List<String> guidTypes = monitor.getRunConfig()
.getRunner(getResourceData().wfo)
.getProduct(getSiteKey())
.getGuidanceTypes(getProduct());
@ -3906,7 +3904,7 @@ public class FFMPResource extends
*
* @return list of the current centered agg
*/
public ArrayList<Long> getCenteredAggregatePfafs() {
public List<Long> getCenteredAggregatePfafs() {
if (centeredAggregatePfafList == null) {
Long center = null;
if (centeredAggregationKey instanceof String) {
@ -3931,7 +3929,7 @@ public class FFMPResource extends
* @param centeredAggregatePfafList
*/
public void setCenteredAggregatePfafs(
ArrayList<Long> centeredAggregatePfafList) {
List<Long> centeredAggregatePfafList) {
this.centeredAggregatePfafList = centeredAggregatePfafList;
}
@ -4203,7 +4201,7 @@ public class FFMPResource extends
ArrayList<String> hucsToLoad = new ArrayList<String>();
if (isWorstCase) {
hucsToLoad.add(ALL);
hucsToLoad.add(FFMPRecord.ALL);
}
// tertiary loader only loads ALL
@ -4212,8 +4210,8 @@ public class FFMPResource extends
hucsToLoad.add(getHuc());
}
} else {
if (!hucsToLoad.contains(ALL)) {
hucsToLoad.add(ALL);
if (!hucsToLoad.contains(FFMPRecord.ALL)) {
hucsToLoad.add(FFMPRecord.ALL);
}
}
// destroy any old loader

View file

@ -72,6 +72,7 @@ import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPConfigBasinXML;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 29 June, 2009 2521 dhladky Initial creation
* 02/01/13 1569 D. Hladky Added constants
*
* </pre>
*
@ -294,7 +295,7 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
.getAvailableUris(siteKey, dataKey, sourceName,
standAloneTime);
getMonitor().processUris(sourceURIs, false, siteKey,
sourceName, standAloneTime, "ALL");
sourceName, standAloneTime, FFMPRecord.ALL);
}
}
}

View file

@ -22,6 +22,7 @@ package com.raytheon.uf.viz.monitor.ffmp.ui.rsc;
import java.util.Date;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGap;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord.ZOOM;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
@ -43,6 +44,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpBasinTableDlg;
* ------------ ---------- ----------- --------------------------
* Oct 13, 2011 dhladky Initial creation.
* Jul 31, 2012 14517 mpduff Fix for Rapid slider changes
* 02/01/13 1569 D. Hladky Added constants
*
* </pre>
*
@ -123,7 +125,7 @@ public class FFMPTableDataLoader extends Thread {
if (resource.lowestCenter == ZOOM.WFO) {
iHuc = resource.getHuc();
} else {
iHuc = "ALL";
iHuc = FFMPRecord.ALL;
}
if (drawable.getTableData(iHuc) != null) {
// System.out.println(" Cache HITTTTTTTTT!!!!!");
@ -138,7 +140,7 @@ public class FFMPTableDataLoader extends Thread {
if (resource.lowestCenter == ZOOM.WFO) {
iHuc = resource.getHuc();
} else {
iHuc = "ALL";
iHuc = FFMPRecord.ALL;
}
// System.out

View file

@ -4,6 +4,21 @@ import java.util.Date;
import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FFMPTableData;
/**
* Table Data Updates go through this object
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 22 April, 2012 2521 dhladky Initial creation
* 02/01/13 1569 D. Hladky Added constants
* </pre>
*
* @author dhladky
* @version 1.0
*/
public class FFMPTableDataUpdate {
private boolean allowNewTableUpdate = false;

View file

@ -1,5 +1,25 @@
package com.raytheon.uf.viz.monitor.ffmp.ui.rsc;
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
/**
* Time object
*
@ -8,6 +28,7 @@ package com.raytheon.uf.viz.monitor.ffmp.ui.rsc;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 22 April, 2012 2521 dhladky Initial creation
* 02/01/13 1569 D. Hladky Added constants
* </pre>
*
* @author dhladky

View file

@ -22,6 +22,21 @@ package com.raytheon.uf.viz.monitor.ffmp.ui.rsc;
import java.util.Date;
/**
* Time Window Object
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 22 April, 2012 2521 dhladky Initial creation
* 02/01/13 1569 D. Hladky Added constants
* </pre>
*
* @author dhladky
* @version 1.0
*/
public class FFMPTimeWindow {
Date beforeTime = null;

View file

@ -29,11 +29,9 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Cache Record implementation for FFMP plugin
* Eventually this will become a full record implementation
*
* <pre>
*
* Aggregate record implementation for FFMP data
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
@ -49,11 +47,16 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@DynamicSerialize
public class FFMPAggregateRecord implements ISerializableObject {
private static final long serialVersionUID = 76774564363471L;
@DynamicSerializeElement
private String wfo;
@DynamicSerializeElement
private String sourceSiteDataKey;
private static final long serialVersionUID = 767745643535471L;
/**
*
* Aggregate Record implementation for FFMP
*/
public FFMPAggregateRecord() {
@ -65,10 +68,18 @@ public class FFMPAggregateRecord implements ISerializableObject {
@DynamicSerializeElement
private List<Long> times = new ArrayList<Long>();
/**
* Sets the times array
* @param times
*/
public void setTimes(List<Long> times) {
this.times = times;
}
/**
* Gets the times array
* @return
*/
public List<Long> getTimes() {
return times;
}
@ -82,11 +93,11 @@ public class FFMPAggregateRecord implements ISerializableObject {
}
/**
* Add a basin Data Cache object
* Add a basin Data aggregate object
* @param cacheData
*/
public void setBasinData(FFMPBasinData cacheData) {
basinsMap.put(cacheData.getHucLevel(), cacheData);
public void addBasinData(FFMPBasinData basinData) {
basinsMap.put(basinData.getHucLevel(), basinData);
}
/**
@ -100,5 +111,38 @@ public class FFMPAggregateRecord implements ISerializableObject {
}
return null;
}
/**
* WFO designator
* @return
*/
public String getWfo() {
return wfo;
}
/**
* Sets the WFO designator
* @param wfo
*/
public void setWfo(String wfo) {
this.wfo = wfo;
}
/**
* Sets the source / site / data key
* @param sourceSiteDataKey
*/
public void setSourceSiteDataKey(String sourceSiteDataKey) {
this.sourceSiteDataKey = sourceSiteDataKey;
}
/**
* Gets the source / site / data key
* @return
*/
public String getSourceSiteDataKey() {
return sourceSiteDataKey;
}
}

View file

@ -61,29 +61,25 @@ public class FFMPBasin implements ISerializableObject, Cloneable {
protected boolean aggregated = false;
/** object used in calculations
* not serialized
* not serialized!
**/
@Transient
protected TreeMap<Date, Float> values;
/** object used for serialization **/
@DynamicSerializeElement
public float[] cacheValues;
public float[] serializedValues;
public void setSerializedValues(float[] serializedValues) {
this.serializedValues = serializedValues;
}
/**
* Get the float array of serialized values
* @return
*/
public float[] getCacheValues() {
return cacheValues;
}
/**
* Set the serialized array of cache values
* @param cacheValues
*/
public void setCacheValues(float[] cacheValues) {
this.cacheValues = cacheValues;
public float[] getSerializedValues() {
return serializedValues;
}
/**
@ -337,8 +333,8 @@ public class FFMPBasin implements ISerializableObject, Cloneable {
*
* @param values
*/
public void setValues(TreeMap<Date, Float> cvalues) {
this.values = cvalues;
public void setValues(TreeMap<Date, Float> values) {
this.values = values;
}
/**
@ -374,18 +370,18 @@ public class FFMPBasin implements ISerializableObject, Cloneable {
}
/**
* Populates the values from the cache
* Populates the map from the serialized values
*
* @param times
*/
public void populate(List<Long> times) {
public void deserialize(List<Long> times) {
// safe to avoid Array Index Exceptions / shouldn't happen but.....
if (cacheValues != null && (times.size() == cacheValues.length)) {
if (serializedValues != null && (times.size() == serializedValues.length)) {
int i = 0;
for (Long time : times) {
values.put(new Date(time), cacheValues[i]);
values.put(new Date(time), serializedValues[i]);
i++;
}
//System.out.println("populated :"+i+" pfaf : "+pfaf);
@ -395,13 +391,13 @@ public class FFMPBasin implements ISerializableObject, Cloneable {
/**
* populates the serialized array
*/
public void setCache() {
public void serialize() {
cacheValues = new float[values.size()];
serializedValues = new float[values.size()];
int i = 0;
for (Date date: values.descendingKeySet()) {
cacheValues[i] = values.get(date);
serializedValues[i] = values.get(date);
i++;
}
//System.out.println("wrote :"+i+" pfaf : "+pfaf);

View file

@ -39,6 +39,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* ------------ ---------- ----------- --------------------------
* 06/22/09 2152 D. Hladky Initial release
* 01/27/13 1478 D. Hladky Added support for write of aggregate record cache
* 01/27/13 1569 D. Hladky Added support for write of aggregate record cache
*
* </pre>
*
@ -251,7 +252,7 @@ public class FFMPBasinData implements ISerializableObject {
* @param expiration
* @return
*/
public float getAverageMaxValue(ArrayList<Long> pfaf_ids, Date date,
public float getAverageMaxValue(List<Long> pfaf_ids, Date date,
long expiration) {
float tvalue = 0.0f;
@ -297,7 +298,7 @@ public class FFMPBasinData implements ISerializableObject {
* @param hour
* @return
*/
public float getMaxValue(ArrayList<Long> pfaf_ids, Date date) {
public float getMaxValue(List<Long> pfaf_ids, Date date) {
float tvalue = 0.0f;
for (Long pfaf : pfaf_ids) {
@ -319,9 +320,9 @@ public class FFMPBasinData implements ISerializableObject {
* @param sourceName
* @return
*/
public float getAverageGuidanceValue(ArrayList<Long> pfaf_ids,
public float getAverageGuidanceValue(List<Long> pfaf_ids,
FFMPGuidanceInterpolation interpolation, float guidance,
ArrayList<Long> forcedPfafs, long expiration) {
List<Long> forcedPfafs, long expiration) {
float tvalue = 0.0f;
float value;
@ -402,7 +403,7 @@ public class FFMPBasinData implements ISerializableObject {
* @param sourceName
* @return
*/
public float getMaxGuidanceValue(ArrayList<Long> pfaf_ids,
public float getMaxGuidanceValue(List<Long> pfaf_ids,
FFMPGuidanceInterpolation interpolation, long expiration,
long parentPfaf) {
float tvalue = Float.NaN;
@ -456,7 +457,7 @@ public class FFMPBasinData implements ISerializableObject {
* @param afterDate
* @return
*/
public float getAccumMaxValue(ArrayList<Long> pfaf_ids, Date beforeDate,
public float getAccumMaxValue(List<Long> pfaf_ids, Date beforeDate,
Date afterDate, long expirationTime, boolean rate) {
float tvalue = 0.0f;
@ -484,9 +485,9 @@ public class FFMPBasinData implements ISerializableObject {
* @param interpolation
* @return
*/
public ArrayList<Float> getGuidanceValues(ArrayList<Long> pfaf_ids,
public List<Float> getGuidanceValues(List<Long> pfaf_ids,
FFMPGuidanceInterpolation interpolation, long expiration) {
ArrayList<Float> values = new ArrayList<Float>();
List<Float> values = new ArrayList<Float>();
for (Long pfaf : pfaf_ids) {
FFMPBasin basin = basins.get(pfaf);
if (basin != null) {
@ -515,9 +516,9 @@ public class FFMPBasinData implements ISerializableObject {
* @param rate
* @return
*/
public ArrayList<Float> getAccumValues(ArrayList<Long> pfaf_ids,
public List<Float> getAccumValues(List<Long> pfaf_ids,
Date beforeDate, Date afterDate, long expirationTime, boolean rate) {
ArrayList<Float> values = new ArrayList<Float>();
List<Float> values = new ArrayList<Float>();
for (Long pfaf : pfaf_ids) {
FFMPBasin basin = basins.get(pfaf);
if (basin != null) {
@ -540,22 +541,22 @@ public class FFMPBasinData implements ISerializableObject {
}
/**
* populates data from the cache
* deserialize data from the aggregate record
*
* @param times
*/
public void populate(List<Long> times) {
for (FFMPBasin basin : basins.values()) {
basin.populate(times);
basin.deserialize(times);
}
}
/**
* populates the serialized array/objects
*/
public void setCache() {
public void serialize() {
for (FFMPBasin basin : basins.values()) {
basin.setCache();
basin.serialize();
}
}

View file

@ -31,6 +31,7 @@ import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager.SOUR
import com.raytheon.uf.common.monitor.xml.SourceXML;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
/**
* FFMP Data Container
@ -59,8 +60,8 @@ public class FFMPDataContainer {
private final ConcurrentHashMap<String, FFMPBasinData> basinDataMap = new ConcurrentHashMap<String, FFMPBasinData>();// DR
private String sourceName = null;
private String filePath = null;
private boolean isPurged = false;
public FFMPDataContainer() {
@ -338,10 +339,6 @@ public class FFMPDataContainer {
}
}
public String getFilePath() {
return filePath;
}
public Set<String> getKeys() {
return basinDataMap.keySet();
}
@ -490,9 +487,11 @@ public class FFMPDataContainer {
* @param backDate
*/
public void purge(Date backDate) {
statusHandler.handle(Priority.INFO, "Purging "+getSourceName()+" Container back to: "+backDate);
for (String huc : basinDataMap.keySet()) {
getBasinData(huc).purgeData(backDate);
}
setPurged(true);
}
/**
@ -500,7 +499,7 @@ public class FFMPDataContainer {
*
* @param cacheRecord
*/
public void setCacheData(FFMPAggregateRecord cacheRecord) {
public void setAggregateData(FFMPAggregateRecord cacheRecord) {
// create a record from the cache record
FFMPRecord record = new FFMPRecord(cacheRecord);
@ -536,10 +535,6 @@ public class FFMPDataContainer {
basinDataMap.put(huc, fftiData);
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public void setSourceName(String sourceName) {
this.sourceName = sourceName;
}
@ -592,4 +587,20 @@ public class FFMPDataContainer {
return basinDataMap;
}
/**
* Sets whether this container has been purged or not
* @param isPurged
*/
public void setPurged(boolean isPurged) {
this.isPurged = isPurged;
}
/**
* Has this container been purged?
* @return
*/
public boolean isPurged() {
return isPurged;
}
}

View file

@ -457,14 +457,14 @@ public class FFMPGuidanceBasin extends FFMPBasin implements ISerializableObject
return buff.toString();
}
public void populate(List<Long> times) {
// does nothing here, don't need to populate anything.
public void deserialize(List<Long> times) {
// does nothing here, this class is serialized as is.
}
/**
* populates the serialized array
*/
public void setCache() {
public void serialize() {
// does nothing here, this class is serialized as is.
}
}

View file

@ -119,6 +119,13 @@ public class FFMPRecord extends ServerSpecificPersistablePluginDataObject
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(FFMPRecord.class);
/** ALL HUC LEVEL **/
public static final String ALL = "ALL";
/** COUNTY HUC LEVEL **/
public static final String COUNTY = "COUNTY";
/** VIRTUAL HUC LEVEL **/
public static final String VIRTUAL = "VIRTUAL";
/**
* Default Constructor
@ -357,7 +364,7 @@ public class FFMPRecord extends ServerSpecificPersistablePluginDataObject
FFMPBasinData fbd = null;
boolean aggregate = true;
if (huc.equals("ALL")) {
if (huc.equals(ALL)) {
aggregate = false;
}
@ -530,7 +537,6 @@ public class FFMPRecord extends ServerSpecificPersistablePluginDataObject
statusHandler.handle(Priority.PROBLEM,
"ERROR Retrieving Map for URI: " + uri
+ "..." + huc);
e.printStackTrace();
}
}
}
@ -552,7 +558,7 @@ public class FFMPRecord extends ServerSpecificPersistablePluginDataObject
throws StorageException, FileNotFoundException {
FFMPBasinData fbd = null;
boolean aggregate = false;
fbd = getBasinData("ALL");
fbd = getBasinData(ALL);
String key = getDataKey();
synchronized (template) {
@ -571,7 +577,7 @@ public class FFMPRecord extends ServerSpecificPersistablePluginDataObject
try {
rec = dataStore.retrieve(
uri + "/" + domain.getCwa(), "ALL",
uri + "/" + domain.getCwa(), ALL,
Request.ALL);
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
@ -619,7 +625,7 @@ public class FFMPRecord extends ServerSpecificPersistablePluginDataObject
FFMPBasinData fbd = null;
try {
boolean aggregate = false;
fbd = getBasinData("ALL");
fbd = getBasinData(ALL);
String key = getDataKey();
for (DomainXML domain : template.getDomains()) {
@ -631,7 +637,7 @@ public class FFMPRecord extends ServerSpecificPersistablePluginDataObject
if (size > 0) {
try {
IDataRecord rec = dataStore
.retrieve(uri + "/" + domain.getCwa(), "ALL",
.retrieve(uri + "/" + domain.getCwa(), ALL,
Request.ALL);
if (rec != null) {
@ -663,13 +669,13 @@ public class FFMPRecord extends ServerSpecificPersistablePluginDataObject
statusHandler.handle(
Priority.PROBLEM,
"ERROR Retrieving Virtual ..."
+ domain.getCwa() + " : " + "ALL");
+ domain.getCwa() + " : " + ALL);
}
}
}
} catch (Throwable e) {
statusHandler.handle(Priority.ERROR, "ERROR Retrieving Virtual..."
+ "ALL");
+ ALL);
}
}
@ -747,8 +753,7 @@ public class FFMPRecord extends ServerSpecificPersistablePluginDataObject
*/
public void purgeData(Date date) {
for (String ihuc : getBasinsMap().keySet()) {
FFMPBasinData basinData = getBasinsMap().get(ihuc);
for (FFMPBasinData basinData : getBasinsMap().values()) {
basinData.purgeData(date);
}
}
@ -762,22 +767,21 @@ public class FFMPRecord extends ServerSpecificPersistablePluginDataObject
}
/**
* Get the fully cache ready object
* @param fileName
* Get the fully populated aggregate record
* @return
*/
public FFMPAggregateRecord getCacheRecord() {
public FFMPAggregateRecord getAggregateRecord() {
FFMPAggregateRecord fdcr = new FFMPAggregateRecord();
for (Entry<String,FFMPBasinData> entry: basinsMap.entrySet()) {
fdcr.setBasinData(entry.getValue());
for (FFMPBasinData basinData: basinsMap.values()) {
fdcr.addBasinData(basinData);
}
return fdcr;
}
/**
* Creates and populates a version of this record from a cache record
* Creates and populates a version of this record from an aggregate record
*
* @param fdcr
*/
@ -785,13 +789,10 @@ public class FFMPRecord extends ServerSpecificPersistablePluginDataObject
List<Long> times = fdcr.getTimes();
for (Entry<String, FFMPBasinData> entry : fdcr.getBasinsMap()
.entrySet()) {
FFMPBasinData fbd = entry.getValue();
for (FFMPBasinData basinData: fdcr.getBasinsMap().values()) {
// Keep in mind times can be null, Guidance basins are like that
fbd.populate(times);
setBasinData(fbd, fbd.getHucLevel());
basinData.populate(times);
setBasinData(basinData, basinData.getHucLevel());
}
}

View file

@ -82,6 +82,7 @@ import com.vividsolutions.jts.io.WKBReader;
* 07/29/09 2152 D. Hladky Initial release
* 07/09/10 3914 D. Hladky Localization work
* 12/13/10 7484 D. Hladky Service Backup
* 02/01/13 1569 D.Hladky Constants
*
* </pre>
*
@ -295,7 +296,7 @@ public class FFMPTemplates {
LinkedHashMap<Long, ?> map = null;
long[] list = readDomainList(huc, cwa, dataKey);
if (huc.equals("ALL")) {
if (huc.equals(FFMPRecord.ALL)) {
map = new LinkedHashMap<Long, FFMPBasinMetaData>();
HashMap<Long, FFMPBasinMetaData> protoMap = (HashMap<Long, FFMPBasinMetaData>) readDomainMap(
dataKey, huc, cwa);
@ -406,7 +407,7 @@ public class FFMPTemplates {
}
try {
if (huc.equals("ALL")) {
if (huc.equals(FFMPRecord.ALL)) {
LocalizationContext lc = pathManager.getContext(
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
@ -515,7 +516,7 @@ public class FFMPTemplates {
public FFMPBasinMetaData getBasin(String dataKey, Long pfaf) {
FFMPBasinMetaData fmbd = null;
for (DomainXML domain : domains) {
LinkedHashMap<Long, ?> map = getMap(dataKey, domain.getCwa(), "ALL");
LinkedHashMap<Long, ?> map = getMap(dataKey, domain.getCwa(), FFMPRecord.ALL);
fmbd = (FFMPBasinMetaData) map.get(pfaf);
if (fmbd != null) {
break;
@ -540,7 +541,7 @@ public class FFMPTemplates {
if (isSiteLoaded(product.getProductKey())) {
for (DomainXML domain : domains) {
LinkedHashMap<Long, ?> map = getMap(
product.getProductKey(), domain.getCwa(), "ALL");
product.getProductKey(), domain.getCwa(), FFMPRecord.ALL);
fmbd = (FFMPBasinMetaData) map.get(pfaf);
if (fmbd != null) {
return fmbd;
@ -738,7 +739,7 @@ public class FFMPTemplates {
if (basinList != null) {
LinkedHashMap<Long, ?> basinMap = getMap(dataKey,
domain.getCwa(), "ALL");
domain.getCwa(), FFMPRecord.ALL);
for (Long key : basinList) {
basins.add((FFMPBasinMetaData) basinMap.get(key));
}
@ -768,7 +769,7 @@ public class FFMPTemplates {
Map<Long, ArrayList<Long>> aggrMap = (Map<Long, ArrayList<Long>>) getMap(
dataKey, cwa, huc);
Map<Long, Geometry> geomMap = geomFactory.getGeometries(this,
dataKey, cwa, "ALL");
dataKey, cwa, FFMPRecord.ALL);
for (Long aggrPfaf : aggrMap.keySet()) {
Envelope env = envMap.get(aggrPfaf);
if ((env != null) && env.contains(coor)) {
@ -776,7 +777,7 @@ public class FFMPTemplates {
for (Long pfaf : aggrMap.get(aggrPfaf)) {
if (geomMap.get(pfaf).contains(point)) {
return (FFMPBasinMetaData) getMap(dataKey, cwa,
"ALL").get(pfaf);
FFMPRecord.ALL).get(pfaf);
}
}
}
@ -799,7 +800,7 @@ public class FFMPTemplates {
// TODO: make reverse lookup...
FFMPBasinMetaData basin = null;
for (DomainXML domain : domains) {
LinkedHashMap<Long, ?> map = getMap(dataKey, domain.getCwa(), "ALL");
LinkedHashMap<Long, ?> map = getMap(dataKey, domain.getCwa(), FFMPRecord.ALL);
for (Long key : map.keySet()) {
basin = ((FFMPBasinMetaData) map.get(key));
if (basin.getBasinId() == basinId) {
@ -923,7 +924,7 @@ public class FFMPTemplates {
try {
for (DomainXML domain : domains) {
for (Long key : getMap(dataKey, domain.getCwa(), "COUNTY")
for (Long key : getMap(dataKey, domain.getCwa(), FFMPRecord.COUNTY)
.keySet()) {
if (countyMap.get(key) == null) {
county = FFMPUtils.getCounty(key, MODE.CAVE.getMode());
@ -963,9 +964,9 @@ public class FFMPTemplates {
*/
@SuppressWarnings("unchecked")
public Long getAggregatedPfaf(Long key, String dataKey, String huc) {
if (huc.equals("ALL")) {
if (huc.equals(FFMPRecord.ALL)) {
return key;
} else if (huc.equals("COUNTY")) {
} else if (huc.equals(FFMPRecord.COUNTY)) {
// TODO: use envelope contains to limit search area?
for (DomainXML domain : domains) {
LinkedHashMap<Long, ?> map = getMap(dataKey, domain.getCwa(),
@ -1104,19 +1105,19 @@ public class FFMPTemplates {
ArrayList<Long> list = null;
Map<Long, TreeSet<Long>> aggrPfafToAllChildPfafsMap = null;
if (huc.equals("ALL")) {
if (huc.equals(FFMPRecord.ALL)) {
map = loadBasins(dataKey, cwa, FFMPUtils.getBasins(cwa,
getMaxExtent(), getSiteExtents(dataKey),
mode.getMode()));
} else if (huc.equals("COUNTY")) {
} else if (huc.equals(FFMPRecord.COUNTY)) {
list = getCountyFips(cwa, dataKey);
} else {
int myHucNum = Integer.parseInt(huc.substring(3));
TreeSet<Long> aggrPfafs = new TreeSet<Long>();
aggrPfafToAllChildPfafsMap = new HashMap<Long, TreeSet<Long>>();
if (myHucNum + 1 == getTotalHucLevels()) {
Set<Long> allPfafs = getMap(dataKey, cwa, "ALL")
Set<Long> allPfafs = getMap(dataKey, cwa, FFMPRecord.ALL)
.keySet();
for (Long pfaf : allPfafs) {
int endIndex = getHucDepthStart() + myHucNum;
@ -1154,16 +1155,16 @@ public class FFMPTemplates {
list = new ArrayList<Long>(aggrPfafs);
}
if (!huc.equals("ALL")) {
if (!huc.equals(FFMPRecord.ALL)) {
map = new LinkedHashMap<Long, ArrayList<Long>>();
Map<Long, Geometry> rawGeometries = null;
LinkedHashMap<Long, FFMPBasinMetaData> allMap = (LinkedHashMap<Long, FFMPBasinMetaData>) getMap(
dataKey, cwa, "ALL");
dataKey, cwa, FFMPRecord.ALL);
for (Long key : list) {
ArrayList<Long> innerList = null;
if (huc.equals("COUNTY")) {
if (huc.equals(FFMPRecord.COUNTY)) {
innerList = new ArrayList<Long>();
ArrayList<?> countyInfo = FFMPUtils.getCountyInfo(
key, mode.getMode());
@ -1213,10 +1214,10 @@ public class FFMPTemplates {
// trigger the write of the "ALL" now that the counties are
// set.
if (huc.equals("COUNTY")) {
if (huc.equals(FFMPRecord.COUNTY)) {
if (allMap != null) {
writeTemplateFile(dataKey, "ALL", cwa, allMap);
writeTemplateFile(dataKey, FFMPRecord.ALL, cwa, allMap);
}
}
}
@ -1228,7 +1229,7 @@ public class FFMPTemplates {
System.runFinalization();
System.gc();
if (!huc.equals("ALL") && map != null) {
if (!huc.equals(FFMPRecord.ALL) && map != null) {
writeTemplateFile(dataKey, huc, cwa, map);
}
}
@ -1311,7 +1312,7 @@ public class FFMPTemplates {
// Expensive..., use envelopes first to get rough idea and
// skip
// unnecessary checks
LinkedHashMap<Long, ?> map = getMap(dataKey, cwa, "ALL");
LinkedHashMap<Long, ?> map = getMap(dataKey, cwa, FFMPRecord.ALL);
for (Entry<Long, ?> entry : map.entrySet()) {
Long pfaf = entry.getKey();
Geometry geometry = rawGeometries.get(pfaf);
@ -1706,7 +1707,7 @@ public class FFMPTemplates {
if (parts.length == 2) {
for (DomainXML domain : domains) {
LinkedHashMap<Long, ArrayList<Long>> countyMap = (LinkedHashMap<Long, ArrayList<Long>>) getMap(
dataKey, domain.getCwa(), "COUNTY");
dataKey, domain.getCwa(), FFMPRecord.ALL);
for (Long id : countyMap.keySet()) {
for (Long key : countyMap.get(id)) {
FFMPBasinMetaData basin = getBasin(dataKey, key);
@ -1883,7 +1884,7 @@ public class FFMPTemplates {
getAbsoluteFileName(dataKey, huc, cwa, "map"));
try {
if (huc.equals("ALL")) {
if (huc.equals(FFMPRecord.ALL)) {
map = (HashMap<Long, FFMPBasinMetaData>) SerializationUtil
.transformFromThrift(FileUtil.file2bytes(f.getFile(),
@ -1918,7 +1919,7 @@ public class FFMPTemplates {
LocalizationContext lc = pathManager.getContext(
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
LocalizationFile f = pathManager.getLocalizationFile(lc,
getAbsoluteFileName(dataKey, "VIRTUAL", cwa, "map"));
getAbsoluteFileName(dataKey, FFMPRecord.VIRTUAL, cwa, "map"));
try {
map = (HashMap<String, FFMPVirtualGageBasinMetaData>) SerializationUtil
@ -1946,7 +1947,7 @@ public class FFMPTemplates {
LocalizationContext lc = pathManager.getContext(
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
LocalizationFile f = pathManager.getLocalizationFile(lc,
getAbsoluteFileName(dataKey, "VIRTUAL", cwa, "list"));
getAbsoluteFileName(dataKey, FFMPRecord.VIRTUAL, cwa, "list"));
try {
list = (String[]) SerializationUtil.transformFromThrift(FileUtil
@ -2036,7 +2037,7 @@ public class FFMPTemplates {
// TODO: add sync locking per cwa
long t0 = System.currentTimeMillis();
pfafGeometries = FFMPUtils.getRawGeometries(getMap(siteKey, cwa,
"ALL").keySet());
FFMPRecord.ALL).keySet());
long t1 = System.currentTimeMillis();
System.out.println("Retrieval of raw geometries for site "
+ siteKey + " cwa " + cwa + " took " + (t1 - t0) + " ms.");
@ -2125,7 +2126,7 @@ public class FFMPTemplates {
for (DomainXML domain : domains) {
for (Entry<Long, ?> entry : getMap(dataKey,
domain.getCwa(), "ALL").entrySet()) {
domain.getCwa(), FFMPRecord.ALL).entrySet()) {
FFMPBasinMetaData downBasin = (FFMPBasinMetaData) entry
.getValue();
@ -2193,7 +2194,7 @@ public class FFMPTemplates {
for (DomainXML domain : domains) {
LinkedHashMap<Long, ?> map = getMap(dataKey, domain.getCwa(), "ALL");
LinkedHashMap<Long, ?> map = getMap(dataKey, domain.getCwa(), FFMPRecord.ALL);
for (Long key : pfafs) {
if (map.containsKey(key)) {

View file

@ -21,6 +21,7 @@ package com.raytheon.uf.common.dataplugin.ffmp;
import java.awt.Rectangle;
import java.awt.geom.Point2D;
import java.io.File;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
@ -30,6 +31,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -79,6 +81,7 @@ import com.vividsolutions.jts.io.WKTWriter;
* ------------ ---------- ----------- --------------------------
* 06/22/09 2152 D. Hladky Initial release
* 06/18/12 DR 15108 G. Zhang Fix County FIPS 4-digit issue
* 01/02/13 DR 1569 D. Hladky constants, arraylist to list and moved common menthods here
* </pre>
*
* @author dhladky
@ -443,7 +446,7 @@ public class FFMPUtils {
long divisor = (long) Math.pow(10,
Integer.parseInt(huc.substring(3)));
rval = new Long(pfaf / divisor);
} else if ("ALL".equals(huc) || "VIRTUAL".equals(huc)) {
} else if (FFMPRecord.ALL.equals(huc) || FFMPRecord.VIRTUAL.equals(huc)) {
pfaf.toString().substring(0, templates.getHucDepthStart());
}
@ -459,7 +462,7 @@ public class FFMPUtils {
long divisor = (long) Math.pow(10,
Integer.parseInt(huc.substring(3)));
rval = new Long(pfaf / divisor);
} else if ("ALL".equals(huc) || "VIRTUAL".equals(huc)) {
} else if (FFMPRecord.ALL.equals(huc) || FFMPRecord.VIRTUAL.equals(huc)) {
rval = Long.parseLong(pfaf.toString().substring(0,
templates.getHucDepthStart()));
}
@ -1272,8 +1275,8 @@ public class FFMPUtils {
* @param guids
* @return
*/
public static float getMaxRatioValue(ArrayList<Float> qpes,
ArrayList<Float> guids) {
public static float getMaxRatioValue(List<Float> qpes,
List<Float> guids) {
float ratio = Float.NaN;
if ((qpes.size() == guids.size()) && (qpes.size() > 0)
@ -1319,8 +1322,8 @@ public class FFMPUtils {
* @param guids
* @return
*/
public static float getMaxDiffValue(ArrayList<Float> qpes,
ArrayList<Float> guids) {
public static float getMaxDiffValue(List<Float> qpes,
List<Float> guids) {
float diff = Float.NaN;
if ((qpes.size() == guids.size()) && (qpes.size() > 0)
&& (guids.size() > 0)) {
@ -1338,4 +1341,15 @@ public class FFMPUtils {
return diff;
}
/**
* Get the file used to store aggregate records
* @param cwa
* @param sourceSiteDataKey
* @return
*/
public static File getHdf5File(String cwa, String sourceSiteDataKey) {
return new File("ffmp" + File.separatorChar + cwa + File.separatorChar + sourceSiteDataKey + ".h5");
}
}

View file

@ -147,7 +147,7 @@ public class HucLevelGeometriesFactory {
if (pfafsToGenerate.size() > 0) {
Map<Long, Geometry> tmp = null;
if ("ALL".equals(huc)) {
if (FFMPRecord.ALL.equals(huc)) {
tmp = generateSimplifiedGeometry(template, dataKey, cwa,
pfafs);
} else {
@ -281,7 +281,7 @@ public class HucLevelGeometriesFactory {
* @return
*/
protected String getChildHuc(FFMPTemplates tempate, String huc) {
String rval = "ALL";
String rval = FFMPRecord.ALL;
if (huc.startsWith("HUC")) {
int totalHuc = tempate.getTotalHucLevels();
@ -307,7 +307,7 @@ public class HucLevelGeometriesFactory {
FFMPTemplates template, String dataKey, String cwa, String huc,
String childHuc) {
if ("ALL".equals(childHuc)) {
if (FFMPRecord.ALL.equals(childHuc)) {
return (Map<Long, Collection<Long>>) template.getMap(dataKey, cwa,
huc);
} else if (childHuc.startsWith("HUC")) {

View file

@ -109,7 +109,7 @@ public class FFMPDao extends PluginDao {
record.getSiteKey(), domain.getCwa(), key);
int size = 0;
if (key.equals("ALL")) {
if (key.equals(FFMPRecord.ALL)) {
for (Entry<String, FFMPVirtualGageBasinMetaData> entry : vmap
.entrySet()) {
if (entry.getValue() != null) {
@ -130,7 +130,7 @@ public class FFMPDao extends PluginDao {
float[] dataRec = new float[size];
int i = 0;
if (key.equals("ALL")) {
if (key.equals(FFMPRecord.ALL)) {
for (Entry<String, FFMPVirtualGageBasinMetaData> entry : vmap
.entrySet()) {
if (entry.getValue() != null) {

View file

@ -16,5 +16,6 @@ Require-Bundle: javax.persistence;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin.binlightning;bundle-version="1.11.26",
com.raytheon.uf.common.dataplugin.grid,
com.raytheon.uf.common.sounding;bundle-version="1.12.1112",
com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0"
com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0",
com.raytheon.uf.common.status;bundle-version="1.12.1174"

View file

@ -1,11 +1 @@
com.raytheon.uf.common.dataplugin.scan.ScanRecord
com.raytheon.uf.common.dataplugin.scan.data.CellTableData
com.raytheon.uf.common.dataplugin.scan.data.CellTableDataRow
com.raytheon.uf.common.dataplugin.scan.data.DMDTableData
com.raytheon.uf.common.dataplugin.scan.data.MDTableData
com.raytheon.uf.common.dataplugin.scan.data.DMDTableDataRow
com.raytheon.uf.common.dataplugin.scan.data.TVSTableData
com.raytheon.uf.common.dataplugin.scan.data.TVSTableDataRow
com.raytheon.uf.common.dataplugin.scan.data.ModelData
com.raytheon.uf.common.dataplugin.scan.data.LightningData
com.raytheon.uf.common.dataplugin.scan.data.SoundingData

View file

@ -49,6 +49,9 @@ import com.raytheon.uf.common.serialization.DynamicSerializationManager;
import com.raytheon.uf.common.serialization.DynamicSerializationManager.SerializationType;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
/**
* Rehash of SCAN
@ -60,6 +63,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 03/17/10 2521 D. Hladky Initial release
* 02/01/13 1649 D. Hladky better logging,
*
* </pre>
*
@ -78,7 +82,10 @@ public class ScanRecord extends ServerSpecificPersistablePluginDataObject {
*
*/
private static final long serialVersionUID = 5983810116816447875L;
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(ScanRecord.class);
@Column(length = 7)
@DataURI(position = 1)
@DynamicSerializeElement
@ -267,7 +274,7 @@ public class ScanRecord extends ServerSpecificPersistablePluginDataObject {
SerializationType.Thrift).deserialize(bais);
setTableData((ScanTableData<?>) o);
} catch (Throwable e) {
e.printStackTrace();
statusHandler.handle(Priority.ERROR, "Couldn't load Table data!" + getDataURI());
}
}
@ -286,7 +293,7 @@ public class ScanRecord extends ServerSpecificPersistablePluginDataObject {
SerializationType.Thrift).deserialize(bais);
setSoundingData((SoundingData) o);
} catch (Throwable e) {
e.printStackTrace();
statusHandler.handle(Priority.ERROR, "Couldn't load Sounding data!" + getDataURI());
}
}
@ -305,7 +312,7 @@ public class ScanRecord extends ServerSpecificPersistablePluginDataObject {
SerializationType.Thrift).deserialize(bais);
setModelData((ModelData) o);
} catch (Throwable e) {
e.printStackTrace();
statusHandler.handle(Priority.ERROR, "Couldn't load Model data!" + getDataURI());
}
}

View file

@ -28,11 +28,14 @@ import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.scan.ScanRecord;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.datastorage.StorageProperties;
import com.raytheon.uf.common.datastorage.StorageProperties.Compression;
import com.raytheon.uf.common.datastorage.records.ByteDataRecord;
import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
import com.raytheon.uf.common.serialization.DynamicSerializationManager;
import com.raytheon.uf.common.serialization.DynamicSerializationManager.SerializationType;
import com.raytheon.uf.edex.core.dataplugin.PluginRegistry;
import com.raytheon.uf.edex.database.plugin.PluginDao;
/**
@ -43,6 +46,7 @@ import com.raytheon.uf.edex.database.plugin.PluginDao;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 02/24/09 2027 dhladky Initial Creation
* 02/01/13 1649 D. Hladky removed XML where not needed, compression
*
* </pre>
*
@ -58,26 +62,40 @@ public class ScanDao extends PluginDao {
@Override
protected IDataStore populateDataStore(IDataStore dataStore,
IPersistable obj) throws Exception {
ScanRecord scanRec = (ScanRecord) obj;
String table = null;
if (scanRec.getType().equals(ScanTables.CELL.name())) {
table = ScanTables.CELL.name();
StorageProperties sp = null;
String compression = PluginRegistry.getInstance()
.getRegisteredObject(scanRec.getPluginName()).getCompression();
if (compression != null) {
sp = new StorageProperties();
sp.setCompression(Compression.valueOf(compression));
}
if (scanRec.getModelData() != null) {
byte[] data = DynamicSerializationManager.getManager(
SerializationType.Thrift).serialize(
scanRec.getTableData());
ByteDataRecord bdr = new ByteDataRecord(table + "/model",
scanRec.getDataURI(), data);
dataStore.addDataRecord(bdr);
dataStore.addDataRecord(bdr, sp);
}
if (scanRec.getSoundingData() != null) {
byte[] data = DynamicSerializationManager.getManager(
SerializationType.Thrift).serialize(
scanRec.getTableData());
ByteDataRecord bdr = new ByteDataRecord(table + "/sounding",
scanRec.getDataURI(), data);
dataStore.addDataRecord(bdr);
dataStore.addDataRecord(bdr, sp);
}
} else if (scanRec.getType().equals(ScanTables.DMD.name())) {

View file

@ -20,10 +20,6 @@ package com.raytheon.uf.common.dataplugin.scan.data;
* further licensing information.
**/
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@ -36,6 +32,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 05/11/2009 1981 dhladky Initial Creation.
* 02/01/13 1569 D. Hladky removed XML where not needed
*
* </pre>
*
@ -43,8 +40,6 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* @version 1.0
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
@SuppressWarnings({ "unchecked", "rawtypes" })
public class CellTableData<T extends ScanTableDataRow> extends ScanTableData {

View file

@ -24,11 +24,6 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.monitor.scan.config.SCANConfig;
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@ -45,14 +40,13 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* April 29, 2009 2037 dhladky Initial creation
* 02/01/13 1569 D. Hladky removed XML where not needed
* </pre>
*
* @author dhladky
* @version 1.0
*
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class CellTableDataRow extends ScanTableDataRow {
@ -71,146 +65,117 @@ public class CellTableDataRow extends ScanTableDataRow {
/** cell rank in table **/
@DynamicSerializeElement
@XmlElement
public Integer rank = 0;
/** cell TVS **/
@DynamicSerializeElement
@XmlElement
public String tvs = TVS_TYPE.NONE.getTVSName();
/** meso cyclone detection alg rank **/
@DynamicSerializeElement
@XmlElement
public String mdaSR = null;
/** prob of severe hail **/
@DynamicSerializeElement
@XmlElement
public Integer posh = 0;
/** prob of hail **/
@DynamicSerializeElement
@XmlElement
public Integer poh = 0;
/** prob of large hail **/
@DynamicSerializeElement
@XmlElement
public Integer polh = 0;
/** hail size, inches **/
@DynamicSerializeElement
@XmlElement
public Double hsize = 0.0;
/** Vertically Integrated Liquid **/
@DynamicSerializeElement
@XmlElement
public Double vil = 0.0;
/** max reflectivity Decibel return **/
@DynamicSerializeElement
@XmlElement
public Double dbz = 0.0;
/** height of max reflectivity dbz return **/
@DynamicSerializeElement
@XmlElement
public Double dbzHt = 0.0;
/** top of storm in kft **/
@DynamicSerializeElement
@XmlElement
public Double top = 0.0;
/** 15 min forecast azm **/
@DynamicSerializeElement
@XmlElement
public Double azm15 = 0.0;
/** 15 min forecast range **/
@DynamicSerializeElement
@XmlElement
public Double rng15 = 0.0;
/** 30 min forecast azm **/
@DynamicSerializeElement
@XmlElement
public Double azm30 = 0.0;
/** 30 min forecast range **/
@DynamicSerializeElement
@XmlElement
public Double rng30 = 0.0;
/** 45 min forecast azm **/
@DynamicSerializeElement
@XmlElement
public Double azm45 = 0.0;
/** 45 min forecast range **/
@DynamicSerializeElement
@XmlElement
public Double rng45 = 0.0;
/** 60 min forecast azm **/
@DynamicSerializeElement
@XmlElement
public Double azm60 = 0.0;
/** 60 min forecast range **/
@DynamicSerializeElement
@XmlElement
public Double rng60 = 0.0;
/** move error **/
@DynamicSerializeElement
@XmlElement
public Double mvtErr = 0.0;
/** move error mean **/
@DynamicSerializeElement
@XmlElement
public Double mvtMn = 0.0;
/** severe wx prob **/
@DynamicSerializeElement
@XmlElement
public Integer svrwx = 0;
/** heavy precip % **/
@DynamicSerializeElement
@XmlElement
public Integer hvyPr = 0;
/** % positive ligtning strikes **/
@DynamicSerializeElement
@XmlElement
public Double pos = 0.0;
/** % cloud to ground strikes **/
@DynamicSerializeElement
@XmlElement
public Double cgRate = 0.0;
/** Volume Coverage Pattern **/
@DynamicSerializeElement
@XmlElement
public Integer vcp = 0;
/** CAPE Convective Available Potential Energy **/
@DynamicSerializeElement
@XmlElement
public Double cape = -99999.0;
/** Storm Relative Helicity **/
@DynamicSerializeElement
@XmlElement
public Double sreh = -99999.0;
@DynamicSerializeElement
@XmlElement
public HashMap<Date, Coordinate> pastCoordinates;
/**

View file

@ -1,9 +1,5 @@
package com.raytheon.uf.common.dataplugin.scan.data;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@ -36,6 +32,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 05/11/2009 1981 dhladky Initial Creation.
* 02/01/13 1569 D. Hladky removed XML where not needed
*
* </pre>
*
@ -44,8 +41,6 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class DMDTableData<T extends ScanTableDataRow> extends ScanTableData {

View file

@ -21,10 +21,7 @@ package com.raytheon.uf.common.dataplugin.scan.data;
import java.util.ArrayList;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@ -40,14 +37,13 @@ import com.raytheon.uf.common.time.DataTime;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* April 29, 2009 2037 dhladky Initial creation
* 02/01/13 1569 D. Hladky removed XML where not needed
* </pre>
*
* @author dhladky
* @version 1.0
*
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class DMDTableDataRow extends ScanTableDataRow {
@ -68,126 +64,101 @@ public class DMDTableDataRow extends ScanTableDataRow {
/** storm ID **/
@DynamicSerializeElement
@XmlElement
public String strmID = "N/A";
/** Low level rotational velocity **/
@DynamicSerializeElement
@XmlElement
public Double llVr = 0.0;
/** low level gate to gate velocity **/
@DynamicSerializeElement
@XmlElement
public Double llgtg = 0.0;
/** base of circulation height kft **/
@DynamicSerializeElement
@XmlElement
public Double base = 0.0;
/** depth of circulation depth kft **/
@DynamicSerializeElement
@XmlElement
public Double depth = 0.0;
/** relative depth % **/
@DynamicSerializeElement
@XmlElement
public Double relDepth = 0.0;
/** low level diameter **/
@DynamicSerializeElement
@XmlElement
public Double llDiam = 0.0;
/** max rotational velocity **/
@DynamicSerializeElement
@XmlElement
public Double maxVr = 0.0;
/** height of max rotational velocity **/
@DynamicSerializeElement
@XmlElement
public Double htMxVr = 0.0;
/** low level convergence **/
@DynamicSerializeElement
@XmlElement
public Double llConv = 0.0;
/** mid level convergence **/
@DynamicSerializeElement
@XmlElement
public Double mlConv = 0.0;
/** Low level shear **/
@DynamicSerializeElement
@XmlElement
public Double llShear = 0.0;
/** tvs Tornado Vortex Sig **/
@DynamicSerializeElement
@XmlElement
public String tvs = "N/A";
/** MSI mean strength index **/
@DynamicSerializeElement
@XmlElement
public Integer msi = 0;
/** age of storm **/
@DynamicSerializeElement
@XmlElement
public Integer age = 0;
/** zero level elevation **/
@DynamicSerializeElement
@XmlElement
public String elev0 = "N/A";
/** status **/
@DynamicSerializeElement
@XmlElement
public String status = "N/A";
/** rank **/
@DynamicSerializeElement
@XmlElement
public String rank = "N/A";
/** rankType **/
@DynamicSerializeElement
@XmlElement
public String rankType = "";
/** overlap **/
@DynamicSerializeElement
@XmlElement
public boolean overlap = false;
/** fcst lat **/
@DynamicSerializeElement
@XmlElement
public ArrayList<Double> fcstLat = null;
/** fsct lon **/
@DynamicSerializeElement
@XmlElement
public ArrayList<Double> fcstLon = null;
@DynamicSerializeElement
@XmlElement
public ArrayList<Double> pastLat = null;
/** fsct lon **/
@DynamicSerializeElement
@XmlElement
public ArrayList<Double> pastLon = null;
/** timeHeight_height **/
@DynamicSerializeElement
@XmlElement
public ArrayList<Double> timeHeightHeight = null;
/** timeHeight_diam **/
@ -197,37 +168,30 @@ public class DMDTableDataRow extends ScanTableDataRow {
/** timeHeight_rotvel **/
@DynamicSerializeElement
@XmlElement
public ArrayList<Double> timeHeightRotvel = null;
/** timeHeight_shear **/
@DynamicSerializeElement
@XmlElement
public ArrayList<Double> timeHeightShear = null;
/** timeHeight_gtgmax **/
@DynamicSerializeElement
@XmlElement
public ArrayList<Double> timeHeightGtgMax = null;
/** timeHeight_rank **/
@DynamicSerializeElement
@XmlElement
public ArrayList<Double> timeHeightRank = null;
/** angles **/
@DynamicSerializeElement
@XmlElement
public ArrayList<Double> timeHeightElevationAngles = null;
/** indexes **/
@DynamicSerializeElement
@XmlElement
public ArrayList<Double> timeHeightElevationIndexes = null;
/** times **/
@DynamicSerializeElement
@XmlElement
public ArrayList<Double> timeHeightTimes = null;
/**

View file

@ -24,16 +24,27 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.time.util.TimeUtil;
/**
*
* SCAN Lightning Data
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 02/01/13 1569 D. Hladky removed XML where not needed
* </pre>
*
* @author dhladky
* @version 1.0
*
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class LightningData implements ISerializableObject {
@ -119,7 +130,7 @@ public class LightningData implements ISerializableObject {
private void purge(Date date) {
// keep no more than 15 minutes worth
long timeBarrier = 15 * 60 * 1000;
long timeBarrier = 15 * TimeUtil.MILLIS_PER_MINUTE;
Date backTime = new Date(date.getTime() - timeBarrier);
ArrayList<Date> old = new ArrayList<Date>();
// purge old records

View file

@ -19,10 +19,6 @@
**/
package com.raytheon.uf.common.dataplugin.scan.data;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@ -36,6 +32,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 11/15/2010 6707 grichard Initial creation
* 02/01/13 1569 D. Hladky removed XML where not needed
*
* </pre>
*
@ -44,8 +41,6 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class MDTableData<T extends ScanTableDataRow> extends ScanTableData {

View file

@ -23,10 +23,6 @@ import java.awt.Point;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.geotools.coverage.grid.GridGeometry2D;
@ -41,8 +37,22 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.time.DataTime;
import com.vividsolutions.jts.geom.Coordinate;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
/**
*
* SCAN Model Data
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 02/01/13 1569 D. Hladky removed XML where not needed, removed SS println's left in code
* </pre>
*
* @author dhladky
* @version 1.0
*
*/
@DynamicSerialize
public class ModelData implements ISerializableObject {
@ -159,19 +169,18 @@ public class ModelData implements ISerializableObject {
public double getValue(String modelName, String prodType, Coordinate coor) {
double value = -99999.0;
try {
System.out.println("Freezing level---debug0 getValue "+modelName+" "+prodType+" "+coor+" "+gribMap.size());
//System.out.println("Freezing level---debug0 getValue "+modelName+" "+prodType+" "+coor+" "+gribMap.size());
Point point = getPoint(modelName, prodType, coor);
GridRecord gribRec = getRecord(modelName, prodType);
FloatDataRecord rec = (FloatDataRecord) getRecord(modelName,
prodType).getMessageData();
System.out.println("Freezing level---debug1 getValue "+rec.getFloatData().length+" "+
gribRec.getSpatialObject().getNx()+","+gribRec.getSpatialObject().getNy()+" "+point);
//System.out.println("Freezing level---debug1 getValue "+rec.getFloatData().length+" "+
// gribRec.getSpatialObject().getNx()+","+gribRec.getSpatialObject().getNy()+" "+point);
value = rec.getFloatData()[(gribRec.getSpatialObject().getNx() *
(gribRec.getSpatialObject().getNy()-point.y)) + point.x];
} catch (Exception e) {
logger.error("No Grib value available....." + modelName + " "
+ prodType);
e.printStackTrace();
}
return value;
}

View file

@ -22,10 +22,6 @@ package com.raytheon.uf.common.dataplugin.scan.data;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
import com.raytheon.uf.common.dataplugin.radar.util.RadarDataInterrogator;
import com.raytheon.uf.common.serialization.ISerializableObject;
@ -41,6 +37,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 9, 2010 5098 grichard Initial creation.
* 02/01/13 1569 D. Hladky removed XML where not needed
*
* </pre>
*
@ -48,8 +45,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* @version 1.0
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class RadarData implements ISerializableObject {

View file

@ -25,11 +25,6 @@ import java.util.Date;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.monitor.scan.config.SCANConfig;
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
import com.raytheon.uf.common.serialization.ISerializableObject;
@ -45,14 +40,14 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* April 29, 2009 2037 dhladky Initial creation
* 02/01/13 1569 D. Hladky removed XML where not needed
* </pre>
*
* @author dhladky
* @version 1.0
*
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public abstract class ScanTableData<T extends ScanTableDataRow> implements
ISerializableObject, Serializable {
@ -63,31 +58,24 @@ public abstract class ScanTableData<T extends ScanTableDataRow> implements
private static final long serialVersionUID = 1L;
@DynamicSerializeElement
@XmlElement
public ScanTables tableName = null;
@DynamicSerializeElement
@XmlElement
public Integer vcp = null;
@DynamicSerializeElement
@XmlElement
public Double trueAngle = null;
@DynamicSerializeElement
@XmlElement
public Boolean lastElevationAngle;
@DynamicSerializeElement
@XmlElement
public Date volScanTime = null;
@DynamicSerializeElement
@XmlElement
public ConcurrentHashMap<String, T> tableData = null;
@DynamicSerializeElement
@XmlElement
public List<String> featureIds = null;
public SCANConfig config = null;

View file

@ -21,11 +21,6 @@ package com.raytheon.uf.common.dataplugin.scan.data;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@ -40,14 +35,14 @@ import com.raytheon.uf.common.time.DataTime;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* April 29, 2009 2037 dhladky Initial creation
* 02/01/13 1569 D. Hladky removed XML where not needed
* </pre>
*
* @author dhladky
* @version 1.0
*
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public abstract class ScanTableDataRow implements ISerializableObject, Serializable {
@ -105,47 +100,35 @@ public abstract class ScanTableDataRow implements ISerializableObject, Serializa
};
/** time of insert **/
@DynamicSerializeElement
@XmlElement
public DataTime time = null;
/** azimuth **/
@DynamicSerializeElement
@XmlElement
public Double azm = 0.0;
/** range **/
@DynamicSerializeElement
@XmlElement
public Double rng = 0.0;
/** speed **/
@DynamicSerializeElement
@XmlElement
public Double spd = 0.0;
/** direction **/
@DynamicSerializeElement
@XmlElement
public Double dir = 0.0;
/** county of origin **/
@DynamicSerializeElement
@XmlElement
public String county = "N/A";
/** cwa **/
@DynamicSerializeElement
@XmlElement
public String cwa = "N/A";
/** latitude **/
@DynamicSerializeElement
@XmlElement
public Double lat = 0.0;
/** longitude **/
@DynamicSerializeElement
@XmlElement
public Double lon = 0.0;
@DynamicSerializeElement
@XmlElement
/** Ident (Cell Table - Storm ID, MESO DMDIdent, TVS FeatureID) **/
public String ident = null;
@DynamicSerializeElement
@XmlElement
/** is feature new **/
public boolean isNew = true;

View file

@ -4,10 +4,6 @@ import java.util.HashMap;
import java.util.Map;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@ -45,44 +41,38 @@ import com.raytheon.uf.common.time.DataTime;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 05/11/2009 2307 dhladky Initial Creation.
* 02/01/13 1569 D. Hladky removed XML where not needed
*
* </pre>
*
* @author dhladky
* @version 1.0
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class SoundingData implements ISerializableObject {
@DynamicSerializeElement
@XmlElement
public DataTime time = null;
/** sounding freeze level **/
@DynamicSerializeElement
@XmlElement
public float frzLevel = 0.0f;
/** sounding 100 - 500 mb thickness **/
@DynamicSerializeElement
@XmlElement
public float thick1000500 = 0.0f;
/** wind speed at 700 mb **/
@DynamicSerializeElement
@XmlElement
public float spd700 = 0.0f;
/** U wind at 500 mb **/
@DynamicSerializeElement
@XmlElement
public float u500 = 0.0f;
/** Sounding total totals **/
@DynamicSerializeElement
@XmlElement
public float totalTotals = 0.0f;
@Transient

View file

@ -20,10 +20,6 @@ package com.raytheon.uf.common.dataplugin.scan.data;
* further licensing information.
**/
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@ -36,6 +32,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 05/11/2009 1981 dhladky Initial Creation.
* 02/01/13 1569 D. Hladky removed XML where not needed
*
* </pre>
*
@ -44,8 +41,6 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class TVSTableData<T extends ScanTableDataRow> extends ScanTableData {

View file

@ -19,10 +19,7 @@
**/
package com.raytheon.uf.common.dataplugin.scan.data;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@ -37,14 +34,14 @@ import com.raytheon.uf.common.time.DataTime;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* April 29, 2009 2037 dhladky Initial creation
* 02/01/13 1569 D. Hladky removed XML where not needed
* </pre>
*
* @author dhladky
* @version 1.0
*
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class TVSTableDataRow extends ScanTableDataRow {
@ -63,23 +60,18 @@ public class TVSTableDataRow extends ScanTableDataRow {
/** Storm ID **/
@DynamicSerializeElement
@XmlElement
public String strmID = null;
/** DMD Ident **/
@DynamicSerializeElement
@XmlElement
public String DMDIdent = null;
/** type of TVS **/
@DynamicSerializeElement
@XmlElement
public String type = TVS_TYPE.NONE.getTVSName();
/** average delta velocity **/
@DynamicSerializeElement
@XmlElement
public Double avgDv = 0.0;
/** average low level delta velocity **/
@DynamicSerializeElement
@XmlElement
public Double llDV = 0.0;
/** maximum delta velocity **/
@DynamicSerializeElement
@ -87,27 +79,21 @@ public class TVSTableDataRow extends ScanTableDataRow {
public Double maxDV = 0.0;
/** maximum delta velocity height kft **/
@DynamicSerializeElement
@XmlElement
public Double maxDvHt = 0.0;
/** base height kft **/
@DynamicSerializeElement
@XmlElement
public Double base = 0.0;
/** depth of circulation kft **/
@DynamicSerializeElement
@XmlElement
public Double depth = 0.0;
/** top of circulation kft **/
@DynamicSerializeElement
@XmlElement
public Double top = 0.0;
/** shear value m/s/km **/
@DynamicSerializeElement
@XmlElement
public Double shear = 0.0;
/** height of maximum shear kft **/
@DynamicSerializeElement
@XmlElement
public Double shrHt = 0.0;
/**

View file

@ -18,6 +18,7 @@
<value>com.raytheon.uf.common.dataplugin.radar</value>
</list>
</property>
<property name="compression" value="LZF"/>
</bean>
<bean factory-bean="pluginRegistry" factory-method="register" depends-on="radarRegistered">

View file

@ -19,25 +19,18 @@
**/
package com.raytheon.uf.edex.plugin.ffmp;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
import java.util.regex.Pattern;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import com.raytheon.edex.msg.DataURINotificationMessage;
import com.raytheon.edex.plugin.radar.dao.RadarStationDao;
@ -54,6 +47,14 @@ import com.raytheon.uf.common.dataplugin.ffmp.SourceBinList;
import com.raytheon.uf.common.dataplugin.ffmp.dao.FFMPDao;
import com.raytheon.uf.common.dataplugin.radar.RadarStation;
import com.raytheon.uf.common.dataplugin.radar.util.RadarsInUseUtil;
import com.raytheon.uf.common.datastorage.DataStoreFactory;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.datastorage.IDataStore.StoreOp;
import com.raytheon.uf.common.datastorage.Request;
import com.raytheon.uf.common.datastorage.StorageProperties;
import com.raytheon.uf.common.datastorage.StorageProperties.Compression;
import com.raytheon.uf.common.datastorage.records.ByteDataRecord;
import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
@ -75,9 +76,6 @@ import com.raytheon.uf.common.monitor.xml.ProductRunXML;
import com.raytheon.uf.common.monitor.xml.ProductXML;
import com.raytheon.uf.common.monitor.xml.SourceIngestConfigXML;
import com.raytheon.uf.common.monitor.xml.SourceXML;
import com.raytheon.uf.common.ohd.AppsDefaults;
import com.raytheon.uf.common.serialization.DynamicSerializationManager;
import com.raytheon.uf.common.serialization.DynamicSerializationManager.SerializationType;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.status.IUFStatusHandler;
@ -86,6 +84,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.uf.edex.core.EDEXUtil;
import com.raytheon.uf.edex.core.dataplugin.PluginRegistry;
import com.raytheon.uf.edex.core.props.PropertiesFactory;
import com.raytheon.uf.edex.cpgsrv.CompositeProductGenerator;
import com.raytheon.uf.edex.dat.utils.DatMenuUtil;
@ -111,6 +110,7 @@ import com.raytheon.uf.edex.plugin.ffmp.common.FFTIProcessor;
* 02/03/2011 6500 cjeanbap Fixed NullPointerException.
* 07/31/2011 578 dhladky FFTI modifications
* 01/27/13 1478 D. Hladky Added creation of full cache records to help read write stress on NAS
* 02/01/13 1569 D. Hladky Added constants, switched to using aggregate records written through pypies
* </pre>
*
* @author dhladky
@ -141,8 +141,7 @@ public class FFMPGenerator extends CompositeProductGenerator implements
private static final String productType = "ffmp";
/**
* The thought was this will eventually be dynamic when We start writing
* long time source records to a DAO. This is the time backward limit for FFTI and cache load data.
* The thought was this will eventually be dynamic when front end can support it.
*/
public static final int SOURCE_CACHE_TIME = 6;
@ -202,13 +201,6 @@ public class FFMPGenerator extends CompositeProductGenerator implements
private IPathManager pathManager;
public static String sharePath = AppsDefaults.getInstance().getToken(
"apps_dir")
+ File.separator + "ffmp" + File.separator;
/** source bins used for finding basin to data correlations **/
private HashMap<String, SourceBinList> sourceBins = new HashMap<String, SourceBinList>();
/** thread executor **/
public Executor processexecutor = null;
@ -1019,7 +1011,7 @@ public class FFMPGenerator extends CompositeProductGenerator implements
* @return
*/
public String getAbsoluteSourceFileName(String sourceId) {
return "ffmp" + File.separator + "sources" + File.separator + sourceId
return productType + File.separator + "sources" + File.separator + sourceId
+ ".bin";
}
@ -1044,15 +1036,7 @@ public class FFMPGenerator extends CompositeProductGenerator implements
* @return
*/
public SourceBinList getSourceBinList(String sourceId) {
SourceBinList sbl = null;
if (!sourceBins.containsKey(sourceId)) {
sbl = readSourceBins(sourceId);
sourceBins.put(sourceId, sbl);
} else {
sbl = sourceBins.get(sourceId);
}
return sbl;
return readSourceBins(sourceId);
}
/**
@ -1061,7 +1045,6 @@ public class FFMPGenerator extends CompositeProductGenerator implements
* @param sbl
*/
public void setSourceBinList(SourceBinList sbl) {
sourceBins.put(sbl.getSourceId(), sbl);
writeSourceBins(sbl);
}
@ -1315,9 +1298,9 @@ public class FFMPGenerator extends CompositeProductGenerator implements
|| source.getSourceType().equals(
SOURCE_TYPE.GUIDANCE.getSourceType())) {
hucs.clear();
hucs.add("ALL");
hucs.add(FFMPRecord.ALL);
} else {
hucs.remove("VIRTUAL");
hucs.remove(FFMPRecord.VIRTUAL);
}
// pull from disk if there
@ -1400,9 +1383,7 @@ public class FFMPGenerator extends CompositeProductGenerator implements
source, ffmpRec.getBasinData(huc), huc,
ffmpRec.getSiteKey());
}
// set the name
fdc.setFilePath("" + sharePath + ffmpRec.getWfo() + "/"
+ sourceSiteDataKey);
// cache it temporarily for FFTI use
if (source.getSourceType().equals(
SOURCE_TYPE.GUIDANCE.getSourceType())) {
@ -1441,7 +1422,7 @@ public class FFMPGenerator extends CompositeProductGenerator implements
}
}
}
// purge it up
// check for a purge
if (fdc != null) {
// this is defensive for if errors get thrown
if (backDate == null) {
@ -1449,11 +1430,13 @@ public class FFMPGenerator extends CompositeProductGenerator implements
- (TimeUtil.MILLIS_PER_HOUR * SOURCE_CACHE_TIME));
}
fdc.purge(backDate);
if (!fdc.isPurged()) {
fdc.purge(backDate);
}
if (write) {
// write it out
writeCacheFiles(fdc);
writeAggregateRecord(fdc, sourceSiteDataKey);
}
}
}
@ -1472,130 +1455,99 @@ public class FFMPGenerator extends CompositeProductGenerator implements
public FFMPDataContainer loadFFMPDataContainer(String sourceSiteDataKey,
ArrayList<String> hucs, String siteKey, String wfo, Date backDate) {
long time = System.currentTimeMillis();
FFMPDataContainer fdc = null;
FFMPAggregateRecord record = null;
boolean populated = false;
if (checkCacheFile(sourceSiteDataKey, wfo, backDate)) {
try {
record = readCacheFile(sourceSiteDataKey, wfo, backDate);
} catch (Exception e) {
statusHandler.handle(Priority.ERROR,
"General Error Reading cache file: " + e.getMessage());
}
if (fdc == null && record != null) {
// creates a place holder for this source
fdc = new FFMPDataContainer(sourceSiteDataKey, hucs, record);
populated = true;
}
try {
record = readAggregateRecord(sourceSiteDataKey, wfo);
} catch (Exception e) {
// this isn't necessarily an error
statusHandler.handle(Priority.DEBUG, "Couldn't load source file: "
+ sourceSiteDataKey);
}
// condition for first time read in
if (fdc == null && record != null) {
// creates a place holder for this source
fdc = new FFMPDataContainer(sourceSiteDataKey, hucs, record);
populated = true;
}
// condition for update to fdc while in use
if (record != null && !populated) {
fdc.setCacheData(record);
fdc.setAggregateData(record);
}
// sometimes a record will sit around for a long time and it will have data going back to the last precip event
// this can be an enormous amount of time. Want to get the data dumped from memory ASAP.
if (fdc != null) {
long time2 = System.currentTimeMillis();
statusHandler.handle(Priority.INFO, "Loaded Source files: in "
+ (time2 - time) + " ms: source: " + sourceSiteDataKey);
fdc.purge(backDate);
}
return fdc;
}
/**
* Load existing cache file
* Load existing aggregate record
*
* @param sourceSiteDataKey
* @param wfo
* @return
* @throws IOException
*/
private FFMPAggregateRecord readCacheFile(String sourceSiteDataKey, String wfo,
Date backDate) throws IOException {
private FFMPAggregateRecord readAggregateRecord(String sourceSiteDataKey,
String wfo) throws Exception {
File file = new File(sharePath + wfo + "/" + sourceSiteDataKey + ".bin");
FFMPAggregateRecord record = null;
GZIPInputStream gis = null;
try {
gis = new GZIPInputStream(new BufferedInputStream(new FileInputStream(file)));
DynamicSerializationManager dsm = DynamicSerializationManager
.getManager(SerializationType.Thrift);
record = (FFMPAggregateRecord) dsm.deserialize(gis);
} catch (SerializationException e) {
statusHandler
.handle(Priority.ERROR,
"Serialization Error Reading cache file: "
+ e.getMessage());
} catch (IOException e) {
statusHandler.handle(Priority.ERROR,
"IO Error Reading cache file: " + e.getMessage());
} catch (Exception e) {
statusHandler.handle(Priority.ERROR,
"General Error Reading cache file: " + e.getMessage());
} catch (Throwable t) {
statusHandler.handle(Priority.ERROR,
"Bogus Thrift Error Reading cache file: " + t.getMessage());
} finally {
if (gis != null) {
gis.close();
}
}
File hdf5File = FFMPUtils.getHdf5File(wfo, sourceSiteDataKey);
IDataStore dataStore = DataStoreFactory.getDataStore(hdf5File);
IDataRecord rec = dataStore.retrieve(wfo, sourceSiteDataKey,
Request.ALL);
byte[] bytes = ((ByteDataRecord) rec).getByteData();
record = SerializationUtil.transformFromThrift(
FFMPAggregateRecord.class, bytes);
return record;
}
/**
* Write cache file
* Writes the aggregate FFMP records
*
* @param sourceSiteDataKey
* @param huc
* @param wfo
* @return
* @param fdc
*/
public void writeCacheFiles(FFMPDataContainer fdc) {
public void writeAggregateRecord(FFMPDataContainer fdc, String sourceSiteDataKey) {
// Write all huc levels in separate files
File fileDir = new File("" + sharePath + config.getCWA());
if (!fileDir.exists()) {
fileDir.mkdir();
}
WriteFiles writer = new WriteFiles(fdc);
WriteAggregateRecord writer = new WriteAggregateRecord(fdc, sourceSiteDataKey);
writer.run();
}
/**
* Inner class to thread writing of cache files
* Inner class to thread writing aggregate records
*
* @author dhladky
*
*/
private class WriteFiles implements Runnable {
private class WriteAggregateRecord implements Runnable {
private FFMPDataContainer fdc;
private String sourceSiteDataKey;
public void run() {
try {
long time = System.currentTimeMillis();
write();
long time2 = System.currentTimeMillis();
statusHandler.handle(Priority.INFO, "Wrote cache file: in "
+ (time2 - time) + " ms :" + fdc.getFilePath());
} catch (Exception e) {
statusHandler.handle(Priority.ERROR,
"WriteFile: removed " + e.getMessage());
"WriteAggregateRecord: removed " + e.getMessage());
}
}
public WriteFiles(FFMPDataContainer fdc) {
public WriteAggregateRecord(FFMPDataContainer fdc, String sourceSiteDataKey) {
this.fdc = fdc;
statusHandler.handle(Priority.DEBUG, "Created FileWriter");
this.sourceSiteDataKey = sourceSiteDataKey;
statusHandler.handle(Priority.DEBUG, "Created Aggregate Record Writer");
}
/**
@ -1605,155 +1557,61 @@ public class FFMPGenerator extends CompositeProductGenerator implements
try {
File sharePathFile = new File(sharePath + config.getCWA());
if (!sharePathFile.exists()) {
sharePathFile.mkdirs();
FFMPAggregateRecord aggRecord = null;
synchronized (fdc) {
aggRecord = new FFMPAggregateRecord();
aggRecord.setSourceSiteDataKey(sourceSiteDataKey);
aggRecord.setWfo(config.getCWA());
// times for Guidance basins will be null
aggRecord.setTimes(fdc.getOrderedTimes());
for (FFMPBasinData fbd : fdc.getBasinMap().values()) {
fbd.serialize();
aggRecord.addBasinData(fbd);
}
}
String fileName = fdc.getFilePath();
// lock for atomic write and read
HashMap<String, String> fileNames = new HashMap<String, String>();
File lockfile = new File(fileName + ".lock");
lockfile.createNewFile();
if (aggRecord.getBasinsMap().size() > 0) {
try {
if (lockfile.canWrite()) {
// write the lock if we can even write to anything
FFMPAggregateRecord cacheRecord = null;
synchronized (fdc) {
cacheRecord = new FFMPAggregateRecord();
// times for Guidance basins will be null
cacheRecord.setTimes(fdc.getOrderedTimes());
for (Entry<String, FFMPBasinData> entry : fdc
.getBasinMap().entrySet()) {
FFMPBasinData fbd = entry.getValue();
fbd.setCache();
cacheRecord.setBasinData(fbd);
}
}
if (cacheRecord.getBasinsMap().size() > 0) {
String tmpFilePath = fileName + ".tmp";
GZIPOutputStream gos = null;
try {
File file = new File(tmpFilePath);
file.createNewFile();
if (file.canWrite()) {
gos = new GZIPOutputStream(new BufferedOutputStream(
new FileOutputStream(file)));
DynamicSerializationManager dsm = DynamicSerializationManager
.getManager(SerializationType.Thrift);
dsm.serialize(cacheRecord, gos);
fileNames.put(tmpFilePath, fileName
+ ".bin");
} else {
statusHandler.handle(
Priority.WARN,
"Can not write cache file: "
+ file.getAbsolutePath());
}
} catch (SerializationException e) {
statusHandler.handle(Priority.ERROR,
"Serialization Error Writing cache file: "
+ e.getMessage());
} catch (IOException e) {
statusHandler.handle(
Priority.ERROR,
"IO Error Writing cache file: "
+ e.getMessage());
} catch (Exception e) {
statusHandler.handle(Priority.ERROR,
"General Error Writing cache file: "
+ e.getMessage());
} finally {
if (gos != null) {
gos.close();
}
}
}
}
} catch (Exception e) {
statusHandler.handle(Priority.ERROR,
"Error writing cache File: " + e.getMessage());
} finally {
// rename the files to real path
try {
for (String tmpName : fileNames.keySet()) {
File file = new File(tmpName);
if (file.renameTo(new File(fileNames.get(tmpName)))) {
statusHandler.handle(
Priority.DEBUG,
"Successful rename: : "
+ fileNames.get(tmpName));
} else {
statusHandler.handle(
Priority.ERROR,
"UN-Successful rename: : "
+ fileNames.get(tmpName));
}
}
if (lockfile.exists()) {
lockfile.delete();
StorageProperties sp = null;
String compression = PluginRegistry.getInstance()
.getRegisteredObject(productType).getCompression();
if (compression != null) {
sp = new StorageProperties();
sp.setCompression(Compression.valueOf(compression));
}
byte[] bytes = SerializationUtil.transformToThrift(aggRecord);
// NAME | GROUP | array |Dimension | size
IDataRecord rec = new ByteDataRecord(sourceSiteDataKey, config.getCWA(),
bytes, 1, new long[] { bytes.length });
File hdf5File = FFMPUtils.getHdf5File(config.getCWA(), sourceSiteDataKey);
IDataStore dataStore = DataStoreFactory.getDataStore(hdf5File);
// write it, allowing, and in fact encouraging replacing the last one
dataStore.addDataRecord(rec, sp);
dataStore.store(StoreOp.OVERWRITE);
} catch (Exception e) {
statusHandler.handle(
Priority.ERROR,
"IO Error Renaming cache file: "
"General Error Writing aggregate record: "
+ e.getMessage());
}
}
} catch (Exception e) {
statusHandler.handle(Priority.ERROR,
"IO Error writing cache files: " + e.getMessage());
"Error writing aggregate record: " + e.getMessage());
}
}
}
/**
* Load existing cache file
*
* @param sourceSiteDataKey
* @param wfo
* @return
*/
public boolean checkCacheFile(String sourceSiteDataKey, String wfo,
Date backDate) {
File file = new File(sharePath + wfo + "/" + sourceSiteDataKey + ".bin");
String sourceName = sourceSiteDataKey.split("-")[0];
SourceXML source = getSourceConfig().getSourceByDisplayName(sourceName);
if (source != null) {
if (source.getSourceType().equals(
SOURCE_TYPE.GUIDANCE.getSourceType())) {
if (file.exists() && file.canRead() && file.canWrite()) {
return true;
}
} else {
if (file.exists() && file.canRead() && file.canWrite()
&& (file.lastModified() > backDate.getTime())) {
// System.out.println("File update and exists..."+sourceSiteDataKey);
return true;
}
}
}
return false;
}
@Override
public synchronized void configChanged(MonitorConfigEvent fce) {
@ -1791,10 +1649,6 @@ public class FFMPGenerator extends CompositeProductGenerator implements
ffgCheck = false;
resetFilters();
if (sourceBins != null) {
sourceBins.clear();
}
loadedData.clear();
if (ffmpData != null) {
@ -1922,7 +1776,7 @@ public class FFMPGenerator extends CompositeProductGenerator implements
* @return
*/
public String getAbsoluteFFTIFileName(String fftiName) {
return "ffmp" + File.separator + "ffti" + File.separator + fftiName
return productType + File.separator + "ffti" + File.separator + fftiName
+ ".bin";
}
@ -1966,5 +1820,5 @@ public class FFMPGenerator extends CompositeProductGenerator implements
public void setProcessExecutor(Executor processexecutor) {
this.processexecutor = processexecutor;
}
}
}

View file

@ -44,6 +44,7 @@ import com.raytheon.uf.edex.plugin.ffmp.FFMPGenerator;
* 29 July, 2011 6772 dhladky Initial creation
* 29 July, 2012 578 dhladky memory work
* 27 Jan, 2013 1478 dhladky Changed arraylist to list for times, more constants
* 02/01/13 1569 D. Hladky Added constants
* </pre>
*
* @author dhladky
@ -89,74 +90,80 @@ public class FFMPInterpolatedGuidanceDelay {
*
* @return
*/
public FFMPRecord calculateDelayedGuidance() {
FFMPDataContainer qpeContainer = null;
public boolean calculateDelayedGuidance() {
boolean delayGuidance = false;
ArrayList<String> hucs = new ArrayList<String>();
hucs.add("ALL");
hucs.add(FFMPRecord.ALL);
qpeContainer = generator.getFFMPDataContainer(qpeSource.getSourceName()
+ "-" + siteKey + "-" + siteKey, hucs, backDate);
long expirationTime = qpeSource.getExpirationMinutes(siteKey)
* TimeUtil.MILLIS_PER_MINUTE;
// determine lag_time
long lagTime = (currentRecord.getDataTime().getRefTime().getTime())
+ (long) (ffgSource.getDurationHour() * TimeUtil.MILLIS_PER_MINUTE);
// Determine hour fraction.
int fraction_Hr = (int) (((float) (currentRecord.getDataTime()
.getRefTime().getTime() - (lagTime - guidFrequency))) / (float) guidFrequency);
// Gets the ordered times for QPE
List<Date> orderedTimes = qpeContainer
.getOrderedTimes(currentRecord.getDataTime().getRefTime());
FFMPDataContainer qpeContainer = generator.getFFMPDataContainer(qpeSource.getSourceName()
+ "-" + siteKey + "-" + siteKey, hucs, backDate);
// EQUATION: Guid = GuidOld + R i/d (GuidNew - GuidOld)
for (Entry<Long, FFMPBasin> entry : currentRecord.getBasinsMap()
.get("ALL").getBasins().entrySet()) {
FFMPBasin currBasin = entry.getValue();
FFMPGuidanceBasin oldBasin = (FFMPGuidanceBasin) previousGuidanceData
.get(entry.getKey());
// comparison for increase / decrease
if (oldBasin != null && currBasin != null) {
// Don't do anything, we have no QPE
if (qpeContainer != null) {
long expirationTime = qpeSource.getExpirationMinutes(siteKey)
* TimeUtil.MILLIS_PER_MINUTE;
// determine lag_time
long lagTime = (currentRecord.getDataTime().getRefTime().getTime())
+ (long) (ffgSource.getDurationHour() * TimeUtil.MILLIS_PER_MINUTE);
// Determine hour fraction.
int fraction_Hr = (int) (((float) (currentRecord.getDataTime()
.getRefTime().getTime() - (lagTime - guidFrequency))) / (float) guidFrequency);
// Gets the ordered times for QPE
List<Date> orderedTimes = qpeContainer
.getOrderedTimes(currentRecord.getDataTime().getRefTime());
float fraction = 0.0f;
float delta = currBasin.getValue()
- oldBasin
.getValue(backDate, ffgSource.getSourceName());
// EQUATION: Guid = GuidOld + R i/d (GuidNew - GuidOld)
for (Entry<Long, FFMPBasin> entry : currentRecord.getBasinsMap()
.get(FFMPRecord.ALL).getBasins().entrySet()) {
FFMPBasin currBasin = entry.getValue();
FFMPGuidanceBasin oldBasin = (FFMPGuidanceBasin) previousGuidanceData
.get(entry.getKey());
// comparison for increase / decrease
if (oldBasin != null && currBasin != null) {
if (delta > 0.0) {
// increasing vals
fraction = fraction_Hr;
} else if (delta < 0.0) {
// decreasing vals, use num/denom from qpe
// this is essentially a ratio of the first accumulation
// step increment
// to the total amount over this time window.
FFMPBasin qpeBasin = qpeContainer.getBasinData("ALL").get(
entry.getKey());
float fraction = 0.0f;
float delta = currBasin.getValue()
- oldBasin.getValue(backDate,
ffgSource.getSourceName());
if (qpeBasin != null) {
float intervalAccum = qpeBasin.getAccumValue(backDate,
currentRecord.getDataTime().getRefTime(),
expirationTime, qpeSource.isRate());
// grab first time after initial for step
float stepAccum = qpeBasin.getAccumValue(
orderedTimes.get(1), orderedTimes.get(0),
expirationTime, qpeSource.isRate());
fraction = stepAccum / intervalAccum;
if (delta > 0.0) {
// increasing vals
fraction = fraction_Hr;
} else if (delta < 0.0) {
// decreasing vals, use num/denom from qpe
// this is essentially a ratio of the first accumulation
// step increment
// to the total amount over this time window.
FFMPBasin qpeBasin = qpeContainer.getBasinData(
FFMPRecord.ALL).get(entry.getKey());
if (qpeBasin != null) {
float intervalAccum = qpeBasin.getAccumValue(
backDate, currentRecord.getDataTime()
.getRefTime(), expirationTime,
qpeSource.isRate());
// grab first time after initial for step
float stepAccum = qpeBasin.getAccumValue(
orderedTimes.get(1), orderedTimes.get(0),
expirationTime, qpeSource.isRate());
fraction = stepAccum / intervalAccum;
}
} else {
// the same
fraction = 0.0f;
}
} else {
// the same
fraction = 0.0f;
float val = currBasin.getValue() + (fraction * delta);
currBasin.setValue(newDate, val);
}
float val = currBasin.getValue() + (fraction * delta);
currBasin.setValue(newDate, val);
}
delayGuidance = true;
}
return currentRecord;
return delayGuidance;
}
}

View file

@ -72,6 +72,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils;
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils.LockState;
import com.raytheon.uf.edex.database.cluster.ClusterTask;
@ -93,6 +94,7 @@ import com.vividsolutions.jts.geom.Polygon;
*
* 07/14/09 2152 D. Hladky Initial release
* 10/25/12 DR 15514 G. Zhang Fix ConcurrentModificationException
* 02/01/13 1569 D. Hladky Added constants
* </pre>
*
* @author dhladky
@ -329,7 +331,7 @@ public class FFMPProcessor {
try {
LinkedHashMap<Long, ?> map = template.getMap(siteKey,
domain.getCwa(), "ALL");
domain.getCwa(), FFMPRecord.ALL);
// this means the data is outside your domain
if (map.keySet().size() > 0) {
@ -454,7 +456,7 @@ public class FFMPProcessor {
if (sourceId != null) {
for (Long key : map.keySet()) {
FFMPBasin basin = getBasin(key, "ALL");
FFMPBasin basin = getBasin(key, FFMPRecord.ALL);
Date date = null;
Float val = null;
@ -625,9 +627,8 @@ public class FFMPProcessor {
}
Date backDate = new Date(ffmpRec.getDataTime().getRefTime()
.getTime()
- (3600 * 1000 * 6));
.getTime()-(FFMPGenerator.SOURCE_CACHE_TIME * TimeUtil.MILLIS_PER_HOUR));
ArrayList<String> hucs = new ArrayList<String>();
hucs.add("ALL");
FFMPDataContainer ffgContainer = generator
@ -651,11 +652,11 @@ public class FFMPProcessor {
// I switched the greater than and less than so it
// will
// process
if (guidFrequency < (6 * 3600 * 1000)
&& guidFrequency >= (1 * 3600 * 1000)) {
if (guidFrequency < (FFMPGenerator.SOURCE_CACHE_TIME * TimeUtil.MILLIS_PER_HOUR)
&& guidFrequency >= (TimeUtil.MILLIS_PER_HOUR)) {
long newTime = recdate.getTime()
+ (int) (source.getDurationHour() * 1000 * 3600);
+ (int) (source.getDurationHour() * TimeUtil.MILLIS_PER_HOUR);
// this is the new date
recdate = new Date(newTime);
ProductRunXML productRunner = generator
@ -672,11 +673,16 @@ public class FFMPProcessor {
siteKey, guidFrequency, source,
qpeSource, previousDate, recdate,
generator,
ffgContainer.getBasinData("ALL"),
ffgContainer.getBasinData(FFMPRecord.ALL),
ffmpRec);
ffmpRec = figd.calculateDelayedGuidance();
boolean delayGuidance = figd
.calculateDelayedGuidance();
// sets the new data time for the record
ffmpRec.setDataTime(new DataTime(recdate));
if (delayGuidance) {
ffmpRec.setDataTime(new DataTime(recdate));
}
}
}
}
@ -805,7 +811,7 @@ public class FFMPProcessor {
private FFMPBasin getBasin(Long pfaf, String huc) {
FFMPBasin basin = getBasinData(huc).get(pfaf);
if (basin == null) {
if (huc.equals("ALL")) {
if (huc.equals(FFMPRecord.ALL)) {
basin = new FFMPBasin(pfaf, false);
} else {
basin = new FFMPBasin(pfaf, true);
@ -827,7 +833,7 @@ public class FFMPProcessor {
FFMPVirtualGageBasin basin = (FFMPVirtualGageBasin) getBasinData(huc)
.get(pfaf);
if (basin == null) {
if (huc.equals("ALL")) {
if (huc.equals(FFMPRecord.ALL)) {
basin = new FFMPVirtualGageBasin(lid, pfaf, false);
} else {
basin = new FFMPVirtualGageBasin(lid, pfaf, true);
@ -849,7 +855,7 @@ public class FFMPProcessor {
// Get basins for level, we process VGB's differently because it is
// a
// special case
if (!huc.equals("VIRTUAL") && !huc.equals("ALL")) {
if (!huc.equals(FFMPRecord.VIRTUAL) && !huc.equals(FFMPRecord.ALL)) {
for (DomainXML domain : template.getDomains()) {
@ -865,7 +871,7 @@ public class FFMPProcessor {
.getAggregatePfafs(pfaf, siteKey, huc);
ArrayList<Double> areas = template
.getAreas(aggPfafs);
val = ffmpRec.getBasinData("ALL").getAverageValue(
val = ffmpRec.getBasinData(FFMPRecord.ALL).getAverageValue(
aggPfafs, areas);
} catch (Exception e) {
// Value is NAN, ignore it.
@ -877,7 +883,6 @@ public class FFMPProcessor {
}
} catch (Exception e) {
e.printStackTrace();
config.getGenerator().logger.error("Unable to process " + huc
+ " level data");
}
@ -1236,9 +1241,9 @@ public class FFMPProcessor {
center = rc.asGridCell(getGridGeometry(),
PixelInCell.CELL_CENTER);
} catch (TransformException e) {
e.printStackTrace();
statusHandler.handle(Priority.ERROR, "Error transforming pfaf! " +pfaf);
} catch (FactoryException e) {
e.printStackTrace();
statusHandler.handle(Priority.ERROR, "Error in geometry! " +pfaf);
}
if (((int) center.x >= 0) && ((int) center.x < getNx())
@ -1425,7 +1430,7 @@ public class FFMPProcessor {
gridCell = new Coordinate(x, y, 0.0);
} catch (Exception e) {
e.printStackTrace();
statusHandler.handle(Priority.ERROR, "Unable translate lat lon coordinate! " +latLon);
}
return gridCell;
}
@ -1443,7 +1448,7 @@ public class FFMPProcessor {
Type.GRID_CORNER);
gridPoint = rc.asLatLon();
} catch (Exception e) {
e.printStackTrace();
statusHandler.handle(Priority.ERROR, "Unable translate grid coordinate! " +gridPoint);
}
return gridPoint;
}
@ -1547,7 +1552,7 @@ public class FFMPProcessor {
}
}
} catch (Exception e) {
e.printStackTrace();
statusHandler.handle(Priority.ERROR, "Unable to process nest! ", e);
}
return myPoints;

View file

@ -29,6 +29,7 @@ import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinMetaData;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPDataContainer;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGap;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceInterpolation;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPTemplates;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPUtils;
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager;
@ -57,6 +58,7 @@ import com.raytheon.uf.edex.plugin.ffmp.FFMPGenerator;
* ------------ ---------- ----------- --------------------------
* Apr 01, 2011 dhladky Initial creation
* July 13, 2012 dhladky Revamped to help memory
* 02/01/13 1569 D. Hladky Added constants
*
* </pre>
*
@ -529,7 +531,6 @@ public class FFTI implements Runnable {
}
}
} catch (Exception e) {
e.printStackTrace();
statusHandler
.handle(Priority.ERROR, "failed to transmit FFTI alert. "
+ attribute.getAttributeName() + " Value: " + value);
@ -585,7 +586,6 @@ public class FFTI implements Runnable {
}
}
} catch (Exception e) {
e.printStackTrace();
statusHandler
.handle(Priority.ERROR, "failed to transmit FFTI alert. "
+ attribute.getAttributeName() + " Value: " + value);
@ -662,7 +662,6 @@ public class FFTI implements Runnable {
} catch (Exception e) {
statusHandler.handle(Priority.ERROR, "failed to evaluate FFTI. "
+ e);
e.printStackTrace();
} finally {
ffmpgen.fftiSources.clear();
ffmpgen.fftiDone = true;
@ -813,8 +812,13 @@ public class FFTI implements Runnable {
accumulator = new FFTIAccum();
}
// This will only happen at initial load, update, and duration changes.
if (accumulator.isReset() || accumulator.getDuration() != duration) {
long expirationTime = ffmpSource.getExpirationMinutes(fftiSiteKey)
* TimeUtil.MILLIS_PER_MINUTE;
// This will only happen at initial load, update, duration changes.
if (accumulator.isReset()
|| accumulator.getDuration() != duration
|| expirationTime < (System.currentTimeMillis() - accumulator
.getLastUpdate())) {
accumulator.setDuration(duration);
accumulator.setUnit(unit);
@ -828,18 +832,17 @@ public class FFTI implements Runnable {
long cur = config.getDate().getTime();
long timeBack = (long) (duration * TimeUtil.MILLIS_PER_HOUR);
Date backDate = new Date(cur - timeBack);
long expirationTime = ffmpSource.getExpirationMinutes(fftiSiteKey) * TimeUtil.MILLIS_PER_MINUTE;
FFMPDataContainer fdc = null;
ArrayList<String> hucs = new ArrayList<String>();
hucs.add("ALL");
hucs.add(FFMPRecord.ALL);
fdc = ffmpgen.getFFMPDataContainer(siteDataKey, hucs, backDate);
if (fdc != null) {
FFMPBasinData fbd = fdc.getBasinData("ALL");
FFMPBasinData fbd = fdc.getBasinData(FFMPRecord.ALL);
// go over the list of CWAs gathering the pfaf list
ArrayList<Long> pfafs = new ArrayList<Long>();
@ -888,6 +891,7 @@ public class FFTI implements Runnable {
ffmpgen.ffmpData.remove(siteDataKey);
}
accumulator.setReset(false);
accumulator.setLastUpdate(System.currentTimeMillis());
ffmpgen.writeFFTIData(siteDataKey, accumulator);
}
@ -925,8 +929,13 @@ public class FFTI implements Runnable {
values = new FFTIRatioDiff();
}
long expirationTime = ffmpQSource.getExpirationMinutes(qSiteKey)
* TimeUtil.MILLIS_PER_MINUTE;
// This will only happen at initial load, update, and duration changes.
if (values.isReset() || values.getDuration() != duration) {
if (values.isReset()
|| values.getDuration() != duration
|| expirationTime < (System.currentTimeMillis() - values
.getLastUpdate())) {
values.setDuration(duration);
values.setUnit(unit);
@ -934,16 +943,16 @@ public class FFTI implements Runnable {
long cur = config.getDate().getTime();
long timeBack = (long) (duration * TimeUtil.MILLIS_PER_HOUR);
Date backDate = new Date(cur - timeBack);
long expirationTime = ffmpQSource.getExpirationMinutes(qSiteKey) * TimeUtil.MILLIS_PER_MINUTE;
// make sure we have data
Date ffgBackDate = new Date(config.getDate().getTime()
Date ffgBackDate = new Date(
config.getDate().getTime()
- (TimeUtil.MILLIS_PER_HOUR * FFMPGenerator.FFG_SOURCE_CACHE_TIME));
String primarySource = ffmpgen.fscm.getPrimarySource(ffmpQSource);
ProductXML product = ffmpgen.fscm.getProduct(primarySource);
ArrayList<String> hucs = new ArrayList<String>();
hucs.add("ALL");
hucs.add(FFMPRecord.ALL);
FFMPDataContainer guidContainer = ffmpgen.getFFMPDataContainer(
ffgType, hucs, ffgBackDate);
@ -981,7 +990,7 @@ public class FFTI implements Runnable {
// go over the list of CWAs gathering the pfaf list
ArrayList<Long> pfafs = new ArrayList<Long>();
ArrayList<String> cwaList = fdm.getCwaList();
FFMPBasinData fbd = qpeContainer.getBasinData("ALL");
FFMPBasinData fbd = qpeContainer.getBasinData(FFMPRecord.ALL);
for (Long key : fbd.getBasins().keySet()) {
for (String cwa : cwaList) {
@ -1013,7 +1022,7 @@ public class FFTI implements Runnable {
if (gap != Double.NaN) {
ArrayList<Float> qpes = qpeContainer.getBasinData("ALL")
List<Float> qpes = qpeContainer.getBasinData(FFMPRecord.ALL)
.getAccumValues(pfafs, backDate, config.getDate(),
expirationTime, false);
@ -1023,7 +1032,7 @@ public class FFTI implements Runnable {
primarySource, ffgType, qSiteKey);
interpolator.setInterpolationSources(duration);
ArrayList<Float> guids = guidContainer.getBasinData("ALL")
List<Float> guids = guidContainer.getBasinData(FFMPRecord.ALL)
.getGuidanceValues(pfafs, interpolator,
guidSourceExpiration);
@ -1037,6 +1046,7 @@ public class FFTI implements Runnable {
// replace or insert it
values.setReset(false);
values.setLastUpdate(System.currentTimeMillis());
ffmpgen.writeFFTIData(siteDataKey, values);
}

View file

@ -19,11 +19,6 @@
**/
package com.raytheon.uf.edex.plugin.ffmp.common;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@ -36,21 +31,19 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 23, 2011 dhladky Initial creation
* 02/01/13 1569 D. Hladky Added constants, changed serialization, time limit
*
* </pre>
*
* @author dhladky
* @version 1.0
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class FFTIAccum extends FFTIData {
@DynamicSerializeElement
@XmlElement
private Double accumulation = 0.0;
public Double getAccumulation() {
return accumulation;
}

View file

@ -1,10 +1,5 @@
package com.raytheon.uf.edex.plugin.ffmp.common;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@ -38,6 +33,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* July 16, 2012 dhladky Initial creation
* 02/01/13 1569 D. Hladky Added constants, last update time
*
* </pre>
*
@ -45,30 +41,26 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* @version 1.0
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class FFTIData implements ISerializableObject {
@DynamicSerializeElement
@XmlElement
private Double gap = 0.0;
@DynamicSerializeElement
@XmlElement
private Double duration = 0.0;
@DynamicSerializeElement
@XmlElement
private String name = null;
@DynamicSerializeElement
@XmlElement
private String unit = null;
@DynamicSerializeElement
@XmlElement
private boolean reset = true;
@DynamicSerializeElement
private long lastUpdate = 0l;
/**
* @param name
@ -124,4 +116,12 @@ public class FFTIData implements ISerializableObject {
this.reset = reset;
}
public void setLastUpdate(long lastUpdate) {
this.lastUpdate = lastUpdate;
}
public long getLastUpdate() {
return lastUpdate;
}
}

View file

@ -54,6 +54,7 @@ import com.raytheon.uf.edex.plugin.ffmp.FFMPGenerator;
* ------------ ---------- ----------- --------------------------
* Apr 01, 2011 dhladky Initial creation
* July 11, 2012 dhladky Edited for FFTI work
* 02/01/13 1569 D. Hladky Added constants, records writing switched to pypies
* </pre>
*
* @author dhladky
@ -73,12 +74,6 @@ public class FFTIProcessor {
/** Pattern for dates in radar */
public static String datePattern = "yyyy-MM-dd HH:mm:ss";
/** 6 hour back time multiplier */
public static long backTime = 3600 * 1000 * 6;
/** FFG back time multiplier */
public static long ffgbackTime = 3600 * 1000 * 24;
/**
* useful constructor
*
@ -215,7 +210,7 @@ public class FFTIProcessor {
if (hucs == null) {
hucs = new ArrayList<String>();
hucs.add("ALL");
hucs.add(FFMPRecord.ALL);
}
for (String huc : hucs) {

View file

@ -20,13 +20,7 @@ package com.raytheon.uf.edex.plugin.ffmp.common;
* further licensing information.
**/
import java.util.ArrayList;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@ -40,6 +34,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 23, 2011 dhladky Initial creation
* 02/01/13 1569 D. Hladky Added constants, serialization changes
*
* </pre>
*
@ -47,43 +42,39 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* @version 1.0
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class FFTIRatioDiff extends FFTIData {
@DynamicSerializeElement
@XmlElements({ @XmlElement(name = "qpe", type = Float.class) })
private ArrayList<Float> qpes;
private List<Float> qpes;
@DynamicSerializeElement
@XmlElements({ @XmlElement(name = "guid", type = Float.class) })
private ArrayList<Float> guids;
private List<Float> guids;
public FFTIRatioDiff() {
}
public FFTIRatioDiff(ArrayList<Float> qpes, ArrayList<Float> guids,
public FFTIRatioDiff(List<Float> qpes, List<Float> guids,
Double gap) {
setQpes(qpes);
setGuids(guids);
setGap(gap);
}
public ArrayList<Float> getQpes() {
public List<Float> getQpes() {
return qpes;
}
public void setQpes(ArrayList<Float> qpes) {
public void setQpes(List<Float> qpes) {
this.qpes = qpes;
}
public ArrayList<Float> getGuids() {
public List<Float> getGuids() {
return guids;
}
public void setGuids(ArrayList<Float> guids) {
public void setGuids(List<Float> guids) {
this.guids = guids;
}

View file

@ -15,6 +15,7 @@
value="com.raytheon.uf.common.dataplugin.scan.dao.ScanDao" />
<property name="record"
value="com.raytheon.uf.common.dataplugin.scan.ScanRecord" />
<property name="compression" value="LZF"/>
</bean>
<bean factory-bean="pluginRegistry" factory-method="register"
@ -22,5 +23,6 @@
<constructor-arg value="scan" />
<constructor-arg ref="scanProperties" />
</bean>
</beans>