Issue #13 - Modified/corrected handling of "ARCHIVE" time stamp

Former-commit-id: 4095a560a3 [formerly 53b5faf65b [formerly a6e1864763ea7b16cd8199121cc45ec3dd1299d5]]
Former-commit-id: 53b5faf65b
Former-commit-id: d845a111af
This commit is contained in:
James Korman 2012-01-25 16:38:43 -06:00
parent 017319df69
commit 9eff1feaa0
2 changed files with 25 additions and 12 deletions

View file

@ -214,17 +214,14 @@ public class MetarDecoder extends AbstractDecoder {
List<PluginDataObject> retVal = new ArrayList<PluginDataObject>();
// String fileName = null;
// if (headers != null) {
// fileName = (String) headers
// .get(DecoderTools.INGEST_FILE_NAME);
// }
Calendar baseTime;
Calendar baseTime = TimeTools.getSystemCalendar();
WMOHeader wmoHdr = sep.getWMOHeader();
if((wmoHdr != null)&&(wmoHdr.isValid())) {
baseTime = TimeTools.findDataTime(wmoHdr.getYYGGgg(), headers);
} else {
baseTime = TimeTools.getSystemCalendar();
if(TimeTools.allowArchive()) {
if((wmoHdr != null)&&(wmoHdr.isValid())) {
baseTime = TimeTools.findDataTime(wmoHdr.getYYGGgg(), headers);
} else {
logger.error("ARCHIVE MODE-No WMO Header found in file" + headers.get(WMOHeader.INGEST_FILE_NAME));
}
}
while (sep.hasNext()) {
@ -326,6 +323,15 @@ public class MetarDecoder extends AbstractDecoder {
Calendar obsTime = record.getTimeObs();
if (obsTime != null) {
Calendar currTime = TimeTools.copy(baseTime);
// Do this only for archive mode!!! Otherwise valid data will not pass if the WMO header
// date/time is much less than the obstime. For instance
// WMO Header time = dd1200
// Observed time = dd1235
// To solve this will require greater precision in the file timestamp.
if(TimeTools.allowArchive()) {
currTime.add(Calendar.HOUR, 1);
}
currTime.add(Calendar.MINUTE, METAR_FUTURE_LIMIT);
long diff = currTime.getTimeInMillis()

View file

@ -50,6 +50,7 @@ import com.raytheon.uf.common.message.Header;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.site.SiteMap;
import com.raytheon.uf.edex.core.props.PropertiesFactory;
import com.raytheon.uf.edex.decodertools.time.TimeTools;
import com.raytheon.uf.edex.wmo.message.AFOSProductId;
import com.raytheon.uf.edex.wmo.message.WMOHeader;
@ -854,8 +855,14 @@ public class TextDB {
}
product.append(reportData);
long writeTime = System.currentTimeMillis();
Long writeTime = new Long(System.currentTimeMillis());
if(TimeTools.allowArchive()) {
Calendar c = header.getHeaderDate();
writeTime = new Long(c.getTimeInMillis());
}
StdTextProduct textProduct = (operationalMode ? new OperationalStdTextProduct()
: new PracticeStdTextProduct());
textProduct.setWmoid(wmoid);