VLab Issue #5020 - DCS_16776 Ingest and display MBA; fixes #5020

Change-Id: I5206e4efa240924caf07c4499bfb3b4cdf5aee5d

Former-commit-id: e5e15da2f57e336d8f23444ab0932b710ad2c033
This commit is contained in:
Zihou Wang 2014-11-21 15:42:10 +00:00
parent 2bc144f4ab
commit 4fe74892ea
13 changed files with 620 additions and 4 deletions

View file

@ -154,5 +154,6 @@
#???|256 | 0 | 0.25 | 230 | PRE | Inst Precip Rate (PRE) | Radial | y | | | | Z | | | | |63
166| 0 | 0 | 0.0 | 230 | ML | Melting Layer (ML) | Graphic | y | | | | Z | | | | |67
170|256 | 0 | 0.25 | 230 | DAA | One Hour Unbiased Accum (DAA) | Radial | | | | |0.01S| | | | |69
196| 0 | 0 | 0.0 | 50 | MBA | Microburst AMDA (MBA) | Generic | | | | | | | | | |28
500| 8 | 0 | 0.463| 463 | Z | Reflectivity (Z) | Radial | | | | | | | | | |64
550| 8 | 0 | 0.926| 111 | Z | Reflectivity (Z) | Radial | | | | | | | | | |64

View file

@ -61,6 +61,7 @@
<item mne="MD"/>
<item mne="DMD"/>
<item mne="GFM"/>
<item mne="MBA"/>
<item mne="MRU"/>
<item mne="TVS"/>
<item mne="TRU"/>

View file

@ -223,6 +223,14 @@
<substitute key="latest" value="true" />
<substitute key="elevation" value="0.0--360.0" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarGraphic.xml"
menuText="Microburst AMDA (MBA)" id="${icao}MicroburstAMDA">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="196" />
<substitute key="mode" value="" />
<substitute key="latest" value="true" />
<substitute key="elevation" value="0.0--360.0" />
</contribute>
<contribute xsi:type="command"
commandId="com.raytheon.viz.radar.ui.RadarDisplayControls" menuText="Radar Display Controls..."
id="${icao}GraphicsRadarDisplayControls" />

View file

@ -0,0 +1,209 @@
/**
* 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.viz.radar.interrogators;
import java.util.HashMap;
import java.util.Map;
import javax.measure.converter.UnitConverter;
import javax.measure.unit.NonSI;
import javax.measure.unit.SI;
import org.opengis.referencing.operation.MathTransform;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.common.dataplugin.radar.RadarDataKey;
import com.raytheon.uf.common.dataplugin.radar.RadarDataPoint;
import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
import com.raytheon.uf.common.dataplugin.radar.level3.MBAPacket.MBAAttributeIDs;
import com.raytheon.uf.common.dataplugin.radar.level3.MBAPacket.MBACategory;
import com.raytheon.uf.common.dataplugin.radar.level3.generic.AreaComponent;
import com.raytheon.uf.common.dataplugin.radar.level3.generic.GenericDataComponent;
import com.raytheon.uf.common.geospatial.CRSCache;
import com.raytheon.viz.radar.ui.RadarDisplayControls;
import com.raytheon.viz.radar.ui.RadarDisplayManager;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Envelope;
/**
* Interrogator class for Radar GFM sampling.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 11/06/2014 DCS 16776 zwang Initial creation
*
* </pre>
*
* @author zwang
* @version 1.0
*/
public class RadarMBAInterrogator extends RadarGraphicInterrogator implements
IRadarInterrogator {
public RadarMBAInterrogator() {
super();
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.radar.interrogators.IRadarInterrogator#sample(com.raytheon
* .edex.plugin.radar.RadarRecord, com.vividsolutions.jts.geom.Coordinate,
* com.raytheon.uf.viz.core.drawables.ColorMapParameters)
*/
@Override
public Map<String, String> sample(RadarRecord record, Coordinate latLon,
ColorMapParameters params) {
Map<String, String> dataMap = new HashMap<String, String>();
if (latLon == null) {
return null;
}
double[] input = { latLon.x, latLon.y }; // rr
double[] output = new double[2]; // rr
try {
MathTransform mt = CRSCache.getInstance().getTransformFromLatLon(
record.getCRS());
mt.transform(input, 0, output, 0, 1);
dataMap.put("crsLocation", output == null ? "-1,-1" : output[0]
+ "," + output[1]);
} catch (Exception e) {
return null;
}
dataMap.put("ICAO", record.getIcao());
dataMap.put("Mnemonic", record.getMnemonic());
addParameters(record, latLon, dataMap);
return dataMap;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.radar.interrogators.IRadarInterrogator#addParameters
* (com.raytheon.uf.common.dataplugin.radar.RadarRecord,
* com.vividsolutions.jts.geom.Coordinate, java.util.Map)
*/
@Override
public int addParameters(RadarRecord radarRecord, Coordinate latLon,
Map<String, String> dataMap) {
dataMap.put("Value", getDataValues(radarRecord, latLon));
return 0;
}
private String getDataValues(RadarRecord radarRecord, Coordinate latLon) {
StringBuffer rval = new StringBuffer();
Coordinate c1 = new Coordinate(latLon.x + .025, latLon.y + .025);
Coordinate c2 = new Coordinate(latLon.x - .025, latLon.y - .025);
Envelope env = new Envelope(c1, c2);
UnitConverter metersPerSecondToKnots = SI.METERS_PER_SECOND
.getConverterTo(NonSI.KNOT);
// Determine if the feature should be sampled
RadarDisplayControls currentSettings = RadarDisplayManager
.getInstance().getCurrentSettings();
if (radarRecord.getProductCode() == 196) {
for (RadarDataKey key : radarRecord.getSymbologyData().keySet()) {
Coordinate currStorm = new Coordinate(key.getLon(),
key.getLat());
if (env.contains(currStorm)) {
// Get the data for the select feature
RadarDataPoint currPoint = radarRecord.getSymbologyData()
.get(key);
AreaComponent currFeature;
HashMap<Integer, HashMap<Integer, GenericDataComponent>> currPointData = currPoint
.getDisplayGenericPointData();
for (Integer type : currPointData.keySet()) {
for (GenericDataComponent currComp : currPointData.get(
type).values()) {
currFeature = (AreaComponent) currComp;
// Category: CATEGORY
String category = currFeature
.getValue(MBAAttributeIDs.CATEGORY
.toString());
// if MBA is filtered out by category, do not sample
int catValue = category.equals("") ? 0 : Integer
.parseInt(category);
// By default, do not show MBA Wind Shear
int minCat = 1;
if (currentSettings.isMbaShowWindShear())
minCat = 0;
if (catValue >= minCat) {
// Microburst strength: DELTAV
String strength = currFeature
.getValue(MBAAttributeIDs.DELTAV.toString());
if ((strength != null) && (strength.length() > 0)) {
double strengthValue = metersPerSecondToKnots
.convert(new Double(strength));
strength = String.format("%dkts", (int) strengthValue);
}
// Maximum wind speed: MAXWINDSPEED
String maxSpeed = currFeature
.getValue(MBAAttributeIDs.MAXWINDSPEED
.toString());
if ((maxSpeed != null) && (maxSpeed.length() > 0)) {
double spdValue = metersPerSecondToKnots
.convert(new Double(maxSpeed));
maxSpeed = String.format("%dkts", (int) spdValue);
}
// Maximum shear: MAXSHEAR
String maxShear = currFeature
.getValue(MBAAttributeIDs.MAXSHEAR
.toString());
if ((maxShear != null) && (maxShear.length() > 0)) {
double shearValue = new Double(maxShear);
maxShear = String.format("%.4f/s", shearValue);
}
rval.append(MBACategory.getCatName(catValue));
rval.append(" " + maxShear);
rval.append(" maxV " + maxSpeed);
rval.append(" deltaV " + strength);
}
}
}
}
}
}
return rval.toString();
}
}

View file

@ -34,6 +34,7 @@ import com.raytheon.viz.radar.interrogators.RadarGFMInterrogator;
import com.raytheon.viz.radar.interrogators.RadarDefaultInterrogator;
import com.raytheon.viz.radar.interrogators.RadarEETInterrogator;
import com.raytheon.viz.radar.interrogators.RadarGraphicInterrogator;
import com.raytheon.viz.radar.interrogators.RadarMBAInterrogator;
import com.raytheon.viz.radar.interrogators.RadarPrecipInterrogator;
import com.raytheon.viz.radar.interrogators.RadarRadialInterrogator;
import com.raytheon.viz.radar.interrogators.RadarRasterInterrogator;
@ -60,6 +61,7 @@ import com.raytheon.viz.radar.ui.xy.RadarXsectXYResource;
* Aug 4, 2010 mnash Initial creation
* 03/04/2013 DCS51 zwang Handle GFM product
* 05/02/2013 DR 14587 D. Friedman Add isVelocityProductCode
* 09/26/2014 DCS16776 zwang Add product Microburst AMDA (MBA)
*
* </pre>
*
@ -99,6 +101,9 @@ public class RadarProductFactory {
}
else if (productCode == 140) {
interrogator = new RadarGFMInterrogator();
}
else if (productCode == 196) {
interrogator = new RadarMBAInterrogator();
} else {
interrogator = new RadarGraphicInterrogator();
}

View file

@ -41,6 +41,7 @@ import com.raytheon.uf.common.dataplugin.radar.level3.DMDPacket.DMDAttributeIDs;
import com.raytheon.uf.common.dataplugin.radar.level3.GFMPacket;
import com.raytheon.uf.common.dataplugin.radar.level3.HdaHailPacket.HdaHailPoint;
import com.raytheon.uf.common.dataplugin.radar.level3.LinkedVector;
import com.raytheon.uf.common.dataplugin.radar.level3.MBAPacket.MBAAttributeIDs;
import com.raytheon.uf.common.dataplugin.radar.level3.MesocyclonePacket.MesocyclonePoint;
import com.raytheon.uf.common.dataplugin.radar.level3.SCITDataPacket;
import com.raytheon.uf.common.dataplugin.radar.level3.SCITDataPacket.SCITDataCell;
@ -107,6 +108,7 @@ import com.vividsolutions.jts.geom.LineString;
* Aug 11, 2014 3504 mapeters Replaced deprecated IODataPreparer
* instances with IRenderedImageCallback.
* Sep 03, 2014 3574 njensen Properly dispose objects
* Nov 06, 2014 16776 zwang Handle AMDA product MBA
*
* </pre>
*
@ -443,6 +445,15 @@ public class RadarGraphicsPage implements IRenderable {
}
}
}
// MBA
else if (type == 196) {
// Handle each Feature in the MBA Packet
for (GenericDataComponent currComponent : stormData
.getDisplayGenericPointData().get(type).values()) {
// Handle Graphic portion
drawMbaImage(currComponent);
}
}
}
// Only display storm id if other information is being displayed
@ -973,6 +984,50 @@ public class RadarGraphicsPage implements IRenderable {
return images;
}
// Handle MBA product
private void drawMbaImage(GenericDataComponent currPt)
throws VizException {
double x, y;
Coordinate point;
// Determine if the feature should be rendered
RadarDisplayControls currentSettings = RadarDisplayManager
.getInstance().getCurrentSettings();
AreaComponent currFeature = (AreaComponent) currPt;
String cat = currFeature.getValue(MBAAttributeIDs.CATEGORY
.getName());
int catValue = cat.equals("") ? 0 : Integer.parseInt(cat);
// By default, do not show MBA Wind Shear
int minCat = 1;
if (currentSettings.isMbaShowWindShear())
minCat = 0;
if (catValue >= minCat) {
int numPoints = currFeature.getPoints().size();
Coordinate[] points = new Coordinate[numPoints];
// Draw Microburst cell
try {
for (int k = 0; k < numPoints; k++) {
x = currFeature.getPoints().get(k).getCoordinate1();
y = currFeature.getPoints().get(k).getCoordinate2();
// convert xy to latlon
point = referencedGfmCoord(x, y).asLatLon();
points[k] = point;
}
wireframeShape.addLineSegment(points);
} catch (TransformException e) {
throw new VizException(e);
} catch (FactoryException e) {
throw new VizException(e);
}
}
}
private PlotObject getImage(HdaHailPoint currPt) throws VizException {
PlotObject image = null;

View file

@ -53,6 +53,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04 DEC 2007 373 lvenable Initial creation
* 06 Nov 2014 DCS 16776 zwang Add control for MBA
*
* </pre>
*
@ -127,6 +128,11 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
*/
private Scale minFeatureScale;
/**
* Show MBA Wind Shear check box.
*/
private Button showMbaWindShear;
/**
* Overlap Mesos check box.
*/
@ -224,6 +230,8 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
addSeparator();
createDmdControls();
addSeparator();
createMbaControls();
addSeparator();
createSrmControls();
createCustomStormMotionGroup();
createCloseButton();
@ -273,6 +281,7 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
overlapMesosChk.setSelection(values.isDmdShowOverlapping());
dmdTrackToShowCbo.select(dmdTrackToShowCbo.indexOf(values
.getDmdTrackType().toString()));
showMbaWindShear.setSelection(values.isMbaShowWindShear());
stormMotionRdo.setSelection(values.getSrmSource().equals(
RadarSRMResource.SRMSource.WARNGEN));
averageStormRdo.setSelection(values.getSrmSource().equals(
@ -660,6 +669,31 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
});
}
/**
* Create the MBA controls.
*/
private void createMbaControls() {
Composite mbaComp = new Composite(shell, SWT.NONE);
GridLayout gl = new GridLayout(2, false);
mbaComp.setLayout(gl);
GridData gd = new GridData(60, SWT.DEFAULT);
Label mbaLbl = new Label(mbaComp, SWT.NONE);
mbaLbl.setFont(labelFont);
mbaLbl.setForeground(getDisplay().getSystemColor(SWT.COLOR_BLUE));
mbaLbl.setText("MBA");
mbaLbl.setLayoutData(gd);
showMbaWindShear = new Button(mbaComp, SWT.CHECK);
showMbaWindShear.setText("Show Wind Shear");
showMbaWindShear.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
values.setMbaShowWindShear(showMbaWindShear.getSelection());
}
});
}
/**
* Create the SRM radio button controls.
*/

View file

@ -29,7 +29,7 @@ import com.raytheon.viz.radar.ui.RadarDisplayManager.TrackTypes;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
*
* 11/06/2014 DCS 16776 zwang Add control for MBA
*
* </pre>
*
@ -59,6 +59,8 @@ public class RadarDisplayControls {
private boolean dmdShowOverlapping;
private TrackTypes dmdTrackType = TrackTypes.PAST_AND_FORECAST;
private boolean mbaShowWindShear;
private SRMSource srmSource;
@ -201,6 +203,25 @@ public class RadarDisplayControls {
}
}
/**
* @return the mbaShowWindShear
*/
public boolean isMbaShowWindShear() {
return mbaShowWindShear;
}
/**
* @param mbaShowWindShear
* the mbaShowWindShear to set
*/
public void setMbaShowWindShear(boolean mbaShowWindShear) {
if (mbaShowWindShear != this.mbaShowWindShear) {
this.mbaShowWindShear = mbaShowWindShear;
RadarDisplayManager.getInstance().displayConfigUpdated();
}
}
/**
* @return the srmSource
*/

View file

@ -171,5 +171,6 @@
#???|256 | 0 | 0.25 | 230 | PRE | Inst Precip Rate | Radial | y | | | | Z | | | | |63 |
166|0 |0 |0.0 |230 |ML |Melting Layer |{S} {T} Melting Layer |{S} {T} ML |Graphic|y | | | |Z | | | | |67 |
170|256 |0 |0.25 |230 |DAA |One Hour Unbiased Accum |{S} Dual Pol Unbiased One Hour Accum ({U}) |{S} DAA |Radial | | | | |0.01S| | | | |69 |in/100
196|0 |0 |0.0 | 50 |MBA |Microburst AMDA |{S} Microburst AMDA |{S} MBA |Graphic| | | | | | | | | |28 |
500|8 |0 |0.463 |463 | Z |Reflectivity |{S} Reflectivity ({U}) |{S} Z |Radial | | | | | | | | | |64 |dBZ
550|8 |0 |0.926 |111 | Z |Reflectivity |{S} Reflectivity ({U}) |{S} Z |Radial | | | | | | | | | |64 |dBZ

View file

@ -352,4 +352,15 @@
</list>
</constructor-arg>
</bean>
<bean factory-bean="radarPacketFactory" factory-method="registerGenericPacketType">
<constructor-arg
value="com.raytheon.uf.common.dataplugin.radar.level3.MBAPacket"
type="java.lang.Class" />
<constructor-arg>
<list>
<value>196</value>
</list>
</constructor-arg>
</bean>
</beans>

View file

@ -27,6 +27,7 @@ import com.raytheon.uf.common.dataplugin.radar.level3.SymbologyPacket;
import com.raytheon.uf.common.dataplugin.radar.level3.SymbologyPoint;
import com.raytheon.uf.common.dataplugin.radar.level3.DMDPacket.DMDAttributeIDs;
import com.raytheon.uf.common.dataplugin.radar.level3.GFMPacket.GFMAttributeIDs;
import com.raytheon.uf.common.dataplugin.radar.level3.MBAPacket.MBAAttributeIDs;
import com.raytheon.uf.common.dataplugin.radar.level3.StormIDPacket.StormIDPoint;
import com.raytheon.uf.common.dataplugin.radar.level3.generic.GenericDataComponent;
import com.raytheon.uf.common.serialization.ISerializableObject;
@ -44,6 +45,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* ------------ ---------- ----------- --------------------------
* Feb 17, 2009 2000 askripsk Initial creation
* 03/04/2013 DCS51 zwang Handle GFM product
* 09/26/2014 DCS16776 zwang Handle AMDA product
*
* </pre>
*
@ -305,6 +307,11 @@ public class RadarDataPoint implements ISerializableObject {
stormID += ":";
stormID += deltaT;
}
// MBA
else if (type == 196) {
stormID = point.getValue(MBAAttributeIDs.DETECT_ID
.toString());
}
if (!"".equalsIgnoreCase(stormID)) {
this.stormID = stormID;

View file

@ -74,6 +74,7 @@ import com.raytheon.uf.common.dataplugin.radar.level3.HdaHailPacket.HdaHailPoint
import com.raytheon.uf.common.dataplugin.radar.level3.Layer;
import com.raytheon.uf.common.dataplugin.radar.level3.LinkedContourVectorPacket;
import com.raytheon.uf.common.dataplugin.radar.level3.LinkedVectorPacket;
import com.raytheon.uf.common.dataplugin.radar.level3.MBAPacket;
import com.raytheon.uf.common.dataplugin.radar.level3.MesocyclonePacket;
import com.raytheon.uf.common.dataplugin.radar.level3.MesocyclonePacket.MesocyclonePoint;
import com.raytheon.uf.common.dataplugin.radar.level3.SCITDataPacket;
@ -135,7 +136,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Dec 18, 2013 16002 kshrestha Added logic to match all dBZ values in
* the DHR with AWIPS1
* Jun 11, 2014 2061 bsteffen Remove IDecoderGettable
*
* Nov 06, 2014 16776 zwang Handle AMDA product
*
* </pre>
*
@ -1192,9 +1193,9 @@ public class RadarRecord extends PersistablePluginDataObject implements
if (needToConvert) {
Coordinate coor;
// for MIGFA, i/j unit is 1km, for other radar products, unit is
// for MIGFA and AMDA, i/j unit is 1km, for other radar products, unit is
// 1/4km
if (type == 140) {
if (type == 140 || type == 196) {
coor = convertStormLatLon(i * 4.0, j * 4.0);
} else {
coor = convertStormLatLon(i, j);
@ -1511,6 +1512,42 @@ public class RadarRecord extends PersistablePluginDataObject implements
currFeature, convertLatLon);
}
continue PACKET;
} else if (currPacket instanceof MBAPacket) {
// Need to get each component/feature out and located the
// thing
MBAPacket packet = (MBAPacket) currPacket;
// need to convert x/y to lon/lat
convertLatLon = true;
AreaComponent currFeature;
for (GenericDataComponent currComponent : packet
.getFeatures().values()) {
currFeature = (AreaComponent) currComponent;
// Calculate the center point of the MBA cell
double x, y;
double totalX = 0.0;
double totalY = 0.0;
double centerX = 0.0;
double centerY = 0.0;
int numP = currFeature.getPoints().size();
for (int kk = 0; kk < numP; kk++) {
x = currFeature.getPoints().get(kk).getCoordinate1();
y = currFeature.getPoints().get(kk).getCoordinate2();
totalX += x;
totalY += y;
}
if (numP != 0) {
centerX = totalX / (double)numP;
centerY = totalY / (double)numP;
}
addPacketData(centerX, centerY, type, RadarProductType.GENERIC,
currFeature, convertLatLon);
}
continue PACKET;
} else if (currPacket instanceof GenericDataPacket) {
// Generic Packet will contain most of the data for the
// product, so, in general, nothing probably needs to be

View file

@ -0,0 +1,226 @@
/**
* 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.uf.common.dataplugin.radar.level3;
import java.io.DataInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import com.raytheon.uf.common.dataplugin.radar.level3.generic.GenericDataComponent;
import com.raytheon.uf.common.dataplugin.radar.level3.generic.GenericDataParameter;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* This is a MBA (Microburst AMDA) centric version of the Generic Packet
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 09/26/2014 DCS 16776 zwang Initial creation
*
* </pre>
*
* @author zwang
* @version 1.0
*/
@DynamicSerialize
public class MBAPacket extends GenericDataPacket {
public static enum MBAAttributeIDs {
DETECT_ID("detect_num"), DELTAV("deltav"), MAXWINDSPEED("maxWindSpeed"),
MAXSHEAR("maxShear"), CATEGORY("category");
private String name;
private MBAAttributeIDs(String name) {
this.name = name;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name
* the name to set
*/
public void setName(String name) {
this.name = name;
}
public static MBAAttributeIDs getAttribute(String name) {
for (MBAAttributeIDs id : MBAAttributeIDs.values()) {
if (name.equals(id.getName())) {
return id;
}
}
return null;
}
@Override
public String toString() {
return name;
}
}
public static enum MBACategory {
WindShear(0), Microburst(1), Macroburst(2), SpeedShear(3);
private final int catValue;
private MBACategory(int catValue) {
this.catValue = catValue;
}
/**
* @return the catValue
*/
public int getCatValue() {
return catValue;
}
public static String getCatName(int cat) {
for (MBACategory id : MBACategory.values()) {
if (cat == id.getCatValue()) {
return id.toString();
}
}
return null;
}
}
@DynamicSerializeElement
private List<String> featureIDs;
// Organizes the components/features based on DETECT_ID
@DynamicSerializeElement
private HashMap<String, GenericDataComponent> features;
@DynamicSerializeElement
private HashMap<String, GenericDataParameter> params;
public MBAPacket(int packetId, DataInputStream in) throws IOException {
super(packetId, in);
}
public MBAPacket() {
}
public String getValue(String featureID, MBAAttributeIDs attributeID) {
String rval = "";
rval = features.get(featureID).getValue(attributeID.toString());
return rval;
}
/**
* @return the featureIDs
*/
public List<String> getFeatureIDs() {
return featureIDs;
}
/**
* @param featureIDs
* the featureIDs to set
*/
public void setFeatureIDs(List<String> featureIDs) {
this.featureIDs = featureIDs;
}
/**
* @return the features
*/
public HashMap<String, GenericDataComponent> getFeatures() {
return features;
}
/**
* @param features
* the features to set
*/
public void setFeatures(HashMap<String, GenericDataComponent> features) {
this.features = features;
}
public GenericDataComponent getFeature(String eventID) {
GenericDataComponent rval = null;
rval = this.features.get(eventID);
return rval;
}
public HashMap<String, GenericDataParameter> getParams() {
return params;
}
public void setParams(HashMap<String, GenericDataParameter> params) {
this.params = params;
}
/**
* Converts the components to GFM Features and groups by gfmID
*/
private void groupFeatures() {
features = new HashMap<String, GenericDataComponent>();
featureIDs = new ArrayList<String>();
params = new HashMap<String, GenericDataParameter>();
String detectID = "";
for (GenericDataParameter param : parameters) {
params.put(param.getId(), param);
}
// Get the DETECT_ID out of each component
for (GenericDataComponent currFeature : components) {
// Loop through the values for the DETECT_ID
for (GenericDataParameter currParam : currFeature.getParameters()) {
if (currParam.getId().equalsIgnoreCase(
MBAAttributeIDs.DETECT_ID.toString()))
detectID = currParam.getValue();
}
features.put(detectID, currFeature);
featureIDs.add(detectID);
}
}
@Override
protected void init(DataInputStream in) throws IOException {
super.init(in);
// Relates all of the GFM feature based on the gfmID
groupFeatures();
}
@Override
public String toString() {
return super.toString();
}
}