Merge changes I92d52e19,Ia6e18647 into 9-Wes2Bridge
* changes: Issue #13 Corrected valid month check - from code review Change-Id: I92d52e191749313b846871c5d8cd7c2fdc3c73c3 Issue #13 - Modified/corrected handling of "ARCHIVE" time stamp Former-commit-id:9cc539f8a4
[formerly bc6f1a41c0dee1c2030d1a2c90d337ddef20b36e] Former-commit-id:db74c784d6
This commit is contained in:
commit
74cd5a6f0b
3 changed files with 28 additions and 14 deletions
|
@ -214,17 +214,14 @@ public class MetarDecoder extends AbstractDecoder {
|
||||||
|
|
||||||
List<PluginDataObject> retVal = new ArrayList<PluginDataObject>();
|
List<PluginDataObject> retVal = new ArrayList<PluginDataObject>();
|
||||||
|
|
||||||
// String fileName = null;
|
Calendar baseTime = TimeTools.getSystemCalendar();
|
||||||
// if (headers != null) {
|
|
||||||
// fileName = (String) headers
|
|
||||||
// .get(DecoderTools.INGEST_FILE_NAME);
|
|
||||||
// }
|
|
||||||
Calendar baseTime;
|
|
||||||
WMOHeader wmoHdr = sep.getWMOHeader();
|
WMOHeader wmoHdr = sep.getWMOHeader();
|
||||||
if((wmoHdr != null)&&(wmoHdr.isValid())) {
|
if(TimeTools.allowArchive()) {
|
||||||
baseTime = TimeTools.findDataTime(wmoHdr.getYYGGgg(), headers);
|
if((wmoHdr != null)&&(wmoHdr.isValid())) {
|
||||||
} else {
|
baseTime = TimeTools.findDataTime(wmoHdr.getYYGGgg(), headers);
|
||||||
baseTime = TimeTools.getSystemCalendar();
|
} else {
|
||||||
|
logger.error("ARCHIVE MODE-No WMO Header found in file" + headers.get(WMOHeader.INGEST_FILE_NAME));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (sep.hasNext()) {
|
while (sep.hasNext()) {
|
||||||
|
@ -326,6 +323,15 @@ public class MetarDecoder extends AbstractDecoder {
|
||||||
Calendar obsTime = record.getTimeObs();
|
Calendar obsTime = record.getTimeObs();
|
||||||
if (obsTime != null) {
|
if (obsTime != null) {
|
||||||
Calendar currTime = TimeTools.copy(baseTime);
|
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);
|
currTime.add(Calendar.MINUTE, METAR_FUTURE_LIMIT);
|
||||||
|
|
||||||
long diff = currTime.getTimeInMillis()
|
long diff = currTime.getTimeInMillis()
|
||||||
|
|
|
@ -50,6 +50,7 @@ import com.raytheon.uf.common.message.Header;
|
||||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||||
import com.raytheon.uf.common.site.SiteMap;
|
import com.raytheon.uf.common.site.SiteMap;
|
||||||
import com.raytheon.uf.edex.core.props.PropertiesFactory;
|
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.AFOSProductId;
|
||||||
import com.raytheon.uf.edex.wmo.message.WMOHeader;
|
import com.raytheon.uf.edex.wmo.message.WMOHeader;
|
||||||
|
|
||||||
|
@ -854,8 +855,14 @@ public class TextDB {
|
||||||
}
|
}
|
||||||
|
|
||||||
product.append(reportData);
|
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()
|
StdTextProduct textProduct = (operationalMode ? new OperationalStdTextProduct()
|
||||||
: new PracticeStdTextProduct());
|
: new PracticeStdTextProduct());
|
||||||
textProduct.setWmoid(wmoid);
|
textProduct.setWmoid(wmoid);
|
||||||
|
|
|
@ -128,7 +128,8 @@ public class TimeTools {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a calendar that expresses the current system time based from specified
|
* Get a calendar that expresses the current system time based from specified
|
||||||
* date information if the
|
* date information only if the archive flag is set. Otherwise the current
|
||||||
|
* system time is returned.
|
||||||
* @param year Year to set.
|
* @param year Year to set.
|
||||||
* @param month
|
* @param month
|
||||||
* @param day
|
* @param day
|
||||||
|
@ -503,7 +504,7 @@ public class TimeTools {
|
||||||
* @return Is the month valid?
|
* @return Is the month valid?
|
||||||
*/
|
*/
|
||||||
public static final boolean isValidMonth(int month) {
|
public static final boolean isValidMonth(int month) {
|
||||||
return ((month > -1)&&(month <= 12));
|
return ((month > 0)&&(month <= 12));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue