13.1.1-10 baseline

Former-commit-id: baa5de2147 [formerly 06d0e6dd16] [formerly baa5de2147 [formerly 06d0e6dd16] [formerly 9b73b6a2a9 [formerly 1e337899d45617a8ee1998f2d2c86f2912668b67]]]
Former-commit-id: 9b73b6a2a9
Former-commit-id: a491a84615 [formerly c8c783f128]
Former-commit-id: ba12b38550
This commit is contained in:
Steve Harris 2013-02-14 13:24:43 -06:00
parent d3bcb1af50
commit 94d338ea0c
87 changed files with 1418 additions and 3155 deletions

View file

@ -5,7 +5,8 @@
12/26/2011 Xiaochuan DR14236 (trac 11710) request to fix SCAN Alert Visualization BASE
configuring file. Changed true or false setting on popup, text,
blink and color items followed the A1 configuring master.gcf file.
01/31/2012 dyninaj DR14427 added category NDFD
01/31/2012 dyninaj DR14427 added category NDFD
11/30/2012 jzeng DR14016 update GFE configuration
-->
<alertConfiguration name="DEFAULT">
<globalConfiguration height="37" width="-1" yPosition="-1" xPosition="-1" logLength="10" audioDuration="30" blinkDuration="5" expandedPopup="false" categoryShown="false" sourceKeyShown="false" priorityShown="false" mode="H2"/>
@ -125,12 +126,12 @@
</configurationMonitor>
</source>
<source locked="true" name="GFE" longName="GFE">
<configurationItem>
<metadata foreground="#000000" background="#ffff00" pythonEnabled="false" log="true" priority="SIGNIFICANT" popup="true" blink="false" text="true" audioEnabled="false"/>
<metadata foreground="#666666" background="#00ff00" pythonEnabled="false" log="true" priority="EVENTA" popup="false" blink="false" text="true" audioEnabled="false"/>
<metadata foreground="#ffffff" background="#ee0000" pythonEnabled="false" log="true" priority="CRITICAL" popup="true" blink="false" text="true" audioEnabled="false"/>
<metadata foreground="#ffffff" background="#000000" pythonEnabled="false" log="true" priority="EVENTB" popup="false" blink="false" text="false" audioEnabled="false"/>
<metadata foreground="#000000" background="#ffa500" pythonEnabled="false" log="true" priority="PROBLEM" popup="true" blink="false" text="true" audioEnabled="false"/>
<configurationItem>
<metadata foreground="#ffffff" background="#ee20e0" pythonEnabled="false" log="true" priority="CRITICAL" popup="true" blink="false" text="true" audioEnabled="false"/>
<metadata foreground="#ffffff" background="#ee0000" pythonEnabled="false" log="true" priority="SIGNIFICANT" popup="true" blink="false" text="true" audioEnabled="false"/>
<metadata foreground="#000000" background="#ffff00" pythonEnabled="false" log="true" priority="PROBLEM" popup="true" blink="false" text="true" audioEnabled="false"/>
<metadata foreground="#000000" background="#ffa500" pythonEnabled="false" log="true" priority="EVENTA" popup="false" blink="false" text="true" audioEnabled="false"/>
<metadata foreground="#666666" background="#00ff00" pythonEnabled="false" log="true" priority="EVENTB" popup="false" blink="false" text="false" audioEnabled="false"/>
<metadata foreground="#ffffff" background="#000000" pythonEnabled="false" log="true" priority="VERBOSE" popup="false" blink="false" text="false" audioEnabled="false"/>
</configurationItem>
<configurationMonitor>

View file

@ -30,8 +30,7 @@
# Heading
#-----------------------------------------------------------------------------
#import siteConfig
#GFESUITE_HOME = siteConfig.GFESUITE_HOME
GFESUITE_HOME = "/awips2/GFESuite"
GFESUITE_PRDDIR = "/tmp/products"
yes = True
no = False

View file

@ -42,7 +42,7 @@
<contribute xsi:type="bundleItem" file="bundles/NOHRSC-SNOW.xml"
menuText="Snow Cover Elev" id="snowCoverElev">
<substitute key="param" value="sce"/>
<substitute key="customLegend" value="Snow Cover elevation (kft)"/>
<substitute key="customLegend" value="Snow Cover by elevation (kft)"/>
<substitute key="sampleFormat" value="0.00"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/NOHRSC-SNOW.xml"

View file

@ -61,12 +61,12 @@
</contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Tungchiang (RCMJ)" id="raobTungchiang"
menuText="Tungchiang (595530) (RCMJ)" id="raobTungchiang"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="595530"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Taipei (RCSS)" id="raobTaipei"
menuText="Taipei (589680) (RCSS)" id="raobTaipei"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="589680"/>
</contribute>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<DerivedParameter unit="K" name="Dew point depression" abbreviation="DpD" xmlns:ns2="group">
<DerivedParameter unit="K" name="Dewpoint depression" abbreviation="DpD" xmlns:ns2="group">
<Method name="Difference">
<Field abbreviation="T"/>
<Field abbreviation="DpT"/>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<DerivedParameter unit="K" name="Dew point temperature" abbreviation="DpT" xmlns:ns2="group">
<DerivedParameter unit="K" name="Dewpoint temperature" abbreviation="DpT" xmlns:ns2="group">
<Method name="Dewpoint">
<Field abbreviation="T"/>
<Field abbreviation="RH"/>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<DerivedParameter abbreviation="DpTmean" name="Dew Point Temp mean" unit="K">
<DerivedParameter abbreviation="DpTmean" name="Dewpoint Temp mean" unit="K">
<Method name="Alias" levels="Surface">
<Field abbreviation="DpTmean" level="2FHAG"/>
</Method>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<DerivedParameter abbreviation="DpTsprd" name="Dew Point Temp sprd" unit="K">
<DerivedParameter abbreviation="DpTsprd" name="Dewpoint Temp sprd" unit="K">
<Method name="Alias" levels="Surface">
<Field abbreviation="DpTsprd" level="2FHAG"/>
</Method>

View file

@ -46,6 +46,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg;
*
* Jan 25, 2010 #4281 zhao Modified the notify method
* Jun 16, 2012 14386 zhao Modified the notify method
* Dec 03, 2012 15216/15639 zhao fixed a bug related to Link-to-Frame
*
* @author
*
@ -78,7 +79,6 @@ public class FogZoneTableDlg extends ZoneTableDlg {
if (zoneTable.isDisposed()) {
return;
}
// TODO: Silver Springs Guys. We now have competing ways of adding the
// data to the table.
// You need to merge the two. The way we had setup originally was to use
@ -86,7 +86,6 @@ public class FogZoneTableDlg extends ZoneTableDlg {
// You guys have this ObMultiHrsReports. Find a way that will
// incorporate both for the obs and
// The algorithm output.
if (me.getSource() instanceof FogMonitor) {
FogMonitor fog = (FogMonitor) me.getSource();
@ -94,12 +93,11 @@ public class FogZoneTableDlg extends ZoneTableDlg {
if (date != null) {
Date nominalTime = date;
ObMultiHrsReports obData = fog.getObData();
// if (!isLinkedToFrame()) {
// nominalTime = obData.getLatestNominalTime();
// }
if (!isLinkedToFrame()) {
nominalTime = obData.getLatestNominalTime();
}
FogDataGenerator fdg = new FogDataGenerator();
HashMap<String, CellType> fogAlgCellType = fdg
.getAlgCellTypes(fog.getAlgorithmData(nominalTime));
HashMap<String, CellType> fogAlgCellType = fdg.getAlgCellTypes(fog.getAlgorithmData(nominalTime));
obData.setFogAlgCellType(fogAlgCellType);
this.updateTableDlg(obData.getObHourReports(nominalTime));
}

View file

@ -86,6 +86,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 10, 2012 #875 rferrel Initial creation
* Dec 05, 2012 #1364 rferrel Replace File.Separator with IPathManager.SEPARATOR
* to work correctly on all platforms.
*
* </pre>
*
@ -180,9 +182,10 @@ public class PointsDataManager implements ILocalizationFileObserver {
LocalizationLevel.USER);
pointsDir = pathMgr.getLocalizationFile(userCtx, AWIPSTOOLS
+ File.separator + site + File.separator + POINTS_DIR);
+ IPathManager.SEPARATOR + site + IPathManager.SEPARATOR
+ POINTS_DIR);
userToolsDir = pathMgr.getLocalizationFile(userCtx, AWIPSTOOLS
+ File.separator + site);
+ IPathManager.SEPARATOR + site);
userToolsDir.addFileUpdatedObserver(this);
childrenKeyMap = new HashMap<String, List<String>>();
@ -392,7 +395,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
*/
private void storePoint(LocalizationFile dir, Point point, String fileName) {
LocalizationFile lFile = pathMgr.getLocalizationFile(userCtx, dir
.getName().trim() + File.separator + fileName);
.getName().trim() + IPathManager.SEPARATOR + fileName);
try {
marshalPointToXmlFile(point, lFile);
@ -433,7 +436,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
boolean doRequest = false;
if (points.isEmpty()) {
doRequest = loadPoints();
String d2dKey = File.separator + D2D_POINTS_GROUP;
String d2dKey = IPathManager.SEPARATOR + D2D_POINTS_GROUP;
Point d2dPoint = points.get(d2dKey);
if (d2dPoint != null) {
if (childrenKeyMap.get(d2dKey).size() == 0) {
@ -444,7 +447,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
String dirPath = pointsDir.getName().trim();
String name = D2D_POINTS_GROUP.replace(' ',
PointUtilities.DELIM_CHAR);
String path = dirPath + File.separator + name;
String path = dirPath + IPathManager.SEPARATOR + name;
LocalizationFile d2dDir = pathMgr.getLocalizationFile(userCtx,
path);
if (!d2dDir.isDirectory()) {
@ -484,7 +487,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
Coordinate center = getHome();
int baseRingSize = 120;
int startAngle = -90;
String group = File.separator + D2D_POINTS_GROUP;
String group = IPathManager.SEPARATOR + D2D_POINTS_GROUP;
List<String> d2dChildren = childrenKeyMap.get(group);
for (char label = 'A'; label <= 'J'; label++) {
String name = String.valueOf(label);
@ -527,7 +530,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
private Coordinate loadHome() {
LocalizationFile lFile = pathMgr.getLocalizationFile(
pointsDir.getContext(), pointsDir.getName().trim()
+ File.separator + HOME_LOCATION_FILE);
+ IPathManager.SEPARATOR + HOME_LOCATION_FILE);
Point point = null;
if (lFile.exists()) {
point = loadPoint(lFile);
@ -574,7 +577,6 @@ public class PointsDataManager implements ILocalizationFileObserver {
childrenKeyMap.put(key, new ArrayList<String>());
}
if (key.length() > 0) {
// p
String parentKey = getParentKey(point);
childrenKeyMap.get(parentKey).add(key);
}
@ -658,7 +660,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
} catch (IOException ex) {
StringBuffer sb = new StringBuffer(lFile.toString());
sb.replace(0, pointsDir.toString().length(), "");
int index = sb.lastIndexOf(File.separator);
int index = sb.lastIndexOf(IPathManager.SEPARATOR);
sb.setLength(index);
point.setGroup(sb.toString());
@ -671,7 +673,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
if (point != null) {
StringBuffer sb = new StringBuffer(lFile.toString());
sb.replace(0, pointsDir.toString().length(), "");
int index = sb.lastIndexOf(File.separator);
int index = sb.lastIndexOf(IPathManager.SEPARATOR);
sb.setLength(index);
point.setGroup(sb.toString());
}
@ -770,10 +772,10 @@ public class PointsDataManager implements ILocalizationFileObserver {
StringBuilder sb = new StringBuilder();
sb.append(pointsDir.getName().trim());
String group = point.getGroup();
if (!group.startsWith(File.separator)) {
sb.append(File.separator);
if (!group.startsWith(IPathManager.SEPARATOR)) {
sb.append(IPathManager.SEPARATOR);
}
sb.append(point.getGroup()).append(File.separator)
sb.append(point.getGroup()).append(IPathManager.SEPARATOR)
.append(POINT_FILENAME_PREFIX).append(point.getName())
.append(POINT_FILENAME_EXT);
String filename = sb.toString().replace(' ', PointUtilities.DELIM_CHAR);
@ -791,8 +793,8 @@ public class PointsDataManager implements ILocalizationFileObserver {
StringBuilder sb = new StringBuilder();
sb.append(pointsDir.getName().trim());
if (group.length() > 0) {
if (group.charAt(0) != File.separatorChar) {
sb.append(File.separator);
if (group.startsWith(IPathManager.SEPARATOR) == false) {
sb.append(IPathManager.SEPARATOR);
}
sb.append(group);
}
@ -810,7 +812,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
String name = null;
StringBuilder sb = new StringBuilder();
sb.append(lFile.toString());
sb.replace(0, sb.lastIndexOf(File.separator) + 1, "");
sb.replace(0, sb.lastIndexOf(IPathManager.SEPARATOR) + 1, "");
if (!lFile.isDirectory()) {
sb.replace(0, POINT_FILENAME_PREFIX.length(), "");
sb.replace(sb.length() - POINT_FILENAME_EXT.length(), sb.length(),
@ -865,7 +867,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
String parentKey = point.getGroup();
if (point.isGroup() && parentKey.length() > 0) {
parentKey = parentKey.substring(0,
parentKey.lastIndexOf(File.separator));
parentKey.lastIndexOf(IPathManager.SEPARATOR));
}
return parentKey;
}
@ -897,7 +899,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
LocalizationFile[] dirs = pathMgr.listStaticFiles(sb.toString(),
new String[0], false, false);
sb.append(File.separator).append(GROUP_TEMP_PREFIX);
sb.append(IPathManager.SEPARATOR).append(GROUP_TEMP_PREFIX);
int end = sb.length();
List<String> names = new ArrayList<String>();
@ -917,7 +919,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
Point node = new GroupNode();
node.setName(name);
String parentKey = getPointKey(parent);
node.setGroup(parentKey + File.separator + name);
node.setGroup(parentKey + IPathManager.SEPARATOR + name);
String nodeKey = getPointKey(node);
PointRequest request = new PointRequest(RequestType.ADD, node);
queueRequest(request);
@ -964,7 +966,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
childrenKeyMap.get(newParentKey).add(key);
} else {
Point newGroup = new GroupNode((Point) point);
String newGroupKey = newParentKey + File.separator
String newGroupKey = newParentKey + IPathManager.SEPARATOR
+ point.getName();
newGroup.setGroup(newGroupKey);
PointRequest request = new PointRequest(RequestType.ADD, newGroup);
@ -996,7 +998,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
String parentKey = getParentKey((Point) srcNode);
Point parent = points.get(parentKey);
Point destNode = new GroupNode(parent);
String destKey = parentKey + File.separator + destName;
String destKey = parentKey + IPathManager.SEPARATOR + destName;
destNode.setName(destName);
destNode.setGroup(destKey);
PointRequest request = new PointRequest(RequestType.ADD, destNode);
@ -1025,7 +1027,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
StringBuilder sb = new StringBuilder();
sb.append(parent);
sb.replace(0, pointsDir.getName().trim().length(), "");
sb.append(File.separator).append(name);
sb.append(IPathManager.SEPARATOR).append(name);
Point gPoint = new GroupNode(name);
gPoint.setGroup(sb.toString().replace(PointUtilities.DELIM_CHAR, ' '));
String groupPath = getPointDirName(gPoint);
@ -1045,7 +1047,8 @@ public class PointsDataManager implements ILocalizationFileObserver {
try {
// Must create a file in the directory to force its creation.
String p = lFile.getName().trim() + File.separator + GROUP_INFO;
String p = lFile.getName().trim() + IPathManager.SEPARATOR
+ GROUP_INFO;
LocalizationFile lf = pathMgr.getLocalizationFile(userCtx, p);
OutputStream outStream = lf.openOutputStream();
outStream.write(gPoint.getGroup().getBytes());
@ -1163,7 +1166,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
StringBuilder sb = new StringBuilder(message.getFileName());
sb.replace(0, pointsDir.getName().length(), "");
sb.replace(sb.lastIndexOf(File.separator), sb.length(), "");
sb.replace(sb.lastIndexOf(IPathManager.SEPARATOR), sb.length(), "");
String groupKey = sb.toString().replace(PointUtilities.DELIM_CHAR, ' ');
sb.setLength(0);
@ -1290,7 +1293,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
}
/**
* Determine if this group message needs to be acted upoin by this instance
* Determine if this group message needs to be acted upon by this instance
* of CAVE.
*
* @param message
@ -1299,11 +1302,11 @@ public class PointsDataManager implements ILocalizationFileObserver {
private boolean checkGroup(FileUpdatedMessage message) {
boolean stateChange = false;
StringBuilder sb = new StringBuilder(message.getFileName());
sb.setLength(sb.lastIndexOf(File.separator));
sb.setLength(sb.lastIndexOf(IPathManager.SEPARATOR));
sb.replace(0, pointsDir.getName().length(), "");
String key = sb.toString().replace(PointUtilities.DELIM_CHAR, ' ');
String parentKey = null;
int index = key.lastIndexOf(File.separator);
int index = key.lastIndexOf(IPathManager.SEPARATOR);
if (index >= 0) {
parentKey = key.substring(0, index);
}
@ -1312,7 +1315,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
switch (message.getChangeType()) {
case ADDED:
if (foundGroup == null) {
sb.replace(0, sb.lastIndexOf(File.separator) + 1, "");
sb.replace(0, sb.lastIndexOf(IPathManager.SEPARATOR) + 1, "");
String name = sb.toString().replace(PointUtilities.DELIM_CHAR,
' ');
Point point = new GroupNode();
@ -1357,7 +1360,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
private void checkGroupDelete(FileUpdatedMessage message) {
String filename = message.getFileName();
String deleteKey = filename.substring(0,
filename.lastIndexOf(File.separator));
filename.lastIndexOf(IPathManager.SEPARATOR));
List<String> childList = groupDeleteMap.get(deleteKey);
if (childList != null) {
childList.remove(filename);
@ -1553,7 +1556,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
// that represents the node. That can not be done until all
// entries in the directory are removed. This determines
// what we need to have deleted and adds requests to the queue.
String groupInfo = deleteKey + File.separator + GROUP_INFO;
String groupInfo = deleteKey + IPathManager.SEPARATOR + GROUP_INFO;
groupDeleteMap.put(deleteKey, new ArrayList<String>());
groupDeleteMap.get(deleteKey).add(groupInfo);
@ -1583,7 +1586,8 @@ public class PointsDataManager implements ILocalizationFileObserver {
private void removePoint(Point point) {
LocalizationFile lFile = null;
if (point.isGroup()) {
String name = getPointDirName(point) + File.separator + GROUP_INFO;
String name = getPointDirName(point) + IPathManager.SEPARATOR
+ GROUP_INFO;
lFile = pathMgr.getLocalizationFile(userCtx, name);
} else {
String name = getPointFilename(point);

View file

@ -44,6 +44,7 @@ import com.vividsolutions.jts.geom.Point;
* has been created to calculate the pivot
* indexes.
* 10-27-2010 #6964 bkowal Added a public class member for the LineStyle.
* 11/29/2012 15571 Qinglu Lin Added compuateCurrentStormCenter();
*
* </pre>
*
@ -189,4 +190,32 @@ public class StormTrackState {
/** Set if you the duration needs to be calculated from the end time */
public Calendar endTime = null;
/** Compute the coordinate of the storm center at the time defined by dataTime via interpolation. */
public boolean compuateCurrentStormCenter(Coordinate coord, DataTime dateTime) {
if (futurePoints == null) return false;
int length = futurePoints.length;
if (length <=1) return false;
DataTime[] dt = new DataTime[2];
dt[0] = futurePoints[0].time;
dt[1] = futurePoints[length-1].time;
Coordinate[] cs = new Coordinate[] {futurePoints[0].coord,futurePoints[length-1].coord};
boolean crossed180 = false;
if (cs[0].x>0 && cs[1].x<0 || cs[0].x<0 && cs[1].x>0) {
crossed180 = true;
if (cs[0].x>0)
cs[0].x = -360. + cs[0].x;
if (cs[1].x>0)
cs[1].x = -360. + cs[1].x;
}
StormTrackUtil trackUtil = new StormTrackUtil();
coord.x = cs[0].x + (cs[1].x-cs[0].x)/trackUtil.timeBetweenDataTimes(dt[1],dt[0])
*trackUtil.timeBetweenDataTimes(dateTime,dt[0]);
coord.y = cs[0].y + (cs[1].y-cs[0].y)/trackUtil.timeBetweenDataTimes(dt[1],dt[0])
*trackUtil.timeBetweenDataTimes(dateTime,dt[0]);
if (crossed180)
if (coord.x<-180.0)
coord.x = 360. + coord.x;
return true;
}
}

View file

@ -218,13 +218,14 @@ public class GLOffscreenRenderingExtension extends GraphicsExtension<IGLTarget>
checkedLuminance = true;
try {
renderOffscreen(image);
renderOnscreen();
} catch (VizException e) {
// assume we don't support luminance
supportsLuminance = false;
// Reconstruct image
image = constructOffscreenImage(dataType, dimensions,
parameters);
} finally {
renderOnscreen();
}
}
return image;

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

View file

@ -20,13 +20,19 @@
package com.raytheon.viz.gfe.actions;
import com.raytheon.viz.gfe.Activator;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.resource.ImageDescriptor;
import com.raytheon.viz.gfe.core.msgs.Message;
import com.raytheon.viz.gfe.core.msgs.ShowISCGridsMsg;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.ToolItem;
/**
* Action to show the ISC grids
*
@ -37,20 +43,45 @@ import com.raytheon.viz.gfe.core.msgs.ShowISCGridsMsg;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 07/20/09 1995 bphillip Initial release
*
* 12/06/12 DR 15574 jzeng Change the image of
* the icon when it is activated
* 01/11/13 DR 15574 jzeng delete all fields to local variables
* </pre>
*
* @author bphillip
* @version 1
*/
public class ShowISCGridsAction extends AbstractHandler {
@Override
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
boolean current = Message.inquireLastMessage(ShowISCGridsMsg.class)
.show();
boolean current = Message.inquireLastMessage(ShowISCGridsMsg.class).show();
if (arg0.getTrigger() instanceof Event) {
Event e = (Event) arg0.getTrigger();
if ( e.widget instanceof ToolItem) {
ToolItem ti = (ToolItem) e.widget;
if (ti != null ){
ImageDescriptor id;
if (!current){
id = Activator.imageDescriptorFromPlugin(
Activator.PLUGIN_ID, "icons/isc1.gif" );
} else {
id = Activator.imageDescriptorFromPlugin(
Activator.PLUGIN_ID, "icons/isc0.gif" );
}
if (id != null){
Image img = id.createImage();
ti.setImage(img);
img.dispose();
}
}
}
}
new ShowISCGridsMsg(!current).send();
return null;
}
}

View file

@ -1,19 +1,19 @@
/**
* 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.
**/
@ -45,6 +45,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.SimulatedTime;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.viz.gfe.Activator;
import com.raytheon.viz.gfe.core.DataManager;
@ -57,7 +58,7 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList;
/**
* The product generation scripts dialog.
*
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
@ -65,9 +66,11 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList;
* Mar 7, 2008 Eric Babin Initial Creation
* Oct 27, 2012 1287 rferrel Code cleanup for non-blocking dialog.
* Oct 25, 2012 1287 rferrel Code changes for non-blocking PublishDialog.
*
* Nov 30, 2012 15575 ryu Added variable replacement for SelectedStart,
* SelectedEnd, and home
*
* </pre>
*
*
* @author ebabin
* @version 1.0
*/
@ -84,6 +87,8 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
private Map<String, String> scriptDict;
private String gfeHome;
private String prddir;
private ToggleSelectList scriptsList;
@ -103,6 +108,8 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
this.setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS);
this.dataManager = dataManager;
gfeHome = Activator.getDefault().getPreferenceStore()
.getString("GFESUITE_HOME");
prddir = Activator.getDefault().getPreferenceStore()
.getString("GFESUITE_PRDDIR");
scripts = Activator.getDefault().getPreferenceStore()
@ -138,7 +145,7 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
}
/**
*
*
*/
private void runScripts() {
int[] idxs = scriptsList.getSelectionIndices();
@ -170,6 +177,15 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
.getSpatialEditorTime();
Date seEnd = new Date(seStart.getTime() + 60 * 1000);
Date selStart = new Date(0);
Date selEnd = new Date(0);
TimeRange selectedTR = dataManager.getParmOp()
.getSelectionTimeRange();
if (selectedTR != null) {
selStart = selectedTR.getStart();
selEnd = selectedTR.getEnd();
}
// The following variables are replaced by known values:
cmd = cmd.replace("{host}", hostParts[0]);
cmd = cmd.replace("{port}", hostParts[1]);
@ -177,8 +193,13 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
cmd = cmd.replace("{productDB}", productDB.toString());
cmd = cmd.replace("{SEstart}", gmtTime.format(seStart));
cmd = cmd.replace("{SEend}", gmtTime.format(seEnd));
cmd = cmd.replace("{SelectedStart}",
gmtTime.format(selStart));
cmd = cmd.replace("{SelectedEnd}",
gmtTime.format(selEnd));
cmd = cmd.replace("{time}", curLocalTime);
cmd = cmd.replace("{ztime}", curGMTTime);
cmd = cmd.replace("{home}", gfeHome);
cmd = cmd.replace("{prddir}", prddir);
// The user is prompted to enter the value with which to replace
@ -397,7 +418,7 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets
* .Shell)

View file

@ -23,8 +23,10 @@ import static com.raytheon.viz.gfe.product.StringUtil.stringJoin;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -76,6 +78,7 @@ import com.raytheon.viz.gfe.textformatter.TextFmtParserUtil;
* 19 Feb 2010 4132 ryu Product correction.
* 30 Jul 2010 6719 jnjanga Placed cursor at the end of inserted CTA
* 26 Sep 2012 15423 ryu Avoid resetting text when possible.
* 03 Dec 2012 15620 ryu Unlock framed cities list for editing.
*
* </pre>
*
@ -141,6 +144,10 @@ public class StyledTextComp extends Composite {
private boolean highlight = Activator.getDefault().getPreferenceStore()
.getBoolean("HighlightFramingCodes");
private boolean newProduct = false;
private Set<String> unlockCitySegs;
private boolean autoWrapMode;
private int wrapColumn = 80; // TODO: get from external
@ -312,6 +319,7 @@ public class StyledTextComp extends Composite {
* The product text.
*/
public void setProductText(String text) {
newProduct = true;
textEditorST.setText(EMPTY);
textEditorST.setStyleRange(null);
parseProductText(text);
@ -320,6 +328,7 @@ public class StyledTextComp extends Composite {
lockText();
findFramingCodes();
textEditorST.getVerticalBar().setSelection(0);
newProduct = false;
}
/**
@ -339,10 +348,8 @@ public class StyledTextComp extends Composite {
* Lock the parts of the text that needs to be uneditable.
*/
private void lockText() {
int strLen = 0;
int startLine = 0;
int endLine = 0;
StyleRange sr;
// NOTE: For the endline variables we need to exclude the last line
// in the for loop because the the parsed index is at line x
@ -360,71 +367,70 @@ public class StyledTextComp extends Composite {
if (ciBlockTip != null) {
startLine = ciBlockTip.getStartIndex().x;
endLine = ciBlockTip.getEndIndex().x;
for (int i = startLine; i < endLine; i++) {
// Add 1 to the length to account for the \n character
strLen += productTextArray[i].length() + 1;
}
sr = new StyleRange(textEditorST.getOffsetAtLine(startLine),
strLen, lockColor, null);
textEditorST.setStyleRange(sr);
lockLines(productTextArray, startLine, endLine);
}
/*
* Lock the mnd text.
*/
strLen = 0;
HashMap<String, TextIndexPoints> mndMap = prodDataStruct.getMndMap();
TextIndexPoints mndTip = mndMap.get("mnd");
if (mndTip != null) {
startLine = mndTip.getStartIndex().x;
endLine = mndTip.getEndIndex().x;
for (int i = startLine; i < endLine; i++) {
// Add 1 to the length to account for the \n character
strLen += productTextArray[i].length() + 1;
}
sr = new StyleRange(textEditorST.getOffsetAtLine(startLine),
strLen, lockColor, null);
textEditorST.setStyleRange(sr);
lockLines(productTextArray, startLine, endLine);
}
/*
* Lock content in the UGC text.
*/
strLen = 0;
if (newProduct) {
unlockCitySegs = new HashSet<String>();
}
List<SegmentData> segArray = prodDataStruct.getSegmentsArray();
TextIndexPoints segTip;
TextIndexPoints segTip, cityTip;
for (SegmentData segmentData : segArray) {
/*
* Lock header.
*/
strLen = 0;
segTip = segmentData.getSegmentDataIndexPoints("header");
cityTip = segmentData.getSegmentDataIndexPoints("city");
if (segTip != null) {
startLine = segTip.getStartIndex().x;
endLine = segTip.getEndIndex().x;
for (int i = startLine; i < endLine; i++) {
// Add 1 to the length to account for the \n character
strLen += productTextArray[i].length() + 1;
String ugc = segTip.getText().substring(0, 6);
// Check if this is a segment for which the cities list
// should be unlocked. Cities list is unlocked for editing
// when framing codes are present.
if (newProduct) {
if (cityTip != null &&
cityTip.getText().indexOf("|*") > 0) {
unlockCitySegs.add(ugc);
}
}
sr = new StyleRange(textEditorST.getOffsetAtLine(startLine),
strLen, lockColor, null);
textEditorST.setStyleRange(sr);
if (unlockCitySegs.contains(ugc)) {
// Lock the segment header but skip the cities list.
int cityStart = cityTip.getStartIndex().x;
int cityEnd = cityTip.getEndIndex().x;
lockLines(productTextArray, startLine, cityStart);
lockLines(productTextArray, cityEnd, endLine);
}
else {
lockLines(productTextArray, startLine, endLine);
}
}
/*
* Lock term.
*/
strLen = 0;
segTip = segmentData.getSegmentDataIndexPoints("term");
if (segTip != null) {
@ -447,18 +453,23 @@ public class StyledTextComp extends Composite {
++endLineOffset;
}
for (int i = startLine; i < endLine + endLineOffset; i++) {
// Add 1 to the length to account for the \n character
strLen += productTextArray[i].length() + 1;
}
sr = new StyleRange(textEditorST.getOffsetAtLine(startLine),
strLen, lockColor, null);
textEditorST.setStyleRange(sr);
lockLines(productTextArray, startLine, endLine + endLineOffset);
}
}
}
private void lockLines(String[] productTextArray, int startLine, int endLine) {
int strLen = 0;
for (int i = startLine; i < endLine; i++) {
// Add 1 to the length to account for the \n character
strLen += productTextArray[i].length() + 1;
}
StyleRange sr = new StyleRange(textEditorST.getOffsetAtLine(startLine),
strLen, lockColor, null);
textEditorST.setStyleRange(sr);
}
/**
* Find the framing codes in the text.
*/

View file

@ -102,6 +102,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* 09 OCT 2012 #15396 Fixed Instantaneous precip index so legend and map display
* will change each time duration is incremented or decremented
* for the "30 minutes Instantaneous" rainfall map .
* 04 Dec 2012 15602 wkwock Fix Hrs hour capped at 100.
*
* </pre>
*
* @author lvenable
@ -1023,6 +1025,7 @@ public class PointDataControlDlg extends CaveSWTDialog {
hoursSpnr.setPageIncrement(5);
hoursSpnr.setSelection(24);
hoursSpnr.setLayoutData(gd);
hoursSpnr.setMaximum(1000);
// hoursSpnr.addSelectionListener(new SelectionAdapter() {
// @Override
// public void widgetSelected(SelectionEvent event) {

View file

@ -21,10 +21,8 @@ package com.raytheon.viz.hydro.timeseries;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
@ -89,7 +87,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* printable area of the page.
* 04 Mar 2011 7644 lbousaid fixed Zoom in feature
* 30 May 2012 14967 wkwock fix insert deleted data to rejecteddata table
* 23 Jul 2012 15195 mpduff Fix dates for displaying groups
* 23 Jul 2012 15195 mpduff Fix dates for displaying groups
* 06 Dec 2012 15066 wkwock Fix "ctrl+r" not work in group mode
*
* </pre>
*
@ -973,7 +972,10 @@ public class TimeSeriesDisplayDlg extends CaveSWTDialog {
setZoomAction(false);
setSelectZoom(false);
reset = true;
displayCanvas.redraw();
for (TimeSeriesDisplayCanvas dc :canvasList){
dc.setZoomed(false);
dc.redraw();
}
} else {
displayCanvas.resetTS();
}

View file

@ -50,6 +50,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* ------------ ---------- ----------- --------------------------
* 02 Sep 2008 lvenable Initial creation.
* 30 Dec 2008 1802 askripsk Connect to database.
* 04 Dec 2012 15522 wkwock Fix incorrect zones and not able to add
*
* </pre>
*
@ -94,6 +95,10 @@ public class CountyZoneUgcDlg extends CaveSWTDialog {
*/
private Button clearBtn;
/**
* for keep track whether selected zones are initialized. false is not initialized.
*/
private boolean zonesFlag = false;
/**
* Constructor.
*
@ -157,6 +162,9 @@ public class CountyZoneUgcDlg extends CaveSWTDialog {
selectionCbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (!zonesFlag) {
getZoneData();
}
updateDisplay();
}
});
@ -328,6 +336,7 @@ public class CountyZoneUgcDlg extends CaveSWTDialog {
private void getZoneData() {
try {
CountyZoneUgcDataManager.getInstance().getZonesSelected(true);
zonesFlag=true;
} catch (VizException e) {
e.printStackTrace();
}

View file

@ -37,6 +37,7 @@ import com.raytheon.viz.hydrocommon.data.ZoneInfoData;
* ------------ ---------- ----------- --------------------------
* Jan 5, 2009 1802 askripsky Initial Creation
* Sep 11,2012 15362 wkwock Fix selected zones
* Dec 4, 2012 15522 wkwock Fix added zones
*
* </pre>
*
@ -159,7 +160,7 @@ public class CountyZoneUgcDataManager {
* @throws VizException
*/
public ArrayList<ZoneInfoData> getZonesSelected() throws VizException {
return getZonesSelected(true);
return getZonesSelected(false);
}
/**

View file

@ -350,6 +350,14 @@ public class OtherPrecipOptions {
up_arrow.setEnabled(true);
}
}
Calendar currentTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
Calendar tmpDate = (Calendar) currentTime.clone();
tmpDate.setTime(DailyQcUtils.pdata[DailyQcUtils.pcpn_day].data_time);
tmpDate.add(Calendar.HOUR_OF_DAY, (DailyQcUtils.pcpn_time-3)*6);
if (currentTime.before(tmpDate)){
up_arrow.setEnabled(false);
}
} else {
/* 24 hour mode. */
if (pcp_flag + 4 >= num_qc_days * 4) {

View file

@ -59,6 +59,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 16, 2009 snaples Initial creation
* Dec 04, 2012 15544 wkwock fix missing 12z-18z after 12
*
* </pre>
*
@ -1021,6 +1022,12 @@ public class DailyQcUtils {
btime.set(Calendar.SECOND, 0);
hrgt12z = 0;
}
/* In order to allow user access the 12~18Z point data for the most recent day,
advance one more day from current day if the later than 18Z */
Calendar currentTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
if (currentTime.get(Calendar.HOUR_OF_DAY)>=18) {
btime.add(Calendar.DAY_OF_MONTH, 1);
}
emonth = btime.get(Calendar.MONTH);
Calendar otime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));

View file

@ -56,6 +56,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Jun 08, 2010 5851 cjeanbap Properly stop alarm/alert observer listener; shellComp is null.
* Oct 31, 2011 8510 rferrel made PRIMARY_MODEL and add check for nonblank productID.
* Sep 20, 2012 1196 rferrel No longer Blocks
* 12/07/2012 15555 m.gamazaychikov Fixed the implementation for New Proximity Alarm.
* </pre>
*
* @author mnash
@ -330,15 +331,34 @@ public class NewAlarmDlg extends CaveSWTDialog {
AOR = new Button(aor, SWT.CHECK);
aorData = new GridData(SWT.DEFAULT, SWT.CENTER, false, false);
AOR.setLayoutData(aorData);
if (prod != null) {
/*
* DR15555 - Set the AOR selection to:
* 1. true - for new alarm
* 2. product's state - for existing alarm
*/
if (prod.getProductId() != "") {
AOR.setSelection(prod.isAor());
}
else {
AOR.setSelection(true);
AOR.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_YELLOW));
}
AOR.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
if (AOR.getSelection() == true) {
/*
* DR15555 - handle the AOR selection:
* - set the background yellow
* - set the AORDistance text to empty string
* - set the ugcList text to empty string
*/
AOR.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_YELLOW));
AORDistance.setText("");
ugcList.setText("");
} else {
AOR.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_WIDGET_BACKGROUND));
@ -355,22 +375,34 @@ public class NewAlarmDlg extends CaveSWTDialog {
AORDistance = new Text(aor, SWT.SINGLE | SWT.BORDER);
aorData = new GridData(SWT.END, SWT.DEFAULT, false, false);
aorData.horizontalAlignment = SWT.RIGHT;
aorData.widthHint = 20;
aorData.widthHint = 60;
AORDistance.setLayoutData(aorData);
if (prod != null) {
/*
* DR15555 - Set the AORDistance selection to:
* 1. empty string - for new alarm
* 2. product's distance - for existing alarm
*/
if (prod.getProductId() != "") {
AORDistance.setText(prod.getAorDistance());
}
else {
AORDistance.setText("");
}
AORDistance.addListener(SWT.KeyDown, new Listener() {
@Override
public void handleEvent(Event e) {
if (!"".equals(AORDistance.getText())
|| (e.character != 0x8 && e.character != 0x7f)) {
AOR.setSelection(true);
AOR.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_YELLOW));
}
}
public void handleEvent(Event e) {
/*
* DR15555 - handle the AOR selection:
* - set the AOR background gray
* - un-select the AOR
* - set the ugcList text to empty string
*/
AOR.setSelection(false);
AOR.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_WIDGET_BACKGROUND));
ugcList.setText("");
}
});
distanceLabel = new Combo(aor, SWT.READ_ONLY);
@ -378,7 +410,12 @@ public class NewAlarmDlg extends CaveSWTDialog {
distanceLabel.setItems(new String[] { "mi", "km" });
aorData.horizontalAlignment = SWT.RIGHT;
distanceLabel.setLayoutData(aorData);
if (prod != null) {
/*
* DR15555 - Set the distanceLabel selection to:
* 1. 'mi' - for new alarm
* 2. product's label - for existing alarm
*/
if (prod.getProductId() != "") {
distanceLabel.setText(prod.getAorLabel());
} else {
distanceLabel.select(0);
@ -394,9 +431,32 @@ public class NewAlarmDlg extends CaveSWTDialog {
ugcLabel.setText("UGC List:");
ugcList = new Text(ugc, SWT.SINGLE | SWT.BORDER);
ugcList.setLayoutData(gd);
if (prod != null) {
/*
* DR15555 - Set the ugcList selection to:
* 1. empty string - for new alarm
* 2. product's ugcList - for existing alarm
*/
if (prod.getProductId() != "") {
ugcList.setText(prod.getUgcList());
}
else {
ugcList.setText("");
}
ugcList.addListener(SWT.KeyDown, new Listener() {
@Override
public void handleEvent(Event e) {
/*
* DR15555 - handle the ugcList selection:
* - set the AOR background gray
* - un-select the AOR
* - set the AORDistance text to empty string
*/
AOR.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_WIDGET_BACKGROUND));
AOR.setSelection(false);
AORDistance.setText("");
}
});
// separator
GridData fullLayoutData = new GridData(SWT.FILL, SWT.DEFAULT, true,

View file

@ -26,14 +26,25 @@ import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.xml.bind.JAXB;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.dataplugin.text.alarms.AlarmAlertProduct;
import com.raytheon.uf.common.dataplugin.text.alarms.AlarmAlertProduct.ProductType;
import com.raytheon.uf.common.dataplugin.text.db.StdTextProduct;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.geospatial.SpatialException;
import com.raytheon.uf.common.geospatial.SpatialQueryFactory;
import com.raytheon.uf.common.geospatial.SpatialQueryResult;
import com.raytheon.uf.common.localization.ILocalizationFileObserver;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
@ -45,11 +56,15 @@ import com.raytheon.uf.common.localization.exception.LocalizationOpFailedExcepti
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.viz.core.localization.LocalizationManager;
import com.raytheon.viz.texteditor.alarmalert.dialogs.AlarmAlertBell;
import com.raytheon.viz.texteditor.command.CommandFactory;
import com.raytheon.viz.texteditor.command.CommandFailedException;
import com.raytheon.viz.texteditor.command.ICommand;
import com.raytheon.viz.texteditor.util.TextEditorUtil;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryFactory;
/**
* This class is used for some of the calculation work used in the alarm/alert
@ -62,6 +77,8 @@ import com.raytheon.viz.texteditor.util.TextEditorUtil;
* ------------ ---------- ----------- --------------------------
* Sep 18, 2009 mnash Initial creation
* 03/19/2012 D. Friedman Fix determination of "Alarm" entries.
* 12/07/2012 15555 m.gamazaychikov Added methods and constants for
* the implementation of proximity alarm
*
* </pre>
*
@ -69,6 +86,14 @@ import com.raytheon.viz.texteditor.util.TextEditorUtil;
* @version 1.0
*/
/**
* @author michaelg
*
*/
/**
* @author michaelg
*
*/
public class AlarmAlertFunctions {
private static final AlarmAlertProduct.ProductType AA = AlarmAlertProduct.ProductType.Alarm_Alert;
@ -88,6 +113,23 @@ public class AlarmAlertFunctions {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(AlarmAlertFunctions.class);
private static final Pattern UGC_NEW_PATTERN = Pattern
.compile("^(([A-Z]{3})(\\d{3}))$");
private static final Pattern UGC_FOLLOW_PATTERN = Pattern
.compile("^(\\d{3})$");
private static String DEFAULT_DISTANCE="3000";
private static final String HYPHEN = Pattern.quote("-");
public static final Pattern UGC = Pattern
.compile("(^(\\w{2}[CZ]\\d{3}\\S*-\\d{6}-)$|((\\d{3}-)*\\d{6}-)$|((\\d{3}-)+))");
private static final double ONE_DEGREE_MI = 69.09;
private static final double ONE_DEGREE_KM = 111.20;
protected void getGIS() {
@ -105,7 +147,22 @@ public class AlarmAlertFunctions {
string.append("AOR");
}
if (!"".equals(prod.getAorDistance())) {
string.append("+" + prod.getAorDistance() + prod.getAorLabel());
/*
* DR15555 - check the text content,
* if it is not a valid number set the
* text to default 3000 mi
*/
Scanner scn = new Scanner(prod.getAorDistance());
while (scn.hasNext()){
if (!scn.hasNextInt()){
prod.setAorDistance(DEFAULT_DISTANCE);
break;
}
else {
scn.next();
}
}
string.append("AOR+" + prod.getAorDistance() + prod.getAorLabel());
} else if (!"".equals(prod.getUgcList())) {
string.append("UGC-" + prod.getUgcList());
}
@ -219,10 +276,11 @@ public class AlarmAlertFunctions {
if (productId != null) {
productId = productId.trim().toUpperCase();
for (AlarmAlertProduct a : currentAlarms) {
// **************
// TODO : For now disable Proximity Alerts
// **************
if (AA.equals(a.getProductType())) {
ProductType pt = a.getProductType();
/*
* Alarm_Alert
*/
if (AA.equals(pt)) {
String s = a.getProductId();
if (s != null) {
s = s.trim().toUpperCase();
@ -234,12 +292,334 @@ public class AlarmAlertFunctions {
}
}
}
/*
* DR1555 - Proximity_Alarm
*/
else if (PA.equals(pt)) {;
String s = a.getProductId();
if (s != null) {
s = s.trim().toUpperCase();
if (s.equals(productId)) {
List<StdTextProduct> productList = getProduct(a
.getProductId());
if (productList.size() > 0) {
StdTextProduct stp = productList.get(0);
if (stp != null) {
Geometry messagePolygon = getMessagePolygon(stp);
if (a.isAor()) {
/*
* Check if polygon in the message
* is within the AOR
*/
if (matchAOR(messagePolygon)) {
prods.add(a);
}
} else if (!"".equals(a.getAorDistance())) {
/*
* Check if polygon in the message
* is within the AOR+distance
*/
if (matchAORExtention(a.getAorDistance(),
a.getAorLabel(), messagePolygon)) {
prods.add(a);
}
} else if (!"".equals(a.getUgcList())) {
/*
* Check if UGCs in the message
* match the UGCs in the alarm
*/
String messageUGCs = getMessageUGCs(stp
.getProduct());
String alarmUGCs = a.getUgcList();
if (matchUGCList(alarmUGCs, messageUGCs)) {
prods.add(a);
}
}
}
}
}
}
}
}
}
return prods;
}
/**
/**
* Return a String containing UGCs specified in the message
*
* @param productText
* @return
*/
private static String getMessageUGCs(String productText) {
String ugcLine = "";
for (String line : productText.replaceAll("\r", "").trim().split("\n")) {
Matcher m = UGC.matcher(line);
if (m.find()) {
ugcLine += line;
continue;
} else if (ugcLine.length() > 0) {
break;
}
}
return ugcLine;
}
/**
* Returns true if the polygon intersects the CWA
*
* @param polygon
* @return
*/
private static boolean matchAOR(Geometry polygon) {
Geometry cwa = null;
String site = LocalizationManager.getInstance().getCurrentSite();
try {
cwa = readCountyWarningArea(site);
} catch (SpatialException e) {
e.printStackTrace();
}
if (cwa!=null) {
if (polygon.intersects(cwa)) {
return true;
}
}
return false;
}
/**
* Returns true if a UGC specified in the alarmUGCs is present in the
* messageUGCs
*
* @param alarmUGCs
* @param messageUGCs
* @return
*/
private static boolean matchUGCList(String alarmUGCs, String messageUGCs) {
List<String> alarmUGCList = getUGCs(alarmUGCs);
for ( String alarmUGC: alarmUGCList) {
if (messageUGCs.contains(alarmUGC) ) {
return true;
}
}
return false;
}
/**
* Return a List of strings of UGCs
*
* @param ugcString
* @return
*/
private static List<String> getUGCs(String ugcString) {
String[] ugcList = ugcString.split(HYPHEN);
// Process the list of UGC lines into a list of UGCs in full form
// matching edit area names
List<String> finalUGCList = new ArrayList<String>(ugcList.length);
String state = null;
for (String ugc : ugcList) {
Matcher newGroup = UGC_NEW_PATTERN.matcher(ugc);
if (newGroup.matches()) {
state = newGroup.group(2);
finalUGCList.add(newGroup.group(1));
} else {
Matcher followGroup = UGC_FOLLOW_PATTERN.matcher(ugc);
if (followGroup.matches()) {
finalUGCList.add(state + followGroup.group(1));
}
}
}
return finalUGCList;
}
/**
* Return Geometry representing the site's CWA
*
* @param site
* @return
* @throws SpatialException
*/
private static Geometry readCountyWarningArea(String site)
throws SpatialException {
Map<String, RequestConstraint> map = new HashMap<String, RequestConstraint>();
map.put("cwa", new RequestConstraint(site));
SpatialQueryResult[] result = SpatialQueryFactory.create().query("cwa",
null, null, map, null);
if (result == null || result.length == 0) {
return null;
}
return result[0].geometry;
}
/**
* Returns true if the polygon intersects the CWA+distance
*
* @param distanceStr
* @param distanceUnits
* @param polygon
* @return
*/
private static boolean matchAORExtention(String distanceStr,
String distanceUnits, Geometry polygon) {
Geometry cwa = null;
String site = LocalizationManager.getInstance().getCurrentSite();
try {
cwa = readCountyWarningArea(site);
} catch (SpatialException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Geometry CWAConvex = cwa.convexHull();
double d0 = 0.0d;
if ("mi".equalsIgnoreCase(distanceUnits)) {
d0 = ONE_DEGREE_MI;
} else {
d0 = ONE_DEGREE_KM;
}
Double distance = Double.parseDouble(distanceStr);
double centerLat = Math.toRadians(CWAConvex.getCentroid().getY());
Double deltaX = distance / (Math.cos(centerLat) * d0);
Double deltaY = distance / d0;
Geometry expandedCWA = expandCWABy(CWAConvex, deltaX, deltaY);
if (expandedCWA != null) {
if (polygon.intersects(expandedCWA)) {
return true;
}
}
return false;
}
/**
* Return expanded by deltaX-deltaY geometry
*
* @param CWAConvex
* @param deltaX
* @param deltaY
* @return
*/
private static Geometry expandCWABy(Geometry CWAConvex, Double deltaX,
Double deltaY) {
Coordinate[] coords = CWAConvex.getCoordinates();
Coordinate[] coordsExpanded = new Coordinate[coords.length];
Double centerLat = CWAConvex.getCentroid().getY();
Double centerLon = CWAConvex.getCentroid().getX();
for (int i = 0; i < coords.length; i++) {
double latE = coords[i].y;
double lonE = coords[i].x;
if (coords[i].x < centerLon) {
lonE = coords[i].x - deltaX;
;
} else if (coords[i].x > centerLon) {
lonE = coords[i].x + deltaX;
} else if (coords[i].x == centerLon) {
lonE = coords[i].x;
}
if (coords[i].y < centerLat) {
latE = coords[i].y - deltaY;
} else if (coords[i].y > centerLat) {
latE = coords[i].y + deltaY;
} else if (coords[i].y == centerLat) {
latE = coords[i].y;
}
coordsExpanded[i] = new Coordinate(lonE, latE);
}
GeometryFactory gf = new GeometryFactory();
return gf.createLinearRing(coordsExpanded).convexHull();
}
/**
* Return the polygon contained in message
*
* @param stp
* @return
*/
private static Geometry getMessagePolygon(StdTextProduct stp) {
String body = stp.getProduct();
if (body.contains("LAT...LON")) {
Coordinate[] coords = getLatLonCoords(body);
GeometryFactory gf = new GeometryFactory();
return gf.createLinearRing(coords);
}
return null;
}
/**
* Return an array of Coordinate[] contained in the message
*
* @param body
* @return
*/
private static Coordinate[] getLatLonCoords(String body) {
String latLon = "";
boolean insideLatLon = false;
ArrayList<Coordinate> coordinates = new ArrayList<Coordinate>();
Pattern latLonPtrn = Pattern
.compile("LAT...LON+(\\s\\d{3,4}\\s\\d{3,5}){1,}");
Pattern subLatLonPtrn = Pattern.compile("\\s(\\d{3,4})\\s(\\d{3,5})");
String[] separatedLines = body.split("\n");
for (String line : separatedLines) {
Matcher m = latLonPtrn.matcher(line);
if (m.find()) {
latLon = line;
insideLatLon = true;
continue;
}
if (insideLatLon) {
m = subLatLonPtrn.matcher(line);
if (!line.startsWith("TIME...") && m.find()) {
latLon += " " + line.trim();
continue;
} else {
insideLatLon = false;
}
}
}
coordinates = processLatlons(latLon);
Coordinate[] coords = new Coordinate[coordinates.size()];
coords = coordinates.toArray(coords);
return coords;
}
/**
* Process the extracted from the message latlon coordinates
* @param latLon
* @return
*/
private static ArrayList<Coordinate> processLatlons(String latLon) {
ArrayList<Coordinate> coordinates = new ArrayList<Coordinate>();
String currentToken = null;
String latlon = "LAT...LON";
String latitude = null;
String longitude = null;
boolean pair = false;
Double dlat, dlong;
StringTokenizer latlonTokens = new StringTokenizer(latLon);
while (latlonTokens.hasMoreTokens()) {
currentToken = latlonTokens.nextToken();
if (!currentToken.equals(latlon)) {
if (pair) {
longitude = currentToken;
pair = false;
dlat = (double) (Integer.parseInt(latitude) / 100.0);
dlong = (double) ((Integer.parseInt(longitude) / 100.0) * (-1.0));
coordinates.add(new Coordinate(dlong, dlat));
} else {
latitude = currentToken;
pair = true;
}
}
}
Double dlong0 = coordinates.get(0).x;
Double dlat0 = coordinates.get(0).y;
coordinates.add(new Coordinate(dlong0, dlat0));
return coordinates;
}
/**
* initialize the localization for user with the save/load functions
*
* @return the initialized localization

View file

@ -34,6 +34,8 @@ import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.TraverseEvent;
import org.eclipse.swt.events.TraverseListener;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.layout.GridData;
@ -94,6 +96,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* 07/26/2012 15171 rferrel Disable editor's send and clear AFOS PIL fields when
* invalid product Id and user want to edit it anyway.
* 09/20/2012 1196 rferrel Changing dialogs being called to not block.
* 11/26/2012 14526 mgamazaychikov Added traverse listener for RETURN key
* </pre>
*
* @author lvenable
@ -221,6 +224,10 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
// this was after shell.pack() before, any reason why?
checkEnableEnter();
/*
* 14526 - Add the traverse listener for RETURN key
*/
setTraverseListenerReturn();
}
@Override
@ -608,49 +615,7 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
enterBtn.setEnabled(true);
enterBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
boolean sendEnabled = true;
if (!isProductValid()) {
// Notify the user that the product may not be valid.
//
// TODO cannot use a model MessageBox here. If displayed
// when an Alarm Alert Bell appears Cave freezes and
// nothing can be done. Need to change this to extend
// CaveSWTDialog in a similar manner to
// WarnGenConfirmationDlg. Better solution if possible
// change AlermAlertBell so modal MessagBox can be used..
MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION
| SWT.YES | SWT.NO);
mb.setMessage("Product Designator "
+ wsfoIdTF.getText()
+ prodCatTF.getText()
+ prodDesignatorTF.getText()
+ " is not in the list of valid products. Use it anyway?");
if (mb.open() == SWT.NO) {
return;
}
parentEditor.enableSend(false);
sendEnabled = false;
} else {
parentEditor.enableSend(true);
}
// call the set methods
parentEditor.setCurrentWmoId(wmoTtaaiiTF.getText());
parentEditor.setCurrentSiteId(ccccTF.getText());
if (sendEnabled) {
parentEditor.setCurrentWsfoId(wsfoIdTF.getText());
parentEditor.setCurrentProdCategory(prodCatTF.getText());
parentEditor.setCurrentProdDesignator(prodDesignatorTF
.getText());
} else {
parentEditor.setCurrentWsfoId("");
parentEditor.setCurrentProdCategory("");
parentEditor.setCurrentProdDesignator("");
}
parentEditor.setAddressee(addresseeTF.getText());
setBbbId();
setReturnValue(true);
shell.dispose();
enterBtnPressed();
}
});
@ -668,7 +633,58 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
}
/**
protected void enterBtnPressed() {
/*
* 14526 - Added the check for when RETURN key is pressed
* but the "Enter" button is not enabled.
*/
if ( !enterBtn.getEnabled()) {
return;
}
boolean sendEnabled = true;
if (!isProductValid()) {
// Notify the user that the product may not be valid.
//
// TODO cannot use a model MessageBox here. If displayed
// when an Alarm Alert Bell appears Cave freezes and
// nothing can be done. Need to change this to extend
// CaveSWTDialog in a similar manner to
// WarnGenConfirmationDlg. Better solution if possible
// change AlermAlertBell so modal MessagBox can be used..
MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION | SWT.YES
| SWT.NO);
mb.setMessage("Product Designator " + wsfoIdTF.getText()
+ prodCatTF.getText() + prodDesignatorTF.getText()
+ " is not in the list of valid products. Use it anyway?");
if (mb.open() == SWT.NO) {
return;
}
parentEditor.enableSend(false);
sendEnabled = false;
} else {
parentEditor.enableSend(true);
}
// call the set methods
parentEditor.setCurrentWmoId(wmoTtaaiiTF.getText());
parentEditor.setCurrentSiteId(ccccTF.getText());
if (sendEnabled) {
parentEditor.setCurrentWsfoId(wsfoIdTF.getText());
parentEditor.setCurrentProdCategory(prodCatTF.getText());
parentEditor.setCurrentProdDesignator(prodDesignatorTF.getText());
} else {
parentEditor.setCurrentWsfoId("");
parentEditor.setCurrentProdCategory("");
parentEditor.setCurrentProdDesignator("");
}
parentEditor.setAddressee(addresseeTF.getText());
setBbbId();
setReturnValue(true);
shell.dispose();
}
/**
* This is a convenience method that will center a label in a RowLayout.
* When controls are placed in a RowLayout they are "aligned" at the top of
* the cell.
@ -942,6 +958,17 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
}
}
});
/*
* 14526 - Add the traverse listener for RETURN key
*/
tf.addTraverseListener(new TraverseListener() {
@Override
public void keyTraversed(TraverseEvent te) {
te.doit = true;
}
});
}
private void textFieldVerifyListener(final StyledText tf) {
@ -1005,4 +1032,19 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
if (allBtn != null)
allBtn.setSelection("ALL".equals(addressee));
}
/*
* Adds the traverse listener for RETURN key
*/
private void setTraverseListenerReturn() {
shell.addTraverseListener(new TraverseListener() {
@Override
public void keyTraversed(TraverseEvent event) {
if (event.detail == SWT.TRAVERSE_RETURN) {
enterBtnPressed();
}
}
});
}
}

View file

@ -60,7 +60,6 @@ import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ExtendedModifyEvent;
import org.eclipse.swt.custom.ExtendedModifyListener;
import org.eclipse.swt.custom.PopupList;
import org.eclipse.swt.custom.ST;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
@ -99,9 +98,11 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.MessageBox;
@ -303,6 +304,7 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
* Do not use changed BBB from OUPResponse.
* 17OCT2012 1229 rferrel Changes for non-blocking SWTMessageBox.
* 05Nov2012 15560 S. Naples Added check to see if we are in edit mode before capturing keys.
* 28Nov2012 14842 M.Gamazaychikov Re-wrote processPopup method
* </pre>
*
* @author lvenable
@ -1106,6 +1108,9 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
private static final String[] popupItems = { "Select All", "Cut", "Copy",
"Paste" };
private static final boolean[] isPopItemDefault = { true, false, true,
false };
private boolean warnGenFlag = false;
@ -3635,7 +3640,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
}
if (e.button == 3) {
processPopup(e.x, e.y);
processPopup();
}
}
@ -3648,33 +3653,48 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
/**
* Process the user choice from the popup list.
* DR14842 - re-written
*/
private void processPopup(int x, int y) {
PopupList popupList = new PopupList(shell);
popupList.setMinimumWidth(50);
if (isEditMode()) {
popupList.setItems(popupItems);
} else {
popupList.setItems(new String[] { "Select All", "Copy" });
}
popupList.select(popupItems[0]);
Point p = Display.getCurrent().map(textEditor, null, x, y);
String choice = popupList.open(new Rectangle(p.x + 10, p.y + 10, 100,
200));
if (choice != null) {
if (popupItems[0].equals(choice)) {
textEditor.selectAll();
} else if (popupItems[1].equals(choice)) {
cutText();
} else if (popupItems[2].equals(choice)) {
copyText();
} else if (popupItems[3].equals(choice)) {
pasteText();
}
textEditor.update();
}
}
private void processPopup() {
Menu menu = new Menu(shell, SWT.POP_UP);
List<String> items = Arrays.asList(popupItems);
for (String pi : popupItems) {
MenuItem mi = new MenuItem(menu, SWT.PUSH);
mi.setText(pi);
if (isEditMode()) {
mi.setEnabled(true);
} else {
mi.setEnabled(isPopItemDefault[items.indexOf(pi)]);
}
mi.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
handleSelection(event);
}
});
}
menu.setVisible(true);
}
/**
* Handle the selection from the popup menu
* @param event
*/
protected void handleSelection(Event event) {
MenuItem item = (MenuItem) event.widget;
String choice = item.getText();
if (choice != null) {
if (popupItems[0].equals(choice)) {
textEditor.selectAll();
} else if (popupItems[1].equals(choice)) {
cutText();
} else if (popupItems[2].equals(choice)) {
copyText();
} else if (popupItems[3].equals(choice)) {
pasteText();
}
textEditor.update();
}
}
/**
* creates the bar containing the script runner controls.

View file

@ -25,8 +25,8 @@
<substitute key="NAM40model" value="mesoEta212" />
<substitute key="ARWmodel1" value="HiResW-ARW-East" />
<substitute key="ARWmodel2" value="HiResW-ARW-West" />
<substitute key="MMMmodel1" value="HiResW-MMM-East" />
<substitute key="MMMmodel2" value="HiResW-MMM-West" />
<substitute key="MMMmodel1" value="HiResW-NMM-East" />
<substitute key="MMMmodel2" value="HiResW-NMM-West" />
<include installTo="menu:volume?after=VolumeBundles"
fileName="menus/volume/baseFamilies.xml">
</include>

View file

@ -1309,7 +1309,7 @@
key="PWmean" indentText="false" />
<contribute xsi:type="menuItem" menuText="Mean Sea Level Pressure"
key="PMSLmean" indentText="false" />
<contribute xsi:type="menuItem" menuText="Dew Point Temp"
<contribute xsi:type="menuItem" menuText="Dewpoint Temp"
key="DpTmean" indentText="false" />
<contribute xsi:type="menuItem" menuText="12-hr Large scale Snowfall"
key="SNOL12mean" indentText="false" />
@ -1353,7 +1353,7 @@
key="PWsprd" indentText="false" />
<contribute xsi:type="menuItem" menuText="Mean Sea Level Pressure"
key="PMSLsprd" indentText="false" />
<contribute xsi:type="menuItem" menuText="Dew Point Temp"
<contribute xsi:type="menuItem" menuText="Dewpoint Temp"
key="DpTsprd" indentText="false" />
<contribute xsi:type="menuItem" menuText="12-hr Large scale Snowfall"
key="SNOL12sprd" indentText="false" />

View file

@ -56,7 +56,8 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 1, 2010 mschenke Initial creation
*
* 12/06/2012 DR 15559 Qinglu Lin Added round() methods.
*
* </pre>
*
* @author mschenke
@ -953,4 +954,34 @@ public class PolygonUtil {
coordinate.x = x / Math.pow(10, decimalPlaces);
coordinate.y = y / Math.pow(10, decimalPlaces);
}
public static void round(List<Coordinate >coordinates, int decimalPlaces) {
for (Coordinate coordinate : coordinates) {
round(coordinate, decimalPlaces);
}
}
public static void round(Coordinate[] coordinates, int decimalPlaces) {
for (Coordinate coordinate : coordinates) {
round(coordinate, decimalPlaces);
}
}
/**
* round()
* Rounding coordinates, instead of truncating them.
*
* History
* 12/06/2012 DR 15559 Qinglu Lin Created.
*/
public static void round(Coordinate coordinate, int decimalPlaces) {
double x = coordinate.x * Math.pow(10, decimalPlaces);
double y = coordinate.y * Math.pow(10, decimalPlaces);
x = Math.round(x);
y = Math.round(y);
coordinate.x = x / Math.pow(10, decimalPlaces);
coordinate.y = y / Math.pow(10, decimalPlaces);
}
}

View file

@ -144,7 +144,16 @@ import com.vividsolutions.jts.io.WKTReader;
* warningAction is neither null nor WarningAction.NEW, removed
* some code from redrawBoxFromHatched().
* 11/15/2012 DR 15430 D. Friedman Use correct county/zone in createGeometryForWatches.
*
* 11/29/2012 DR 15571 Qinglu Lin Called compuateCurrentStormCenter() in getStormLocations();
* For CON, CAN, and COR, calculate Coordinate array, cc, specifically in
* getStormLocations().
* 12/10/2012 DR 15571 Qinglu Lin Change warningAction's initialization from null to WarningAction.NEW, and add code
* in getStormLocations() for handling case when warningAction equals WarningAction.NEW;
* 12/13/2012 DR 15559 Qinglu Lin Added code to call WarngenUIState's adjustPolygon().
* 12/17/2012 DR 15571 Qinglu Lin For hydro products,futurePoints is null. Resolved an issue caused by trying to get
* Coordinate[] from futurePoints.
* 12/18/2012 DR 15571 Qinglu Lin Resolved coordinate issue in TML line caused by clicking Restart button.
*
* </pre>
*
* @author mschenke
@ -229,7 +238,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
private GeospatialDataList geoData = null;
private WarningAction warningAction = null;
private WarningAction warningAction = WarningAction.NEW;
static {
for (int i = 0; i < 128; i++) {
@ -1600,8 +1609,17 @@ public class WarngenLayer extends AbstractStormTrackResource {
.hatchWarningArea(state.getWarningPolygon(),
state.getWarningArea());
if (hatched != null) {
state.setWarningPolygon(hatched);
state.snappedToArea = true;
// DR 15559
Coordinate[] coords = hatched.getCoordinates();
PolygonUtil.round(coords, 2);
state.adjustPolygon(coords);
GeometryFactory gf = new GeometryFactory();
LinearRing lr = gf.createLinearRing(coords);
state.setWarningPolygon(gf.createPolygon(lr, null));
updateWarnedAreas(true, true);
issueRefresh();
// End of DR 15559
state.snappedToArea = true;
}
System.out.println("Time to createWarningPolygon: "
+ (System.currentTimeMillis() - t0) + "ms");
@ -1820,9 +1838,16 @@ public class WarngenLayer extends AbstractStormTrackResource {
Coordinate[] cc = null;
switch (stormTrackState.displayType) {
case POINT:
cc = new Coordinate[] { stormTrackState.futurePoints == null ? stormTrackState.dragMePoint
.getCoordinate() : stormTrackState.futurePoints[0].coord };
break;
cc = new Coordinate[] { stormTrackState.futurePoints == null ? stormTrackState.dragMePoint
.getCoordinate() : stormTrackState.futurePoints[0].coord };
if (warningAction == null || warningAction == WarningAction.NEW || warningAction == WarningAction.CON
|| warningAction == WarningAction.CAN) {
Coordinate coord = new Coordinate(stormTrackState.dragMePoint.getCoordinate());
DataTime currentDataTime = new DataTime(SimulatedTime.getSystemTime().getTime());
if (stormTrackState.compuateCurrentStormCenter(coord,currentDataTime))
cc = new Coordinate[] {coord};
}
break;
case POLY:
Coordinate[] polyPoints = stormTrackState.dragMeLine
.getCoordinates();

View file

@ -41,6 +41,8 @@ import com.vividsolutions.jts.geom.Polygon;
* May 7, 2010 mschenke Initial creation
* 03/14/2012 DR 14690 Qinglu Lin Add clear2().
* 10/26/2012 DR 15479 Qinglu Lin Added removeDuplicateCoordinate().
* 12/06/2012 DR 15559 Qinglu Lin Added computeSlope(), computeCoordinate(),
* and adjustPolygon().
*
* </pre>
*
@ -145,6 +147,151 @@ public class WarngenUIState {
warningPolygon = gf.createPolygon(gf.createLinearRing(vertices), null);
}
/**
* computeSlope
* compute the slope of a line.
*
* History
* 12/06/2012 DR 15559 Qinglu Lin Created.
*/
private double computeSlope(Coordinate[] coords, int i) {
double min = 1.0E-08;
double dx = coords[i].x-coords[i+1].x;
double slope = 0.0;
if (Math.abs(dx)>min) {
slope = (coords[i].y-coords[i+1].y)/dx;
}
return slope;
}
/**
* computeCoordinate
* Compute the x component of a coordinate after its y component
* is adjusted.
*
* History
* 12/06/2012 DR 15559 Qinglu Lin Created.
*/
private void computeCoordinate(Coordinate[] c, int i, int j) {
double slope;
slope = computeSlope(c,i);
int iPlus1 = i+1;
if (c[j].x>=c[i].x && c[j].x<=c[iPlus1].x ||
c[j].x>=c[iPlus1].x && c[j].x<=c[i].x) {
double x,y;
double min1 = 0.005d;
y = slope*(c[j].x-c[i].x) + c[i].y;
double d = Math.abs(y-c[j].y);
if (d>min1)
return;
double min2 = 1.0E-8d;
double delta = 0.005d; // empirical value
double dyMin = 0.01d;
int jMinus1 = j-1;
if (jMinus1<0)
jMinus1 = c.length-2;
int jPlus1 = j+1;
if (Math.abs(y-c[j].y)<min1) {
double dy1, dy2;
dy1 = Math.abs(c[jMinus1].y-y);
dy2 = Math.abs(c[jPlus1].y-y);
if (dy1>=dy2 && (Math.abs(dy1)>dyMin || Math.abs(dy2)>dyMin)) {
// attempt to use l2 for computation
if (c[j].y==c[jMinus1].y && Math.abs(c[j].x-c[jMinus1].x)>min2) {
// l2 is a horizontal line, use l3 for computation
if (c[jPlus1].y<c[j].y) delta = -delta;
slope = computeSlope(c,j);
if (Math.abs(slope) > min2) {
y = c[j].y+delta;
x = (y-c[jPlus1].y)/slope + c[jPlus1].x;
} else {
// l3 is a vertical line
y = c[j].y+delta;
x = c[j].x;
}
} else {
// use l2 for computation
if (c[jMinus1].y<c[j].y) delta = -delta;
slope = computeSlope(c,jMinus1);
if (Math.abs(slope) > min2) {
y = c[j].y+delta;
x = (y-c[jMinus1].y)/slope + c[jMinus1].x;
} else {
// l2 is a vertical line
y = c[j].y+delta;
x = c[j].x;
}
}
} else {
if (Math.abs(dy1)>dyMin || Math.abs(dy2)>dyMin) {
// attempt to use l3 for computation
if (c[j].y==c[jPlus1].y && Math.abs(c[j].x-c[jPlus1].x)>min2) {
// l3 is a horizontal line, use l2 for computation
if (c[jMinus1].y<c[j].y) delta = -delta;
slope = computeSlope(c,jMinus1);
if (Math.abs(slope) > min2) {
y = c[j].y+delta;
x = (y-c[jMinus1].y)/slope + c[jMinus1].x;
} else {
// l2 is a vertical line
y = c[j].y+delta;
x = c[j].x;
}
} else {
// use l3 for computation
if (c[jPlus1].y<c[j].y) delta = -delta;
slope = computeSlope(c,j);
if (Math.abs(slope) > min2) {
y = c[j].y+delta;
x = (y-c[jPlus1].y)/slope + c[jPlus1].x;
} else {
// l3 is a vertical line
y = c[j].y+delta;
x = c[j].x;
}
}
} else {
x = c[j].x;
y = c[j].y;
}
}
c[j].x = x;
c[j].y = y;
if (j==0)
c[c.length-1] = c[j];
}
}
}
/**
* adjustPolygon
* When a point is very close to a line in the initial warning polygon, the resulting coordinates
* cause the failure of polygon drawing in follow-up. The method move that kind of points away from
* the line, and return a Polygon.
*
* History
* 12/06/2012 DR 15559 Qinglu Lin Created.
*/
public void adjustPolygon(Coordinate[] coords) {
int n = coords.length;
for (int i=0; i<n-1; ++i) {
int j;
for (j=i+2; j<=n-2; j++) {
computeCoordinate(coords,i,j);
}
if (i<=n-3)
for (j=0; j<i; j++) {
computeCoordinate(coords,i,j);
}
else
for (j=1; j<i; j++) {
computeCoordinate(coords,i,j);
}
}
}
/**
* Set the old warning area in lat/lon projection. Will be converted to
* local

View file

@ -127,6 +127,11 @@ import com.vividsolutions.jts.io.WKTReader;
* Sep 10, 2012 15295 snaples Added property setting for runtime log to createScript.
* Sep 18, 2012 15332 jsanchez Used a new warning text handler.
* Nov 9, 1202 DR 15430 D. Friedman Improve watch inclusion.
* Nov 26, 2012 15550 Qinglu Lin For CAN to EXP, added TMLtime to context.
* Nov 30, 2012 15571 Qinglu Lin For NEW, assigned simulatedTime to TMLtime; For COR, used stormLocs
* in oldWarn.
* Dec 17, 2012 15571 Qinglu Lin For hydro products, resolved issue caused by calling wkt.read(loc)
* while loc is null.
* </pre>
*
* @author njensen
@ -368,8 +373,6 @@ public class TemplateRunner {
// CAN and EXP products follow different rules as followups
if (!(selectedAction == WarningAction.CAN || selectedAction == WarningAction.EXP)) {
Coordinate[] stormLocs = warngenLayer
.getStormLocations(stormTrackState);
wx = new Wx(config, stormTrackState,
warngenLayer.getStormLocations(stormTrackState),
startTime.getTime(), DateUtil.roundDateTo15(endTime)
@ -391,7 +394,10 @@ public class TemplateRunner {
context.put("duration", duration);
context.put("event", eventTime);
context.put("TMLtime", eventTime);
if (selectedAction == WarningAction.COR)
context.put("TMLtime", eventTime);
else
context.put("TMLtime", simulatedTime);
context.put("ugcline",
FipsUtil.getUgcLine(areas, wx.getEndTime(), 15));
context.put("areaPoly", GisUtil.convertCoords(warngenLayer
@ -433,13 +439,25 @@ public class TemplateRunner {
motionDirection -= 360;
}
context.put("movementDirection", motionDirection);
Coordinate[] stormLocs = warngenLayer
.getStormLocations(stormTrackState);
// Convert to Point2D representation as Velocity requires
// getX() and getY() methods which Coordinate does not have
Coordinate[] newStormLocs = GisUtil.d2dCoordinates(stormLocs);
Point2D.Double[] coords = new Point2D.Double[newStormLocs.length];
for (int i = 0; i < newStormLocs.length; i++) {
coords[i] = new Point2D.Double(newStormLocs[i].x,
newStormLocs[i].y);
if (selectedAction == WarningAction.COR) {
AbstractWarningRecord oldWarn = CurrentWarnings.getInstance(
threeLetterSiteId).getNewestByTracking(etn, phenSig);
String loc = oldWarn.getLoc();
if (loc != null) {
Geometry locGeom = wkt.read(loc);
stormLocs = locGeom.getCoordinates();
}
} else {
stormLocs = GisUtil.d2dCoordinates(stormLocs);
}
Point2D.Double[] coords = new Point2D.Double[stormLocs.length];
for (int i = 0; i < stormLocs.length; i++) {
coords[i] = new Point2D.Double(stormLocs[i].x,
stormLocs[i].y);
}
context.put("eventLocation", coords);
t0 = System.currentTimeMillis();
@ -453,6 +471,7 @@ public class TemplateRunner {
threeLetterSiteId).getNewestByTracking(etn, phenSig);
context.put("now", simulatedTime);
context.put("event", eventTime);
context.put("TMLtime", eventTime);
context.put("start", oldWarn.getStartTime().getTime());
context.put("expire", oldWarn.getEndTime().getTime());
Calendar canOrExpCal = Calendar.getInstance();
@ -468,13 +487,21 @@ public class TemplateRunner {
.getCoordinates()));
// If there is no storm track
if (oldWarn.getLoc() != null) {
Geometry locGeom = wkt.read(oldWarn.getLoc());
Coordinate[] locs = locGeom.getCoordinates();
// Convert to Point2D representation as Velocity requires
// getX() and getY() methods which Coordinate does not have
Point2D.Double[] coords = new Point2D.Double[locs.length];
Point2D.Double[] coords;
Coordinate[] locs;
if (selectedAction == WarningAction.CAN) {
locs = warngenLayer.getStormLocations(stormTrackState);
locs = GisUtil.d2dCoordinates(locs);
coords = new Point2D.Double[locs.length];
} else {
Geometry locGeom = wkt.read(oldWarn.getLoc());
locs = locGeom.getCoordinates();
coords = new Point2D.Double[locs.length];
}
for (int i = 0; i < locs.length; i++) {
coords[i] = new Point2D.Double(locs[i].x, locs[i].y);
coords[i] = new Point2D.Double(locs[i].x, locs[i].y);
}
context.put("eventLocation", coords);
double motionDirection = oldWarn.getMotdir();

View file

@ -9,8 +9,7 @@
<dataType>RADAR</dataType>
<sourceType>QPE</sourceType>
<rateOrAccum>rate</rateOrAccum>
<expirationMinutes>10</expirationMinutes>
<unit>inches</unit>
<expirationMinutes>10</expirationMinutes>
</source>
<source>
<SourceName>DPR</SourceName>
@ -21,8 +20,7 @@
<dataType>RADAR</dataType>
<sourceType>QPE</sourceType>
<rateOrAccum>rate</rateOrAccum>
<expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
<expirationMinutes>15</expirationMinutes>
</source>
<source>
<SourceName>DHRMOSAIC</SourceName>
@ -32,8 +30,7 @@
<dataType>XMRG</dataType>
<sourceType>QPE</sourceType>
<rateOrAccum>rate</rateOrAccum>
<expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
<expirationMinutes>15</expirationMinutes>
<conversion>0.0003937</conversion>
<dateFormat>yyyyMMddHHmm</dateFormat>
<hrapGridFactor>4</hrapGridFactor>
@ -46,8 +43,7 @@
<dataType>XMRG</dataType>
<sourceType>QPE</sourceType>
<rateOrAccum>rate</rateOrAccum>
<expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
<expirationMinutes>15</expirationMinutes>
<conversion>0.0003937</conversion>
<dateFormat>yyyyMMddHHmm</dateFormat>
<hrapGridFactor>4</hrapGridFactor>
@ -63,8 +59,7 @@
<dataType>PDO</dataType>
<sourceType>QPF</sourceType>
<rateOrAccum>accum</rateOrAccum>
<expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
<expirationMinutes>15</expirationMinutes>
<mosaic>true</mosaic>
</source>
<source>
@ -75,8 +70,7 @@
<dataType>XMRG</dataType>
<sourceType>QPF</sourceType>
<rateOrAccum>accum</rateOrAccum>
<expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
<expirationMinutes>15</expirationMinutes>
<conversion>0.0003937</conversion>
<mosaic>true</mosaic>
<dateFormat>yyyyMMddHHmm</dateFormat>
@ -90,8 +84,7 @@
<dataType>XMRG</dataType>
<sourceType>QPF</sourceType>
<rateOrAccum>accum</rateOrAccum>
<expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
<expirationMinutes>15</expirationMinutes>
<conversion>0.0003937</conversion>
<mosaic>true</mosaic>
<dateFormat>yyyyMMddHHmm</dateFormat>
@ -108,8 +101,7 @@
<rateOrAccum>accum</rateOrAccum>
<expirationMinutes>2080</expirationMinutes>
<interpolatedGuidanceDelay>true</interpolatedGuidanceDelay>
<interpolatedGuidanceTransition>true</interpolatedGuidanceTransition>
<unit>inches</unit>
<interpolatedGuidanceTransition>true</interpolatedGuidanceTransition>
<conversion>0.03937</conversion>
<mosaic>true</mosaic>
<guidanceType>RFC</guidanceType>
@ -125,8 +117,7 @@
<rateOrAccum>accum</rateOrAccum>
<expirationMinutes>2080</expirationMinutes>
<interpolatedGuidanceDelay>true</interpolatedGuidanceDelay>
<interpolatedGuidanceTransition>true</interpolatedGuidanceTransition>
<unit>inches</unit>
<interpolatedGuidanceTransition>true</interpolatedGuidanceTransition>
<conversion>0.03937</conversion>
<mosaic>true</mosaic>
<guidanceType>RFC</guidanceType>
@ -142,8 +133,7 @@
<rateOrAccum>accum</rateOrAccum>
<expirationMinutes>2080</expirationMinutes>
<interpolatedGuidanceDelay>true</interpolatedGuidanceDelay>
<interpolatedGuidanceTransition>true</interpolatedGuidanceTransition>
<unit>inches</unit>
<interpolatedGuidanceTransition>true</interpolatedGuidanceTransition>
<conversion>0.03937</conversion>
<mosaic>true</mosaic>
<guidanceType>RFC</guidanceType>
@ -156,8 +146,7 @@
<dataType>XMRG</dataType>
<sourceType>GAGE</sourceType>
<rateOrAccum>rate</rateOrAccum>
<expirationMinutes>30</expirationMinutes>
<unit>inches</unit>
<expirationMinutes>30</expirationMinutes>
<conversion>0.0003937</conversion>
<hrapGridFactor>4</hrapGridFactor>
</source>
@ -169,8 +158,7 @@
<dataType>XMRG</dataType>
<sourceType>GAGE</sourceType>
<rateOrAccum>rate</rateOrAccum>
<expirationMinutes>30</expirationMinutes>
<unit>inches</unit>
<expirationMinutes>30</expirationMinutes>
<conversion>0.0003937</conversion>
<hrapGridFactor>4</hrapGridFactor>
</source>
@ -182,8 +170,7 @@
<dataType>RADAR</dataType>
<sourceType>GAGE</sourceType>
<rateOrAccum>rate</rateOrAccum>
<expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
<expirationMinutes>15</expirationMinutes>
</source>
<source>
<SourceName>VGBDPR</SourceName>
@ -193,8 +180,7 @@
<dataType>RADAR</dataType>
<sourceType>GAGE</sourceType>
<rateOrAccum>rate</rateOrAccum>
<expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
<expirationMinutes>15</expirationMinutes>
</source>
<product primarySource="DHRMOSAIC">
<rate>DHRMOSAIC</rate>

View file

@ -1,19 +1,19 @@
/**
* 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.
**/
@ -33,6 +33,7 @@ import com.raytheon.edex.plugin.gfe.cache.ifpparms.IFPParmIdCache;
import com.raytheon.edex.plugin.gfe.db.dao.GFEDao;
import com.raytheon.edex.plugin.gfe.db.dao.IscSendRecordDao;
import com.raytheon.edex.plugin.gfe.exception.GfeConfigurationException;
import com.raytheon.edex.plugin.gfe.exception.GfeMissingConfigurationException;
import com.raytheon.edex.plugin.gfe.isc.IRTManager;
import com.raytheon.edex.plugin.gfe.reference.MapManager;
import com.raytheon.edex.plugin.gfe.server.GridParmManager;
@ -66,9 +67,9 @@ import com.raytheon.uf.edex.site.ISiteActivationListener;
/**
* Activates the GFE server capabilities for a site
*
*
* <pre>
*
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
@ -77,9 +78,11 @@ import com.raytheon.uf.edex.site.ISiteActivationListener;
* Apr 06, 2012 #457 dgilling Clear site's ISCSendRecords on
* site deactivation.
* Jul 12, 2012 15162 ryu added check for invalid db at activation
*
* Dec 11, 2012 14360 ryu log a clean message in case of
* missing configuration (no stack trace).
*
* </pre>
*
*
* @author njensen
* @version 1.0
*/
@ -216,7 +219,7 @@ public class GFESiteActivation implements ISiteActivationListener {
/**
* Activates a site by reading its server config and generating maps, topo,
* and text products for the site
*
*
* @param siteID
*/
@Override
@ -239,6 +242,13 @@ public class GFESiteActivation implements ISiteActivationListener {
"Error validating configuration for " + siteID);
}
internalActivateSite(siteID);
} catch (GfeMissingConfigurationException e) {
sendActivationFailedNotification(siteID);
// Stack trace is not printed per requirement for DR14360
statusHandler.handle(Priority.PROBLEM, siteID
+ " will not be activated: "
+ e.getLocalizedMessage());
throw e;
} catch (Exception e) {
sendActivationFailedNotification(siteID);
statusHandler.handle(Priority.PROBLEM, siteID
@ -255,10 +265,10 @@ public class GFESiteActivation implements ISiteActivationListener {
/**
* Activate site routine for internal use.
*
*
* Doesn't update the site list so it is preserved when loading sites at
* start up
*
*
* @param siteID
* @throws PluginException
* @throws GfeException
@ -481,7 +491,7 @@ public class GFESiteActivation implements ISiteActivationListener {
/**
* Deactivates a site's GFE services
*
*
* @param siteID
*/
@Override
@ -555,7 +565,7 @@ public class GFESiteActivation implements ISiteActivationListener {
/**
* Returns the currently active GFE sites the server is running
*
*
* @return the active sites
*/
@Override
@ -565,7 +575,7 @@ public class GFESiteActivation implements ISiteActivationListener {
/*
* (non-Javadoc)
*
*
* @see com.raytheon.uf.edex.site.ISiteActivationListener#validateConfig()
*/
@Override

View file

@ -1,19 +1,19 @@
/**
* 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.
**/
@ -31,6 +31,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.raytheon.edex.plugin.gfe.exception.GfeConfigurationException;
import com.raytheon.edex.plugin.gfe.exception.GfeMissingConfigurationException;
import com.raytheon.uf.common.dataplugin.gfe.discrete.DiscreteDefinition;
import com.raytheon.uf.common.dataplugin.gfe.discrete.DiscreteKey;
import com.raytheon.uf.common.dataplugin.gfe.python.GfePyIncludeUtil;
@ -45,16 +46,17 @@ import com.raytheon.uf.common.util.FileUtil;
/**
* Manages the serverConfigs of active sites
*
*
* <pre>
*
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 9, 2009 njensen Initial creation
*
* Dec 11, 2012 14360 ryu Throw specific exception for missing configuration.
*
* </pre>
*
*
* @author njensen
* @version 1.0
*/
@ -72,7 +74,7 @@ public class IFPServerConfigManager {
/**
* Returns the sites that have active configurations
*
*
* @return
*/
protected static Set<String> getActiveSites() {
@ -81,7 +83,7 @@ public class IFPServerConfigManager {
/**
* Gets the server configuration for a particular site
*
*
* @param siteID
* the site
* @return the site's configuration
@ -100,7 +102,7 @@ public class IFPServerConfigManager {
/**
* Initializes a site's serverConfig by reading in the site's localConfig
*
*
* @param siteID
* the site
* @return the site's configuration
@ -152,11 +154,11 @@ public class IFPServerConfigManager {
}
}
if (!siteConfigFound) {
throw new GfeConfigurationException(
throw new GfeMissingConfigurationException(
"No siteConfig.py file found for " + siteID);
}
} else {
throw new GfeConfigurationException(
throw new GfeMissingConfigurationException(
"No site config directory found for " + siteID);
}
siteDir = siteDirFile.getPath();
@ -186,7 +188,7 @@ public class IFPServerConfigManager {
/**
* Removes a site's configuration from the set of active configurations
*
*
* @param siteID
*/
protected static void removeSite(String siteID) {

View file

@ -0,0 +1,59 @@
/**
* 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.
**/
package com.raytheon.edex.plugin.gfe.exception;
/**
* Exception class for missing GFE server configuration
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 12/11/12 #14360 ryu Initial Creation
*
* </pre>
*
* @author ryu
* @version 1.0
*/
public class GfeMissingConfigurationException extends GfeConfigurationException {
private static final long serialVersionUID = 1L;
/**
* @param aCause
*/
public GfeMissingConfigurationException(String aCause) {
super(aCause);
}
/**
* Parser exception set with a cause and an existing exception. Used for
* exception chaining to preserve state.
*
* @param aCause
* @param anException
*/
public GfeMissingConfigurationException(String aCause, Throwable anException) {
super(aCause, anException);
}
}

View file

@ -76,6 +76,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* ------------ ---------- ----------- --------------------------
* 4/7/09 1994 bphillip Initial Creation
* Jul 25, 2012 977 rjpeter Add ability for sub grids to have a defined center point.
* 12/04/2012 DR 15382 D. Friedman Restrict subgrid coordinates to reference grid bounds.
* </pre>
*
* @author bphillip
@ -542,6 +543,10 @@ public class GribSpatialCache {
Coordinate upperRightPosition = new Coordinate(
xCenterPoint + xDistance, yCenterPoint
- yDistance);
lowerLeftPosition.x = Math.min(Math.max(0, lowerLeftPosition.x), gridCoverage.getNx() - 1);
lowerLeftPosition.y = Math.min(Math.max(0, lowerLeftPosition.y), gridCoverage.getNy() - 1);
upperRightPosition.x = Math.min(Math.max(0, upperRightPosition.x), gridCoverage.getNx() - 1);
upperRightPosition.y = Math.min(Math.max(0, upperRightPosition.y), gridCoverage.getNy() - 1);
lowerLeftPosition = MapUtil.gridCoordinateToLatLon(
lowerLeftPosition, PixelOrientation.CENTER,

View file

@ -56,6 +56,8 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
* correctly parse multiple SHEF formats
* 12/03/2008 chammack Camel refactor
* 12/xx/2010 jkorman Complete rewrite.
* 11/29/2012 lbousaidi fixed the decoding issue when the shef starts
* with :
* </pre>
*
* @author bphillip
@ -615,9 +617,6 @@ public class ShefSeparator extends AbstractRecordSeparator {
private static String removeInternalComments(String dataLine) {
String s = null;
if (dataLine != null) {
if (dataLine.startsWith(":")) {
s = new String();
} else {
StringBuilder buffer = new StringBuilder(dataLine.length());
boolean inComment = false;
for (int i = 0; i < dataLine.length(); i++) {
@ -630,8 +629,7 @@ public class ShefSeparator extends AbstractRecordSeparator {
inComment = !inComment;
}
}
s = buffer.toString();
}
s = buffer.toString();
} else {
s = new String();
}

View file

@ -78,6 +78,8 @@ import com.raytheon.uf.edex.database.dao.DaoConfig;
* 02/02/2009 1943 J. Sanchez Add method postRiverStatus.
* 05/29/2009 2410 J. Sanchez Posted data for unknstnvalue.
* 02/24/2012 14535 W. Kwock Correct the duration value.
* 11/29/2012 15530 lbousaidi corrected posting and production time for
* latestobsvalue table.
*
* </pre>
*
@ -1074,11 +1076,10 @@ public class PostTables {
}
cs.setString(11, productId);
cs.setTimestamp(12, new Timestamp(shefData.getObservationTimeObj()
.getTime()));
cs.setTimestamp(13, new Timestamp(shefData.getObservationTimeObj()
.getTime()));
cs.setTimestamp(12, new java.sql.Timestamp(productTime.getTime()));
cs.setTimestamp(13, new java.sql.Timestamp(postTime.getTime()));
int doOverwrite = PostTables.determineUpdateAction(duplicateOption,
record.isRevisedRecord());
cs.setInt(14, doOverwrite);

View file

@ -49,6 +49,7 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
* 6/1/09 #2432 jsanchez Updated value magnitude for hourlypp/pc.
* 26 Nov 2012 #15554 lbousaidi used obstime instead of system time in isNear12Z
* routine.
* 4 Dec 2012 #15569 lbousaidi fixed daily pp value when token is set to USE_REVCODE
* </pre>
*
* @author mnash
@ -408,6 +409,13 @@ public class GagePP {
default:
break;
}
} else {
if (rec.getDataDuration() == 24) {
dailyPP.setValue(Double.valueOf(rec.getValue()));
dailyPP.setQc(String.valueOf(rec.getQualCode()));
rev_24hour_code = rec.revision;
}
}
/*
* Increment the count of total values. This should always

View file

@ -159,15 +159,19 @@ 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());
Point point = getPoint(modelName, prodType, coor);
GribRecord gribRec = getRecord(modelName, prodType);
FloatDataRecord rec = (FloatDataRecord) getRecord(modelName,
prodType).getMessageData();
value = rec.getFloatData()[(gribRec.getSpatialObject().getNx() * point.x)
+ point.y];
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

@ -28,6 +28,7 @@ package com.raytheon.uf.common.monitor.xml;
* ------------ ---------- ----------- --------------------------
* 29 Jan, 2010 3915 dhladky Initial creation
* 18 Apr. 2012 DR 14619 dhladky Replace isOverride()
* 28 Nov. 2012 DR 14412 gzhang makes unit internal to this class
* </pre>
* @author dhladky
* @version 1.0
@ -86,8 +87,10 @@ public class SourceXML implements ISerializableObject {
@XmlElement(name = "interpolatedGuidanceTransition")
protected boolean interpolatedGuidanceTransition;
@XmlElement(name = "unit")
//@XmlElement(name = "unit") // DR 14412
protected String unit;
public static final String UNIT_TXT = "inches"; // DR 14412
@XmlElement(name = "conversion")
protected Double conversion = 1.0;
@ -285,6 +288,8 @@ public class SourceXML implements ISerializableObject {
}
public String getUnit() {
if( unit == null || unit.isEmpty()) // DR 14412
unit = UNIT_TXT;
return unit;
}

View file

@ -24,10 +24,22 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map.Entry;
import java.util.TreeSet;
import org.geotools.coverage.grid.GridGeometry2D;
import org.geotools.geometry.DirectPosition2D;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.raytheon.uf.common.dataplugin.grib.GribRecord;
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
import com.raytheon.uf.common.geospatial.ISpatialObject;
import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.geospatial.PointUtil;
import com.raytheon.uf.common.monitor.xml.SCANModelParameterXML;
import com.vividsolutions.jts.geom.Coordinate;
@ -72,9 +84,9 @@ public class FreezingLevel {
// reference time
Calendar refTime = null;
private transient final Log logger = LogFactory.getLog(getClass());
public FreezingLevel(String modelName) {
this.modelName = modelName;
times = new HashMap<Integer, Date>();
zeroCount = 0;
@ -96,6 +108,79 @@ public class FreezingLevel {
}
}
/**
* find (x,y) coordinate for lat,lon(coor)
* @param coors
*/
public DirectPosition2D findXYloc(Coordinate coor, String type){
ScanDataCache cache = ScanDataCache.getInstance();
ISpatialObject iso = cache.getModelData().getGribRecord(modelName, type).getSpatialObject();
CoordinateReferenceSystem crs=iso.getCrs();
GridGeometry2D mapGeometry = MapUtil.getGridGeometry(iso);
DirectPosition2D resultPoint;
try {
resultPoint = PointUtil.determineExactIndex(
coor, crs, mapGeometry);
System.out.println("Freezing level -- lat,lon:"+coor+" = "+resultPoint);
return resultPoint;
} catch (Exception e) {
System.out.println("Error: Freezing level -- unable to find x,y coordinate for lat,lon:"+coor);
e.printStackTrace();
}
return null;
}
/**
* get the bi-linear interpolation value amount the nearest 4 points
*
* @param modelName, prodType, coor
* @return bi-linear interpolation amount the nearest 4 points
* @throws VizException
*/
public double getValue(String modelName, String prodType, Coordinate coor) {
double value = -99999.0;
try {
//xyLoc is the location in x,y
DirectPosition2D xyLoc = findXYloc(coor, prodType);
//data from hdf5
ScanDataCache cache = ScanDataCache.getInstance();
GribRecord gribRec = cache.getModelData().getGribRecord(modelName, prodType);
FloatDataRecord rec = (FloatDataRecord) gribRec.getMessageData();
//dimension of the record from hdf5, recNx =151 and recNy=113 during development
int recNx = gribRec.getSpatialObject().getNx();
int recNy = gribRec.getSpatialObject().getNy();
//get four nearest points/values form the record around xyLoc
int x0=(int)(xyLoc.x);
int x1=x0+1;
int y0=(int)(xyLoc.y);
int y1=y0+1;
double p1=xyLoc.x-x0;
double p2=1-p1;
double p3=xyLoc.y-y0;
double p4=1-p3;
double value2 = rec.getFloatData()[(recNx * y0) + x0];
double value3 = rec.getFloatData()[(recNx * y0) + x1];
double value0 = rec.getFloatData()[(recNx * y1) + x0];
double value1 = rec.getFloatData()[(recNx * y1) + x1];
//do a bi-linear interpolation amount the nearest 4 points
value = (p1*p4*value1)+(p2*p4*value0)+(p1*p3*value3)+(p2*p3*value2);
logger.info("bi-linear interpolation value: "+value+" "+value0+" "+value1+
" "+value2+" "+value3+" for coor:"+coor+" "+recNx+","+recNy);
} catch (Exception e) {
logger.error("No Grib value available....." + modelName + " "
+ prodType+" lat,lon:"+coor);
e.printStackTrace();
}
return value;
}
/**
* Give me the freezing level for an array of points
*
@ -107,6 +192,7 @@ public class FreezingLevel {
HashMap<Coordinate, Float> freezingMap = new HashMap<Coordinate, Float>();
ScanDataCache cache = ScanDataCache.getInstance();
//get data from hdf5 files
for (Coordinate coor : coors) {
HashMap<Integer, Double> ghValues = new HashMap<Integer, Double>();
@ -114,34 +200,46 @@ public class FreezingLevel {
for (Entry<String, Integer> entry : getGHLevelMap().entrySet()) {
if (cache.getModelData().isType(modelName, entry.getKey())) {
ghValues.put(entry.getValue(), cache.getModelData()
.getValue(modelName, entry.getKey(), coor));
ghValues.put(entry.getValue(), getValue(modelName, entry.getKey(), coor));
} else {
ghValues.put(entry.getValue(),null);
}
}
for (Entry<String, Integer> entry : getTLevelMap().entrySet()) {
if (cache.getModelData().isType(modelName, entry.getKey())) {
tValues.put(entry.getValue(), cache.getModelData()
.getValue(modelName, entry.getKey(), coor));
tValues.put(entry.getValue(), getValue(modelName, entry.getKey(), coor));
}
}
Double fLevel = -99999.0;
//here's the calculation
Double fLevel = 0.0;
Integer jtopLevel = null;
Integer ktopLevel = null;
int foundValFlag=-1;//-1=all ghValue and tValue are null,
//0=all ghValue<=-9000 and tValue<=273.16, 1=found a fLevel
System.out
.println("********** Starting Freezing Level Calculations *****************");
for (Integer level : ghValues.keySet()) {
TreeSet<Integer> ts= new TreeSet<Integer>(ghValues.keySet());//want an asc sorted list
Iterator<Integer> it = ts.iterator();
//for (Integer level : ghValues.keySet()) {
while (it.hasNext()) {
Integer level = (Integer) it.next();
Double tValue = tValues.get(level);
Double ghValue = ghValues.get(level);
System.out.println("GH Value: " + ghValue + " TValue: "
+ tValue);
if (ghValue != null && ghValue > -9000) {
if (tValue != null && tValue > 273.16) {
if (ghValue != null && tValue != null && foundValFlag ==-1){
foundValFlag=0;
}
if (ghValue != null && ghValue.doubleValue() > -9000) {
if (tValue != null && tValue.doubleValue() > 273.16) {
fLevel = (ghValues.get(ktopLevel) - ((ghValues
.get(ktopLevel) - ghValue) * ((273.16 - tValues
@ -155,6 +253,7 @@ public class FreezingLevel {
+ " - " + tValues.get(jtopLevel)
+ ")))) * .00328");
System.out.println("*** FreezingLevel = " + fLevel);
foundValFlag=1;
freezingMap.put(coor, fLevel.floatValue());
break;
} else {
@ -163,6 +262,12 @@ public class FreezingLevel {
}
}
}
if (foundValFlag==0) {//this means all tValue are <= 273.16
freezingMap.put(coor, 0.0f);
System.out.println("*** FreezingLevel = 0.0");
}
System.out
.println("********** Finished Freezing Level Calculations *****************");
}
@ -252,6 +357,7 @@ public class FreezingLevel {
paramXML.setModelName(model);
paramXML.setParameterName(param);
String sql = getSQL(interval, model, param, refTime);
System.out.println("Freezing level sql="+sql);
GribRecord modelRec = DATUtils.getMostRecentGribRecord(interval, sql,
paramXML);
@ -361,8 +467,8 @@ public class FreezingLevel {
+ level
+ "\'"
+ " limit 1)) and reftime='"
+ refTimeStr
+ "' order by reftime desc, forecasttime desc limit 1";
+ refTimeStr + "' and forecasttime=0"
+ " order by reftime desc, forecasttime desc limit 1";
return sql;
}
}

View file

@ -83,7 +83,10 @@ public class MpeRUCFreezingLevel {
.getToken("mpe_point_freezing_dir");
public static String dqcPreprocessorBasetime = AppsDefaults.getInstance()
.getToken("DQC_PREPROCESSOR_BASETIME");
.getToken("dqc_preprocessor_basetime");
public static String mpeSiteId = AppsDefaults.getInstance()
.getToken("mpe_site_id");
public File stationFile = null;
@ -93,21 +96,11 @@ public class MpeRUCFreezingLevel {
public static String[] models = new String[] { "RUC236" };
public MpeRUCFreezingLevel() {
File directory = new File(stationFilePath);
this.stationFile = new File(stationFilePath+"/"+mpeSiteId+"_freezing_station_list");
if (directory != null) {
for (File file : directory.listFiles()) {
if (file.isFile()
&& file.getName().contains("freezing_station_list")) {
this.stationFile = file;
break;
}
}
}
// correct env vairiable dqcPreprocessorBasetime if needed
// correct env vairiable dqcPreprocessorBasetime if needed. Default to 12z
if (dqcPreprocessorBasetime == null) {
dqcPreprocessorBasetime = "00z";
dqcPreprocessorBasetime = "12z";
}
dqcPreprocessorBasetime = dqcPreprocessorBasetime.toLowerCase();
@ -115,7 +108,7 @@ public class MpeRUCFreezingLevel {
&& !dqcPreprocessorBasetime.equals("06z")
&& !dqcPreprocessorBasetime.equals("12z")
&& !dqcPreprocessorBasetime.equals("18z")) {
dqcPreprocessorBasetime = "00z";
dqcPreprocessorBasetime = "12z";
}
}
@ -219,10 +212,8 @@ public class MpeRUCFreezingLevel {
// order
try {
String site = PropertiesFactory.getInstance().getEnvProperties()
.getEnvValue("SITENAME");
ofstream = new FileOutputStream(getAbsoluteOutFileName(
dates[3].getTime(), site));
dates[3].getTime(), mpeSiteId));
out = new DataOutputStream(ofstream);
bw = new BufferedWriter(new OutputStreamWriter(out));
@ -269,8 +260,7 @@ public class MpeRUCFreezingLevel {
String fzlev = "M";
if (fle != null) {
fzlev = String.valueOf(fle.getFreezingLevel())
.substring(0, 4) + "S";
fzlev = String.format("%3.2f",fle. getFreezingLevel()) + "S";
}
buf.append(" " + fzlev);

View file

@ -1,19 +1,19 @@
/**
* 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.
**/
@ -48,23 +48,24 @@ import com.raytheon.uf.edex.core.props.PropertiesFactory;
import com.raytheon.uf.edex.site.SiteActivationMessage.Action;
/**
*
*
* Site Aware Registry
*
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 30, 2010 rjpeter Initial creation
* Jul 31, 2012 #965 dgilling Force ordering of sites in
* Jul 31, 2012 #965 dgilling Force ordering of sites in
* getActiveSites().
* Nov 1, 2012 15417 ryu Modified getActiveSites to include
* home site only if activated.
*
* Dec 11, 2012 14360 ryu No printing stack trace on activation exception
*
* </pre>
*
*
* @author rjpeter
* @version 1.0
*/
@ -100,7 +101,7 @@ public class SiteAwareRegistry {
/**
* registers/adds site activation listeners
*
*
* @param sa
* the listener to register / add to the list
*/
@ -115,8 +116,8 @@ public class SiteAwareRegistry {
try {
sa.activateSite(siteID);
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
// Stack trace is not printed per requirement for DR14360
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage());
}
}
@ -134,7 +135,7 @@ public class SiteAwareRegistry {
/**
* get the set of strings for the active sites
*
*
* @return the requested array of Strings this is a string array to make it
* work with dwr frontend, most of the other stuff is Set<String>
*/
@ -156,7 +157,7 @@ public class SiteAwareRegistry {
/**
* Checks to see if the given site is active
*
*
* @param site
* The site to check
* @return True if the site is active, else false
@ -182,7 +183,7 @@ public class SiteAwareRegistry {
/**
* activate the site specified in each listener
*
*
* @param siteID
*/
public void activateSite(String siteID) {
@ -203,7 +204,7 @@ public class SiteAwareRegistry {
/**
* deactivate the site specified in each listener
*
*
* @param siteID
*/
public void deactivateSite(String siteID) {
@ -223,7 +224,7 @@ public class SiteAwareRegistry {
/**
* cycle the site specified in each listener
*
*
* @param siteID
*/
public void cycleSite(String siteID) {

View file

@ -42,19 +42,27 @@ from ufpy.UsageOptionParser import UsageOptionParser
def main():
(options, args) = validateArgs()
for i in range(1,4):
print >> sys.stderr, "Attempt number: ", i
try:
netCdfRequest = createRequest()
netCdfRequest.setArgString(netCdfRequest.getArgString() + " -h " + options.host + " -r " + str(options.port))
thriftClient = ThriftClient.ThriftClient(options.host, options.port, "/services")
serverResponse = thriftClient.sendRequest(netCdfRequest)
except Exception, e:
print >> sys.stderr, "Unhandled exception thrown during ifpnetCDF processing: \n", str(e)
sys.exit(1)
try:
netCdfRequest = createRequest()
netCdfRequest.setArgString(netCdfRequest.getArgString() + " -h " + options.host + " -r " + str(options.port))
thriftClient = ThriftClient.ThriftClient(options.host, options.port, "/services")
serverResponse = thriftClient.sendRequest(netCdfRequest)
except Exception, e:
print >> sys.stderr, "Unhandled exception thrown during ifpnetCDF processing: \n", str(e)
sys.exit(1)
if (not serverResponse.isOkay()):
print >> sys.stderr, "Errors occurred during ifpnetCDF processing: ", serverResponse.message()
sys.exit(1)
if (serverResponse.isOkay()):
break
else:
print >> sys.stderr, "Errors occurred during ifpnetCDF processing: ", serverResponse.message()
if (i == 3):
print >> sys.stderr, "Final attempt failed - exiting"
sys.exit(1)
def validateArgs():
parser = UsageOptionParser(conflict_handler="resolve")
@ -134,4 +142,4 @@ def createRequest():
if __name__ == '__main__':
main()

View file

@ -35,7 +35,8 @@ import os, sys
# 09/14/10 dgilling Initial Creation.
# 11/04/10 5849 cjeanbap Updated Notification package location
# 06/09/11 9841 rferrel fixed help and argument order
# for sendNotificationMsg.
# for sendNotificationMsg.
# 11/29/12 DR14016 jzeng change priority definition from 0-3 to 1-4
#
#
class PrintHelpOnErrorParser(ArgumentParser):
@ -55,13 +56,13 @@ def main():
help="Port upon which the alertViz server is running.",
metavar="port")
group = parser.add_mutually_exclusive_group()
group.add_argument("-r", action="store_const", const=3, dest="priority",
group.add_argument("-r", action="store_const", const=4, dest="priority",
help="Send as a routine message. (default)")
group.add_argument("-s", action="store_const", const=1, dest="priority",
group.add_argument("-s", action="store_const", const=2, dest="priority",
help="Send as a significant message.")
group.add_argument("-u", action="store_const", const=0, dest="priority",
group.add_argument("-u", action="store_const", const=1, dest="priority",
help="Send as an urgent message.")
group.add_argument("-a", action="store_const", const=2, dest="priority",
group.add_argument("-a", action="store_const", const=3, dest="priority",
help="Send as an alert message.")
parser.add_argument("-c", action="store", dest="msgClass",
help="Message class.", metavar="class", default="GFE")

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="unit-test"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gov.noaa.nws.ncep.edex.plugin.convsigmet</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -1,7 +0,0 @@
#Wed Sep 23 08:38:09 CDT 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6

View file

@ -1,18 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Convsigmet Plug-in
Bundle-SymbolicName: gov.noaa.nws.ncep.edex.plugin.convsigmet
Bundle-Version: 1.0.0
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: gov.noaa.nws.ncep.common.dataplugin.convsigmet;bundle-version="1.0.0",
gov.noaa.nws.ncep.edex.common,
gov.noaa.nws.ncep.common;bundle-version="1.0.0",
com.raytheon.edex.common;bundle-version="1.11.1",
com.raytheon.uf.edex.decodertools;bundle-version="1.0.0",
com.raytheon.uf.common.pointdata;bundle-version="1.11.8",
com.raytheon.uf.edex.pointdata;bundle-version="1.11.8",
org.apache.commons.logging;bundle-version="1.0.4",
org.geotools,
javax.persistence,
javax.measure,
org.junit;bundle-version="1.0.0"

View file

@ -1,4 +0,0 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.

View file

@ -1,7 +0,0 @@
<project basedir="." default="deploy" name="gov.noaa.nws.ncep.edex.plugin.convsigmet">
<available file="../build.edex" property="build.dir.location" value="../build.edex" />
<available file="../../../../../build.edex" property="build.dir.location" value="../../../../../build.edex" />
<import file="${build.dir.location}/basebuilds/component_deploy_base.xml" />
</project>

View file

@ -1,26 +0,0 @@
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="convsigmetPluginName" class="java.lang.String">
<constructor-arg type="java.lang.String" value="convsigmet" />
</bean>
<bean id="convsigmetProperties" class="com.raytheon.uf.common.dataplugin.PluginProperties">
<property name="pluginName" ref="convsigmetPluginName" />
<property name="pluginFQN" value="gov.noaa.nws.ncep.common.dataplugin.convsigmet" />
<property name="dao" value="gov.noaa.nws.ncep.common.dataplugin.convsigmet.dao.ConvSigmetDao" />
<property name="record"
value="gov.noaa.nws.ncep.common.dataplugin.convsigmet.ConvSigmetRecord" />
</bean>
<bean factory-bean="pluginRegistry" factory-method="register" depends-on="levelRegistered">
<constructor-arg ref="convsigmetPluginName"/>
<constructor-arg ref="convsigmetProperties"/>
</bean>
</beans>

View file

@ -1,73 +0,0 @@
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="convsigmetDecoder" class="gov.noaa.nws.ncep.edex.plugin.convsigmet.decoder.ConvSigmetDecoder">
<constructor-arg ref="convsigmetPluginName"/>
</bean>
<bean id="convsigmetSeparator" class="gov.noaa.nws.ncep.edex.plugin.convsigmet.decoder.ConvSigmetSeparator"/>
<bean id="convsigmetDistRegistry" factory-bean="distributionSrv"
factory-method="register">
<constructor-arg value="convsigmet" />
<constructor-arg value="jms-dist:queue:Ingest.convsigmet" />
</bean>
<bean id="convsigmetCamelRegistered" factory-bean="contextManager"
factory-method="register" depends-on="persistCamelRegistered">
<constructor-arg ref="convsigmet-camel"/>
</bean>
<camelContext id="convsigmet-camel"
xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler"
autoStartup="false">
<!--
<endpoint id="convsigmetFileEndpoint" uri="file:${edex.home}/data/sbn/convsigmet?noop=true&amp;idempotent=false"/>
<route id="convsigmetFileConsumerRoute">
<from ref="convsigmetFileEndpoint"/>
<bean ref="fileToString" />
<setHeader headerName="pluginName">
<constant>convsigmet</constant>
</setHeader>
<to uri="jms-generic:queue:Ingest.convsigmet"/>
</route>
-->
<!-- Begin ConvSigmet routes -->
<route id="convsigmetIngestRoute">
<from uri="jms-generic:queue:Ingest.convsigmet"/>
<setHeader headerName="pluginName">
<constant>convsigmet</constant>
</setHeader>
<doTry>
<pipeline>
<bean ref="stringToFile" />
<split streaming="true">
<method bean="convsigmetSeparator" method="separate"/>
<doTry>
<pipeline>
<bean ref="convsigmetDecoder" method="decode"/>
<to uri="directvm:indexAlert"/>
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>
<to uri="log:convsigmet?level=ERROR&amp;showBody=false&amp;showCaughtException=true&amp;showStackTrace=true"/>
</doCatch>
</doTry>
</split>
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>
<to uri="log:convsigmet?level=ERROR&amp;showBody=false&amp;showCaughtException=true&amp;showStackTrace=true"/>
</doCatch>
</doTry>
</route>
</camelContext>
</beans>

View file

@ -1,256 +0,0 @@
/**
*
* Convective Sigmet Decoder
*
* This java class decodes CONVSIGMET (convective sigmet) raw data.
* HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 03/2009 87/114 L. Lin Initial coding
* 06/2009 87/114 L. Lin Increase size of locationLine and location
* and generalize method "processLocation".
* 07/2009 87/114 L. Lin Migration to TO11
* 07/2011 87/114 F. J. Yen Fix for RTN TTR 9973--ConvSigmet Decoder Ignoring
* time range--implemented fix from Steven Harris,
* RTN to set the end time range
* </pre>
*
* This code has been developed by the SIB for use in the AWIPS2 system.
* @author L. Lin
* @version 1.0
*/
package gov.noaa.nws.ncep.edex.plugin.convsigmet.decoder;
import gov.noaa.nws.ncep.common.dataplugin.convsigmet.ConvSigmetRecord;
import gov.noaa.nws.ncep.common.dataplugin.convsigmet.ConvSigmetSection;
import gov.noaa.nws.ncep.edex.plugin.convsigmet.util.ConvSigmetParser;
import gov.noaa.nws.ncep.edex.util.UtilN;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Scanner;
import com.raytheon.edex.esb.Headers;
import com.raytheon.edex.exception.DecoderException;
import com.raytheon.edex.plugin.AbstractDecoder;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.edex.decodertools.core.IDecoderConstants;
public class ConvSigmetDecoder extends AbstractDecoder {
private final String pluginName;
/**
* Constructor
*
* @throws DecoderException
*/
public ConvSigmetDecoder(String name) throws DecoderException {
pluginName = name;
}
public PluginDataObject[] decode(byte[] data, Headers headers)
throws DecoderException {
String traceId = "";
if (headers != null) {
traceId = (String) headers.get("traceId");
}
String sectionDelim = "OUTLOOK|CONVECTIVE";
String etx = IDecoderConstants.ETX;
String theBulletin = null;
String region = null;
Calendar startTime = null;
byte[] messageData = null;
ConvSigmetRecord record = null;
ConvSigmetSeparator sep = ConvSigmetSeparator.separate(data, headers);
messageData = sep.next();
String theMessage = new String(messageData);
/*
* May have multiple duplicate bulletins, only get the first bulletin
* and eliminate the remaining bulletins after the first bulletin.
*/
Scanner cc = new Scanner(theMessage).useDelimiter(etx);
if (cc.hasNext()) {
theBulletin = cc.next();
} else {
theBulletin = theMessage;
}
// record = new ConvsigmetRecord();
// Decode and set WMO line
record = ConvSigmetParser.processWMO(theBulletin, headers);
// Decode the forecast region such as: W, C, or E
region = ConvSigmetParser.processFcstRegion(theBulletin);
String forecastRegion = "SIG".concat(region);
/*
* Check the Convsigmet record object. If not, throws exception.
*/
if (record != null) {
record.setTraceId(traceId);
record.setPluginName(pluginName);
record.setReportType(pluginName);
record.setForecastRegion(forecastRegion);
try {
record.constructDataURI();
} catch (PluginException e) {
logger.error("Error constructing dataURI", e);
record = null;
}
}
if (record != null) {
try {
// Replace special characters to a blank so that it may be
// readable
record.setBullMessage(UtilN
.removeLeadingWhiteSpaces((theBulletin.substring(5))
.replace('\036', ' ').replace('\r', ' ')
.replace('\003', ' ').replace('\000', ' ')
.replace('\001', ' ')));
// Decode the starting time
startTime = ConvSigmetParser.processStartTime(theBulletin,
headers);
// Decode the correction flag and set
Boolean correctionFlag = ConvSigmetParser
.processCorrectionFlag(theBulletin);
Integer correction = 0;
if (correctionFlag) {
correction = 1;
}
record.setCorrectionFlag(correction);
/*
* Break the bulletin message into sections by a "OUTLOOK" or
* "CONVECTIVE".
*/
Scanner sc = new Scanner(theBulletin)
.useDelimiter(sectionDelim);
ArrayList<String> segmentList = new ArrayList<String>();
segmentList.clear();
while (sc.hasNext()) {
String segment = sc.next();
segmentList.add(segment);
}
Calendar issueTime = record.getIssueTime();
/*
* process each section in a order of section and location line
*/
Calendar min = null;
Calendar max = null;
for (String segment : segmentList) {
// starts a new section
Scanner sc2 = new Scanner(segment);
String whatSection = sc2.next();
if (whatSection.equals("SIGMET")
|| whatSection.equals("SIGMET...NONE")) {
segment = "CONVECTIVE".concat(segment);
// process this section which starts with
// "CONVECTIVE SIGMET".
ConvSigmetSection section = ConvSigmetParser
.processSection(segment, issueTime, startTime,
region, headers);
record.addConvSigmetSection(section);
// keep track of time range
if (min == null || min.getTime().after(section.getStartTime().getTime())) {
min = section.getStartTime();
}
if (max == null || max.getTime().before(section.getEndTime().getTime())) {
max = section.getEndTime();
}
} else if (whatSection.equals("VALID")) {
segment = "OUTLOOK".concat(segment);
// process this section which starts with
// "OUTLOOK VALID".
Scanner scOutlook = new Scanner(segment)
.useDelimiter("AREA ");
ArrayList<String> outlookList = new ArrayList<String>();
outlookList.clear();
// Check if "OUTLOOK" section contains more than one
// "AREA".
while (scOutlook.hasNext()) {
String outlookSegment = scOutlook.next();
outlookList.add(outlookSegment);
}
if (outlookList.size() <= 1) {
// only one "AREA" or NIL report
ConvSigmetSection outlook = ConvSigmetParser
.processOutLook(segment, region, headers);
record.addConvSigmetSection(outlook);
if (min == null || min.getTime().after(outlook.getStartTime().getTime())) {
min = outlook.getStartTime();
}
if (max == null || max.getTime().before(outlook.getEndTime().getTime())) {
max = outlook.getEndTime();
}
} else {
/*
* Here are more than one outlook areas Store the
* header section and remove it from the outlook
* list
*/
String outlookHeader = outlookList.get(0);
outlookList.remove(outlookHeader);
// process multiple outlook sections
for (String outlookSection : outlookList) {
outlookSection = outlookHeader.concat("AREA ")
.concat(outlookSection);
ConvSigmetSection outlook = ConvSigmetParser
.processOutLook(outlookSection, region,
headers);
record.addConvSigmetSection(outlook);
if (min == null || min.getTime().after(
outlook.getStartTime().getTime())) {
min = outlook.getStartTime();
}
if (max == null || max.getTime().before(
outlook.getEndTime().getTime())) {
max = outlook.getEndTime();
}
}
}
}
}
record.setDataTime(new DataTime(record.getDataTime().getRefTimeAsCalendar(),
new TimeRange(min.getTime(),
max.getTimeInMillis() - min.getTimeInMillis())));
} catch (Exception e) {
logger.error("Error processing decoded sigmet", e);
record = null;
}
}
/*
* Return the ConvsigmetRecord record object.
*/
if (record == null) {
return new PluginDataObject[0];
} else {
return new PluginDataObject[] { record };
}
}
}

View file

@ -1,145 +0,0 @@
/**
* ConvsigmetSeparator
*
* This class sets the raw data to an Arraylist, records, of
* String based on a uniquely identified separator.
*
* <pre>
* L. Lin 03/2009 Creation
* </pre>
*
* This code has been developed by the SIB for use in the AWIPS system.
*/
package gov.noaa.nws.ncep.edex.plugin.convsigmet.decoder;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.raytheon.edex.esb.Headers;
import com.raytheon.edex.plugin.AbstractRecordSeparator;
import com.raytheon.edex.util.Util;
public class ConvSigmetSeparator extends AbstractRecordSeparator {
private final Log logger = LogFactory.getLog(getClass());
/** Regex used for separate the bulletins */
private static final String BULLSEPARATOR = "([0-9]{3})( )*\\x0d\\x0d\\x0a([A-Z]{4}[0-9]{2}) ([A-Z]{4}) ([0-9]{6})( [A-Z]{3})?\\x0d\\x0d\\x0a";
/** Regex matcher */
private Matcher matcher;
/** Pattern object for regex search */
private Pattern pattern;
/** List of records contained in file */
private List<String> records;
private Iterator<String> iterator = null;
/**
* Constructor.
*
*/
public ConvSigmetSeparator() {
records = new ArrayList<String>();
}
public static ConvSigmetSeparator separate(byte[] data, Headers headers) {
ConvSigmetSeparator ds = new ConvSigmetSeparator();
ds.setData(data, headers);
return ds;
}
public void setData(byte[] data, Headers headers) {
doSeparate(new String(data));
iterator = records.iterator();
}
/*
* (non-Javadoc)
*
* @see com.raytheon.edex.plugin.IRecordSeparator#hasNext()
*/
public boolean hasNext() {
if (iterator == null) {
return false;
} else {
return iterator.hasNext();
}
}
/**
* Get record
*/
public byte[] next() {
try {
String temp = iterator.next();
if (Util.isEmptyString(temp)) {
return (byte[]) null;
} else {
return temp.getBytes();
}
} catch (NoSuchElementException e) {
return (byte[]) null;
}
}
/**
* @param message
* separate bulletins
*/
private void doSeparate(String message) {
/* Regex used for separate the bulletins */
try {
pattern = Pattern.compile(BULLSEPARATOR);
matcher = pattern.matcher(message);
/*
* Set number of bulletins to records only if the bulletin separator
* is not the same. At the point, only separators are stored in
* "records"
*/
while (matcher.find()) {
if (!records.contains(matcher.group())) {
records.add(matcher.group());
}
}
/*
* Append the raw data file to the records.
*/
for (int i = 0; i < records.size(); i++) {
if (i < records.size() - 1) {
records.set(
i,
"\n"
+ message.substring(
message.indexOf(records.get(i)),
message.indexOf(records.get(i + 1))));
} else {
records.set(
i,
"\n"
+ message.substring(message.indexOf(records
.get(i))));
}
}
} catch (Exception e) {
e.printStackTrace();
if (logger.isInfoEnabled()) {
logger.info("No valid records found!");
}
logger.warn("No valid records found!");
}
return;
}
}

View file

@ -1,4 +0,0 @@
/**
* Contains decoder.java for decoder plug-ins
*/
package gov.noaa.nws.ncep.edex.plugin.convsigmet.decoder;;

View file

@ -1,655 +0,0 @@
/**
* Convsigmet DecoderUtil
*
* This java class intends to serve as a decoder utility for Convsigmet.
*
* HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 03/2009 87/114 L. Lin Initial coding
* 06/2009 87/114 L. Lin Generalize the method processLocation.
* 07/2009 87/114 L. Lin Migration to TO11
* 09/2009 87/114 L. Lin Add latitude/longitude to location table
* 07/2011 87/114 F. J. Yen Fix the day of the end time when it is
* not the same as the day of the start time.
* </pre>
*
* This code has been developed by the SIB for use in the AWIPS2 system.
* @author L. Lin
* @version 1.0
*/
package gov.noaa.nws.ncep.edex.plugin.convsigmet.util;
import gov.noaa.nws.ncep.common.dataplugin.convsigmet.ConvSigmetLocation;
import gov.noaa.nws.ncep.common.dataplugin.convsigmet.ConvSigmetRecord;
import gov.noaa.nws.ncep.common.dataplugin.convsigmet.ConvSigmetSection;
import gov.noaa.nws.ncep.edex.tools.decoder.LatLonLocTbl;
import gov.noaa.nws.ncep.edex.util.UtilN;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.raytheon.edex.esb.Headers;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.edex.decodertools.core.LatLonPoint;
import com.raytheon.uf.edex.decodertools.time.TimeTools;
public class ConvSigmetParser {
/**
* Constructor
*/
public ConvSigmetParser() {
}
/**
* Parse the WMO line and store WMO header, OfficeID, issue time,
* designatorBBB,...
*
* @param wmoline
* The bulletin message
*
* @return a ConvsigmetRecord
*/
public static ConvSigmetRecord processWMO(String wmoline, Headers headers) {
ConvSigmetRecord record = null;
// Regular expression for WMO/ICAO, station ID, and issue date (and
// maybe designator BBB)
final String WMO_EXP = "([A-Z]{4}[0-9]{2}) ([A-Z]{4}) ([0-9]{6})( ([A-Z]{3}))?";
// Pattern used for extracting WMO header, officeID, product purge time,
// and issue date and designatorBBB
final Pattern wmoPattern = Pattern.compile(WMO_EXP);
Matcher theMatcher = wmoPattern.matcher(wmoline);
if (theMatcher.find()) {
record = new ConvSigmetRecord();
record.setWmoHeader(theMatcher.group(1));
record.setIssueOffice(theMatcher.group(2));
record.setDesignatorBBB(theMatcher.group(5));
// Decode the issue time.
Calendar issueTime = TimeTools.findDataTime(theMatcher.group(3),
headers);
record.setIssueTime(issueTime);
DataTime dataTime = new DataTime(issueTime);
record.setDataTime(dataTime);
}
return record;
}
/**
* Obtains forecast region as: SIGW, SIGC, or SIGE from a report
*
* @param bullMessage
* The bulletin message
* @return a string for forecast region
*/
public static String processFcstRegion(String bullMessage) {
// Regular expression for "SIG" forecast region
final String FCSTREGION_EXP = "SIG([A-Z]{1}) ( )*";
// Pattern used for extracting forecast region
final Pattern fcstregionPattern = Pattern.compile(FCSTREGION_EXP);
Matcher theMatcher = fcstregionPattern.matcher(bullMessage);
if (theMatcher.find()) {
return theMatcher.group(1);
} else {
return " ";
}
}
/**
* process regular section of a convective sigmet report
*
* @param theSection
* The section lines from bulletin message
* @param issueTime
* The bulletin issue time
* @param startTime
* The start time for this section
* @param forecastRegion
* as "W", "C", or "E"
* @return a ConvsigmetSection table
*/
public static ConvSigmetSection processSection(String theSection,
Calendar issueTime, Calendar startTime, String forecastRegion,
Headers headers) {
// Default equal to one hour if there is no valid time in report
final int validPeriod = 1;
// Decode the phenomena description
ConvSigmetSection currentSection = ConvSigmetParser
.processPhenomena(theSection);
// Replace the special characters
currentSection.setSegment(theSection.replace('\r', ' ')
.replace('\036', ' ').replace('\003', ' ').replace('\000', ' ')
.replace('\001', ' '));
// Decode the locations
ConvSigmetParser.processLocation(theSection, currentSection);
// Decode the sequence ID
String sequenceID = ConvSigmetParser.processSequenceID(theSection);
if (sequenceID.equals(" ")) {
// Default as: 0W, 0C, or 0E if no sequenceID has been found.
sequenceID = "0".concat(forecastRegion);
}
currentSection.setSequenceID(sequenceID);
// Set the starting time
if (startTime == null) {
currentSection.setStartTime(issueTime);
} else {
currentSection.setStartTime(startTime);
}
// Decode the end time
Calendar endTime = ConvSigmetParser.processEndTime(theSection,
currentSection, headers);
if (endTime == null) {
/*
* if no end time available, end time will be the issue time plus a
* valid period; the default is one hour for now.
*/
endTime = TimeTools.copy(issueTime);
endTime.add(Calendar.HOUR, validPeriod);
currentSection.setEndTime(endTime);
} else {
currentSection.setEndTime(endTime);
}
int startMonth = startTime.get(Calendar.MONTH);
int endMonth = endTime.get(Calendar.MONTH);
int startDay = startTime.get(Calendar.DAY_OF_MONTH);
int endDay = endTime.get(Calendar.DAY_OF_MONTH);
if ((startMonth == endMonth) && (startDay > endDay)) {
// In case the end time needs to advance one month
endTime.add(Calendar.MONTH, 1);
}
return currentSection;
}
/**
* process the outlook section of a convective sigmet report.
*
* @param theOutlook
* The outlook section lines from bulletin message
* @param forecastRegion
* as "W", "C", or "E"
* @return a ConvsigmetSection table
*/
public static ConvSigmetSection processOutLook(String theOutlook,
String forecastRegion, Headers headers) {
ConvSigmetSection currentOutLook = new ConvSigmetSection();
currentOutLook.setSegment(theOutlook.replace('\r', ' ')
.replace('\036', ' ').replace('\003', ' ').replace('\000', ' ')
.replace('\001', ' '));
currentOutLook.setClassType("OUTLOOK");
// Decode start time and end time
ConvSigmetParser.processValidTime(theOutlook, currentOutLook, headers);
// Decode locations
if (ConvSigmetParser.processLocation(theOutlook, currentOutLook)) {
final String SID_EXP = "AREA ([0-9]{1})...FROM";
// Pattern used for extracting the number of sequence ID.
final Pattern sidPattern = Pattern.compile(SID_EXP);
Matcher theMatcher = sidPattern.matcher(theOutlook);
// Default sequenceID as: 1W, 1C, or 1E if locations have been
// found.
String sequenceID = "1".concat(forecastRegion);
if (theMatcher.find()) {
// Multiple areas such as: "AREA 1", "AREA 2", ...etc
sequenceID = theMatcher.group(1).concat(forecastRegion);
}
currentOutLook.setSequenceID(sequenceID);
} else {
// Default sequenceID as: 0W, 0C, or 0E if outlook section is a NIL
// report.
String sequenceID = "0".concat(forecastRegion);
currentOutLook.setSequenceID(sequenceID);
}
return currentOutLook;
}
/**
* Obtains start time from input report
*
* @param theSection
* The bulletin message
* @return a calendar for start time
*/
public static Calendar processStartTime(String theSection, Headers headers) {
// Regular expression for start time
final String STARTTIME_EXP = "(\\x1e)([A-Z]{4}) ([A-Z]{3}) ([0-9]{6})( [A-Z]{3})?";
// attern used for extracting the starting time
final Pattern starttimePattern = Pattern.compile(STARTTIME_EXP);
// Calendar mndTime = Calendar.getInstance();
Matcher theMatcher = starttimePattern.matcher(theSection);
if (theMatcher.find()) {
// Get start time
Calendar mndTime = null;
return TimeTools.findDataTime(theMatcher.group(4), headers);
} else {
return null;
}
}
/**
* Obtains correction flag
*
* @param theSection
* The bulletin message
* @return true if finds a correction flag
*/
public static Boolean processCorrectionFlag(String theSection) {
Boolean correctionFlag = false;
// Regular expression for the correction flag
final String CORFLAG_EXP = "(\\x1e)([A-Z]{4}) ([A-Z]{3}) ([0-9]{6})( [A-Z]{3})?";
// Pattern used for extracting the correction flag
final Pattern corflagPattern = Pattern.compile(CORFLAG_EXP);
Matcher theMatcher = corflagPattern.matcher(theSection);
if (theMatcher.find()) {
Scanner scCorrection = new Scanner(theMatcher.group(0));
// check if this contains a correction flag
while (scCorrection.hasNext()) {
if (scCorrection.next().equals("COR")) {
correctionFlag = true;
}
}
}
return correctionFlag;
}
/**
* Obtains the sequence ID
*
* @param inSegment
* The segment which contains this sequence ID
* @return a string for sequence ID
*/
public static String processSequenceID(String inSegment) {
// Regular expression for the sequence ID
final String SEQUENCEID_EXP = "CONVECTIVE SIGMET (([0-9]{2}|[0-9]{1})[A-Z]{1})";
// Pattern used for extracting the sequence ID
final Pattern sequenceidPattern = Pattern.compile(SEQUENCEID_EXP);
Matcher theMatcher = sequenceidPattern.matcher(inSegment);
if (theMatcher.find()) {
return theMatcher.group(1);
} else {
return " ";
}
}
/**
* Get the end time
*
* @param theSegment
* The segment which contains end time
* @param section
* The section table which contains the start time
* @return a calendar for end time
*/
public static Calendar processEndTime(String theSegment,
ConvSigmetSection section, Headers headers) {
// Regular expression for end time
final String ENDTIME_EXP = "VALID UNTIL ([0-9]{4})Z";
// Pattern used for extracting the end time
final Pattern endtimePattern = Pattern.compile(ENDTIME_EXP);
// Calendar mndTime = Calendar.getInstance();
Matcher theMatcher = endtimePattern.matcher(theSegment);
if (theMatcher.find()) {
Calendar startTime = section.getStartTime();
String endTimeGroup = Integer.toString(
startTime.get(Calendar.DAY_OF_MONTH)).concat(
theMatcher.group(1));
if (startTime.get(Calendar.DAY_OF_MONTH) < 10) {
// add a "0" if the day of month less than 10
endTimeGroup = "0".concat(endTimeGroup);
}
// Determine the end time.
Calendar endTime = TimeTools.findDataTime(endTimeGroup, headers);
int startHrMn = startTime.get(Calendar.HOUR_OF_DAY) * 100 +
startTime.get(Calendar.MINUTE);
int endHrMn = Integer.parseInt(theMatcher.group(1));
if (endHrMn < startHrMn) {
/* Increment for the next day */
endTime.add(Calendar.DATE,1);
}
return endTime;
} else {
return null;
}
}
/**
* Parse the phenomena...
*
* @param theFlight
* The flight level line
* @return a section record
*/
public static ConvSigmetSection processPhenomena(String theFlight) {
String classType = null;
// Regular expression for the flight line
final String FL_EXP = "((DMSHG|DSIPTG|INTSFYG|DVLPG) )?(LINE|AREA|ISOL)(\\S|\\s)*FROM ([0-9]{3})?([0-9]{2})KT. ((TOP|TOPS) (TO|ABV)) FL([0-9]{3})";
// Pattern used for extracting the direction, speed, distance, and
// flight level
final Pattern flPattern = Pattern.compile(FL_EXP);
Matcher theMatcher = flPattern.matcher(theFlight);
// Regular expression for the classType line
final String CLASS_EXP = "((DMSHG|DSIPTG|INTSFYG|DVLPG) )?(LINE|AREA|ISOL)(\\S|\\s)*((TOP|TOPS) (TO|ABV)) FL([0-9]{3})";
// Pattern used for extracting the class type and flight level
final Pattern classPattern = Pattern.compile(CLASS_EXP);
Matcher classMatcher = classPattern.matcher(theFlight);
ConvSigmetSection currentSection = new ConvSigmetSection();
if (theMatcher.find()) {
classType = theMatcher.group(3);
int direction = Integer.parseInt(theMatcher.group(5));
int speed = Integer.parseInt(theMatcher.group(6));
int flightLevel = Integer.parseInt(theMatcher.group(10));
String flightLevelTop = theMatcher.group(7);
String intensity = theMatcher.group(1);
currentSection.setFlightLevel(flightLevel);
currentSection.setDirection(direction);
currentSection.setSpeed(speed);
currentSection.setClassType(classType);
currentSection.setIntensity(intensity);
currentSection.setCloudTop(flightLevelTop);
if (classType.equals("LINE")) {
final String DISTANCE_EXP = "LINE (EMBD )?(SEV )?TS ([0-9]{2})";
final Pattern distancePattern = Pattern.compile(DISTANCE_EXP);
Matcher disMatcher = distancePattern.matcher(theFlight);
if (disMatcher.find()) {
int distance = Integer.parseInt(disMatcher.group(3));
currentSection.setDistance(distance);
}
} else if (classType.equals("ISOL")) {
final String ISOLDISTANCE_EXP = "ISOL (\\S|\\s)* TS D([0-9]{2})";
final Pattern isoldistancePattern = Pattern
.compile(ISOLDISTANCE_EXP);
Matcher isoldisMatcher = isoldistancePattern.matcher(theFlight);
if (isoldisMatcher.find()) {
int distance = Integer.parseInt(isoldisMatcher.group(2));
currentSection.setDistance(distance);
}
// get ISOL location table
getIsolLocation(theFlight, currentSection);
}
} else if (classMatcher.find()) {
classType = classMatcher.group(3);
int flightLevel = Integer.parseInt(classMatcher.group(8));
String flightLevelTop = classMatcher.group(5);
String intensity = classMatcher.group(1);
currentSection.setFlightLevel(flightLevel);
currentSection.setClassType(classType);
currentSection.setIntensity(intensity);
currentSection.setCloudTop(flightLevelTop);
if (classType.equals("LINE")) {
final String DISTANCE_EXP = "LINE (EMBD )?(SEV )?TS ([0-9]{2})";
final Pattern distancePattern = Pattern.compile(DISTANCE_EXP);
Matcher disMatcher = distancePattern.matcher(theFlight);
if (disMatcher.find()) {
int distance = Integer.parseInt(disMatcher.group(3));
currentSection.setDistance(distance);
}
} else if (classType.equals("ISOL")) {
final String ISOLDISTANCE_EXP = "ISOL (\\S|\\s)* TS D([0-9]{2})";
final Pattern isoldistancePattern = Pattern
.compile(ISOLDISTANCE_EXP);
Matcher isoldisMatcher = isoldistancePattern.matcher(theFlight);
if (isoldisMatcher.find()) {
int distance = Integer.parseInt(isoldisMatcher.group(2));
currentSection.setDistance(distance);
}
// get ISOL location table
getIsolLocation(theFlight, currentSection);
}
} else {
// Finds no "flight level line", "CS" as default for a NIL report.
currentSection.setClassType("CS");
currentSection.setIntensity(null);
}
return currentSection;
}
/**
* Obtains the start time and end time
*
* @param theSection
* The outlook section contains the valid times group
*/
public static void processValidTime(String theSection,
ConvSigmetSection currentOutLook, Headers headers) {
// Regular expression for start time
final String TIMES_EXP = "OUTLOOK VALID ([0-9]{6})-([0-9]{6})";
// Pattern used for extracting the starting time and end time
final Pattern starttimePattern = Pattern.compile(TIMES_EXP);
Calendar startTime = null;
Calendar endTime = null;
// Calendar mndTime = Calendar.getInstance();
Matcher theMatcher = starttimePattern.matcher(theSection);
if (theMatcher.find()) {
// Decode the start time and end time; then set them.
startTime = TimeTools.findDataTime(theMatcher.group(1), headers);
currentOutLook.setStartTime(startTime);
endTime = TimeTools.findDataTime(theMatcher.group(2), headers);
int startMonth = startTime.get(Calendar.MONTH);
int endMonth = endTime.get(Calendar.MONTH);
int startDay = startTime.get(Calendar.DAY_OF_MONTH);
int endDay = endTime.get(Calendar.DAY_OF_MONTH);
if ((startMonth == endMonth) && (startDay > endDay)) {
// Roll over a month
endTime.add(Calendar.MONTH, 1);
}
currentOutLook.setEndTime(endTime);
} else {
currentOutLook.setStartTime(startTime);
currentOutLook.setEndTime(endTime);
}
}
/**
* Obtains the location information for ISOL.
*
* @param theSection
* The section lines from bulletin message
* @param sectionTable
* The section Table
*/
public static void getIsolLocation(String theSection,
ConvSigmetSection sectionTable) {
String line = null;
LatLonPoint point = null;
final String ISOLLOCATION_EXP = "\\x0d\\x0d\\x0a(([0-9]{2}|[0-9]{3})([ENSW])* [A-Z]{3})\\x0d\\x0d\\x0a";
final Pattern isollocationPattern = Pattern.compile(ISOLLOCATION_EXP);
Matcher isollocMatcher = isollocationPattern.matcher(theSection);
if (isollocMatcher.find()) {
line = isollocMatcher.group(1);
}
if (line != null) {
ConvSigmetLocation currentLocation = new ConvSigmetLocation();
currentLocation.setLocationLine(line);
currentLocation.setLocation(line);
currentLocation.setIndex(1);
// Get a latLonPoint for this station ID from "vors" location table
point = LatLonLocTbl.getLatLonPoint(line, "vors");
currentLocation.setLatitude(point
.getLatitude(LatLonPoint.INDEGREES));
currentLocation.setLongitude(point
.getLongitude(LatLonPoint.INDEGREES));
sectionTable.addConvSigmetLocation(currentLocation);
}
}
/**
* Parse the location lines and add location table to the section table if
* any
*
* @param theSection
* The section lines from bulletin message
* @param sectionTable
* The section Table
* @return true if finds a location line
*/
public static Boolean processLocation(String theSection,
ConvSigmetSection sectionTable) {
Boolean hasLocationLine = true;
String locationDelimiter = "-";
ArrayList<String> terminationList = new ArrayList<String>();
terminationList.addAll(Arrays
.asList(new String[] { "WST", "REF", "LINE", "AREA", "ISOL",
"DMSHG", "DVLPG", "DSIPTG", "INTSFYG" }));
LatLonPoint point = null;
Scanner sclocations = new Scanner(theSection).useDelimiter("FROM");
// throws away the first section which is not the "FROM" location
String locationSection = sclocations.next();
if (sclocations.hasNext()) {
locationSection = sclocations.next();
Scanner scLocationLine = new Scanner(locationSection)
.useDelimiter("\\x0d\\x0d\\x0a");
String lines = " ";
String curLine = null;
ArrayList<String> locationList = new ArrayList<String>();
locationList.clear();
Boolean notBreak = true;
while (scLocationLine.hasNext() && notBreak) {
// Get next location line
curLine = scLocationLine.next();
Scanner scLocationToken = new Scanner(curLine);
if (scLocationToken.hasNext()) {
// Check the first token from each line
String firstToken = scLocationToken.next();
if (terminationList.contains(firstToken)) {
// terminate
notBreak = false;
break;
}
}
lines = lines.concat(" ").concat(curLine);
}
// Clean up the leading space
lines = UtilN.removeLeadingWhiteSpaces(lines);
// Parse the location lines by a "-"
Scanner scLocation = new Scanner(lines)
.useDelimiter(locationDelimiter);
locationList.clear();
// Get all locations
while (scLocation.hasNext()) {
locationList.add(scLocation.next());
}
// set locations to data base
if (locationList.size() > 1) {
Integer idxLocation = 0;
for (String Location : locationList) {
ConvSigmetLocation currentLocation = new ConvSigmetLocation();
currentLocation.setLocationLine(lines);
currentLocation.setLocation(Location);
// Get a latLonPoint for this station ID from "vors"
// location table
point = LatLonLocTbl.getLatLonPoint(Location, "vors");
currentLocation.setLatitude(point
.getLatitude(LatLonPoint.INDEGREES));
currentLocation.setLongitude(point
.getLongitude(LatLonPoint.INDEGREES));
currentLocation.setIndex(idxLocation + 1);
idxLocation++;
sectionTable.addConvSigmetLocation(currentLocation);
}
} else {
hasLocationLine = false;
}
} else {
hasLocationLine = false;
}
return hasLocationLine;
}
}

View file

@ -1,4 +0,0 @@
/**
* Contains tools for decoder plug-ins
*/
package gov.noaa.nws.ncep.edex.plugin.convsigmet.util;

View file

@ -1,11 +0,0 @@

563
WSUS33 KKCI 241455
SIGW
MKCW WST 241455
CONVECTIVE SIGMET...NONE
OUTLOOK VALID 241655-242055
TS ARE NOT EXPD TO REQUIRE WST ISSUANCES.


View file

@ -1,85 +0,0 @@
/**
* This Java class is the JUnit test for the convsigmet decoder separator.
*
* <pre>
*
* L. Lin 04/09 Creation
* </pre>
*
*/
package gov.noaa.nws.ncep.edex.plugin.convsigmet.decoder;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.File;
import java.io.IOException;
import java.io.FileNotFoundException;
public class ConvSigmetSeparatorTest {
ConvSigmetSeparator sep;
char[] cbuf;
int ntime = 0;
StringBuffer contents = new StringBuffer();
byte[] actual = null;
@Before
public void setUp() throws Exception {
sep = new ConvSigmetSeparator();
File file = new File ("unit-test/gov/noaa/nws/ncep/edex/plugin/convsigmet/decoder/2009022414.conv");
System.out.println(file.toString());
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(file));
String text = null;
// repeat until all lines is read
while ((text = reader.readLine()) != null) {
if ( text.length() != 0 ) {
contents.append(text).append("\r\r\n");
}
}
}
catch (FileNotFoundException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
finally {
try {
if (reader != null) {
reader.close();
}
}
catch (IOException e) {
e.printStackTrace();
}
}
sep = new ConvSigmetSeparator();
actual = contents.toString().getBytes();
sep.setData(actual, null);
}
@Test
public void testHasNext() {
assertTrue("Find Convsigmet separator! ", sep.hasNext());
}
@Test
public void testGetRecord() {
byte[] expected = sep.next();
String a = new String (actual);
String e = new String (expected);
System.out.println("expected=\n" + e);
String b = a.substring(3);
System.out.println("actual b=\n" + b);
assertEquals(e.trim(),b.trim());
}
}

View file

@ -1,268 +0,0 @@
/**
* This Java class is the JUnit test for the convsigmet parser.
*
* <pre>
*
* L. Lin 04/09 Creation
* </pre>
*
*/
package gov.noaa.nws.ncep.edex.plugin.convsigmet.util;
import static org.junit.Assert.*;
import gov.noaa.nws.ncep.common.dataplugin.convsigmet.ConvSigmetRecord;
import gov.noaa.nws.ncep.common.dataplugin.convsigmet.ConvSigmetSection;
import gov.noaa.nws.ncep.edex.plugin.convsigmet.util.ConvSigmetParser;
import gov.noaa.nws.ncep.edex.util.UtilN;
import com.raytheon.edex.plugin.AbstractDecoder;
import com.raytheon.edex.util.Util;
import java.util.zip.DataFormatException;
import java.util.Calendar;
import org.junit.Test;
public class ConvSigmetParserTest extends AbstractDecoder {
@Test
public void testProcessWMO() {
final String wmoHeader = "WSUS33";
final String testBull = "WSUS33 KKCI 011455\n\n\r" +
"SIGW \n\n\r";
ConvSigmetRecord record = null;
record = ConvSigmetParser.processWMO(testBull, null);
String wmo=record.getWmoHeader();
assertEquals(wmo, wmoHeader);
final String issueString = "011455";
//Calendar mndTime = Calendar.getInstance();
//Calendar timeGroup=ConvsigmetParser.convertDdhhmmToStandardCal(issueString, mndTime);
Calendar timeGroup = null;
try {
timeGroup = Util.findCurrentTime(issueString);
} catch (DataFormatException e) {
System.out.println("Unable to get issue time");
}
Calendar issueTime=record.getIssueTime();
System.out.println("======= This is the issue date:");
System.out.println("issue date:year= " + timeGroup.get(Calendar.YEAR) );
System.out.println("issue date:month= " + timeGroup.get(Calendar.MONTH) );
System.out.println("issue date:day= " + timeGroup.get(Calendar.DAY_OF_MONTH) );
System.out.println("issue date:hour= " + timeGroup.get(Calendar.HOUR) );
System.out.println("issue date:minute= " + timeGroup.get(Calendar.MINUTE) );
assertEquals(timeGroup, issueTime);
}
@Test
public void testProcessFcstRegion() {
final String fcstRegion = "W";
final String testBull = "WSUS33 KKCI 241455\n\n\r" +
"SIGW \n\n\r";
String regionRet = ConvSigmetParser.processFcstRegion(testBull);
assertEquals(fcstRegion, regionRet);
}
@Test
public void testProcessStartTime() {
final String timeString ="261755";
final String testBull = "WSUS31 KKCI 261755\n\n\r" +
"SIGE \n\n\r" +
"\036MKCE WST 261755\n\n\r" +
"CONVECTIVE SIGMET...NONE\n\n\r" +
"\n\n\r" +
"OUTLOOK VALID 261955-262355\n\n\r" +
"FROM 50E GRB-ROD-TTH-50E GRB\n\n\r" +
"WST ISSUANCES POSS. REFER TO MOST RECENT ACUS01 KWNS FROM STORM\n\n\r" +
"PREDICTION CENTER FOR SYNOPSIS AND METEOROLOGICAL DETAILS.\n\n\r";
//Calendar mndTime = Calendar.getInstance();
//Calendar startTime=ConvsigmetParser.convertDdhhmmToStandardCal(timeString, mndTime);
Calendar startTime = null;
try {
startTime = Util.findCurrentTime(timeString);
} catch (DataFormatException e) {
System.out.println("Unable to get start time");
}
Calendar timeRet=ConvSigmetParser.processStartTime(testBull, null);
assertEquals(startTime,timeRet);
}
@Test
public void testProcessEndTime() {
final String timeString ="261855";
final String testBull = "WSUS31 KKCI 261755\n\n\r" +
"SIGE \n\n\r" +
"\036MKCE WST 261755\n\n\r" +
"CONVECTIVE SIGMET 19C\n\n\r" +
"VALID UNTIL 1855Z\n\n\r" +
"MN IA NE\n\n\r" +
"FROM 50SE RWF-30W MCW-20SSE OVR\n\n\r" +
"LINE EMBD SEV TS 30 NM WIDE MOV FROM 26035KT. TOPS TO FL350.\n\n\r" +
"HAIL TO 1 IN...WIND GUSTS TO 50KT POSS.\n\n\r" +
"\n\n\r" +
"OUTLOOK VALID 261955-262355\n\n\r" +
"FROM 50E GRB-ROD-TTH-50E GRB\n\n\r" +
"WST ISSUANCES POSS. REFER TO MOST RECENT ACUS01 KWNS FROM STORM\n\n\r" +
"PREDICTION CENTER FOR SYNOPSIS AND METEOROLOGICAL DETAILS.\n\n\r";
//Calendar mndTime = Calendar.getInstance();
//Calendar endTime=ConvsigmetParser.convertDdhhmmToStandardCal(timeString, mndTime);
Calendar endTime = null;
try {
endTime = Util.findCurrentTime(timeString);
} catch (DataFormatException e) {
System.out.println("Unable to get end time");
}
ConvSigmetSection curSection = new ConvSigmetSection();
curSection.setStartTime(endTime);
Calendar timeRet=ConvSigmetParser.processEndTime(testBull, curSection, null);
assertEquals(endTime,timeRet);
}
@Test
public void testProcessCorrectionFlag() {
final String testBull1 = "WSUS31 KKCI 261755\n\n\r" +
"SIGE \n\n\r" +
"\036MKCE WST 261755 COR\n\n\r" +
"CONVECTIVE SIGMET...NONE\n\n\r" +
"\n\n\r" +
"OUTLOOK VALID 261955-262355\n\n\r" +
"FROM 50E GRB-ROD-TTH-50E GRB\n\n\r" +
"WST ISSUANCES POSS. REFER TO MOST RECENT ACUS01 KWNS FROM STORM\n\n\r" +
"PREDICTION CENTER FOR SYNOPSIS AND METEOROLOGICAL DETAILS.\n\n\r";
final String testBull2 = "WSUS31 KKCI 261755\n\n\r" +
"SIGE \n\n\r" +
"\036MKCE WST 261755\n\n\r" +
"CONVECTIVE SIGMET...NONE\n\n\r" +
"\n\n\r" +
"OUTLOOK VALID 261955-262355\n\n\r" +
"FROM 50E GRB-ROD-TTH-50E GRB\n\n\r" +
"WST ISSUANCES POSS. REFER TO MOST RECENT ACUS01 KWNS FROM STORM\n\n\r" +
"PREDICTION CENTER FOR SYNOPSIS AND METEOROLOGICAL DETAILS.\n\n\r";
final boolean YES=true;
final boolean NO=false;
boolean corRet = ConvSigmetParser.processCorrectionFlag(testBull1);
assertEquals(YES,corRet);
corRet = ConvSigmetParser.processCorrectionFlag(testBull2);
assertEquals(NO,corRet);
}
@Test
public void testProcessSequenceID() {
final String sequenceID = "19C";
final String testBull = "WSUS31 KKCI 261755\n\n\r" +
"SIGE \n\n\r" +
"\036MKCE WST 261755\n\n\r" +
"CONVECTIVE SIGMET 19C\n\n\r" +
"VALID UNTIL 1855Z\n\n\r" +
"MN IA NE\n\n\r" +
"FROM 50SE RWF-30W MCW-20SSE OVR\n\n\r" +
"LINE EMBD SEV TS 30 NM WIDE MOV FROM 26035KT. TOPS TO FL350.\n\n\r" +
"HAIL TO 1 IN...WIND GUSTS TO 50KT POSS.\n\n\r" +
"\n\n\r" +
"OUTLOOK VALID 261955-262355\n\n\r" +
"FROM 50E GRB-ROD-TTH-50E GRB\n\n\r" +
"WST ISSUANCES POSS. REFER TO MOST RECENT ACUS01 KWNS FROM STORM\n\n\r" +
"PREDICTION CENTER FOR SYNOPSIS AND METEOROLOGICAL DETAILS.\n\n\r";
String idRet = ConvSigmetParser.processSequenceID(testBull);
assertEquals(sequenceID, idRet);
}
@Test
public void testProcessValidTime() {
final String startString = "261955";
final String endString = "262355";
final String testBull = "WSUS31 KKCI 261755\n\n\r" +
"SIGE \n\n\r" +
"\036MKCE WST 261755\n\n\r" +
"CONVECTIVE SIGMET 19C\n\n\r" +
"VALID UNTIL 1855Z\n\n\r" +
"MN IA NE\n\n\r" +
"FROM 50SE RWF-30W MCW-20SSE OVR\n\n\r" +
"LINE EMBD SEV TS 30 NM WIDE MOV FROM 26035KT. TOPS TO FL350.\n\n\r" +
"HAIL TO 1 IN...WIND GUSTS TO 50KT POSS.\n\n\r" +
"\n\n\r" +
"OUTLOOK VALID 261955-262355\n\n\r" +
"FROM 50E GRB-ROD-TTH-50E GRB\n\n\r" +
"WST ISSUANCES POSS. REFER TO MOST RECENT ACUS01 KWNS FROM STORM\n\n\r" +
"PREDICTION CENTER FOR SYNOPSIS AND METEOROLOGICAL DETAILS.\n\n\r";
Calendar startTime = null;
Calendar mndTime = null;
startTime = UtilN.findDataTime(startString, mndTime);
Calendar endTime = null;
endTime = UtilN.findDataTime(endString, mndTime);
ConvSigmetSection curSection = new ConvSigmetSection();
ConvSigmetParser.processValidTime(testBull, curSection, null);
Calendar startRet = curSection.getStartTime();
Calendar endRet = curSection.getEndTime();
assertEquals(endTime, endRet);
assertEquals(startTime, startRet);
}
@Test
public void testProcessFlightLevel() {
final String classType = "LINE";
final int direction = 260;
final int speed = 35;
final int flightLevel = 350;
final String testBull = "WSUS31 KKCI 261755\n\n\r" +
"SIGE \n\n\r" +
"\036MKCE WST 261755\n\n\r" +
"CONVECTIVE SIGMET 19C\n\n\r" +
"VALID UNTIL 1855Z\n\n\r" +
"MN IA NE\n\n\r" +
"FROM 50SE RWF-30W MCW-20SSE OVR\n\n\r" +
"LINE EMBD SEV TS 30 NM WIDE MOV FROM 26035KT. TOPS TO FL350.\n\n\r" +
"HAIL TO 1 IN...WIND GUSTS TO 50KT POSS.\n\n\r" +
"\n\n\r" +
"OUTLOOK VALID 261955-262355\n\n\r" +
"FROM 50E GRB-ROD-TTH-50E GRB\n\n\r" +
"WST ISSUANCES POSS. REFER TO MOST RECENT ACUS01 KWNS FROM STORM\n\n\r" +
"PREDICTION CENTER FOR SYNOPSIS AND METEOROLOGICAL DETAILS.\n\n\r";
ConvSigmetSection retSection = ConvSigmetParser.processPhenomena(testBull);
assertEquals(classType, retSection.getClassType());
assertEquals(direction, retSection.getDirection());
assertEquals(speed, retSection.getSpeed());
assertEquals(flightLevel, retSection.getFlightLevel());
}
}

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<requestPatterns xmlns:ns2="group">
<regex>^WSUS3[123].*</regex>
</requestPatterns>

View file

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<purgeRuleSet xmlns:ns2="group">
<rule>
<id>
<pluginName>convsigmet</pluginName>
<key>default</key>
</id>
<period>02-00:00:00</period>
</rule>
</purgeRuleSet>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="unit-test"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gov.noaa.nws.ncep.edex.plugin.nonconvsigmet</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>

View file

@ -1,7 +0,0 @@
#Wed Sep 23 08:36:23 CDT 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6

View file

@ -1,18 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Nonconvsigmet Plug-in
Bundle-SymbolicName: gov.noaa.nws.ncep.edex.plugin.nonconvsigmet
Bundle-Version: 1.0.0
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: gov.noaa.nws.ncep.common.dataplugin.nonconvsigmet;bundle-version="1.0.0",
gov.noaa.nws.ncep.edex.common;bundle-version="1.0.0",
gov.noaa.nws.ncep.common;bundle-version="1.0.0",
com.raytheon.edex.common;bundle-version="1.11.1",
com.raytheon.uf.edex.decodertools;bundle-version="1.0.0",
com.raytheon.uf.common.pointdata;bundle-version="1.11.8",
com.raytheon.uf.edex.pointdata;bundle-version="1.11.8",
org.apache.commons.logging;bundle-version="1.0.4",
org.geotools,
javax.persistence,
javax.measure
Import-Package: org.junit

View file

@ -1,4 +0,0 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.

View file

@ -1,7 +0,0 @@
<project basedir="." default="deploy" name="gov.noaa.nws.ncep.edex.plugin.nonconvsigmet">
<available file="../build.edex" property="build.dir.location" value="../build.edex" />
<available file="../../../../../build.edex" property="build.dir.location" value="../../../../../build.edex" />
<import file="${build.dir.location}/basebuilds/component_deploy_base.xml" />
</project>

View file

@ -1,26 +0,0 @@
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="nonconvsigmetPluginName" class="java.lang.String">
<constructor-arg type="java.lang.String" value="nonconvsigmet" />
</bean>
<bean id="nonconvsigmetProperties" class="com.raytheon.uf.common.dataplugin.PluginProperties">
<property name="pluginName" ref="nonconvsigmetPluginName" />
<property name="pluginFQN" value="gov.noaa.nws.ncep.common.dataplugin.nonconvsigmet" />
<property name="dao" value="gov.noaa.nws.ncep.common.dataplugin.nonconvsigmet.dao.NonConvSigmetDao" />
<property name="record"
value="gov.noaa.nws.ncep.common.dataplugin.nonconvsigmet.NonConvSigmetRecord" />
</bean>
<bean factory-bean="pluginRegistry" factory-method="register">
<constructor-arg ref="nonconvsigmetPluginName"/>
<constructor-arg ref="nonconvsigmetProperties"/>
</bean>
</beans>

View file

@ -1,73 +0,0 @@
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="nonconvsigmetDecoder" class="gov.noaa.nws.ncep.edex.plugin.nonconvsigmet.decoder.NonConvSigmetDecoder">
<constructor-arg ref="nonconvsigmetPluginName"/>
</bean>
<bean id="nonconvsigmetSeparator" class="gov.noaa.nws.ncep.edex.plugin.nonconvsigmet.decoder.NonConvSigmetSeparator"/>
<bean id="nonconvsigmetDistRegistry" factory-bean="distributionSrv"
factory-method="register">
<constructor-arg value="nonconvsigmet" />
<constructor-arg value="jms-dist:queue:Ingest.nonconvsigmet" />
</bean>
<bean id="nonconvsigmetCamelRegistered" factory-bean="contextManager"
factory-method="register" depends-on="persistCamelRegistered">
<constructor-arg ref="nonconvsigmet-camel"/>
</bean>
<camelContext id="nonconvsigmet-camel"
xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler"
autoStartup="false">
<!--
<endpoint id="nonconvsigmetFileEndpoint" uri="file:${edex.home}/data/sbn/nonconvsigmet?noop=true&amp;idempotent=false"/>
<route id="nonconvsigmetFileConsumerRoute">
<from ref="nonconvsigmetFileEndpoint"/>
<bean ref="fileToString" />
<setHeader headerName="pluginName">
<constant>nonconvsigmet</constant>
</setHeader>
<to uri="jms-generic:queue:Ingest.nonconvsigmet"/>
</route>
-->
<!-- Begin NonConvSigmet routes -->
<route id="nonconvsigmetIngestRoute">
<from uri="jms-generic:queue:Ingest.nonconvsigmet"/>
<setHeader headerName="pluginName">
<constant>nonconvsigmet</constant>
</setHeader>
<doTry>
<pipeline>
<bean ref="stringToFile" />
<split streaming="true">
<method bean="nonconvsigmetSeparator" method="separate"/>
<doTry>
<pipeline>
<bean ref="nonconvsigmetDecoder" method="decode"/>
<to uri="directvm:indexAlert"/>
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>
<to uri="log:nonconvsigmet?level=ERROR&amp;showBody=false&amp;showCaughtException=true&amp;showStackTrace=true"/>
</doCatch>
</doTry>
</split>
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>
<to uri="log:nonconvsigmet?level=ERROR&amp;showBody=false&amp;showCaughtException=true&amp;showStackTrace=true"/>
</doCatch>
</doTry>
</route>
</camelContext>
</beans>

View file

@ -1,108 +0,0 @@
/**
*
* Non-Convective Sigmet Decoder
*
* This java class decodes NONCONVSIGMET (non-convective sigmet) raw data.
* HISTORY
*
* Date Author Description
* ------------ ---------- ----------- --------------------------
* 06/2009 Uma Josyula Initial creation
*
* This code has been developed by the SIB for use in the AWIPS2 system.
*/
package gov.noaa.nws.ncep.edex.plugin.nonconvsigmet.decoder;
import gov.noaa.nws.ncep.common.dataplugin.nonconvsigmet.NonConvSigmetRecord;
import gov.noaa.nws.ncep.edex.plugin.nonconvsigmet.util.NonConvSigmetParser;
import gov.noaa.nws.ncep.edex.util.UtilN;
import java.util.Scanner;
import com.raytheon.edex.esb.Headers;
import com.raytheon.edex.exception.DecoderException;
import com.raytheon.edex.plugin.AbstractDecoder;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.edex.decodertools.core.IDecoderConstants;
public class NonConvSigmetDecoder extends AbstractDecoder {
private final String pluginName;
/**
* Constructor
*
* @throws DecoderException
*/
public NonConvSigmetDecoder(String name) throws DecoderException {
pluginName = name;
}
public PluginDataObject[] decode(byte[] data, Headers headers)
throws DecoderException {
String traceId = "";
if (headers != null) {
traceId = (String) headers.get("traceId");
}
String etx = IDecoderConstants.ETX;
String theBulletin = null;
byte[] messageData = null;
NonConvSigmetRecord currentRecord = null;
NonConvSigmetSeparator sep = NonConvSigmetSeparator.separate(data,
headers);
messageData = sep.next();
String theMessage = new String(messageData);
/*
* May have multiple duplicate bulletins, only get the first bulletin
* and eliminate the remaining bulletins after the first bulletin.
*/
Scanner cc = new Scanner(theMessage).useDelimiter(etx);
if (cc.hasNext()) {
theBulletin = cc.next();
} else {
theBulletin = theMessage;
}
/*
* Decode by calling the NonconvSigmetParser method processRecord
*/
currentRecord = NonConvSigmetParser.processRecord(theBulletin, headers);
if (currentRecord != null) {
currentRecord.setReportType(pluginName);
/*
* Replace special characters to a blank so that it may be readable
*/
currentRecord.setBullMessage(UtilN
.removeLeadingWhiteSpaces((theBulletin.substring(5))
.replace('\036', ' ').replace('\r', ' ')
.replace('\003', ' ').replace('\000', ' ')
.replace('\001', ' ')));
/*
* Check the NonConvsigmet record object. If not, throws exception.
*/
currentRecord.setTraceId(traceId);
currentRecord.setPluginName(pluginName);
try {
currentRecord.constructDataURI();
} catch (PluginException e) {
logger.error(traceId + "- Unable to construct dataURI", e);
currentRecord = null;
}
}
/*
* Return the NonConvsigmetRecord record object.
*/
if (currentRecord == null) {
return new PluginDataObject[0];
} else {
return new PluginDataObject[] { currentRecord };
}
}
}

View file

@ -1,147 +0,0 @@
/**
* NonConvsigmetSeparator
*
* This class sets the raw data to an Arraylist, records, of
* String based on a uniquely identified separator.
*
* <pre>
* Uma Josyula 06/2009 Creation
* </pre>
*
* This code has been developed by the SIB for use in the AWIPS system.
*/
package gov.noaa.nws.ncep.edex.plugin.nonconvsigmet.decoder;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.raytheon.edex.esb.Headers;
import com.raytheon.edex.plugin.AbstractRecordSeparator;
import com.raytheon.edex.util.Util;
public class NonConvSigmetSeparator extends AbstractRecordSeparator {
private final Log logger = LogFactory.getLog(getClass());
/** Regex used for separate the bulletins */
private static final String BULLSEPARATOR = "([0-9]{3})( )*\\x0d\\x0d\\x0a([A-Z]{4}[0-9]{2}) ([A-Z]{4}) ([0-9]{6})( [A-Z]{3})?\\x0d\\x0d\\x0a";
/** Regex matcher */
private Matcher matcher;
/** Pattern object for regex search */
private Pattern pattern;
/** List of records contained in file */
private List<String> records;
private Iterator<String> iterator = null;
/**
* Constructor.
*
*/
public NonConvSigmetSeparator() {
records = new ArrayList<String>();
}
public static NonConvSigmetSeparator separate(byte[] data, Headers headers) {
NonConvSigmetSeparator ds = new NonConvSigmetSeparator();
ds.setData(data, headers);
return ds;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.edex.plugin.AbstractRecordSeparator#setData(byte[],
* com.raytheon.edex.esb.Headers)
*/
public void setData(byte[] data, Headers headers) {
doSeparate(new String(data));
iterator = records.iterator();
}
/*
* (non-Javadoc)
*
* @see com.raytheon.edex.plugin.IRecordSeparator#hasNext()
*/
public boolean hasNext() {
if (iterator == null) {
return false;
} else {
return iterator.hasNext();
}
}
/**
* Get record
*/
public byte[] next() {
try {
String temp = iterator.next();
if (Util.isEmptyString(temp)) {
return (byte[]) null;
} else {
return temp.getBytes();
}
} catch (NoSuchElementException e) {
return (byte[]) null;
}
}
/**
* @param message
* separate bulletins
*/
private void doSeparate(String message) {
/* Regex used for separate the bulletins */
try {
pattern = Pattern.compile(BULLSEPARATOR);
matcher = pattern.matcher(message);
/*
* Set number of bulletins to records only if the bulletin separator
* is not the same. At the point, only separators are stored in
* "records"
*/
while (matcher.find()) {
if (!records.contains(matcher.group())) {
records.add(matcher.group());
}
}
/*
* Append the raw data file to the records.
*/
for (int i = 0; i < records.size(); i++) {
if (i < records.size() - 1) {
records.set(
i,
"\n"
+ message.substring(
message.indexOf(records.get(i)),
message.indexOf(records.get(i + 1))));
} else {
records.set(
i,
"\n"
+ message.substring(message.indexOf(records
.get(i))));
}
}
} catch (Exception e) {
logger.warn("No valid records found!", e);
}
return;
}
}

View file

@ -1,4 +0,0 @@
/**
* Contains decoder.java for decoder plug-ins
*/
package gov.noaa.nws.ncep.edex.plugin.nonconvsigmet.decoder;;

View file

@ -1,409 +0,0 @@
/*
* NonConvsigmet DecoderUtil
*
* This java class intends to serve as a decoder utility for NonConvsigmet.
*
* HISTORY
*
* Date Author Description
* ------------ ---------- ----------- --------------------------
* 06/2009 Uma Josyula Initial creation
* 07/2011 F. J. Yen Fix for RTN TTR 9973--ConvSigment Decoder Ignoring
* time range (NonConvsigmet, too). Set the rangeEnd
* time to the endTime
*
* This code has been developed by the SIB for use in the AWIPS2 system.
*/
package gov.noaa.nws.ncep.edex.plugin.nonconvsigmet.util;
import gov.noaa.nws.ncep.common.dataplugin.nonconvsigmet.NonConvSigmetLocation;
import gov.noaa.nws.ncep.common.dataplugin.nonconvsigmet.NonConvSigmetRecord;
import gov.noaa.nws.ncep.edex.tools.decoder.LatLonLocTbl;
import gov.noaa.nws.ncep.edex.util.UtilN;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.raytheon.edex.esb.Headers;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.edex.decodertools.core.LatLonPoint;
import com.raytheon.uf.edex.decodertools.time.TimeTools;
public class NonConvSigmetParser {
/**
* Constructor
*/
public NonConvSigmetParser() {
}
/**
* Parse the WMO line and store WMO header, OfficeID, issue time,
* designatorBBB,...
*
* @param wmoline
* The bulletin message
*
* @return a NonConvsigmetRecord
*/
public static NonConvSigmetRecord processWMO(String wmoline, Headers headers) {
NonConvSigmetRecord currentRecord = null;
// Regular expression for WMO/ICAO, station ID, and issue date (and
// maybe designator BBB)
final String WMO_EXP = "([A-Z]{4}[0-9]{2}) ([A-Z]{4}) ([0-9]{6})( ([A-Z]{3}))?";
// Pattern used for extracting WMO header,issue office and issue date
// and designatorBBB
final Pattern wmoPattern = Pattern.compile(WMO_EXP);
Matcher theMatcher = wmoPattern.matcher(wmoline);
if (theMatcher.find()) {
currentRecord = new NonConvSigmetRecord();
currentRecord.setWmoHeader(theMatcher.group(1));
currentRecord.setIssueOffice(theMatcher.group(2));
currentRecord.setDesignatorBBB(theMatcher.group(5));
// Decode the issue time.
Calendar issueTime = TimeTools.findDataTime(theMatcher.group(3),
headers);
currentRecord.setIssueTime(issueTime);
/* 999999999999999999999999999999
DataTime dataTime = new DataTime(issueTime);
currentRecord.setDataTime(dataTime);
999 */
}
return currentRecord;
}
/**
* Obtains start time and end time and forecast Region from input report
*
* @param theBullMsg
* The bulletin message which contains start time and end time.
*
* @param NonConvSigmetRecord
*
* @return a NonConvsigmetRecord
*/
public static NonConvSigmetRecord processStartEndTime(String theBullMsg,
NonConvSigmetRecord nconvRecord, Headers headers) {
final String STARTTIME_EXP = "([A-Z]{4}) WS ([0-9]{6})( [A-Z]{3})?";
final String ENDTIME_EXP = "VALID UNTIL ([0-9]{6})";
final Pattern starttimePattern = Pattern.compile(STARTTIME_EXP);
final Pattern endtimePattern = Pattern.compile(ENDTIME_EXP);
Calendar stTime = null;
Calendar endTime = null;
/*
* Default equal to one hour if there is no valid time in report
*/
NonConvSigmetRecord currentRecord = nconvRecord;
// Calculate the startTime
Matcher theMatcher = starttimePattern.matcher(theBullMsg);
if (theMatcher.find()) {
currentRecord.setForecastRegion(theMatcher.group(1));
stTime = TimeTools.findDataTime(theMatcher.group(2), headers);
}
if (stTime == null) {
currentRecord.setStartTime(currentRecord.getIssueTime());
} else {
currentRecord.setStartTime(stTime);
}
// Calculate the endTime
theMatcher = endtimePattern.matcher(theBullMsg);
if (theMatcher.find()) {
endTime = TimeTools.findDataTime(theMatcher.group(1), headers);
}
if (endTime == null) {
endTime = currentRecord.getIssueTime();
currentRecord.setEndTime(endTime);
} else {
currentRecord.setEndTime(endTime);
}
/* 9999999999999999999999999999999 */
DataTime dataTime = new DataTime(stTime, new TimeRange (stTime.getTime(),
endTime.getTimeInMillis() - stTime.getTimeInMillis()) );
currentRecord.setDataTime(dataTime);
/* 999 */
return currentRecord;
}
/**
* Obtains SigmetId from input report
*
* @param theBullMsg
* The bulletin message.
*
* @param NonConvSigmetRecord
*
* @return a NonConvsigmetRecord
*/
public static NonConvSigmetRecord processSigmetId(String theBullMsg,
NonConvSigmetRecord nconvRecord) {
final String SIGMETID_EXP = "SIGMET ([A-Z]{2,} [0-9]{1})";
final Pattern sigPattern = Pattern.compile(SIGMETID_EXP);
NonConvSigmetRecord currentRecord = nconvRecord;
// Parse sigmetId
Matcher theMatcher = sigPattern.matcher(theBullMsg);
if (theMatcher.find()) {
currentRecord.setSigmetId(theMatcher.group(1));
}
return currentRecord;
}
/**
* Parse the phenomena... Hazard Type,Hazard Intensity,Hazard Cause,Hazard
* Condition,FlightLevel1,FlightLevel2,SigmetId,AWIPSId,CorAmdTest,StateList
*
* @param theBullMsg
* from bulletin message
*
* @param a
* NonConvsigmetRecord
*
* @return a NonConvsigmetRecord
*/
public static NonConvSigmetRecord processPhenomena(String theBullMsg,
NonConvSigmetRecord nconvRecord) {
final String FL_EXP1 = "BTN (FL)?([0-9]{3}) AND (FL)?([0-9]{3})";
final String FL_EXP2 = "BLW (FL)?([0-9]{3})";
final String HAZARDTYPE_EXP = " (TURB|ICGICIP|ICE) ";
final String HAZARDINTS_EXP = "(OCNL [A-Z0-9]{2,})(BLW (FL)?([0-9]{3}).|BTN|TURB|ICGICIP|ICE|ICGIC|VA|DU)?";
final String HAZARDCAUS_EXP = "OCNL ([\\w| ])*(.|DUE TO)?([\\w| ]*). CONDS";
final String HAZARDCOND_EXP = "(CONDS [\\w| ]*)(\\x0d\\x0d\\x0a)?([\\w| ]*)([0-9]{4})Z";
final String STATELIST_EXP = "(([A-Z]{2})( [A-Z]{2})*)\\x0d\\x0d\\x0a";
final String AWIPSID_EXP = "([A-Z]{2}[0-9]{1}[A-Z]{1})( )*\\x0d\\x0d\\x0a";
final String CORREMARK_EXP = "(COR|AMD|TEST)";
final Pattern flPattern1 = Pattern.compile(FL_EXP1);
final Pattern flPattern2 = Pattern.compile(FL_EXP2);
final Pattern hzTypePattern = Pattern.compile(HAZARDTYPE_EXP);
final Pattern hzIntsPattern = Pattern.compile(HAZARDINTS_EXP);
final Pattern hzCausPattern = Pattern.compile(HAZARDCAUS_EXP);
final Pattern hzCondPattern = Pattern.compile(HAZARDCOND_EXP);
final Pattern stPattern = Pattern.compile(STATELIST_EXP);
final Pattern awipsPattern = Pattern.compile(AWIPSID_EXP);
final Pattern corRemarkPattern = Pattern.compile(CORREMARK_EXP);
NonConvSigmetRecord currentRecord = nconvRecord;
Matcher theMatcher = flPattern1.matcher(theBullMsg);
if (theMatcher.find()) {
currentRecord
.setFlightLevel2(Integer.parseInt(theMatcher.group(4)));
currentRecord
.setFlightLevel1(Integer.parseInt(theMatcher.group(2)));
} else {
theMatcher = flPattern2.matcher(theBullMsg);
if (theMatcher.find()) {
currentRecord.setFlightLevel1(Integer.parseInt(theMatcher
.group(2)));
}
}
theMatcher = hzCausPattern.matcher(theBullMsg);
if (theMatcher.find()) {
currentRecord.setHazardCause(theMatcher.group(3));
}
theMatcher = hzCondPattern.matcher(theBullMsg);
if (theMatcher.find()) {
currentRecord.setHazardCondition(theMatcher.group(0));
}
theMatcher = hzIntsPattern.matcher(theBullMsg);
if (theMatcher.find()) {
currentRecord.setHazardIntensity(theMatcher.group(1));
}
theMatcher = hzTypePattern.matcher(theBullMsg);
if (theMatcher.find()) {
if ("TURB".equals(theMatcher.group(1))) {
currentRecord.setHazardType("TURBULENCE");
} else {
currentRecord.setHazardType(theMatcher.group(1));
}
}
theMatcher = stPattern.matcher(theBullMsg);
if (theMatcher.find()) {
currentRecord.setStateList(theMatcher.group(1));
}
theMatcher = awipsPattern.matcher(theBullMsg);
if (theMatcher.find()) {
currentRecord.setAwipsId(theMatcher.group(1));
}
theMatcher = corRemarkPattern.matcher(theBullMsg);
if (theMatcher.find()) {
currentRecord.setCorrectionRemarks(theMatcher.group(0));
}
return currentRecord;
}
/**
* Parse the location lines... Add location table to the section table if
* any
*
* @param theBullMsg
* from bulletin message
*
* @param recordTable
* The record Table
*
* @return true if finds a location line
*/
public static Boolean processLocation(String theBullMsg,
NonConvSigmetRecord recordTable) {
Boolean hasLocationLine = true;
String locationDelimiter = "-| TO ";
ArrayList<String> terminationList = new ArrayList<String>();
terminationList.addAll(Arrays.asList(new String[] { "OCNL", "SEV" }));
Scanner sclocations = new Scanner(theBullMsg).useDelimiter("FROM");
/*
* throws away the first section which is not the "FROM" location
*/
LatLonPoint point;
String locationRecord = sclocations.next();
if (sclocations.hasNext()) {
locationRecord = sclocations.next();
Scanner scLocationLine = new Scanner(locationRecord)
.useDelimiter("\\x0d\\x0d\\x0a");
String lines = " ";
String curLine = null;
ArrayList<String> locationList = new ArrayList<String>();
locationList.clear();
Boolean notBreak = true;
while (scLocationLine.hasNext() && notBreak) {
curLine = scLocationLine.next();// Get next location line
Scanner scLocationToken = new Scanner(curLine);
if (scLocationToken.hasNext()) {
// Check the first token from each line
String firstToken = scLocationToken.next();
if (terminationList.contains(firstToken)) {
notBreak = false;// terminate
break;
}
}
lines = lines.concat(" ").concat(curLine);
}
// Clean up the leading space
lines = UtilN.removeLeadingWhiteSpaces(lines);
// Parse the location lines by a "-" or "TO"
Scanner scLocation = new Scanner(lines)
.useDelimiter(locationDelimiter);
locationList.clear();
// Get all locations
while (scLocation.hasNext()) {
locationList.add(scLocation.next());
}
// set locations to data base
if (locationList.size() > 1) {
Integer idxLocation = 0;
for (String location : locationList) {
NonConvSigmetLocation currentLocation = new NonConvSigmetLocation();
currentLocation.setLocationLine(lines);
currentLocation.setLocation(location);
point = LatLonLocTbl.getLatLonPoint(location, "vors");
currentLocation.setIndex(idxLocation + 1);
idxLocation++;
currentLocation.setLatitude(point
.getLatitude(LatLonPoint.INDEGREES));
currentLocation.setLongitude(point
.getLongitude(LatLonPoint.INDEGREES));
recordTable.addNonConvSigmetLocation(currentLocation);
}
} else {
hasLocationLine = false;
}
} else {
hasLocationLine = false;
}
return hasLocationLine;
}
/**
* process regular section of a non-convective sigmet report
*
* @return a NonConvsigmetRecord table
*/
public static NonConvSigmetRecord processRecord(String theBullMsg,
Headers headers) {
final String CANCELSIGMET_EXP = "(CANCEL SIGMET|TEST)";
final Pattern cancelSigPattern = Pattern.compile(CANCELSIGMET_EXP);
Matcher theMatcher = cancelSigPattern.matcher(theBullMsg);
// Decode the WMO Header
NonConvSigmetRecord currentRecord = NonConvSigmetParser.processWMO(
theBullMsg, headers);
// Decode the sigmetId
currentRecord = NonConvSigmetParser.processSigmetId(theBullMsg,
currentRecord);
// Decode the Start Time,End Time,ForecastRegion
currentRecord = NonConvSigmetParser.processStartEndTime(theBullMsg,
currentRecord, headers);
// Decode the phenomena description
currentRecord = NonConvSigmetParser.processPhenomena(theBullMsg,
currentRecord);
// Replace the special characters
currentRecord
.setBullMessage(theBullMsg.replace('\r', ' ')
.replace('\003', ' ').replace('\000', ' ')
.replace('\001', ' '));
if (theMatcher.find()) {
if ("UNKNOWN".equals(currentRecord.getHazardType())) {
if ("TEST".equals(theMatcher.group(0))) {
currentRecord.setHazardType("TEST");
} else {
currentRecord.setHazardType("CANCEL");
}
}
} else {
// Decode the locations
NonConvSigmetParser.processLocation(theBullMsg, currentRecord);
}
return currentRecord;
}
}

View file

@ -1,4 +0,0 @@
/**
* Contains tools for decoder plug-ins
*/
package gov.noaa.nws.ncep.edex.plugin.nonconvsigmet.util;

View file

@ -1,81 +0,0 @@

000
WSUS06 KKCI 071506
WS6Y
SFOY WS 071506
CANCEL SIGMET YANKEE 2. CONDS HV BECM MOSTLY MOD.
....

000
WSUS02 KKCI 071510
WS2N
MIAN WS 071510
SIGMET NOVEMBER 3 VALID UNTIL 071910
NC SC GA NY LO PA OH LE WV VA MD
FROM MSS TO FLO TO LGC TO GQO TO HMV TO CLE TO 30NNW BUF TO MSS
OCNL SEV TURB BTN 080 AND FL250. RPRTD BY ACFT. REPLACES SIGMET
NOVEMBER 2. CONDS CONTG BYD 1910Z.
....

000
WSUS01 KKCI 071510
WS1N
BOSN WS 071510
SIGMET NOVEMBER 3 VALID UNTIL 071910
NY LO PA OH LE WV VA MD NC SC GA
FROM MSS TO FLO TO LGC TO GQO TO HMV TO CLE TO 30NNW BUF TO MSS
OCNL SEV TURB BTN 080 AND FL250. RPRTD BY ACFT. REPLACES SIGMET
NOVEMBER 2. CONDS CONTG BYD 1910Z.
....

000
WSUS01 KKCI 071518
WS1O
BOSO WS 071518
SIGMET OSCAR 1 VALID UNTIL 071918
WV VA MD DC DE
FROM 50S ETX TO SBY TO 60WNW ECG TO HMV TO 30SE AIR TO 50S ETX
OCNL SEV MXD/RIME ICGICIP BTN 100 AND FL240. RPRTD BY ACFT. CONDS
CONTG BYD 1918Z.
....


View file

@ -1,86 +0,0 @@
/**
* This Java class is the JUnit test for the non-convsigmet decoder separator.
*
* <pre>
*
* UmaJosyula 04/09 Creation
* </pre>
*
*/
package gov.noaa.nws.ncep.edex.plugin.nonconvsigmet.decoder;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import gov.noaa.nws.ncep.edex.plugin.nonconvsigmet.decoder.NonConvSigmetSeparator;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.File;
import java.io.IOException;
import java.io.FileNotFoundException;
public class NonConvSigmetSeparatorTest {
NonConvSigmetSeparator sep;
char[] cbuf;
int ntime = 0;
StringBuffer contents = new StringBuffer();
byte[] actual = null;
@Before
public void setUp() throws Exception {
sep = new NonConvSigmetSeparator();
File file = new File ("unit-test/gov/noaa/nws/ncep/edex/plugin/nonconvsigmet/decoder/2009010715.nconv");
System.out.println(file.toString());
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(file));
String text = null;
// repeat until all lines is read
while ((text = reader.readLine()) != null) {
if ( text.length() != 0 ) {
contents.append(text).append("\r\r\n");
}
}
}
catch (FileNotFoundException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
finally {
try {
if (reader != null) {
reader.close();
}
}
catch (IOException e) {
e.printStackTrace();
}
}
sep = new NonConvSigmetSeparator();
actual = contents.toString().getBytes();
sep.setData(actual, null);
}
@Test
public void testHasNext() {
assertTrue("Find NonConvsigmet separator! ", sep.hasNext());
}
@Test
public void testGetRecord() {
byte[] expected = sep.next();
String a = new String (actual);
String e = new String (expected);
assertEquals(e.trim(),a.trim());
}
}

View file

@ -1,161 +0,0 @@
/**
* This Java class is the JUnit test for the non-convsigmet parser.
*
* <pre>
*
* Uma Josyula 04/09 Creation
* </pre>
*
*/
package gov.noaa.nws.ncep.edex.plugin.nonconvsigmet.util;
import static org.junit.Assert.*;
import gov.noaa.nws.ncep.common.dataplugin.nonconvsigmet.NonConvSigmetRecord;
import gov.noaa.nws.ncep.edex.plugin.nonconvsigmet.util.NonConvSigmetParser;
//import gov.noaa.nws.ncep.edex.util.UtilN;
import com.raytheon.edex.plugin.AbstractDecoder;
import com.raytheon.edex.util.Util;
import java.util.zip.DataFormatException;
import java.util.Calendar;
import org.junit.Test;
public class NonConvSigmetParserTest extends AbstractDecoder {
@Test
public void testProcessWMO() {
final String wmoHeader = "WSUS01";
final String testBull = "WSUS01 KKCI 071510\n\n\r";
NonConvSigmetRecord record = null;
record = NonConvSigmetParser.processWMO(testBull, null);
String wmo=record.getWmoHeader();
assertEquals(wmo, wmoHeader);
final String issueString = "071510";
Calendar timeGroup = null;
try {
timeGroup = Util.findCurrentTime(issueString);
} catch (DataFormatException e) {
System.out.println("Unable to get issue time");
}
Calendar issueTime=record.getIssueTime();
System.out.println("******* This is the issue date:");
System.out.println("issue date:year= " + timeGroup.get(Calendar.YEAR) );
System.out.println("issue date:month= " + timeGroup.get(Calendar.MONTH) );
System.out.println("issue date:day= " + timeGroup.get(Calendar.DAY_OF_MONTH) );
System.out.println("issue date:hour= " + timeGroup.get(Calendar.HOUR) );
System.out.println("issue date:minute= " + timeGroup.get(Calendar.MINUTE) );
assertEquals(timeGroup, issueTime);
}
@Test
public void testProcessStartEndTime() {
final String stTimeString ="071510";
final String endTimeString ="071910";
final String fcstRegion = "BOSN";
NonConvSigmetRecord record = new NonConvSigmetRecord();
final String testBull = "WSUS01 KKCI 071510\n\n\r" +
"WS1N \n\n\r"+
"BOSN WS 071510 \n\n\r" +
"SIGMET NOVEMBER 3 VALID UNTIL 071910Z\n\n\r" +
"NY LO PA OH LE WV VA MD NC SC GA \n\n\r" +
"FROM MSS TO FLO TO LGC TO GQO TO HMV TO CLE TO 30NNW BUF TO MSS \n\n\r" +
"OCNL SEV TURB BTN 080 AND FL250. RPRTD BY ACFT. REPLACES SIGMET \n\n\r" +
"NOVEMBER 2. CONDS CONTG BYD 1910Z.";
Calendar startTime = null;
Calendar endTime = null;
try {
startTime = Util.findCurrentTime(stTimeString);
endTime = Util.findCurrentTime(endTimeString);
} catch (DataFormatException e) {
System.out.println("Unable to get start and end time");
}
record = NonConvSigmetParser.processStartEndTime(testBull, record, null);
Calendar sttimeRet=record.getStartTime();
Calendar endtimeRet=record.getEndTime();
String regionRet= record.getForecastRegion();
assertEquals(startTime,sttimeRet);
assertEquals(endTime,endtimeRet);
assertEquals(fcstRegion, regionRet);
}
@Test
public void testProcessPhenomena() {
final String corRemarks = " ";
final int flightLevel1 = 80;
final int flightLevel2 = 250;
final String hazardType ="TURB";
final String hazardIntensity="OCNL SEV";
final String hazardCause="RPRTD BY ACFT";
final String hazardCondition="CONDS CONTG BYD 1910Z";
final String stateList ="NY LO PA OH LE WV VA MD NC SC GA";
final String awipsId = "WS1N";
NonConvSigmetRecord record = new NonConvSigmetRecord();
final String testBull = "WSUS01 KKCI 071510\n\n\r" +
"WS1N\n\n\r"+
"BOSN WS 071510\n\n\r" +
"SIGMET NOVEMBER 3 VALID UNTIL 071910\n\n\r" +
"NY LO PA OH LE WV VA MD NC SC GA\n\n\r" +
"FROM MSS TO FLO TO LGC TO GQO TO HMV TO CLE TO 30NNW BUF TO MSS\n\n\r" +
"OCNL SEV TURB BTN 080 AND FL250. RPRTD BY ACFT. REPLACES SIGMET\n\n\r" +
"NOVEMBER 2. CONDS CONTG BYD 1910Z.";
record = NonConvSigmetParser.processPhenomena(testBull, record);
String corrRet = record.getCorrectionRemarks();
int flLevelRet1 =record.getFlightLevel1();
int flLevelRet2 =record.getFlightLevel2();
String hazardTypeRet=record.getHazardType();
String hazardIntensityRet=record.getHazardIntensity();
String hazardCauseRet=record.getHazardCause();
String hazardConditionRet=record.getHazardCondition();
String stListRet=record.getStateList();
String awipsIdRet=record.getAwipsId();
assertEquals(flightLevel1, flLevelRet1);
assertEquals(flightLevel2, flLevelRet2);
assertEquals(hazardType, hazardTypeRet);
assertEquals(hazardIntensity, hazardIntensityRet);
assertEquals(hazardCause, hazardCauseRet);
assertEquals(hazardCondition, hazardConditionRet);
assertEquals(stateList, stListRet);
assertEquals(awipsId, awipsIdRet);
assertEquals(corRemarks, corrRet);
}
@Test
public void testProcessSigmetId() {
final String sigmetId = "NOVEMBER 3";
NonConvSigmetRecord record = new NonConvSigmetRecord();
final String testBull = "WSUS01 KKCI 071510\n\n\r" +
"WS1N \n\n\r"+
"BOSN WS 071510 \n\n\r" +
"SIGMET NOVEMBER 3 VALID UNTIL 071910\n\n\r" +
"NY LO PA OH LE WV VA MD NC SC GA \n\n\r" +
"FROM MSS TO FLO TO LGC TO GQO TO HMV TO CLE TO 30NNW BUF TO MSS \n\n\r" +
"OCNL SEV TURB BTN 080 AND FL250. RPRTD BY ACFT. REPLACES SIGMET \n\n\r" +
"NOVEMBER 2. CONDS CONTG BYD 1910Z.";
record = NonConvSigmetParser.processSigmetId(testBull, record);
String sigmetIdRet = record.getSigmetId();
assertEquals(sigmetId, sigmetIdRet);
}
}

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<requestPatterns xmlns:ns2="group">
<regex>^W[CSV]US0[1-6].*</regex>
</requestPatterns>

View file

@ -5,7 +5,7 @@
Name: awips2-ldm
Summary: AWIPS II LDM Distribution
Version: 6.8.1
Release: 26
Release: 27
Group: AWIPSII
BuildRoot: /tmp
URL: N/A

View file

@ -380,7 +380,7 @@ IDS|DDPLUS ^(FOUS[67].) (....) (..)(..)(..)
# FILE -overwrite -log -close -edex /data_store/misc_adm_messages/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H
#
# separate out svrwx lsr and GSM misc adm messages
IDS|DDPLUS ^(N[A-VYZ]....) (.{4}) (..)(..)(..)
IDS|DDPLUS|HDS ^(N[A-VYZ]....) (.{4}) (..)(..)(..)
FILE -overwrite -log -close -edex /data_store/misc_adm_messages/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H
IDS|DDPLUS ^(NWUS[01346-9].) (.{4}) (..)(..)(..)
FILE -overwrite -log -close -edex /data_store/misc_adm_messages/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H

View file

@ -340,6 +340,8 @@ fi
if [ "${1}" = "-edex" ]; then
buildRPM "awips2"
buildRPM "Installer.ncep-database"
buildRPM "awips2-gfesuite-client"
buildRPM "awips2-gfesuite-server"
buildEDEX
if [ $? -ne 0 ]; then
exit 1
@ -357,6 +359,14 @@ if [ "${1}" = "-qpid" ]; then
exit 0
fi
if [ "${1}" = "-gfesuite" ]; then
buildRPM "awips2"
buildRPM "awips2-gfesuite-client"
buildRPM "awips2-gfesuite-server"
exit 0
fi
if [ "${1}" = "-ldm" ]; then
# Ensure that the user has root privileges.
if [ ! ${UID} = 0 ]; then