Issue #826: Fix TCG and Warning decoders to properly respect ALLOW_ARCHIVE_DATA env variable, fix broken GFE
VTEC notification route. Change-Id: I48550b9023cc7f251462f0c6620cff352f4512be Former-commit-id:151515b52d
[formerly151515b52d
[formerly 151a2069e3bf46f08bc636cf1bd4974b07e65da3]] Former-commit-id:1df1bbbf9e
Former-commit-id:617400bc30
This commit is contained in:
parent
bd58025a99
commit
522b0037bb
4 changed files with 61 additions and 51 deletions
|
@ -122,7 +122,8 @@
|
|||
<route id="gfeVtecChangeNotification">
|
||||
<from uri="jms-generic:topic:edex.alerts.vtec"/>
|
||||
<doTry>
|
||||
<bean ref="vtecChangeListener" method="handleNotification"/>
|
||||
<bean ref="serializationUtil" method="transformFromThrift" />
|
||||
<bean ref="vtecChangeListener" method="handleNotification" />
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:vtecChangeListener?level=ERROR&showBody=false&showCaughtException=true&showStackTrace=true"/>
|
||||
|
|
|
@ -84,7 +84,7 @@ class StdWarningDecoder():
|
|||
#base time for decoder
|
||||
self._time = time.time() + self._timeOffset #present time
|
||||
allowArchive = os.getenv("ALLOW_ARCHIVE_DATA")
|
||||
if (allowArchive == "true" and re.match(".*\\.\\d{8}$", self._incomingFilename) ):
|
||||
if allowArchive.lower() == "true" and re.match(".*\\.\\d{8}$", self._incomingFilename):
|
||||
m = re.search('(.*\\.)(\\d{8}$)', self._incomingFilename)
|
||||
yyyymmdd = m.group(2)
|
||||
timeTuple = time.strptime(yyyymmdd, "%Y%m%d")
|
||||
|
|
|
@ -21,7 +21,6 @@ package com.raytheon.uf.edex.plugin.tcg.decoder;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
|
||||
|
@ -31,70 +30,79 @@ import com.raytheon.uf.common.dataplugin.tcg.dao.TropicalCycloneGuidanceDao;
|
|||
import com.raytheon.uf.common.pointdata.PointDataDescription;
|
||||
import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 26, 2009 jsanchez Initial creation
|
||||
*
|
||||
* Jun 28, 2012 #826 dgilling Use wmoHeader headerDate to
|
||||
* set refTime so times are set
|
||||
* correctly when processing archive
|
||||
* data.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author jsanchez
|
||||
* @version 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
public class QLMData extends TCGDataAdapter{
|
||||
|
||||
private class ForecastPosition{
|
||||
public class QLMData extends TCGDataAdapter {
|
||||
|
||||
private class ForecastPosition {
|
||||
public int hour;
|
||||
|
||||
|
||||
public double latitude;
|
||||
|
||||
|
||||
public double longitude;
|
||||
|
||||
|
||||
public ForecastPosition(int hour, double lat, double lon) {
|
||||
this.hour = hour;
|
||||
this.latitude = lat;
|
||||
this.longitude = lon;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private List<ForecastPosition> list = new ArrayList<ForecastPosition>();
|
||||
|
||||
|
||||
private static final int MAX_FORECASTS = 22;
|
||||
|
||||
public QLMData(PointDataDescription pdd, TropicalCycloneGuidanceDao dao, String pluginName) {
|
||||
super(pdd,dao,pluginName);
|
||||
|
||||
public QLMData(PointDataDescription pdd, TropicalCycloneGuidanceDao dao,
|
||||
String pluginName) {
|
||||
super(pdd, dao, pluginName);
|
||||
}
|
||||
|
||||
public List<TropicalCycloneGuidance> findReports(byte [] message) {
|
||||
@Override
|
||||
public List<TropicalCycloneGuidance> findReports(byte[] message) {
|
||||
List<TropicalCycloneGuidance> reports = new ArrayList<TropicalCycloneGuidance>();
|
||||
List<InternalReport> parts = InternalReport.identifyMessage(message);
|
||||
if(parts != null){
|
||||
if (parts != null) {
|
||||
clearData();
|
||||
for(InternalReport iRpt : parts) {
|
||||
for (InternalReport iRpt : parts) {
|
||||
InternalType t = iRpt.getLineType();
|
||||
String s = iRpt.getReportLine();
|
||||
if (InternalType.PRODUCT.equals(t)) {
|
||||
productType = s;
|
||||
} else if(InternalType.STORM_TYPE_INFO.equals(t)){
|
||||
} else if (InternalType.STORM_TYPE_INFO.equals(t)) {
|
||||
parseStormTypeInfo(s);
|
||||
} else if(InternalType.INIT_TIME_INFO.equals(t)){
|
||||
} else if (InternalType.INIT_TIME_INFO.equals(t)) {
|
||||
parseInitTimeInfo(s);
|
||||
} else if(InternalType.FORECAST_POSITION_INFO.equals(t)) {
|
||||
} else if (InternalType.FORECAST_POSITION_INFO.equals(t)) {
|
||||
parseForecastPositionInfo(s);
|
||||
} else if(InternalType.STORM_DISSIPATED.equals(t) || list.size() == MAX_FORECASTS){
|
||||
} else if (InternalType.STORM_DISSIPATED.equals(t)
|
||||
|| list.size() == MAX_FORECASTS) {
|
||||
boolean firstValue = true;
|
||||
for(ForecastPosition fp : list) {
|
||||
for (ForecastPosition fp : list) {
|
||||
TropicalCycloneGuidance rpt = new TropicalCycloneGuidance();
|
||||
SurfaceObsLocation location = new SurfaceObsLocation(stationId);
|
||||
SurfaceObsLocation location = new SurfaceObsLocation(
|
||||
stationId);
|
||||
location.setLongitude(fp.longitude);
|
||||
location.setLatitude(fp.latitude);
|
||||
|
||||
|
||||
rpt.setWmoHeader(wmoHeader.getWmoHeader());
|
||||
rpt.setTraceId(traceId);
|
||||
rpt.setPluginName(pluginName);
|
||||
|
@ -102,13 +110,15 @@ public class QLMData extends TCGDataAdapter{
|
|||
rpt.setType(stormType);
|
||||
rpt.setProductType(productType);
|
||||
rpt.setLocation(location);
|
||||
rpt.setInsertTime(Calendar.getInstance(TimeZone.getTimeZone("GMT")));
|
||||
rpt.setInsertTime(Calendar.getInstance(TimeZone
|
||||
.getTimeZone("GMT")));
|
||||
DataTime dt;
|
||||
if(firstValue){
|
||||
if (firstValue) {
|
||||
firstValue = false;
|
||||
dt = new DataTime(refTime.getRefTimeAsCalendar());
|
||||
} else {
|
||||
dt = new DataTime(refTime.getRefTimeAsCalendar(), fp.hour * 3600);
|
||||
dt = new DataTime(refTime.getRefTimeAsCalendar(),
|
||||
fp.hour * 3600);
|
||||
}
|
||||
rpt.setDataTime(dt);
|
||||
reports.add(rpt);
|
||||
|
@ -119,42 +129,40 @@ public class QLMData extends TCGDataAdapter{
|
|||
}
|
||||
return reports;
|
||||
}
|
||||
|
||||
private void parseStormTypeInfo(String stormTypeInfo){
|
||||
|
||||
private void parseStormTypeInfo(String stormTypeInfo) {
|
||||
int index = setStormType(stormTypeInfo);
|
||||
if (index != -1) {
|
||||
String temp[] = stormTypeInfo.substring(index).trim().split(" ");
|
||||
stormName = temp[0];
|
||||
}
|
||||
}
|
||||
|
||||
private void parseInitTimeInfo(String initTimeInfo){
|
||||
|
||||
|
||||
private void parseInitTimeInfo(String initTimeInfo) {
|
||||
String data[] = getParts(initTimeInfo.substring(12), 3);
|
||||
|
||||
int hour = Integer.valueOf(data[0].substring(0,data[0].length() - 1));
|
||||
|
||||
int hour = Integer.valueOf(data[0].substring(0, data[0].length() - 1));
|
||||
int minute = 0;
|
||||
int month = MONTH_MAP.get(data[1]);
|
||||
int day = Integer.valueOf(data[2]);
|
||||
|
||||
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
|
||||
cal.setTime(new Date());
|
||||
Calendar cal = wmoHeader.getHeaderDate();
|
||||
int year = cal.get(Calendar.YEAR);
|
||||
|
||||
|
||||
refTime = getDataTime(year, month, day, hour, minute, "GMT");
|
||||
}
|
||||
|
||||
private void parseForecastPositionInfo(String positionInfo){
|
||||
|
||||
private void parseForecastPositionInfo(String positionInfo) {
|
||||
|
||||
String data[] = getParts(positionInfo, 3);
|
||||
|
||||
|
||||
int hour = Integer.valueOf(data[0]);
|
||||
double lat = Double.valueOf(data[1]);
|
||||
double lon = Double.valueOf(data[2]) * -1;
|
||||
list.add(new ForecastPosition(hour,lat,lon));
|
||||
list.add(new ForecastPosition(hour, lat, lon));
|
||||
}
|
||||
|
||||
public void clearData(){
|
||||
|
||||
@Override
|
||||
public void clearData() {
|
||||
list.clear();
|
||||
stationId = null;
|
||||
stormType = TCGStormType.UNKNOWN;
|
||||
|
|
|
@ -50,6 +50,8 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 26, 2009 jsanchez Initial creation
|
||||
* Jun 28, 2012 #826 dgilling Ensure getDataTime properly
|
||||
* handles time zones.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -271,7 +273,7 @@ public abstract class TCGDataAdapter {
|
|||
|
||||
protected DataTime getDataTime(int year, int month, int day, int hour,
|
||||
int minute, String timeZone) {
|
||||
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
|
||||
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(timeZone));
|
||||
cal.set(Calendar.YEAR, year);
|
||||
cal.set(Calendar.MONTH, month - 1);
|
||||
cal.set(Calendar.DAY_OF_MONTH, day);
|
||||
|
@ -279,7 +281,6 @@ public abstract class TCGDataAdapter {
|
|||
cal.set(Calendar.MINUTE, minute);
|
||||
cal.set(Calendar.SECOND, 0);
|
||||
cal.set(Calendar.MILLISECOND, 0);
|
||||
cal.setTimeZone(TimeZone.getTimeZone(timeZone));
|
||||
return new DataTime(cal);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue