Issue #2316 Unify pirep and ncpirep.

Former-commit-id: 37dcf924bd [formerly 62fef686b8] [formerly e542f18440 [formerly e07ea17d953739f853e87e6ed150e013a9b7ae07]]
Former-commit-id: e542f18440
Former-commit-id: 92a69aa69c
This commit is contained in:
Ben Steffensmeier 2013-09-05 11:02:23 -05:00
parent 4234d8d812
commit 72ad2bd11c
70 changed files with 294 additions and 4663 deletions

View file

@ -128,13 +128,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.dataplugin.pirep"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.dataplugin.poessounding"
download-size="0"

View file

@ -199,7 +199,7 @@
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.common.dataplugin.ncpirep"
id="gov.noaa.nws.ncep.common.dataplugin.pirep"
download-size="0"
install-size="0"
version="0.0.0"

View file

@ -32,22 +32,13 @@ xmlns:xlink="http://www.w3.org/1999/xlink" style="stroke: rgb(255,255,255);">
font-family: WxSymbolFont;
}
text.special
{
fill: none;
font-size: 1em;
stroke-width: 1px;
font-size: 1em;
font-family: SpecialSymbolFont;
}
]]>
</style>
<symbol overflow="visible" id="plotData" class="info">
<text id="iceInensity" plotMode="table" class="weather" plotLookupTable="icing_intens_trans.txt" plotParam="ICI" x="0" y="0">0</text>
<text id="fltLvlText" plotMode="text" plotParam="FLT_LVL" plotFormat="%3.0f" plotUnit="hft" style="text-anchor: end;" x="-15px" y="0px">75</text>
<text id="iceType" plotMode="table" class="weather" plotLookupTable="icing_type_trans.txt" plotParam="ICT" style="text-anchor: end" x="0" y="-10">0</text>
<!--text id="topText" plotMode="text" plotParam="TOP_HGT" plotFormat="%3.0f" plotUnit="hft" style="text-anchor: end;" x="-15px" y="-15px">75</text-->
<!--text id="botText" plotMode="text" plotParam="BOT_HGT" plotFormat="%3.0f" plotUnit="hft" style="text-anchor: end;" x="-15px" y="15px">75</text-->
<text id="sampleText" plotMode="sample" plotParam="obsText"> </text>
<text id="iceInensity" plotMode="table" class="weather" plotLookupTable="icing_intens_trans.txt" plotParam="iceInten" x="0" y="0">0</text>
<text id="fltLvlText" plotMode="text" plotParam="flightLevel" plotFormat="%3.0f" plotUnit="hft" style="text-anchor: end;" x="-15px" y="0px">75</text>
<text id="iceType" plotMode="table" class="weather" plotLookupTable="icing_type_trans.txt" plotParam="iceType" style="text-anchor: end" x="0" y="-10">0</text>
</symbol>
</defs>

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -5,6 +5,64 @@ overflow="visible"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" style="stroke: rgb(255,255,255);">
<defs>
<script type="text/python" plotDelegate="plotDelegate">
import time
class PirepPlotDelegate(PlotDelegate):
def __init__(self):
PlotDelegate.__init__(self)
def getSampleText(self, rec):
# use obsText for pirep
if rec.isValidParameter("obsText"):
return rec.getString("obsText")
# rebuild text for airep
sampleString = "ARP "
sampleString += rec.getString("stationId")
sampleString += " "
lat = rec.getFloat("latitude")
if(lat &lt; 0):
sampleString += "%.3fS " % (-1*lat)
else:
sampleString += "%.3fN " % (lat)
lon = rec.getFloat("longitude")
if(lon &lt; 0):
sampleString += "%.3fW " % (-1*lon)
else:
sampleString += "%.3fE " % (lon)
timeObs = rec.getLong("timeObs")
sampleString += time.strftime("%H%M",time.localtime(timeObs/1000))
sampleString += " F%d" % (rec.getInt("flightLevel")/100)
temp = rec.getFloat("temperature")
if temp &lt; -273.15:
pass
elif temp &lt; 0:
sampleString += " M%d" % (int(-1*temp))
else:
sampleString += " P%d" % (int(temp))
windDir = int(rec.getFloat("windDir"))
windSpeed = int(rec.getFloat("windSpeed"))
if windDir > -1080 or windSpeed > 0:
sampleString += " %d/%dKT" % (windDir, windSpeed)
turbFreq = rec.getString("turbFreq")
turbInten = rec.getString("turbInten")
turbType = rec.getString("turbType")
if turbFreq != "" or turbInten != "" or turbType != "":
sampleString += " TB"
if turbFreq != "":
sampleString += " "
sampleString += turbFreq
if turbInten != "":
sampleString += " "
sampleString += turbInten
if turbType != "":
sampleString += " "
sampleString += turbType
return sampleString
plotDelegate = PirepPlotDelegate()
</script>
<style type="text/css">
<![CDATA[
@font-face { font-family: "WindSymbolFont";
@ -22,13 +80,6 @@ xmlns:xlink="http://www.w3.org/1999/xlink" style="stroke: rgb(255,255,255);">
font-size: 1em;
font-family: WindSymbolFont;
}
text.arrow
{
fill: none;
font-size: 1em;
font-size: 1em;
font-family: WindSymbolFont;
}
text.text
{
fill: none;
@ -37,28 +88,14 @@ xmlns:xlink="http://www.w3.org/1999/xlink" style="stroke: rgb(255,255,255);">
font-family: StandardFont;
font-size: 1em;
}
text.weather
{
fill: none;
font-size: 1em;
stroke-width: 1px;
font-family: WxSymbolFont;
}
text.special
{
fill: none;
font-size: 1em;
stroke-width: 1px;
font-size: 1em;
font-family: SpecialSymbolFont;
}
]]>
</style>
<symbol overflow="visible" id="plotData" class="info">
<text id="fltLvlText" plotMode="text" plotParam="FLT_LVL" plotFormat="%3.0f" plotUnit="hft" style="text-anchor: start;" x="10px" y="-10px">75</text>
<text id="tempText" plotMode="text" plotParam="T" plotFormat="%3.0f" style="text-anchor: end;" x="-10px" y="-10px">75</text>
<g id="windVaneText" plotMode="barb" plotParam="WS,WD" plotUnit="kts" x="0" y="0" transform="rotate(0,0,0)">
<text id="sampleParams1" plotMode="sample" plotParam="obsText,stationId,longitude,latitude,timeObs,flightLevel"> </text>
<text id="sampleParams2" plotMode="sample" plotParam="temperature,windDir,windSpeed,turbInten,turbFreq,turbType"> </text>
<text id="fltLvlText" plotMode="text" plotParam="flightLevel" plotFormat="%3.0f" plotUnit="hft" style="text-anchor: start;" x="10px" y="-10px">75</text>
<text id="tempText" plotMode="text" plotParam="temperature" plotFormat="%3.0f" style="text-anchor: end;" x="-10px" y="-10px">75</text>
<g id="windVaneText" plotMode="barb" plotParam="windSpeed,windDir" plotUnit="kts" x="0" y="0" transform="rotate(0,0,0)">
<text id="windVaneText" class="arrow" x="0" y="0">0</text>
<text id="windArrowText" class="barb" x="0" y="0">arrow</text>
</g>

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 4 KiB

View file

@ -32,22 +32,13 @@ xmlns:xlink="http://www.w3.org/1999/xlink" style="stroke: rgb(255,255,255);">
font-family: WxSymbolFont;
}
text.special
{
fill: none;
font-size: 1em;
stroke-width: 1px;
font-size: 1em;
font-family: SpecialSymbolFont;
}
]]>
</style>
<symbol overflow="visible" id="plotData" class="info">
<text id="turbInensity" plotMode="table" class="weather" plotLookupTable="turb_intens_trans.txt" plotParam="TBI" x="0" y="0">0</text>
<text id="fltLvlText" plotMode="text" plotParam="FLT_LVL" plotFormat="%3.0f" plotUnit="hft" style="text-anchor: end;" x="-15px" y="0px">75</text>
<text id="turbFreq" plotMode="table" class="weather" plotLookupTable="turb_freq_trans.txt" plotParam="TBF" style="text-anchor: end" x="0" y="-10">0</text>
<!--text id="topText" plotMode="text" plotParam="TOP_HGT" plotUnit="hft" plotFormat="%3.0f" style="text-anchor: end;" x="-15px" y="-15px">75</text-->
<!--text id="botText" plotMode="text" plotParam="BOT_HGT" plotUnit="hft" plotFormat="%3.0f" style="text-anchor: end;" x="-15px" y="15px">75</text-->
<text id="sampleText" plotMode="sample" plotParam="obsText"> </text>
<text id="turbInensity" plotMode="table" class="weather" plotLookupTable="turb_intens_trans.txt" plotParam="turbInten" x="0" y="0">0</text>
<text id="fltLvlText" plotMode="text" plotParam="flightLevel" plotFormat="%3.0f" plotUnit="hft" style="text-anchor: end;" x="-15px" y="0px">75</text>
<text id="turbFreq" plotMode="table" class="weather" plotLookupTable="turb_freq_trans.txt" plotParam="turbFreq" style="text-anchor: end" x="0" y="-10">0</text>
</symbol>
</defs>

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -82,14 +82,13 @@ import com.raytheon.viz.pointdata.rsc.PlotResourceData;
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 11/20/2006 brockwoo Initial creation.
* 03/16/2009 jsanchez Added processAvailDirective.
* 06/29/2009 2538 jsanchez Implemented pointdata.
* ======================================
* AWIPS2 DR Work
* 08/09/2012 1085 jkorman Corrected data construction.
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Nov 20, 2006 brockwoo Initial creation.
* Mar 16, 2009 jsanchez Added processAvailDirective.
* Jun 29, 2009 2538 jsanchez Implemented pointdata.
* Aug 09, 2012 1085 jkorman Corrected data construction.
* Sep 05, 2013 2316 bsteffen Unify pirep and ncpirep.
*
* </pre>
*
@ -1015,7 +1014,7 @@ public class PlotModelFactory2 {
sb.append(" ");
sb.append(fields[i]);
}
display = sb.toString();
display = sb.toString().trim();
}
if (element.lookup != null) {

View file

@ -51,12 +51,15 @@ import com.raytheon.viz.pointdata.rsc.retrieve.PointDataPlotInfoRetriever;
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 17, 2009 njensen Initial creation
* Jun 29, 2009 2538 jsanchez Implemented Metars.
* May 14, 2013 1869 bsteffen Get plots working without dataURI
* Aug 09, 2013 2033 mschenke Switched File.separator to IPathManager.SEPARATOR
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Feb 17, 2009 njensen Initial creation
* Jun 29, 2009 2538 jsanchez Implemented Metars.
* May 14, 2013 1869 bsteffen Get plots working without dataURI
* Aug 09, 2013 2033 mschenke Switched File.separator to
* IPathManager.SEPARATOR
* Sep 05, 2013 2316 bsteffen Unify pirep and ncpirep.
*
*
* </pre>
*
@ -148,7 +151,6 @@ public class PlotResourceData extends AbstractRequestableResourceData {
* These use the original PlotResource, whoever can convert these gets
* to delete thousands of lines of code, it will be amazing.
*/
pluginProps.put("pirep", new PluginPlotProperties(false, false));
pluginProps.put("airep", new PluginPlotProperties(false, false));
pluginProps.put("acars", new PluginPlotProperties(false, false));
@ -191,6 +193,7 @@ public class PlotResourceData extends AbstractRequestableResourceData {
pluginProps.put("bufrmthdw", new PluginPlotProperties());
pluginProps.put("bufrssmi", new PluginPlotProperties());
pluginProps.put("madis", new PluginPlotProperties());
pluginProps.put("pirep", new PluginPlotProperties());
ParsedURL.registerHandler(new LocalizationParsedURLHandler());
}

View file

@ -0,0 +1,7 @@
#!/bin/bash
# DR #2316 drop pirep,ncpirep,airep,ncairep
PSQL="/awips2/psql/bin/psql"
${PSQL} -U awips -d metadata -c "delete from plugin_info where name = 'pirep' or name = 'ncpirep';"
${PSQL} -U awips -d metadata -c "drop table pirep, pirep_anc_data, ncpirep, ncpirep_anc_data;"

View file

@ -95,7 +95,6 @@
<exclude>ncep-util-on-edex-ingestGrib</exclude>
<exclude>ncscd-ingest.xml</exclude>
<exclude>ncpafm-ingest.xml</exclude>
<exclude>ncpirep-ingest.xml</exclude>
<exclude>nctaf-ingest.xml</exclude>
<exclude>nctext-ingest.xml</exclude>
<exclude>ncuair-ingest.xml</exclude>

View file

@ -1,7 +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="output" path="bin"/>
</classpath>

View file

@ -1,7 +0,0 @@
#Thu Mar 26 10:21:52 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,20 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Pirep Plug-in
Bundle-SymbolicName: com.raytheon.edex.plugin.pirep
Bundle-Version: 1.12.1174.qualifier
Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization
Bundle-Vendor: RAYTHEON
Require-Bundle: com.raytheon.edex.common,
com.raytheon.uf.edex.pointdata,
com.raytheon.uf.edex.decodertools;bundle-version="1.0.0",
org.geotools,
javax.measure,
javax.persistence,
org.apache.camel;bundle-version="1.0.0";resolution:=optional
Export-Package: com.raytheon.edex.plugin.pirep,
com.raytheon.edex.plugin.pirep.dao,
com.raytheon.edex.plugin.pirep.decoder
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.raytheon.uf.common.dataplugin.pirep,
org.apache.commons.logging

View file

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

View file

@ -1,260 +0,0 @@
/**
* 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.pirep;
import java.util.Calendar;
import java.util.List;
import com.raytheon.edex.esb.Headers;
import com.raytheon.edex.exception.DecoderException;
import com.raytheon.edex.plugin.AbstractDecoder;
import com.raytheon.edex.plugin.pirep.decoder.PirepParser;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.pirep.PirepLayerData;
import com.raytheon.uf.common.dataplugin.pirep.PirepRecord;
import com.raytheon.uf.common.pointdata.spatial.AircraftObsLocation;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.edex.decodertools.aircraft.AircraftCloudLayer;
import com.raytheon.uf.edex.decodertools.aircraft.AircraftFlightCondition;
import com.raytheon.uf.edex.decodertools.core.BasePoint;
import com.raytheon.uf.edex.decodertools.core.DecoderTools;
import com.raytheon.uf.edex.decodertools.core.IDecoderInput;
import com.raytheon.uf.edex.decodertools.time.TimeTools;
import com.raytheon.uf.edex.wmo.message.WMOHeader;
/**
* Decoder strategy for text PIREP observation data. Most common usage is as
* follows. <code>
* PirepDecoder dec = new PirepDecoder();
* dec.setMessage(msgData);
* while(dec.hasNext())
* {
* PluginDataObject r = dec.decode();
* // do something with record.
* }
* </code>
*
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 03, 2008 384 jkorman Initial Coding.
* Jan 28, 2008 861 jkorman Add pirep layer data.
* Apr 08, 2008 1039 jkorman Added traceId for tracing data.
* Nov 13, 2008 1684 chammack Camel Refactor
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class PirepDecoder extends AbstractDecoder {
// Name of the plugin controlling this decoder.
private final String PLUGIN_NAME;
/**
* Construct this decoder using supplied plugin name.
*
* @throws DecoderException
*/
public PirepDecoder(String pluginName) throws DecoderException {
PLUGIN_NAME = pluginName;
}
/**
* Get the next decoded data record.
*
* @param input
* the input
* @return One record of decoded data.
* @throws DecoderException
* Thrown if no data is available.
*/
public PluginDataObject[] decode(IDecoderInput input, Headers headers)
throws DecoderException {
PluginDataObject[] reports = null;
String traceId = "";
if (headers != null) {
traceId = (String) headers.get("traceId");
}
try {
logger.debug(traceId + "- PirepDecoder.decode()");
PirepRecord report = populateRecord(
new PirepParser(input.getReport(), traceId, headers),
input.getWmoHeader());
if (report != null) {
report.setTraceId(traceId);
try {
report.constructDataURI();
} catch (PluginException e) {
fixTrace(e);
logger.error(traceId + "- Unable to construct dataURI", e);
}
reports = new PluginDataObject[] { report };
}
} catch (Exception e) {
fixTrace(e);
logger.error(traceId + "- Error in PirepDecoder", e);
} finally {
if (reports == null) {
reports = new PluginDataObject[0];
}
}
return reports;
}
/**
* Populate a PirepRecord with data that was decoded from a single PIREP
* report.
*
* @param parser
* The PIREP parser that contains the decoded data.
* @param wmoHeader
* the wmo header
* @return The populated record. This method returns a null reference if
* either the observation time or location data is unavailable.
*/
private PirepRecord populateRecord(PirepParser parser, WMOHeader wmoHeader) {
PirepRecord record = null;
AircraftObsLocation location = null;
if (parser != null) {
// If there is no observation time or location,
// don't bother going further.
Calendar oTime = parser.getObservationTime();
BasePoint p = parser.getLocation();
if ((oTime != null) && (p != null)) {
record = new PirepRecord();
location = new AircraftObsLocation();
record.setTimeObs(oTime);
record.setRefHour(TimeTools.copyToNearestHour(oTime));
DataTime dataTime = new DataTime(oTime);
record.setDataTime(dataTime);
record.setWmoHeader(wmoHeader.getWmoHeader());
record.setObsText(DecoderTools.normalizeObs(
parser.getReportData(), wmoHeader.getWmoHeader()));
location.setLatitude(p.getLatitude());
location.setLongitude(p.getLongitude());
location.setLocation(p.getLatitude(), p.getLongitude());
record.setReportData(parser.getReportData());
record.setReportType(parser.getReportType());
location.setFlightLevel(parser.getFlightLevel());
record.setAircraftType(parser.getAircraftType());
record.setTemp(parser.getTemperature());
record.setWindDirection(parser.getWindDirection());
record.setWindSpeed(parser.getWindSpeed());
record.setLocation(location);
record.setHorzVisibility(parser.getHorxVisibility());
// Collect the decoded icing flight conditions data
List<AircraftFlightCondition> icing = parser.getIcingLayers();
if (icing != null) {
PirepLayerData iceLayer = null;
for (AircraftFlightCondition layer : icing) {
if ((iceLayer = PirepLayerData.getLayerData(layer)) != null) {
iceLayer.setLayerType(PirepLayerData.LAYER_TYP_ICING);
record.addLayer(iceLayer);
}
} // for
}
// Collect the decoded turbulence flight conditions data
List<AircraftFlightCondition> turbc = parser
.getTurbulenceLayers();
if (turbc != null) {
PirepLayerData turbLayer = null;
for (AircraftFlightCondition layer : turbc) {
if ((turbLayer = PirepLayerData.getLayerData(layer)) != null) {
turbLayer
.setLayerType(PirepLayerData.LAYER_TYP_TURBC);
record.addLayer(turbLayer);
}
} // for
}
List<AircraftCloudLayer> clouds = parser.getCloudLayers();
if (clouds != null) {
PirepLayerData cloudLayer = null;
for (AircraftCloudLayer layer : clouds) {
if ((cloudLayer = PirepLayerData
.getCloudLayerData(layer)) != null) {
record.addLayer(cloudLayer);
}
} // for
}
String[] weatherCodes = parser.getWeatherCodes();
if (weatherCodes != null) {
StringBuilder sb = new StringBuilder();
for (String code : weatherCodes) {
sb.append(code);
sb.append(" ");
}
record.setWeatherGroup(sb.toString().trim());
}
}
}
return record;
}
/**
*
* @param e
* @return
*/
private Throwable fixTrace(Throwable e) {
StackTraceElement[] trace = e.getStackTrace();
StackTraceElement[] newTrace = null;
int traceIdx = trace.length - 1;
for (; traceIdx >= 0; traceIdx--) {
StackTraceElement element = trace[traceIdx];
if (element.getClassName().indexOf("com.raytheon") >= 0) {
break;
}
}
if (traceIdx >= 0) {
newTrace = new StackTraceElement[traceIdx + 1];
for (int j = 0; j < (traceIdx + 1); j++) {
newTrace[j] = trace[j];
}
e.setStackTrace(newTrace);
}
return e;
}
}

View file

@ -1,202 +0,0 @@
/**
* 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.pirep;
import static com.raytheon.uf.edex.decodertools.core.IDecoderConstants.WMO_HEADER;
import java.util.ArrayList;
import java.util.List;
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.uf.edex.decodertools.core.DecoderInput;
import com.raytheon.uf.edex.decodertools.core.DecoderTools;
import com.raytheon.uf.edex.decodertools.core.IDecoderInput;
import com.raytheon.uf.edex.wmo.message.WMOHeader;
/**
* The PirepSeparator takes a potential weather message and attempts to
* determine the WMO header and data type of the enclosed data. Normal usage is
* to create an instance and set the message data using the setData method. When
* complete the separator contains the WMO header, the message data with all
* leading data up to and including the WMO header removed. In addition all
* extraneous spaces and carriage control has been removed. The message reports
* are available using hasNext to determine if data is available, and the
* getRecord method to retrieve the actual report data. Note that this separator
* implementation should not be used on mixed text/binary weather messages.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 20080103 384 jkorman Initial Coding.
* 20080219 861 jkorman Clean up javadoc.
* ======================================
* AWIPS2 DR Work
* 20120911 1011 jkorman Changed to handle end of report
* properly.
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class PirepSeparator extends AbstractRecordSeparator {
/** The logger */
private Log logger = LogFactory.getLog(getClass());
private static final String PIREP_HDR = "[\\r\\n]*.*(UA|UUA) +/OV";
private static final String EOR_E = "=";
private static final String EOR_S = ";";
private WMOHeader wmoHeader = null;
private byte[] messageData = null;
private List<String> reports = null;
private int currentReport = -1;
public static PirepSeparator separate(byte[] data, Headers headers) {
PirepSeparator pirepSeparator = new PirepSeparator();
pirepSeparator.setData(data, headers);
return pirepSeparator;
}
/**
* Get the next record. This implementation returns the record as a String.
*
* @return The next observation record as a String.
*/
@Override
public IDecoderInput next() {
IDecoderInput data = null;
if (hasNext()) {
data = new DecoderInput(wmoHeader, reports.get(currentReport++));
}
return data;
}
/**
* Is there another record available?
*
* @return Is there another record available?
*/
@Override
public boolean hasNext() {
return ((reports != null) && (reports.size() > 0) && (currentReport < reports
.size()));
}
/**
* Set the raw message data and invoke the internal message separation
* process.
*
* @param rawMessage
* The raw weather text message.
*/
@Override
public void setData(byte[] rawMessage, Headers headers) {
currentReport = -1;
reports = null;
rawMessage = DecoderTools.cleanData(rawMessage);
if (rawMessage != null) {
wmoHeader = new WMOHeader(rawMessage, headers);
if (wmoHeader.isValid()) {
messageData = DecoderTools.stripWMOHeader(rawMessage,
WMO_HEADER);
doSeparate(new String(messageData));
}
}
if ((reports != null) && (reports.size() > 0)) {
currentReport = 0;
} else {
String msg = (wmoHeader != null) ? wmoHeader.getWmoHeader() : "";
logger.info("No reports in data in " + msg);
}
}
/**
* Get the message data.
*
* @return The cleaned message data.
*/
public byte[] getMessage() {
return messageData;
}
/**
* Get the WMO header associated with the message data.
*
* @return The WMO header.
*/
public WMOHeader getWmoHeader() {
return wmoHeader;
}
/**
* Separate the candidate message into individual pirep reports based on the
* report header .
*
* @param message
* The message data to separate.
*/
private void doSeparate(String message) {
Pattern pattern = Pattern.compile(PIREP_HDR);
Matcher matcher = pattern.matcher(message);
ArrayList<Integer> bodyRecords = new ArrayList<Integer>();
bodyRecords = new ArrayList<Integer>();
while (matcher.find()) {
bodyRecords.add(matcher.start());
}
reports = new ArrayList<String>();
for (int i = 0; i < bodyRecords.size(); i++) {
String observation = null;
if (i < bodyRecords.size() - 1) {
observation = message.substring(bodyRecords.get(i),
bodyRecords.get(i + 1)).trim();
} else {
observation = message.substring(bodyRecords.get(i)).trim();
}
if(observation.endsWith(EOR_E) || observation.endsWith(EOR_S)) {
observation = observation.substring(0, observation.length() - 1);
}
reports.add(observation);
}
bodyRecords = null;
}
}

View file

@ -1,95 +0,0 @@
/**
* 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.pirep.dao;
import java.util.List;
import com.raytheon.edex.db.dao.DefaultPluginDao;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.pirep.PirepRecord;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.edex.database.DataAccessLayerException;
/**
* Set of DAO methods for Surface Observation data.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 20080103 384 jkorman Initial Coding.
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class PirepDao extends DefaultPluginDao {
/**
* Creates a new ReccoDao
*/
public PirepDao(String pluginName) throws PluginException {
super(pluginName);
}
/**
* Retrieves an sfcobs report using the datauri .
*
* @param dataURI
* The dataURI to match against.
* @return The report record if it exists.
*/
public PirepRecord queryByDataURI(String dataURI) {
PirepRecord report = null;
List<?> obs = null;
try {
obs = queryBySingleCriteria("dataURI", dataURI);
} catch (DataAccessLayerException e) {
e.printStackTrace();
}
if ((obs != null) && (obs.size() > 0)) {
report = (PirepRecord) obs.get(0);
}
return report;
}
/**
* Queries for to determine if a given data uri exists on the sfcobs table.
*
* @param dataUri
* The DataURI to find.
* @return An array of objects. If not null, there should only be a single
* element.
*/
public Object[] queryDataUriColumn(final String dataUri) {
String sql = "select datauri from awips.pirep where datauri='"
+ dataUri + "';";
Object[] results = executeSQLQuery(sql);
return results;
}
}

View file

@ -1,445 +0,0 @@
/**
* 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.pirep.decoder;
import java.util.ArrayList;
import java.util.List;
import com.raytheon.uf.edex.decodertools.aircraft.AircraftFlightCondition;
import com.raytheon.uf.edex.decodertools.aircraft.Entry;
import com.raytheon.uf.edex.decodertools.aircraft.WordTranslator;
/**
* Perform decode on PIREP turbulence layers.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 10, 2011 jkorman Initial creation
* ======================================
* AWIPS2 DR Work
* 08/09/2012 1011 jkorman Removed test code to unit test.
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class PirepTools {
private static final char SPACE = ' ';
private static final char DASH = '-';
private static final char SOLIDUS = '/';
private static final int INT_ID = 1;
private static final int FRQ_ID = 2;
private static final int TYP_ID = 3;
private static final int MOD_ID = 4;
private static final int SYN_ID = 5;
public static final int TURBC_SYN_NONE = 0;
public static final int TURBC_SYN_DASH = 1;
public static final int TURBC_SYN_SPC = 2;
public static final int MOD_ID_ABV = 0;
public static final int MOD_ID_BLO = 1;
public static final int MOD_ID_UNK = 2;
public static final int TURBC_FRQ_NONE = 0;
public static final int TURBC_FRQ_OCN = 1;
public static final int TURBC_FRQ_ISO = 2;
public static final int TURBC_FRQ_INT = 3;
public static final int TURBC_FRQ_CON = 4;
public static final int TURBC_INT_NONE = 0;
public static final int TURBC_INT_SMOOTHLGT = 1;
public static final int TURBC_INT_LGT = 2;
public static final int TURBC_INT_LGTMOD = 3;
public static final int TURBC_INT_MOD = 4;
public static final int TURBC_INT_MODSEV = 5;
public static final int TURBC_INT_SEV = 6;
public static final int TURBC_INT_EXTRM = 8;
public static final int TURBC_TYP_NONE = 0;
public static final int TURBC_TYP_CAT = 1;
public static final int TURBC_TYP_CHOP = 2;
public static final int TURBC_TYP_LLWS = 3;
private static final WordTranslator TURBC_WORDS = new WordTranslator();
static {
TURBC_WORDS.enter("OCN", "OCN", false, 1, FRQ_ID);
TURBC_WORDS.enter("OCA", "OCN", false, 1, FRQ_ID);
TURBC_WORDS.enter("OCNL", "OCN", false, 1, FRQ_ID);
TURBC_WORDS.enter("ISO", "ISO", false, 1, FRQ_ID);
TURBC_WORDS.enter("INT", "INT", false, 2, FRQ_ID);
TURBC_WORDS.enter("STE", "STE", false, 3, FRQ_ID);
TURBC_WORDS.enter("CON", "CON", false, 3, FRQ_ID);
TURBC_WORDS.enter("SMTH", "NEG", false, TURBC_INT_NONE, INT_ID);
TURBC_WORDS.enter("SMT[A-Z]", "NEG", true, TURBC_INT_NONE, INT_ID);
TURBC_WORDS.enter("SM[A-Z]H", "NEG", true, TURBC_INT_NONE, INT_ID);
TURBC_WORDS.enter("NONE", "NEG", false, TURBC_INT_NONE, INT_ID);
TURBC_WORDS.enter("NIL", "NEG", false, TURBC_INT_NONE, INT_ID);
TURBC_WORDS.enter("NEG", "NEG", false, TURBC_INT_NONE, INT_ID);
TURBC_WORDS.enter("SMOOTH", "NEG", false, TURBC_INT_NONE, INT_ID);
TURBC_WORDS.enter("LIG", "LGT", false, TURBC_INT_LGT, INT_ID);
TURBC_WORDS.enter("LIT", "LGT", false, TURBC_INT_LGT, INT_ID);
TURBC_WORDS.enter("LGT", "LGT", false, TURBC_INT_LGT, INT_ID);
TURBC_WORDS.enter("LIGHT", "LGT", false, TURBC_INT_LGT, INT_ID);
TURBC_WORDS.enter("SLIGHT", "LGT", false, TURBC_INT_LGT, INT_ID);
TURBC_WORDS.enter("MOD", "MOD", false, TURBC_INT_MOD, INT_ID);
TURBC_WORDS.enter("MDT", "MOD", false, TURBC_INT_MOD, INT_ID);
TURBC_WORDS.enter("SEV", "SEV", false, TURBC_INT_SEV, INT_ID);
TURBC_WORDS.enter("SVR", "SEV", false, TURBC_INT_SEV, INT_ID);
TURBC_WORDS.enter("HVY", "SEV", false, TURBC_INT_SEV, INT_ID);
TURBC_WORDS.enter("EXTRM", "EXTRM", false, TURBC_INT_EXTRM, INT_ID);
TURBC_WORDS.enter("EXTRE", "EXTRM", false, TURBC_INT_EXTRM, INT_ID);
TURBC_WORDS.enter("XTRM", "EXTRM", false, TURBC_INT_EXTRM, INT_ID);
TURBC_WORDS.enter("CHOP", "CHOP", false, TURBC_TYP_CAT, TYP_ID);
TURBC_WORDS.enter("CAT", "CAT", false, TURBC_TYP_CHOP, TYP_ID);
TURBC_WORDS.enter("LLWS", "LLWS", false, TURBC_TYP_LLWS, TYP_ID);
TURBC_WORDS.enter("ABV", "ABV", false, MOD_ID_ABV, MOD_ID);
TURBC_WORDS.enter("ABOVE", "ABV", false, MOD_ID_ABV, MOD_ID);
TURBC_WORDS.enter("BLO", "BLO", false, MOD_ID_BLO, MOD_ID);
TURBC_WORDS.enter("BELOW", "BLO", false, MOD_ID_BLO, MOD_ID);
TURBC_WORDS.enter("UNK", "UNK", false, MOD_ID_UNK, MOD_ID);
TURBC_WORDS.enter("UNKN", "UNK", false, MOD_ID_UNK, MOD_ID);
TURBC_WORDS.enter("UNKNOWN", "UNK", false, MOD_ID_UNK, MOD_ID);
TURBC_WORDS.enter("TO", "-", false, TURBC_SYN_DASH, SYN_ID);
TURBC_WORDS.enter("-", "-", false, TURBC_SYN_DASH, SYN_ID);
}
// Data that may contain layer information.
private String layerData;
// Layers decoded from layerData
private List<String> layers;
/**
* Construct zero or more layers from the supplied data.
* @param data A string that may contain layer information.
*/
public PirepTools(String data) {
layerData = data;
separateLayers();
}
/**
* Separate the layer data into individual layers delimited by
* a solidus "/" character.
*/
private void separateLayers() {
layers = new ArrayList<String>();
if (layerData != null) {
int pos = layerData.indexOf(SOLIDUS);
int lastPos = 0;
while (pos > lastPos) {
layers.add(layerData.substring(lastPos, pos));
// move past the solidus
lastPos = pos + 1;
pos = layerData.indexOf(SOLIDUS, lastPos);
}
// Add the remainder of the data.
layers.add(layerData.substring(lastPos));
}
}
/**
* Perform the decode function on all layers that were found in the
* data.
* @return A list of AircraftFlightConditions for each layer decoded. Return
* an empty list if no data was found.
*/
public List<AircraftFlightCondition> decodeTurbulenceData() {
List<AircraftFlightCondition> tbLayers = new ArrayList<AircraftFlightCondition>();
if (layers != null) {
for (String layer : layers) {
AircraftFlightCondition tbLayer = decodeLayer(layer);
if (tbLayer != null) {
tbLayers.add(tbLayer);
}
}
}
return tbLayers;
}
/**
* Perform the actual decode function of a single layer.
* @param layer One layer of turbulence data to be decoded.
* @return The decoded turbulence conditions. Returns a null value
* if proper data was not found or an error occured.
*/
private AircraftFlightCondition decodeLayer(String layer) {
AircraftFlightCondition tbLayer = null;
List<String> words = separateLayer(layer);
for(int i = 0;i < words.size();i++) {
String s = words.get(i);
Entry e = TURBC_WORDS.translate(s);
if(e != null) {
words.set(i,e.getTranslatedWord());
} else {
if(s.length() > 3) {
e = TURBC_WORDS.translate(s.substring(0,3));
if((e != null)&&(e.getSecondId() == FRQ_ID)) {
words.set(i,e.getTranslatedWord());
}
}
}
}
AircraftFlightCondition afc = new AircraftFlightCondition();
if(analysis(words, afc)) {
tbLayer = afc;
}
// Ensure the intensities are in the correct order.
reOrderIntensity(tbLayer);
// Ensure the heights are in ascending order.
reOrderHeight(tbLayer);
return tbLayer;
}
/**
*
* @param words
* @param afc Target flight condition object to receive the turbulence
* information.
* @return Was the operation successful.
*/
private boolean analysis(List<String> words, AircraftFlightCondition afc) {
boolean success = true;
boolean seenFreq = false;
boolean intA = false;
boolean intB = false;
boolean typ = false;
boolean flA = false;
boolean flB = false;
boolean modSeen = false;
for(String word : words) {
Entry e = TURBC_WORDS.translate(word);
if(e != null) {
Integer id = e.getSecondId();
switch(id) {
case INT_ID: {
if (!intA) {
afc.setIntensity1(word);
intA = true;
} else {
if (!intB) {
afc.setIntensity2(word);
intB = true;
}
}
break;
}
case FRQ_ID: {
if(!seenFreq) {
afc.setFrequency(word);
}
break;
}
case TYP_ID: {
if (!typ) {
afc.setType(word);
}
break;
}
case MOD_ID: {
switch(e.getFirstId()) {
case MOD_ID_ABV : {
afc.setTopHeight(-9999);
flB = true;
break;
}
case MOD_ID_BLO : {
afc.setBaseHeight(-9999);
flA = true;
break;
}
}
break;
}
case SYN_ID: {
break;
}
}
} else {
// check to see if this is a flight level
try {
if (!flA) {
int n = Integer.parseInt(word);
afc.setBaseHeight(n * 100);
flA = true;
} else {
if (!flB) {
int n = Integer.parseInt(word);
afc.setTopHeight(n * 100);
flB = true;
}
}
} catch(NumberFormatException nfe) {
}
}
}
return success;
}
/**
* Separate the layer information into a list of words separated
* by spaces or a dash "-".
* @param layer
* @return
*/
private List<String> separateLayer(String layer) {
List<String> words = new ArrayList<String>();
if((layer != null)&&(layer.length() > 0)) {
StringBuilder sb = new StringBuilder(layer);
for(int i = 0;i < sb.length();i++) {
switch(sb.charAt(i)) {
case '\n' :
case '\r' :
case '\t' : {
sb.setCharAt(i, SPACE);
}
}
}
layer = sb.toString();
String [] ss = layer.split(String.valueOf(SPACE));
for(String s : ss) {
int i = s.indexOf(DASH);
if(i == 0) {
words.add(String.valueOf(DASH));
words.add(s.substring(1));
} else if(i > 0) {
words.add(s.substring(0,i));
words.add(String.valueOf(DASH));
words.add(s.substring(i+1));
} else {
if(!String.valueOf(SPACE).equals(s)) {
words.add(s);
}
}
}
}
return words;
}
/**
* If there are two intensity modifiers, reorder them so the the
* lower intensity occurs first.
* @param layer A layer that may contain intensity modifiers.
*/
private void reOrderIntensity(AircraftFlightCondition layer) {
if(layer != null) {
Integer iA = TURBC_WORDS.getFirstId(layer.getIntensity1());
Integer iB = TURBC_WORDS.getFirstId(layer.getIntensity2());
if(iA != null) {
if(iB != null) {
if(iA > iB) {
String t = layer.getIntensity1();
layer.setIntensity1(layer.getIntensity2());
layer.setIntensity2(t);
}
}
}
}
}
/**
* If there are two heights, reorder them so the the
* lower height occurs first.
* @param layer A layer that may contain layer heights.
*/
private void reOrderHeight(AircraftFlightCondition layer) {
if(layer != null) {
Integer iA = layer.getBaseHeight();
Integer iB = layer.getTopHeight();
if(iA != null) {
if(iB != null) {
if((iA > 0) && (iA > iB)) {
Integer t = layer.getBaseHeight();
layer.setBaseHeight(layer.getTopHeight());
layer.setTopHeight(t);
}
}
}
}
}
/**
* Attempt to convert a string to an integer value.
*
* @param aNumber
* A possible integer value.
* @return The converted number or null if conversion failed.
*/
public static Integer parseInteger(String aNumber) {
Integer retValue = null;
try {
retValue = new Integer(aNumber.trim());
} catch (NumberFormatException nfe) {
retValue = null;
}
return retValue;
} // parseInteger()
}

View file

@ -1,124 +0,0 @@
/**
* 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.pirep.decoder;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/**
* Enum that identifies the PIREP Text Element Indicators (TEIs).
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* AWIPS2 DR Work
* Aug 7, 2012 1011 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public enum TEI implements Iterable<TEI> {
// This TEI is used to identify the start of the PIREP, i.e. SSS [UA|UUA]
PIREP("PIREP"), OV("/OV "), TM("/TM "), FL("/FL"), TP("/TP"), SK("/SK "), WX(
"/WX"), TA("/TA"), WV("/WV"), TB("/TB"), IC("/IC"), RM("/RM"),
NF("NF"); // These two don't go into the id map!
// Map of valid TEIs.
private static Map<String, TEI> ID_MAP = new HashMap<String, TEI>();
static {
ID_MAP.put(OV.id, OV);
ID_MAP.put(TM.id, TM);
ID_MAP.put(FL.id, FL);
ID_MAP.put(TP.id, TP);
ID_MAP.put(SK.id, SK);
ID_MAP.put(WX.id, WX);
ID_MAP.put(TA.id, TA);
ID_MAP.put(WV.id, WV);
ID_MAP.put(TB.id, TB);
ID_MAP.put(IC.id, IC);
ID_MAP.put(RM.id, RM);
}
private String id;
/**
* Construct a TEI with a specified identifier.
*
* @param id
* The identifier to assign.
*/
private TEI(String id) {
this.id = id;
}
/**
* Get the identifier for this TEI.
*
* @return The TEI identifier.
*/
public String getId() {
return id;
}
/**
* Get the string representation of this TEI. This returns the same as
* getId().
*
* @return The TEI string representation.
*/
public String toString() {
return id;
}
/**
* Get an iterator to the valid TEIs. This iterable iterator the TEI NF (not
* found).
*
* @return An iterator to the valid TEIs.
*/
@Override
public Iterator<TEI> iterator() {
return ID_MAP.values().iterator();
}
/**
* Get a TEI based on its string identifier. Returns the TEI "NF" if the TEI
* identifier could not be found.
*
* @param id
* A candidate TEI identifier.
* @return The TEI found, or NF if not found.
*/
public static TEI getTEI(String id) {
TEI tei = NF;
if (ID_MAP.containsKey(id)) {
tei = ID_MAP.get(id);
}
return tei;
}
}

View file

@ -1,219 +0,0 @@
/**
* 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.pirep.decoder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Parse Pilot Report (PIREP) Text Element Indicators (TEIs) from potential
* report text. This
*
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* AWIPS2 DR Work
* Aug 7, 2012 1011 jkorman Initial creation
* Aug 23, 2012 1011 jkorman Change control characters to spaces.
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class TEIInfo implements Comparable<TEIInfo> {
// The start position of this TEI within the decoded data.
private int start;
// The stop position of this TEI's text within the decoded data.
private int stop;
// The TEI associated with the info.
private TEI tei;
// The extracted text associated with this TEI.
private String teiText;
/**
* Construct a TEIInfo instance with a given TEI, position, and index.
*
* @param tei
* @param position
* @param teiIndex
*/
private TEIInfo(TEI tei, int position) {
this.tei = tei;
start = position;
}
/**
*
*/
@Override
public String toString() {
return String.format("%s:%d:%d:%d", tei, start, stop);
}
/**
* Calculate the hashCode for this instance.
*
* @return The calculated hashCode.
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + start;
result = prime * result + ((tei == null) ? 0 : tei.hashCode());
result = prime * result + ((teiText == null) ? 0 : teiText.hashCode());
return result;
}
/**
* Is this instance equal to another object instance.
*
* @return Is this instance equal to another object instance.
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TEIInfo other = (TEIInfo) obj;
if (start != other.start)
return false;
if (tei != other.tei)
return false;
if (teiText == null) {
if (other.teiText != null)
return false;
} else if (!teiText.equals(other.teiText))
return false;
return true;
}
/**
* Override compareTo for TEIInfo. This method uses the start position of
* the TEI within the decoded data as the comparands.
*/
@Override
public int compareTo(TEIInfo t) {
return (t.start == start) ? 0 : (t.start < start) ? 1 : -1;
}
/**
* Get the TEI that was decoded.
*
* @return The decoded TEI.
*/
public TEI getTei() {
return tei;
}
/**
* Get the extracted text for the TEI.
*
* @return The TEI extracted text.
*/
public String getTeiText() {
return teiText;
}
/**
* Extract the TEI information as well as the text data associated with that
* TEI into a collection of TEIInfo objects. Out of order data can be correctly
* parsed and returned.
*
* @param str
* Data containing a PIREP.
* @return Returns a list of TEIs found in the input data. Returns a zero
* length list if the input was null or no TEIs could be found.
*/
public static List<TEIInfo> findTEIs(String str) {
List<TEIInfo> positions = new ArrayList<TEIInfo>();
if (str != null) {
StringBuilder sb = new StringBuilder(str);
for(int i = 0;i < sb.length();i++) {
char c = sb.charAt(i);
if(c < ' ') {
sb.setCharAt(i, ' ');
}
}
str = sb.toString();
int teiIndex = 0;
// loop over the valid TEIs
for (TEI tei : TEI.PIREP) {
int n = str.indexOf(tei.getId());
if (n >= 0) {
TEIInfo info = new TEIInfo(tei, n);
positions.add(info);
}
teiIndex++;
}
Collections.sort(positions);
if (positions.size() > 0) {
TEIInfo tt = positions.get(0);
// Ensure that the PIREP is starting correctly!
if (TEI.OV.equals(tt.tei)) {
// Note that this will find both "UA" and "UUA"
if (str.substring(0, tt.start).indexOf("UA") > 0) {
// Insert the PIREP element at the 'head' of the list
positions.add(0, new TEIInfo(TEI.PIREP, 0));
// Now iterate the list and fixup the stop positions
// of each TEI
TEIInfo previous = null;
for (TEIInfo t : positions) {
if (previous == null) {
previous = t;
} else {
previous.stop = t.start;
previous = t;
}
}
// Set the last TEI stop position to the end of the
// report.
previous.stop = str.length();
}
}
}
// Now come in and extract the text associated with each TEI.
for (TEIInfo t : positions) {
if (TEI.PIREP.equals(t.getTei())) {
// Pick up the leading portion of the PIREP
t.teiText = str.substring(t.start, t.stop).trim();
} else {
t.teiText = str.substring(
t.start + t.getTei().getId().length(), t.stop)
.trim();
}
}
}
return positions;
}
}

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<purgeRuleSet>
<defaultRule>
<period>01-00:00:00</period>
</defaultRule>
</purgeRuleSet>

View file

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
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.
-->
<requestPatterns xmlns:ns2="group">
<regex>^UB.*</regex>
</requestPatterns>

View file

@ -1,8 +0,0 @@
#Thu Feb 10 17:06:37 CST 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
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,24 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Pirep
Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.pirep
Bundle-Version: 1.0.0.qualifier
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.dataplugin.annotations,
com.raytheon.uf.common.geospatial,
com.raytheon.uf.common.pointdata.spatial,
com.raytheon.uf.common.serialization,
com.raytheon.uf.common.serialization.annotations,
com.raytheon.uf.common.time,
com.raytheon.uf.edex.decodertools.aircraft,
com.vividsolutions.jts.geom,
javax.measure.quantity,
javax.measure.unit,
javax.persistence
Require-Bundle: com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
com.raytheon.uf.common.dataplugin,
org.hibernate;bundle-version="1.0.0"
Export-Package: com.raytheon.uf.common.dataplugin.pirep

View file

@ -1,2 +0,0 @@
com.raytheon.uf.common.dataplugin.pirep.PirepRecord
com.raytheon.uf.common.dataplugin.pirep.PirepLayerData

View file

@ -1,430 +0,0 @@
/**
* 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.pirep;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.edex.decodertools.aircraft.AircraftCloudLayer;
import com.raytheon.uf.edex.decodertools.aircraft.AircraftFlightCondition;
/**
* This structure holds information about layer type data contained within a
* pirep observation. For turbulence and icing data each layer must have a layer
* type (i.e. icing) and at least one height to be considered valid. Cloud data
* must have at least one cloud cover amount and a height to be considered
* valid. These rules are enforced by using the getLayerData and
* getCloudLayerData factory methods. The user may enforce their own rules by
* setting the data directly.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 20080128 861 jkorman Initial Coding.
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
@Entity
@Table(name="pirep_anc_data")
@DynamicSerialize
@XmlAccessorType(XmlAccessType.NONE)
public class PirepLayerData implements Serializable, ISerializableObject {
private static final long serialVersionUID = 1L;
public static final String LAYER_TYP_ICING = "ICING";
public static final String LAYER_TYP_TURBC = "TURBC";
public static final String LAYER_TYP_CLOUD = "CLOUD";
public static final Integer INDETERMINATE = 99999;
@Id
@GeneratedValue
private Integer recordId = null;
@Column
private Integer obsId;
@ManyToOne
@JoinColumn(name="parent", nullable=false)
private PirepRecord parent = null;
@Column(length=8)
@XmlAttribute
@DynamicSerializeElement
private String layerType;
@Column(length=8)
@XmlAttribute
@DynamicSerializeElement
private String dataType;
@Column(length=8)
@XmlAttribute
@DynamicSerializeElement
private String frequency;
@Column
@XmlAttribute
@DynamicSerializeElement
private Integer baseLayerHeight;
@Column
@XmlAttribute
@DynamicSerializeElement
private Integer topLayerHeight;
@Column(length=8)
@XmlAttribute
@DynamicSerializeElement
private String firstValue;
@Column(length=8)
@XmlAttribute
@DynamicSerializeElement
private String secondValue;
/**
* Construct an empty base.
*/
public PirepLayerData() {
}
/**
* Constructor with known parent.
*
* @param parent
* The parent of this class.
*/
public PirepLayerData(PirepRecord parent) {
this.parent = parent;
}
/**
* Constructor with known parent and observation type.
*
* @param parent
* The parent of this class.
* @param type
* The observation type for this data.
*/
public PirepLayerData(PirepRecord parent, String type) {
this(parent);
layerType = type;
}
/**
* Get the record id.
*
* @return The recordId. If not set returns null.
*/
public Integer getRecordId() {
return recordId;
}
/**
* Set the record id.
*
* @param recordId
* The recordId.
*/
public void setRecordId(Integer recordId) {
this.recordId = recordId;
}
/**
* Get the observation id. This is the foreign key to the parent.
*
* @return The observation id. If not set returns null.
*/
public Integer getObsId() {
return obsId;
}
/**
* Set the observation id. This is the foreign key to the parent.
*
* @param obsId
* The observation id.
*/
public void setObsId(Integer obsId) {
this.obsId = obsId;
}
/**
* Get the parent for this class.
*
* @return the parent
*/
public PirepRecord getParent() {
return parent;
}
/**
* Set the parent for this class.
*
* @param parent
* The parent to set.
*/
public void setParent(PirepRecord parent) {
this.parent = parent;
}
/**
* @return the layerType
*/
public String getLayerType() {
return layerType;
}
/**
* @param layerType
* the layerType to set
*/
public void setLayerType(String layerType) {
this.layerType = layerType;
}
/**
* @return the dataType
*/
public String getDataType() {
return dataType;
}
/**
* @param dataType
* the dataType to set
*/
public void setDataType(String dataType) {
this.dataType = dataType;
}
/**
* @return the frequency
*/
public String getFrequency() {
return frequency;
}
/**
* @param frequency the frequency to set
*/
public void setFrequency(String frequency) {
this.frequency = frequency;
}
/**
* @return the baseLayerHeight
*/
public Integer getBaseLayerHeight() {
return baseLayerHeight;
}
/**
* @param baseLayerHeight
* the baseLayerHeight to set
*/
public void setBaseLayerHeight(Integer baseLayerHeight) {
this.baseLayerHeight = baseLayerHeight;
}
/**
* @return the topLayerHeight
*/
public Integer getTopLayerHeight() {
return topLayerHeight;
}
/**
* @param topLayerHeight
* the topLayerHeight to set
*/
public void setTopLayerHeight(Integer topLayerHeight) {
this.topLayerHeight = topLayerHeight;
}
/**
* @return the firstValue
*/
public String getFirstValue() {
return firstValue;
}
/**
* @param firstValue
* the firstValue to set
*/
public void setFirstValue(String firstValue) {
this.firstValue = firstValue;
}
/**
* @return the secondValue
*/
public String getSecondValue() {
return secondValue;
}
/**
* @param secondValue
* the secondValue to set
*/
public void setSecondValue(String secondValue) {
this.secondValue = secondValue;
}
/**
* Factored out code that creates icing or turbulence layer data.
*
* @param layer
* Decoded flight conditions data (Turbulence or icing)
* @return A populated entry.
*/
public static PirepLayerData getLayerData(AircraftFlightCondition layer) {
PirepLayerData dataLayer = null;
boolean isValid = false;
String intensity = layer.getIntensity1();
if (intensity != null) {
dataLayer = new PirepLayerData();
dataLayer.setFirstValue(intensity);
isValid = true;
}
intensity = layer.getIntensity2();
if (intensity != null) {
dataLayer = getLayer(dataLayer);
dataLayer.setSecondValue(intensity);
isValid = true;
}
String value = layer.getFrequency();
if(value != null) {
dataLayer = getLayer(dataLayer);
dataLayer.frequency = value;
}
String type = layer.getType();
if (type != null) {
dataLayer = getLayer(dataLayer);
dataLayer.setDataType(type);
isValid = true;
}
// if we have at least one intensity and/or type get the height info.
// Note, only reported if different from flight level
if (isValid) {
Integer hgt = layer.getBaseHeight();
if (hgt != null) {
dataLayer = getLayer(dataLayer);
dataLayer.setBaseLayerHeight(hgt);
}
hgt = layer.getTopHeight();
if (hgt != null) {
dataLayer.setTopLayerHeight(hgt);
}
}
if (!isValid) {
dataLayer = null;
}
return dataLayer;
}
/**
* Factored out code that creates icing or turbulence layer data.
*
* @param layer
* Decoded flight conditions data (Turbulence or icing)
* @return A populated entry.
*/
public static PirepLayerData getCloudLayerData(AircraftCloudLayer layer) {
PirepLayerData cloudLayer = null;
boolean isValid = false;
String intensity = layer.getCloudCover1();
if (intensity != null) {
cloudLayer = new PirepLayerData();
cloudLayer.setFirstValue(intensity);
isValid = true;
}
intensity = layer.getCloudCover2();
if (intensity != null) {
cloudLayer = getLayer(cloudLayer);
cloudLayer.setSecondValue(intensity);
isValid = true;
}
// if we have at least one cloud coverage
if (isValid) {
// reset so we can ensure at least one height.
isValid = false;
Integer hgt = layer.getCloudBaseHeight();
if (hgt != null) {
cloudLayer = getLayer(cloudLayer);
cloudLayer.setBaseLayerHeight(hgt);
isValid = true;
}
hgt = layer.getCloudTopHeight();
if (hgt != null) {
cloudLayer = getLayer(cloudLayer);
cloudLayer.setTopLayerHeight(hgt);
isValid = true;
}
}
if (!isValid) {
cloudLayer = null;
}
if (cloudLayer != null) {
cloudLayer.setDataType(null);
cloudLayer.setLayerType(PirepLayerData.LAYER_TYP_CLOUD);
}
return cloudLayer;
}
/**
*
* @param layer
* @return
*/
private static PirepLayerData getLayer(PirepLayerData layer) {
return (layer != null) ? layer : new PirepLayerData();
}
}

View file

@ -1,852 +0,0 @@
/**
* 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.pirep;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import javax.measure.quantity.Angle;
import javax.measure.quantity.Length;
import javax.measure.quantity.Pressure;
import javax.measure.quantity.Temperature;
import javax.measure.quantity.Velocity;
import javax.measure.unit.NonSI;
import javax.measure.unit.SI;
import javax.measure.unit.Unit;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.hibernate.annotations.Index;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
import com.raytheon.uf.common.pointdata.spatial.AircraftObsLocation;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.vividsolutions.jts.geom.Geometry;
/**
* PirepRecord is the Data Access component for pirep observation data.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 03, 2008 384 jkorman Initial Coding.
* Apr 08, 2009 952 jsanchez Updated getValue and getStrings methods.
* Added getMessageData method.
* May 21, 2009 2338 jsanchez Changed the unit of the alititude.
* Apr 04, 2013 1846 bkowal Added an index on refTime and
* forecastTime
* Aug 09, 2012 1011 jkorman Added separate max icing level as well
* as separated code to generate distinct
* max icing/turbulence levels. Removed
* code that used "display" boolean to
* determine data access.
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
* May 07, 2013 1869 bsteffen Remove dataURI column from
* PluginDataObject.
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* </pre>
*
* @author jkorman
* @version 1.0
*/
@Entity
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "pirepseq")
@Table(name = "pirep", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
/*
* Both refTime and forecastTime are included in the refTimeIndex since
* forecastTime is unlikely to be used.
*/
@org.hibernate.annotations.Table(appliesTo = "pirep", indexes = { @Index(name = "pirep_refTimeIndex", columnNames = {
"refTime", "forecastTime" }) })
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class PirepRecord extends PluginDataObject implements ISpatialEnabled,
IDecoderGettable {
private static final long serialVersionUID = 1L;
public static final Unit<Temperature> TEMPERATURE_UNIT = SI.CELSIUS;
public static final Unit<Length> ALTITUDE_UNIT = NonSI.FOOT;
public static final Unit<Velocity> WIND_SPEED_UNIT = NonSI.KNOT;
public static final Unit<Angle> WIND_DIR_UNIT = NonSI.DEGREE_ANGLE;
public static final Unit<Pressure> PRESSURE_UNIT = SI.PASCAL;
public static final Unit<Angle> LOCATION_UNIT = NonSI.DEGREE_ANGLE;
private static final HashMap<String, String> PARM_MAP = new HashMap<String, String>();
private static final HashMap<String, Integer> ICING_MAP = new HashMap<String, Integer>();
private static final HashMap<String, Integer> TURB_MAP = new HashMap<String, Integer>();
static {
PARM_MAP.put("T", SFC_TEMP);
PARM_MAP.put("WS", SFC_WNDSPD);
PARM_MAP.put("WD", SFC_WNDDIR);
PARM_MAP.put("NLAT", STA_LAT);
PARM_MAP.put("NLON", STA_LON);
PARM_MAP.put("FLT_LVL", UA_FLTLVL);
PARM_MAP.put("ICT", UA_ICETYPE);
PARM_MAP.put("ICI", UA_ICEINTENSE);
PARM_MAP.put("TBF", UA_TURBFREQ);
PARM_MAP.put("TBI", UA_TURBINTENSE);
PARM_MAP.put("TOP_HGT", UA_TOPHGT);
PARM_MAP.put("BOT_HGT", UA_BOTHGT);
ICING_MAP.put("", new Integer(0));
ICING_MAP.put("NEG", new Integer(1));
ICING_MAP.put("TRACE", new Integer(2));
ICING_MAP.put("TRACELGT", new Integer(3));
ICING_MAP.put("LGT", new Integer(4));
ICING_MAP.put("LGTMOD", new Integer(5));
ICING_MAP.put("MOD", new Integer(6));
ICING_MAP.put("MODSEV", new Integer(7));
ICING_MAP.put("SEV", new Integer(8));
TURB_MAP.put("", new Integer(0));
TURB_MAP.put("NEG", new Integer(1));
TURB_MAP.put("SMOOTHLGT", new Integer(2));
TURB_MAP.put("LGT", new Integer(3));
TURB_MAP.put("LGTMOD", new Integer(4));
TURB_MAP.put("MOD", new Integer(5));
TURB_MAP.put("MODSEV", new Integer(6));
TURB_MAP.put("SEV", new Integer(7));
TURB_MAP.put("EXTRM", new Integer(8));
}
@Transient
private PirepLayerData maxTurbcLayerData = null;
@Transient
private PirepLayerData maxIcingLayerData = null;
@Transient
private boolean display = true;
@Column
@XmlAttribute
@DynamicSerializeElement
private Integer obsId;
// Time of the observation.
@Column
@XmlAttribute
@DynamicSerializeElement
private Calendar timeObs;
// Time of the observation to the nearest hour.
@Column
@XmlAttribute
@DynamicSerializeElement
private Calendar refHour;
//
@Column
@DataURI(position = 1)
@XmlAttribute
@DynamicSerializeElement
private Integer reportType;
// Text of the WMO header
@Column(length = 32)
@XmlElement
@DynamicSerializeElement
private String wmoHeader;
// Correction indicator from wmo header
@Column(length = 8)
@DataURI(position = 2)
@XmlElement
@DynamicSerializeElement
private String corIndicator;
@Column
@XmlElement
@DynamicSerializeElement
private String aircraftType;
// Observation air temperature in degrees Kelvin.
// Decimal(5,2)
@Column
@XmlElement
@DynamicSerializeElement
private Double temp;
// Observation wind direction in angular degrees. Integer
@Column
@XmlElement
@DynamicSerializeElement
private Integer windDirection;
// Observation wind speed in meters per second.
// Decimal(5,2)
@Column
@XmlElement
@DynamicSerializeElement
private Double windSpeed;
@Column
@XmlElement
@DynamicSerializeElement
private Integer horzVisibility;
@Column
@XmlElement
@DynamicSerializeElement
private String obsText;
@Column(length = 16)
@XmlElement
@DynamicSerializeElement
private String weatherGroup;
@DynamicSerializeElement
@XmlElement
@OneToMany(cascade = CascadeType.ALL, mappedBy = "parent", fetch = FetchType.EAGER)
private Set<PirepLayerData> ancPirepData;
@Embedded
@DataURI(position = 3, embedded = true)
@XmlElement
@DynamicSerializeElement
private AircraftObsLocation location;
/**
*
*/
public PirepRecord() {
}
/**
* Constructor for DataURI construction through base class. This is used by
* the notification service.
*
* @param uri
* A data uri applicable to this class.
* @param tableDef
* The table definitions for this class.
*/
public PirepRecord(String uri) {
super(uri);
}
public Integer getObsId() {
return obsId;
}
public void setObsId(Integer obsId) {
this.obsId = obsId;
}
/**
* @return the wmoHeader
*/
public String getWmoHeader() {
return wmoHeader;
}
/**
* @param wmoHeader
* the wmoHeader to set
*/
public void setWmoHeader(String wmoHeader) {
this.wmoHeader = wmoHeader;
}
/**
* Get the report correction indicator.
*
* @return The corIndicator
*/
public String getCorIndicator() {
return corIndicator;
}
/**
* Set the report correction indicator.
*
* @param corIndicator
* The corIndicator.
*/
public void setCorIndicator(String corIndicator) {
this.corIndicator = corIndicator;
}
/**
* Get the report data for this observation.
*
* @return The Report data.
*/
public String getReportData() {
String s = null;
if (messageData instanceof String) {
s = (String) messageData;
}
return s;
}
/**
* Set the report data for this observation.
*
* @param reportData
* The Report data.
*/
public void setReportData(String reportData) {
messageData = reportData;
}
/**
* Get this observation's geometry.
*
* @return The geometry for this observation.
*/
public Geometry getGeometry() {
return location.getGeometry();
}
/**
* Get the geometry latitude.
*
* @return The geometry latitude.
*/
public double getLatitude() {
return location.getLatitude();
}
/**
* Get the geometry longitude.
*
* @return The geometry longitude.
*/
public double getLongitude() {
return location.getLongitude();
}
/**
* Is the location defined in the spatial tables.
*
* @return Is the location defined in the spatial tables.
*/
public Boolean getLocationDefined() {
return location.getLocationDefined();
}
/**
* Get the station identifier for this observation.
*
* @return the stationId
*/
public String getStationId() {
return location.getStationId();
}
/**
* Get the elevation, in meters, of the observing platform or location.
*
* @return The observation elevation, in meters.
*/
public Integer getFlightLevel() {
return location.getFlightLevel();
}
/**
* @return the reportType
*/
public Integer getReportType() {
return reportType;
}
/**
* @param reportType
* the reportType to set
*/
public void setReportType(Integer reportType) {
this.reportType = reportType;
}
/**
* @return the timeObs
*/
public Calendar getTimeObs() {
return timeObs;
}
/**
* @param timeObs
* the timeObs to set
*/
public void setTimeObs(Calendar timeObs) {
this.timeObs = timeObs;
}
/**
* @return the refHour
*/
public Calendar getRefHour() {
return refHour;
}
/**
* @param refHour
* the refHour to set
*/
public void setRefHour(Calendar refHour) {
this.refHour = refHour;
}
/**
* @param aircraftType
* the aircraftType to set
*/
public void setAircraftType(String aircraftType) {
this.aircraftType = aircraftType;
}
/**
* @return the aircraftType
*/
public String getAircraftType() {
return aircraftType;
}
/**
* @return the temp
*/
public Double getTemp() {
return temp;
}
/**
* @param temp
* the temp to set
*/
public void setTemp(Double temp) {
this.temp = temp;
}
/**
* @return the windDirection
*/
public Integer getWindDirection() {
return windDirection;
}
/**
* @param windDirection
* the windDirection to set
*/
public void setWindDirection(Integer windDirection) {
this.windDirection = windDirection;
}
/**
* @return the windspeed
*/
public Double getWindSpeed() {
return windSpeed;
}
/**
* @param windspeed
* the windspeed to set
*/
public void setWindSpeed(Double windSpeed) {
this.windSpeed = windSpeed;
}
/**
* @return the horzVisibility
*/
public Integer getHorzVisibility() {
return horzVisibility;
}
/**
* @param horzVisibility
* the horzVisibility to set
*/
public void setHorzVisibility(Integer horzVisibility) {
this.horzVisibility = horzVisibility;
}
/**
* @return the obsText
*/
public String getObsText() {
return obsText;
}
/**
* @param obsText
* the obsText to set
*/
public void setObsText(String obsText) {
this.obsText = obsText;
}
/**
* @return the weatherGroup
*/
public String getWeatherGroup() {
return weatherGroup;
}
/**
* @param weatherGroup
* the weatherGroup to set
*/
public void setWeatherGroup(String weatherGroup) {
this.weatherGroup = weatherGroup;
}
/**
* @return the ancPirepData
*/
public Set<PirepLayerData> getAncPirepData() {
return ancPirepData;
}
/**
* @param ancPirepData
* the ancPirepData to set
*/
public void setAncPirepData(Set<PirepLayerData> ancPirepData) {
this.ancPirepData = ancPirepData;
}
/**
*
* @param cloud
*/
public void addLayer(PirepLayerData layer) {
layer.setParent(this);
if (ancPirepData == null) {
ancPirepData = new HashSet<PirepLayerData>();
}
ancPirepData.add(layer);
}
@Override
public void setDataURI(String dataURI) {
super.setDataURI(dataURI);
identifier = dataURI;
}
/**
* Get the IDecoderGettable reference for this record.
*
* @return The IDecoderGettable reference for this record.
*/
@Override
public IDecoderGettable getDecoderGettable() {
return this;
}
/**
* Get the value of a parameter that is represented as a String.
*
* @param paramName
* The name of the parameter value to retrieve.
* @return The String value of the parameter. If the parameter is unknown, a
* null reference is returned.
*/
@Override
public String getString(String paramName) {
String retData = null;
if ("STA".matches(paramName)) {
retData = getStationId();
} else if ("TEXT".equals(paramName)) {
retData = obsText;
}
return retData;
}
/**
* Get the value and units of a named parameter within this observation.
*
* @param paramName
* The name of the parameter value to retrieve.
* @return An Amount with value and units. If the parameter is unknown, a
* null reference is returned.
*/
@Override
public Amount getValue(String paramName) {
findMaxIcingLayer();
findMaxTurbcLayer();
Amount a = null;
String pName = PARM_MAP.get(paramName);
if (SFC_TEMP.equals(pName) && (temp != null)) {
a = new Amount(temp, TEMPERATURE_UNIT);
} else if (SFC_WNDSPD.equals(pName) && (windSpeed != null)) {
a = new Amount(windSpeed, WIND_SPEED_UNIT);
} else if (SFC_WNDDIR.equals(pName) && (windDirection != null)) {
a = new Amount(windDirection, WIND_DIR_UNIT);
} else if (STA_LAT.equals(pName)) {
a = new Amount(this.getLatitude(), LOCATION_UNIT);
} else if (STA_LON.equals(pName)) {
a = new Amount(this.getLongitude(), LOCATION_UNIT);
} else if (UA_FLTLVL.equals(pName) && (getFlightLevel() != null)) {
a = new Amount(this.getFlightLevel().intValue(), ALTITUDE_UNIT);
} else if (UA_TOPHGT.equals(pName) && (maxTurbcLayerData != null)
&& (maxTurbcLayerData.getTopLayerHeight() != null)) {
a = new Amount(maxTurbcLayerData.getTopLayerHeight().intValue(),
ALTITUDE_UNIT);
} else if (UA_BOTHGT.equals(pName) && (maxTurbcLayerData != null)
&& (maxTurbcLayerData.getBaseLayerHeight() != null)) {
a = new Amount(maxTurbcLayerData.getBaseLayerHeight().intValue(),
ALTITUDE_UNIT);
}
return a;
}
/**
* Get the value of a parameter that is represented as a String.
*
* @param paramName
* The name of the parameter value to retrieve.
* @return The String value of the parameter. If the parameter is unknown, a
* null reference is returned.
*/
@Override
public Collection<Amount> getValues(String paramName) {
return null;
}
@Override
public String[] getStrings(String paramName) {
findMaxIcingLayer();
findMaxTurbcLayer();
String[] retData = null;
if ("ICI".matches(paramName)) {
if (maxIcingLayerData != null) {
String intensity = getIntensity(maxIcingLayerData);
if (intensity != null) {
retData = new String[] { intensity };
}
}
} else if ("ICT".matches(paramName) && (maxIcingLayerData != null)) {
if (maxIcingLayerData != null) {
String type = maxIcingLayerData.getDataType();
if (type != null) {
retData = new String[] { type, };
}
}
} else if ("TBI".matches(paramName)) {
if (maxTurbcLayerData != null) {
String intensity = getIntensity(maxTurbcLayerData);
if (intensity != null) {
retData = new String[] { intensity };
}
}
} else if ("TBF".matches(paramName)) {
findMaxTurbcLayer();
if (maxTurbcLayerData != null) {
String freq = maxTurbcLayerData.getFrequency();
if (freq != null) {
retData = new String[] { freq, };
}
}
}
return retData;
}
private void findMaxIcingLayer() {
if (maxIcingLayerData == null) {
int rank = -1;
for (PirepLayerData layer : this.ancPirepData) {
if (layer.getLayerType().equals(PirepLayerData.LAYER_TYP_ICING)) {
String intensity = getIntensity(layer);
Integer n = ICING_MAP.get(intensity);
if ((n != null) && (n > rank)) {
rank = n;
maxIcingLayerData = layer;
}
}
}
if (maxIcingLayerData != null) {
display = (getIntensity(maxIcingLayerData) != null);
} else {
display = false;
}
}
}
/**
* Find a turbulence layer with the greatest ordinal intensity.
*/
private void findMaxTurbcLayer() {
if (maxTurbcLayerData == null) {
int rank = -1;
for (PirepLayerData layer : this.ancPirepData) {
if (PirepLayerData.LAYER_TYP_TURBC.equals(layer.getLayerType())) {
String intensity = getIntensity(layer);
Integer n = TURB_MAP.get(intensity);
if ((n != null) && (n > rank)) {
rank = n;
maxTurbcLayerData = layer;
}
}
}
if (maxTurbcLayerData != null) {
display = (getIntensity(maxTurbcLayerData) != null);
} else {
display = false;
}
}
}
/**
* Get the combined intensity for a layer.
*
* @param layer
* @return
*/
public String getIntensity(PirepLayerData layer) {
String intensity = null;
if (layer.getFirstValue() != null) {
intensity = layer.getFirstValue();
}
if (layer.getSecondValue() != null) {
intensity += layer.getSecondValue();
}
return intensity;
}
@Override
public AircraftObsLocation getSpatialObject() {
return location;
}
public AircraftObsLocation getLocation() {
return location;
}
public void setLocation(AircraftObsLocation location) {
this.location = location;
}
@Override
public String getMessageData() {
return getObsText();
}
/**
* Returns the hashCode for this object. This implementation returns the
* hashCode of the generated dataURI.
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = (prime * result)
+ ((getDataURI() == null) ? 0 : getDataURI().hashCode());
return result;
}
/**
* Checks if this record is equal to another by checking the generated
* dataURI.
*
* @param obj
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
PirepRecord other = (PirepRecord) obj;
if (getDataURI() == null) {
if (other.getDataURI() != null) {
return false;
}
} else if (!getDataURI().equals(other.getDataURI())) {
return false;
}
return true;
}
@Override
@Column
@Access(AccessType.PROPERTY)
public String getDataURI() {
return super.getDataURI();
}
/**
* @return the maxTurbcLayerData
*/
public PirepLayerData getMaxTurbcLayerData() {
findMaxTurbcLayer();
return maxTurbcLayerData;
}
/**
* @return the maxIcingLayerData
*/
public PirepLayerData getMaxIcingLayerData() {
findMaxIcingLayer();
return maxIcingLayerData;
}
@Override
public String getPluginName() {
return "pirep";
}
}

View file

@ -185,13 +185,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.edex.plugin.pirep"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.edex.plugin.poessounding"
download-size="0"
@ -325,13 +318,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.dataplugin.pirep"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.dataplugin.obs"
download-size="0"

View file

@ -277,7 +277,7 @@
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.common.dataplugin.ncpirep"
id="gov.noaa.nws.ncep.common.dataplugin.pirep"
download-size="0"
install-size="0"
version="0.0.0"
@ -361,7 +361,7 @@
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.edex.plugin.ncpirep"
id="gov.noaa.nws.ncep.edex.plugin.pirep"
download-size="0"
install-size="0"
version="0.0.0"

View file

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gov.noaa.nws.ncep.common.dataplugin.ncpirep</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,2 +0,0 @@
gov.noaa.nws.ncep.common.dataplugin.ncpirep.NcPirepRecord
gov.noaa.nws.ncep.common.dataplugin.ncpirep.NcPirepLayerData

View file

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

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.common.dataplugin.pirep</name>
<name>gov.noaa.nws.ncep.common.dataplugin.pirep</name>
<comment></comment>
<projects>
</projects>

View file

@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Ncpirep Plug-in
Bundle-SymbolicName: gov.noaa.nws.ncep.common.dataplugin.ncpirep
Bundle-Name: Pirep Plug-in
Bundle-SymbolicName: gov.noaa.nws.ncep.common.dataplugin.pirep
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: com.raytheon.uf.common.status;bundle-version="1.12.1174",
@ -31,6 +31,6 @@ Import-Package: com.raytheon.edex.db.dao,
javax.measure.unit,
javax.persistence,
org.springframework.orm.hibernate3
Export-Package: gov.noaa.nws.ncep.common.dataplugin.ncpirep,
gov.noaa.nws.ncep.common.dataplugin.ncpirep.dao
Export-Package: gov.noaa.nws.ncep.common.dataplugin.pirep,
gov.noaa.nws.ncep.common.dataplugin.pirep.dao

View file

@ -0,0 +1,2 @@
gov.noaa.nws.ncep.common.dataplugin.pirep.PirepRecord
gov.noaa.nws.ncep.common.dataplugin.pirep.PirepLayerData

View file

@ -1,4 +1,4 @@
package gov.noaa.nws.ncep.common.dataplugin.ncpirep;
package gov.noaa.nws.ncep.common.dataplugin.pirep;
/**
* This software was modified from Raytheon's pirep plugin by
@ -8,12 +8,10 @@ package gov.noaa.nws.ncep.common.dataplugin.ncpirep;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
@ -44,17 +42,16 @@ import com.raytheon.uf.edex.decodertools.aircraft.AircraftFlightCondition;
* Append intensity2 to intensity1 for TB, IC, SK.
* Created getTurbLayerData and getIceLayerData method.
* 08/31/2011 286 qzhou Created project and moved this from ~edex.plugin.pirep
* Sep 05, 2013 2316 bsteffen Unify pirep and ncpirep.
*
* </pre>
*
* @author qzhou
* @version 1.0
*/
@Entity
@Table(name="ncpirep_anc_data")
@DynamicSerialize
@XmlAccessorType(XmlAccessType.NONE)
public class NcPirepLayerData implements Serializable, ISerializableObject {
public class PirepLayerData implements Serializable, ISerializableObject {
private static final long serialVersionUID = 1L;
@ -75,7 +72,7 @@ public class NcPirepLayerData implements Serializable, ISerializableObject {
@ManyToOne
@JoinColumn(name="parent", nullable=false)
private NcPirepRecord parent = null;
private PirepRecord parent = null;
@Column(length=8)
@XmlAttribute
@ -179,7 +176,7 @@ public class NcPirepLayerData implements Serializable, ISerializableObject {
/**
* Construct an empty base.
*/
public NcPirepLayerData() {
public PirepLayerData() {
}
/**
@ -188,7 +185,7 @@ public class NcPirepLayerData implements Serializable, ISerializableObject {
* @param parent
* The parent of this class.
*/
public NcPirepLayerData(NcPirepRecord parent) {
public PirepLayerData(PirepRecord parent) {
this.parent = parent;
}
@ -200,7 +197,7 @@ public class NcPirepLayerData implements Serializable, ISerializableObject {
* @param type
* The observation type for this data.
*/
public NcPirepLayerData(NcPirepRecord parent, String type) {
public PirepLayerData(PirepRecord parent, String type) {
this(parent);
hazardType = type;
}
@ -248,7 +245,7 @@ public class NcPirepLayerData implements Serializable, ISerializableObject {
*
* @return the parent
*/
public NcPirepRecord getParent() {
public PirepRecord getParent() {
return parent;
}
@ -258,7 +255,7 @@ public class NcPirepLayerData implements Serializable, ISerializableObject {
* @param parent
* The parent to set.
*/
public void setParent(NcPirepRecord parent) {
public void setParent(PirepRecord parent) {
this.parent = parent;
}
@ -554,8 +551,8 @@ public class NcPirepLayerData implements Serializable, ISerializableObject {
* Decoded flight conditions data (Turbulence or icing)
* @return A populated entry.
*/
public static NcPirepLayerData getTurbLayerData(AircraftFlightCondition layer) {
NcPirepLayerData dataLayer = new NcPirepLayerData(); //null;
public static PirepLayerData getTurbLayerData(AircraftFlightCondition layer) {
PirepLayerData dataLayer = new PirepLayerData(); //null;
boolean isValid = false;
@ -601,13 +598,13 @@ public class NcPirepLayerData implements Serializable, ISerializableObject {
dataLayer = null;
}
if (dataLayer != null) {
dataLayer.setLayerType(NcPirepLayerData.LAYER_TYP_TURBC);
dataLayer.setLayerType(PirepLayerData.LAYER_TYP_TURBC);
}
return dataLayer;
}
public static NcPirepLayerData getIceLayerData(AircraftFlightCondition layer) {
NcPirepLayerData dataLayer = new NcPirepLayerData(); //null;
public static PirepLayerData getIceLayerData(AircraftFlightCondition layer) {
PirepLayerData dataLayer = new PirepLayerData(); //null;
boolean isValid = false;
String intensity = layer.getIntensity1();
@ -646,7 +643,7 @@ public class NcPirepLayerData implements Serializable, ISerializableObject {
dataLayer = null;
}
if (dataLayer != null) {
dataLayer.setLayerType(NcPirepLayerData.LAYER_TYP_ICING);
dataLayer.setLayerType(PirepLayerData.LAYER_TYP_ICING);
}
return dataLayer;
@ -659,8 +656,8 @@ public class NcPirepLayerData implements Serializable, ISerializableObject {
* Decoded flight conditions data (Turbulence or icing)
* @return A populated entry.
*/
public static NcPirepLayerData getCloudLayerData(AircraftCloudLayer layer) {
NcPirepLayerData cloudLayer = new NcPirepLayerData();
public static PirepLayerData getCloudLayerData(AircraftCloudLayer layer) {
PirepLayerData cloudLayer = new PirepLayerData();
boolean isValid = false;
@ -696,7 +693,7 @@ public class NcPirepLayerData implements Serializable, ISerializableObject {
}
if (cloudLayer != null) {
//cloudLayer.setDataType(null);
cloudLayer.setLayerType(NcPirepLayerData.LAYER_TYP_CLOUD);
cloudLayer.setLayerType(PirepLayerData.LAYER_TYP_CLOUD);
}
return cloudLayer;

View file

@ -1,4 +1,4 @@
package gov.noaa.nws.ncep.common.dataplugin.ncpirep;
package gov.noaa.nws.ncep.common.dataplugin.pirep;
/**
* This software was developed and / or modified by Raytheon Company,
@ -20,6 +20,8 @@ package gov.noaa.nws.ncep.common.dataplugin.ncpirep;
* further licensing information.
**/
import gov.noaa.nws.ncep.common.dataplugin.pirep.dao.PirepDao;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
@ -30,10 +32,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import gov.noaa.nws.ncep.common.dataplugin.ncpirep.dao.NcPirepDao;
import com.raytheon.uf.common.pointdata.Dimension;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.pointdata.Dimension;
import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.pointdata.PointDataDescription;
import com.raytheon.uf.common.pointdata.PointDataView;
@ -41,7 +41,7 @@ import com.raytheon.uf.common.pointdata.spatial.AircraftObsLocation;
import com.raytheon.uf.common.time.DataTime;
/**
* Provides a transform from NcPirepRecords to PointDataContainer and vice versa.
* Provides a transform from PirepRecords to PointDataContainer and vice versa.
*
* <pre>
*
@ -52,14 +52,15 @@ import com.raytheon.uf.common.time.DataTime;
* 08/30/2011 286 qzhou Added fields for TB, IC, SK. Remove general fields.
* 08/31/2011 286 qzhou Created project and moved this from ~edex.plugin.pirep
* 09/27/2011 286 qzhou Make TB, IC, SK records all start from 0 in the arrays.
* Fixed visibility .
* Fixed visibility .
* Sep 05, 2013 2316 bsteffen Unify pirep and ncpirep.
* </pre>
*
* @author qzhou
* @version 1.0
*/
public class NcPirepPointDataTransform {
public class PirepPointDataTransform {
private static final String CORRECTION_CODE = "correctionCode";
@ -152,13 +153,13 @@ public class NcPirepPointDataTransform {
ALL_PARAMS_LIST = sb.toString();
}
private NcPirepDao dao;
private PirepDao dao;
private PointDataDescription description;
public NcPirepPointDataTransform() {
public PirepPointDataTransform() {
try {
this.dao = new NcPirepDao("ncpirep");
this.dao = new PirepDao("pirep");
this.description = dao.getPointDataDescription();
} catch (Exception e) {
// TODO Auto-generated catch block
@ -171,7 +172,7 @@ public class NcPirepPointDataTransform {
if (pdo.length > 0) {
Map<File, PointDataContainer> pointMap = new HashMap<File, PointDataContainer>();
for (PluginDataObject p : pdo) {
if (!(p instanceof NcPirepRecord))
if (!(p instanceof PirepRecord))
continue;
File f = this.dao.getFullFilePath(p);
PointDataContainer pdc = pointMap.get(f);
@ -179,7 +180,7 @@ public class NcPirepPointDataTransform {
pdc = PointDataContainer.build(this.description);
pointMap.put(f, pdc);
}
NcPirepRecord npr = (NcPirepRecord) p;
PirepRecord npr = (PirepRecord) p;
PointDataView pdv = buildView(pdc, npr);
npr.setPointDataView(pdv);
}
@ -188,7 +189,7 @@ public class NcPirepPointDataTransform {
}
private PointDataView buildView(PointDataContainer container,
NcPirepRecord record) {
PirepRecord record) {
PointDataView pdv = container.append();
pdv.setString(STATION_ID, record.getStationId());
Dimension [] dims = description.dimensions;
@ -218,7 +219,7 @@ public class NcPirepPointDataTransform {
pdv.setString(SUSPECT_TIME_FLAG, record.getSuspectTimeFlag());
if (record.getAncPirepData() != null) {
Iterator<NcPirepLayerData> pldIterator = record.getAncPirepData().iterator();
Iterator<PirepLayerData> pldIterator = record.getAncPirepData().iterator();
int i = 0;
int iTb = -1;
int iIc = -1;
@ -226,7 +227,7 @@ public class NcPirepPointDataTransform {
while (pldIterator.hasNext()) {
// TODO: storing duplicate info like this, needs to be resolved
NcPirepLayerData pld = pldIterator.next();
PirepLayerData pld = pldIterator.next();
if (pld.getLayerType() != null && i < maxLayer) {
StringBuffer pldBuffer = new StringBuffer();
@ -299,8 +300,8 @@ public class NcPirepPointDataTransform {
return pdv;
}
public static NcPirepRecord toNcPirepRecord(PointDataView pdv) {
NcPirepRecord npr = new NcPirepRecord();
public static PirepRecord toPirepRecord(PointDataView pdv) {
PirepRecord npr = new PirepRecord();
npr.setObsId(pdv.getInt(OBS_ID));
npr.setCorIndicator(pdv.getString(CORRECTION_CODE));
@ -339,27 +340,27 @@ public class NcPirepPointDataTransform {
int[] pldSkyBaseHeight = pdv.getIntAllLevels(SKY_BASE_HEIGHT);
int[] pldSkyTopHeight = pdv.getIntAllLevels(SKY_BASE_HEIGHT);
Set<NcPirepLayerData> pldList = new HashSet<NcPirepLayerData>();
Set<PirepLayerData> pldList = new HashSet<PirepLayerData>();
if (numLayer !=null && numLayer.intValue() > 0) {
for (int i = 0; i < numLayer.intValue(); i ++) {
NcPirepLayerData ncPirepLayerData = new NcPirepLayerData();
ncPirepLayerData.setLayerType(pldLayerType[i]);
ncPirepLayerData.setTurbInten(pldTurbInten[i]);
ncPirepLayerData.setIceInten(pldIceInten[i]);
ncPirepLayerData.setSkyInten1(pldSkyInten1[i]);
ncPirepLayerData.setSkyInten2(pldSkyInten2[i]);
ncPirepLayerData.setTurbBaseHeight(pldTurbBaseHeight[i]);
ncPirepLayerData.setTurbTopHeight(pldTurbTopHeight[i]);
ncPirepLayerData.setIceBaseHeight(pldIceBaseHeight[i]);
ncPirepLayerData.setIceTopHeight(pldIceTopHeight[i]);
ncPirepLayerData.setSkyBaseHeight(pldSkyBaseHeight[i]);
ncPirepLayerData.setSkyTopHeight(pldSkyTopHeight[i]);
PirepLayerData pirepLayerData = new PirepLayerData();
pirepLayerData.setLayerType(pldLayerType[i]);
pirepLayerData.setTurbInten(pldTurbInten[i]);
pirepLayerData.setIceInten(pldIceInten[i]);
pirepLayerData.setSkyInten1(pldSkyInten1[i]);
pirepLayerData.setSkyInten2(pldSkyInten2[i]);
pirepLayerData.setTurbBaseHeight(pldTurbBaseHeight[i]);
pirepLayerData.setTurbTopHeight(pldTurbTopHeight[i]);
pirepLayerData.setIceBaseHeight(pldIceBaseHeight[i]);
pirepLayerData.setIceTopHeight(pldIceTopHeight[i]);
pirepLayerData.setSkyBaseHeight(pldSkyBaseHeight[i]);
pirepLayerData.setSkyTopHeight(pldSkyTopHeight[i]);
// //may not need in cave
// if ((levels[i].intValue()) != PointDataDescription.FILL_VALUE_INT) {
// ncPirepLayerData.setBaseLayerHeight(levels[i].intValue());
// PirepLayerData.setBaseLayerHeight(levels[i].intValue());
// }
pldList.add(ncPirepLayerData);
pldList.add(pirepLayerData);
}
}
@ -368,13 +369,13 @@ public class NcPirepPointDataTransform {
return npr;
}
public static NcPirepRecord[] toNcPirepRecords(PointDataContainer container) {
List<NcPirepRecord> records = new ArrayList<NcPirepRecord>();
public static PirepRecord[] toPirepRecords(PointDataContainer container) {
List<PirepRecord> records = new ArrayList<PirepRecord>();
container.setCurrentSz(container.getAllocatedSz());
for (int i = 0; i < container.getCurrentSz(); i++) {
PointDataView pdv = container.readRandom(i);
records.add(toNcPirepRecord(pdv));
records.add(toPirepRecord(pdv));
}
return records.toArray(new NcPirepRecord[records.size()]);
return records.toArray(new PirepRecord[records.size()]);
}
}

View file

@ -1,4 +1,4 @@
package gov.noaa.nws.ncep.common.dataplugin.ncpirep;
package gov.noaa.nws.ncep.common.dataplugin.pirep;
/**
* This software was modified from Raytheon's pirep plugin by
@ -52,7 +52,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.vividsolutions.jts.geom.Geometry;
/**
* NcPirepRecord is the Data Access component for pirep observation data.
* PirepRecord is the Data Access component for pirep observation data.
*
* <pre>
*
@ -76,6 +76,7 @@ import com.vividsolutions.jts.geom.Geometry;
* May 07, 2013 1869 bsteffen Remove dataURI column from
* PluginDataObject.
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Sep 05, 2013 2316 bsteffen Unify pirep and ncpirep.
*
* </pre>
*
@ -83,18 +84,18 @@ import com.vividsolutions.jts.geom.Geometry;
* @version 1.0
*/
@Entity
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "ncpirepseq")
@Table(name = "ncpirep", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "pirepseq")
@Table(name = "pirep", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
/*
* Both refTime and forecastTime are included in the refTimeIndex since
* forecastTime is unlikely to be used.
*/
@org.hibernate.annotations.Table(appliesTo = "ncpirep", indexes = { @Index(name = "ncpirep_refTimeIndex", columnNames = {
@org.hibernate.annotations.Table(appliesTo = "pirep", indexes = { @Index(name = "pirep_refTimeIndex", columnNames = {
"refTime", "forecastTime" }) })
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class NcPirepRecord extends PluginDataObject implements ISpatialEnabled,
public class PirepRecord extends PluginDataObject implements ISpatialEnabled,
IDecoderGettable, IPointData, IPersistable {
private static final long serialVersionUID = 1L;
@ -152,7 +153,7 @@ public class NcPirepRecord extends PluginDataObject implements ISpatialEnabled,
}
@Transient
private NcPirepLayerData maxPirepLayerData = null;
private PirepLayerData maxPirepLayerData = null;
@Transient
private boolean display = true;
@ -250,9 +251,9 @@ public class NcPirepRecord extends PluginDataObject implements ISpatialEnabled,
@XmlElement
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "parent", fetch =
// FetchType.EAGER)
// private Set<NcPirepLayerData> ancPirepData;
// private Set<PirepLayerData> ancPirepData;
@Transient
private Set<NcPirepLayerData> ancPirepData = new HashSet<NcPirepLayerData>();
private Set<PirepLayerData> ancPirepData = new HashSet<PirepLayerData>();
@Embedded
@DataURI(position = 3, embedded = true)
@ -267,7 +268,7 @@ public class NcPirepRecord extends PluginDataObject implements ISpatialEnabled,
/**
*
*/
public NcPirepRecord() {
public PirepRecord() {
}
/**
@ -279,7 +280,7 @@ public class NcPirepRecord extends PluginDataObject implements ISpatialEnabled,
* @param tableDef
* The table definitions for this class.
*/
public NcPirepRecord(String uri) {
public PirepRecord(String uri) {
super(uri);
}
@ -572,7 +573,7 @@ public class NcPirepRecord extends PluginDataObject implements ISpatialEnabled,
/**
* @return the ancPirepData
*/
public Set<NcPirepLayerData> getAncPirepData() {
public Set<PirepLayerData> getAncPirepData() {
return ancPirepData;
}
@ -580,7 +581,7 @@ public class NcPirepRecord extends PluginDataObject implements ISpatialEnabled,
* @param ancPirepData
* the ancPirepData to set
*/
public void setAncPirepData(Set<NcPirepLayerData> ancPirepData) {
public void setAncPirepData(Set<PirepLayerData> ancPirepData) {
this.ancPirepData = ancPirepData;
}
@ -588,10 +589,10 @@ public class NcPirepRecord extends PluginDataObject implements ISpatialEnabled,
*
* @param cloud
*/
public void addLayer(NcPirepLayerData layer) {
public void addLayer(PirepLayerData layer) {
layer.setParent(this);
if (ancPirepData == null) {
ancPirepData = new HashSet<NcPirepLayerData>();
ancPirepData = new HashSet<PirepLayerData>();
}
ancPirepData.add(layer);
}
@ -692,10 +693,10 @@ public class NcPirepRecord extends PluginDataObject implements ISpatialEnabled,
if ("ICI".matches(paramName)) {
int rank = -1;
String iceIntensity = null;
for (NcPirepLayerData layer : this.ancPirepData) {
for (PirepLayerData layer : this.ancPirepData) {
String intensity = "";
if (layer.getLayerType().equals(
NcPirepLayerData.LAYER_TYP_ICING)) {
PirepLayerData.LAYER_TYP_ICING)) {
if (layer.getIceInten() != null) {
intensity = layer.getIceInten();
}
@ -722,10 +723,10 @@ public class NcPirepRecord extends PluginDataObject implements ISpatialEnabled,
} else if ("TBI".matches(paramName)) {
int rank = -1;
String turbIntensity = null;
for (NcPirepLayerData layer : this.ancPirepData) {
for (PirepLayerData layer : this.ancPirepData) {
String intensity = "";
if (layer.getLayerType().equals(
NcPirepLayerData.LAYER_TYP_TURBC)) {
PirepLayerData.LAYER_TYP_TURBC)) {
if (layer.getTurbInten() != null) {
intensity = layer.getTurbInten();
}
@ -806,7 +807,7 @@ public class NcPirepRecord extends PluginDataObject implements ISpatialEnabled,
if (getClass() != obj.getClass()) {
return false;
}
NcPirepRecord other = (NcPirepRecord) obj;
PirepRecord other = (PirepRecord) obj;
if (getDataURI() == null) {
if (other.getDataURI() != null) {
return false;
@ -857,6 +858,6 @@ public class NcPirepRecord extends PluginDataObject implements ISpatialEnabled,
@Override
public String getPluginName() {
return "ncpirep";
return "pirep";
}
}

View file

@ -1,4 +1,4 @@
package gov.noaa.nws.ncep.common.dataplugin.ncpirep.dao;
package gov.noaa.nws.ncep.common.dataplugin.pirep.dao;
/**
* This software was modified from Raytheon's pirep plugin by
@ -6,9 +6,10 @@ package gov.noaa.nws.ncep.common.dataplugin.ncpirep.dao;
**/
//uf.common.status.IUFStatusHandler cannot be resolved. It is indirectly
//referenced from required .class files
import gov.noaa.nws.ncep.common.dataplugin.ncpirep.NcPirepRecord;
import gov.noaa.nws.ncep.common.dataplugin.pirep.PirepRecord;
import java.util.List;
import javax.xml.bind.JAXBException;
import com.raytheon.uf.common.dataplugin.PluginException;
@ -29,21 +30,22 @@ import com.raytheon.uf.edex.pointdata.PointDataPluginDao;
* ------------ ---------- ----------- --------------------------
* 04/28/2011 F. J. Yen Initial creation from pirep
* 08/31/2011 286 qzhou Moved this from ~edex.plugin.pirep
* Sep 05, 2013 2316 bsteffen Unify pirep and ncpirep.
* </pre>
*
* @author qzhou
* @version 1.0
*/
public class NcPirepDao extends PointDataPluginDao<NcPirepRecord> {
public class PirepDao extends PointDataPluginDao<PirepRecord> {
private PointDataDescription pdd;
/**
* Creates a new NcPirepDao
* Creates a new PirepDao
*
* @throws PluginException
*/
public NcPirepDao(String pluginName) throws PluginException {
public PirepDao(String pluginName) throws PluginException {
super(pluginName);
}
@Override
@ -51,15 +53,16 @@ public class NcPirepDao extends PointDataPluginDao<NcPirepRecord> {
IPersistable obj) throws Exception {
return null;
}
/**
* Retrieves an NcPirep report using the datauri .
* Retrieves an Pirep report using the datauri .
*
* @param dataURI
* The dataURI to match against.
* @return The report record if it exists.
*/
public NcPirepRecord queryByDataURI(String dataURI) {
NcPirepRecord report = null;
public PirepRecord queryByDataURI(String dataURI) {
PirepRecord report = null;
List<?> obs = null;
try {
obs = queryBySingleCriteria("dataURI", dataURI);
@ -67,7 +70,7 @@ public class NcPirepDao extends PointDataPluginDao<NcPirepRecord> {
e.printStackTrace();
}
if ((obs != null) && (obs.size() > 0)) {
report = (NcPirepRecord) obs.get(0);
report = (PirepRecord) obs.get(0);
}
return report;
}
@ -82,7 +85,7 @@ public class NcPirepDao extends PointDataPluginDao<NcPirepRecord> {
*/
public Object[] queryDataUriColumn(final String dataUri) {
String sql = "select datauri from awips.ncpirep where datauri='"
String sql = "select datauri from awips.pirep where datauri='"
+ dataUri + "';";
Object[] results = executeSQLQuery(sql);
@ -95,13 +98,13 @@ public class NcPirepDao extends PointDataPluginDao<NcPirepRecord> {
}
@Override
public NcPirepRecord newObject() {
return new NcPirepRecord();
public PirepRecord newObject() {
return new PirepRecord();
}
@Override
public String getPointDataFileName(NcPirepRecord p) {
return "ncpirep.h5";
public String getPointDataFileName(PirepRecord p) {
return "pirep.h5";
}
/*
@ -123,7 +126,7 @@ public class NcPirepDao extends PointDataPluginDao<NcPirepRecord> {
if (pdd == null) {
pdd = PointDataDescription.fromStream(this.getClass()
.getResourceAsStream("/res/pointdata/ncpirep.xml"));
.getResourceAsStream("/res/pointdata/pirep.xml"));
}
return pdd;
}

View file

@ -7,7 +7,7 @@
<constraint constraintValue="PIREP" constraintType="EQUALS"/>
</mapping>
<mapping key="pluginName">
<constraint constraintValue="ncpirep" constraintType="EQUALS"/>
<constraint constraintValue="pirep" constraintType="EQUALS"/>
</mapping>
</baseConstraints>
</NcInventoryDefinition>

View file

@ -7,7 +7,7 @@
<constraint constraintValue="PIREP" constraintType="EQUALS"/>
</mapping>
<mapping key="pluginName">
<constraint constraintValue="ncpirep" constraintType="EQUALS"/>
<constraint constraintValue="pirep" constraintType="EQUALS"/>
</mapping>
</baseConstraints>
</NcInventoryDefinition>

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<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.ncpirep</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,23 +0,0 @@
<beans
xmlns="http://www.springframework.org/schema/beans"
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-3.1.xsd">
<bean id="ncpirepPluginName" class="java.lang.String">
<constructor-arg type="java.lang.String" value="ncpirep" />
</bean>
<bean id="ncpirepProperties" class="com.raytheon.uf.common.dataplugin.PluginProperties">
<property name="pluginName" ref="ncpirepPluginName" />
<property name="pluginFQN" value="gov.noaa.nws.ncep.common.dataplugin.ncpirep" />
<property name="dao" value="gov.noaa.nws.ncep.common.dataplugin.ncpirep.dao.NcPirepDao" />
<property name="record" value="gov.noaa.nws.ncep.common.dataplugin.ncpirep.NcPirepRecord" />
</bean>
<bean factory-bean="pluginRegistry" factory-method="register">
<constructor-arg value="ncpirep"/>
<constructor-arg ref="ncpirepProperties"/>
</bean>
</beans>

View file

@ -1,81 +0,0 @@
<beans
xmlns="http://www.springframework.org/schema/beans"
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-3.1.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<!--bean id="ncpirepDao" class="gov.noaa.nws.ncep.common.dataplugin.ncpirep.dao.NcPirepDao">
<constructor-arg ref="ncpirepPluginName" />
</bean-->
<bean id="ncpirepDecoder" class="gov.noaa.nws.ncep.edex.plugin.ncpirep.NcPirepDecoder">
<constructor-arg ref="ncpirepPluginName" />
<!--property name="dao" ref="ncpirepDao" /-->
</bean>
<bean id="ncpirepPointData" class="gov.noaa.nws.ncep.common.dataplugin.ncpirep.NcPirepPointDataTransform"/>
<bean id="ncpirepSeparator" class="gov.noaa.nws.ncep.edex.plugin.ncpirep.NcPirepSeparator"/>
<bean id="ncpirepDistRegistry" factory-bean="distributionSrv"
factory-method="register">
<constructor-arg value="ncpirep" />
<constructor-arg value="jms-dist:queue:Ingest.ncpirep" />
</bean>
<bean id="ncpirepCamelRegistered" factory-bean="contextManager"
factory-method="register" depends-on="persistCamelRegistered">
<constructor-arg ref="ncpirep-camel"/>
</bean>
<camelContext id="ncpirep-camel" xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler"
autoStartup="false">
<!-- Allow use of sbn -->
<endpoint id="ncpirepFileEndpoint" uri="file:${edex.home}/data/sbn/ncpirep?noop=true&amp;idempotent=false"/>
<route id="ncpirepFileConsumerRoute">
<from ref="ncpirepFileEndpoint"/>
<bean ref="fileToString" />
<setHeader headerName="pluginName">
<constant>ncpirep</constant>
</setHeader>
<to uri="jms-generic:queue:Ingest.ncpirep"/>
</route>
<!-- End of section to allow use of sbn -->
<!-- Begin ncpirep routes -->
<route id="ncpirepIngestRoute">
<from uri="jms-generic:queue:Ingest.ncpirep"/>
<setHeader headerName="pluginName">
<constant>ncpirep</constant>
</setHeader>
<doTry>
<pipeline>
<bean ref="stringToFile" />
<split streaming="true">
<method bean="ncpirepSeparator" method="separate"/>
<doTry>
<pipeline>
<bean ref="ncpirepDecoder" method="decode"/>
<!-- Add next line for h5 version and change next
line from indexAlert to persistIndexAlert" /-->
<bean ref="ncpirepPointData" method="toPointData" />
<!-- to uri="direct-vm:indexAlert" /-->
<to uri="direct-vm:persistIndexAlert" />
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>
<to uri="log:ncpirep?level=ERROR"/>
</doCatch>
</doTry>
</split>
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>
<to uri="log:ncpirep?level=ERROR"/>
</doCatch>
</doTry>
</route>
</camelContext>
</beans>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.edex.plugin.pirep</name>
<name>gov.noaa.nws.ncep.edex.plugin.pirep</name>
<comment></comment>
<projects>
</projects>

View file

@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Ncpirep
Bundle-SymbolicName: gov.noaa.nws.ncep.edex.plugin.ncpirep
Bundle-Name: Pirep
Bundle-SymbolicName: gov.noaa.nws.ncep.edex.plugin.pirep
Bundle-Version: 1.12.1174.qualifier
Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization
Bundle-Vendor: NOAA/NWS/NCEP/NCO/SIB
@ -14,9 +14,9 @@ Require-Bundle: com.raytheon.edex.common;bundle-version="1.12.1174",
javax.persistence;bundle-version="1.0.0",
org.apache.camel;bundle-version="1.0.0",
com.raytheon.uf.common.status;bundle-version="1.12.1174",
gov.noaa.nws.ncep.common.dataplugin.ncpirep;bundle-version="1.0.0"
Export-Package: gov.noaa.nws.ncep.edex.plugin.ncpirep,
gov.noaa.nws.ncep.edex.plugin.ncpirep.decoder
gov.noaa.nws.ncep.common.dataplugin.pirep;bundle-version="1.0.0"
Export-Package: gov.noaa.nws.ncep.edex.plugin.pirep,
gov.noaa.nws.ncep.edex.plugin.pirep.decoder
Import-Package: com.raytheon.uf.edex.pointdata,
gov.noaa.nws.ncep.common.tools,
org.apache.commons.logging

View file

@ -5,6 +5,7 @@
* __________ _______ __________ __________________________
* 05/23/2011 F. J. Yen Initial creation.
* 08/23/2011 286 qzhou Added 13 fields. Changed maxLayer to 3.
-->
<pointDataDescription>
<dimension name="maxLayer" length="5"/>

View file

@ -9,9 +9,10 @@
<bean id="pirepProperties" class="com.raytheon.uf.common.dataplugin.PluginProperties">
<property name="pluginName" ref="pirepPluginName" />
<property name="pluginFQN" value="com.raytheon.uf.common.dataplugin.pirep" />
<property name="dao" value="com.raytheon.edex.plugin.pirep.dao.PirepDao" />
<property name="record" value="com.raytheon.uf.common.dataplugin.pirep.PirepRecord" />
<property name="pluginFQN" value="gov.noaa.nws.ncep.common.dataplugin.pirep" />
<property name="dao" value="gov.noaa.nws.ncep.common.dataplugin.pirep.dao.PirepDao" />
<property name="record" value="gov.noaa.nws.ncep.common.dataplugin.pirep.PirepRecord" />
</bean>
<bean factory-bean="pluginRegistry" factory-method="register">

View file

@ -4,11 +4,18 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="pirepDecoder" class="com.raytheon.edex.plugin.pirep.PirepDecoder">
<constructor-arg ref="pirepPluginName" />
<!--bean id="pirepDao" class="gov.noaa.nws.ncep.common.dataplugin.pirep.dao.PirepDao">
<constructor-arg ref="pirepPluginName" />
</bean-->
<bean id="pirepDecoder" class="gov.noaa.nws.ncep.edex.plugin.pirep.PirepDecoder">
<constructor-arg ref="pirepPluginName" />
<!--property name="dao" ref="pirepDao" /-->
</bean>
<bean id="pirepPointData" class="gov.noaa.nws.ncep.common.dataplugin.pirep.PirepPointDataTransform"/>
<bean id="pirepSeparator" class="com.raytheon.edex.plugin.pirep.PirepSeparator"/>
<bean id="pirepSeparator" class="gov.noaa.nws.ncep.edex.plugin.pirep.PirepSeparator"/>
<bean id="pirepDistRegistry" factory-bean="distributionSrv"
factory-method="register">
@ -19,13 +26,12 @@
<bean id="pirepCamelRegistered" factory-bean="contextManager"
factory-method="register" depends-on="persistCamelRegistered">
<constructor-arg ref="pirep-camel"/>
</bean>
<camelContext id="pirep-camel"
xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler"
autoStartup="false">
<!--
</bean>
<camelContext id="pirep-camel" xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler"
autoStartup="false">
<!-- Allow use of sbn -->
<endpoint id="pirepFileEndpoint" uri="file:${edex.home}/data/sbn/pirep?noop=true&amp;idempotent=false"/>
<route id="pirepFileConsumerRoute">
@ -36,10 +42,11 @@
</setHeader>
<to uri="jms-generic:queue:Ingest.pirep"/>
</route>
-->
<!-- Begin Pirep routes -->
<!-- End of section to allow use of sbn -->
<!-- Begin pirep routes -->
<route id="pirepIngestRoute">
<from uri="jms-generic:queue:Ingest.pirep?destinationResolver=#qpidDurableResolver"/>
<from uri="jms-generic:queue:Ingest.pirep"/>
<setHeader headerName="pluginName">
<constant>pirep</constant>
</setHeader>
@ -51,7 +58,11 @@
<doTry>
<pipeline>
<bean ref="pirepDecoder" method="decode"/>
<to uri="direct-vm:indexAlert"/>
<!-- Add next line for h5 version and change next
line from indexAlert to persistIndexAlert" /-->
<bean ref="pirepPointData" method="toPointData" />
<!-- to uri="direct-vm:indexAlert" /-->
<to uri="direct-vm:persistIndexAlert" />
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>

View file

@ -2,11 +2,11 @@
* This software was modified from Raytheon's airep plugin by
* NOAA/NWS/NCEP/NCO to order to output point data in HDF5.
**/
package gov.noaa.nws.ncep.edex.plugin.ncpirep;
package gov.noaa.nws.ncep.edex.plugin.pirep;
import gov.noaa.nws.ncep.common.dataplugin.ncpirep.NcPirepLayerData;
import gov.noaa.nws.ncep.common.dataplugin.ncpirep.NcPirepRecord;
import gov.noaa.nws.ncep.edex.plugin.ncpirep.decoder.NcPirepParser;
import gov.noaa.nws.ncep.common.dataplugin.pirep.PirepLayerData;
import gov.noaa.nws.ncep.common.dataplugin.pirep.PirepRecord;
import gov.noaa.nws.ncep.edex.plugin.pirep.decoder.PirepParser;
import java.util.Calendar;
import java.util.List;
@ -29,7 +29,7 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
/**
* Decoder strategy for text PIREP observation data. Most common usage is as
* follows. <code>
* NcPirepDecoder dec = new NcPirepDecoder();
* PirepDecoder dec = new PirepDecoder();
* dec.setMessage(msgData);
* while(dec.hasNext())
* {
@ -49,12 +49,13 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
* Aug 30, 2011 286 qzhou Fixed report time
* Sep 26, 2011 286 qzhou Changed reportType from int to string
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Sep 05, 2013 2316 bsteffen Unify pirep and ncpirep.
* </pre>
*
* @author F. J. Yen
* @version 1.0
*/
public class NcPirepDecoder extends AbstractDecoder {
public class PirepDecoder extends AbstractDecoder {
// Name of the plugin controlling this decoder.
private final String PLUGIN_NAME;
@ -63,7 +64,7 @@ public class NcPirepDecoder extends AbstractDecoder {
*
* @throws DecoderException
*/
public NcPirepDecoder(String pluginName) throws DecoderException {
public PirepDecoder(String pluginName) throws DecoderException {
PLUGIN_NAME = pluginName;
}
@ -86,11 +87,11 @@ public class NcPirepDecoder extends AbstractDecoder {
traceId = (String) headers.get("traceId");
}
try {
logger.debug(traceId + "- NcPirepDecoder.decode()");
logger.debug(traceId + "- PirepDecoder.decode()");
System.out.println("****" + input.getReport());
NcPirepRecord report = populateRecord(
new NcPirepParser(input.getReport(), traceId),
PirepRecord report = populateRecord(
new PirepParser(input.getReport(), traceId),
input.getWmoHeader());
if (report != null) {
@ -106,7 +107,7 @@ public class NcPirepDecoder extends AbstractDecoder {
} catch (Exception e) {
fixTrace(e);
logger.error(traceId + "- Error in NcPirepDecoder", e);
logger.error(traceId + "- Error in PirepDecoder", e);
} finally {
if (reports == null) {
reports = new PluginDataObject[0];
@ -116,20 +117,20 @@ public class NcPirepDecoder extends AbstractDecoder {
}
/**
* Populate a NcPirepRecord with data that was decoded from a single PIREP
* Populate a PirepRecord with data that was decoded from a single PIREP
* report.
*
* @param parser
* The NcPIREP parser that contains the decoded data.
* The PIREP parser that contains the decoded data.
* @param wmoHeader
* the wmo header
* @return The populated record. This method returns a null reference if
* either the observation time or location data is unavailable.
*/
private NcPirepRecord populateRecord(NcPirepParser parser,
private PirepRecord populateRecord(PirepParser parser,
WMOHeader wmoHeader) {
NcPirepRecord record = null;
PirepRecord record = null;
AircraftObsLocation location = null;
if (parser != null) {
@ -152,7 +153,7 @@ public class NcPirepDecoder extends AbstractDecoder {
BasePoint p = parser.getLocation();
if ((oTime != null) && (p != null)) {
record = new NcPirepRecord();
record = new PirepRecord();
location = new AircraftObsLocation();
record.setTimeObs(oTime);
@ -191,7 +192,7 @@ public class NcPirepDecoder extends AbstractDecoder {
if (icing != null) {
for (AircraftFlightCondition layer : icing) {
NcPirepLayerData iceLayer = NcPirepLayerData
PirepLayerData iceLayer = PirepLayerData
.getIceLayerData(layer);
if (iceLayer != null) {
@ -204,7 +205,7 @@ public class NcPirepDecoder extends AbstractDecoder {
.getTurbulenceLayers();
if (turbc != null) {
for (AircraftFlightCondition layer : turbc) {
NcPirepLayerData turbLayer = NcPirepLayerData
PirepLayerData turbLayer = PirepLayerData
.getTurbLayerData(layer);
if (turbLayer != null) {
@ -218,7 +219,7 @@ public class NcPirepDecoder extends AbstractDecoder {
List<AircraftCloudLayer> clouds = parser.getCloudLayers();
if (clouds != null) {
for (AircraftCloudLayer layer : clouds) {
NcPirepLayerData cloudLayer = NcPirepLayerData
PirepLayerData cloudLayer = PirepLayerData
.getCloudLayerData(layer);
if (cloudLayer != null) {
@ -272,18 +273,18 @@ public class NcPirepDecoder extends AbstractDecoder {
public static final void main(String[] args) {
NcPirepRecord rec = new NcPirepRecord();
PirepRecord rec = new PirepRecord();
NcPirepLayerData layer = new NcPirepLayerData(rec);
layer.setLayerType(NcPirepLayerData.LAYER_TYP_TURBC);
PirepLayerData layer = new PirepLayerData(rec);
layer.setLayerType(PirepLayerData.LAYER_TYP_TURBC);
layer.setTurbFreq("OCN");
layer.setTurbInten("LGT");
layer.setTurbBaseHeight(15000);
layer.setTurbTopHeight(20000);
rec.addLayer(layer);
layer = new NcPirepLayerData(rec);
layer.setLayerType(NcPirepLayerData.LAYER_TYP_TURBC);
layer = new PirepLayerData(rec);
layer.setLayerType(PirepLayerData.LAYER_TYP_TURBC);
layer.setTurbInten("MOD");
layer.setTurbBaseHeight(20000);
layer.setTurbTopHeight(22000);

View file

@ -2,7 +2,7 @@
* This software was modified from Raytheon's pirep plugin by
* NOAA/NWS/NCEP/NCO to order to output point data in HDF5.
**/
package gov.noaa.nws.ncep.edex.plugin.ncpirep;
package gov.noaa.nws.ncep.edex.plugin.pirep;
import java.util.ArrayList;
import java.util.List;
@ -19,7 +19,7 @@ import com.raytheon.uf.edex.decodertools.core.IDecoderInput;
import com.raytheon.uf.edex.wmo.message.WMOHeader;
/**
* The NcPirepSeparator takes a potential weather message and attempts to
* The PirepSeparator takes a potential weather message and attempts to
* determine the WMO header and data type of the enclosed data. Normal usage is
* to create an instance and set the message data using the setData method. When
* complete the separator contains the WMO header, the message data with all
@ -38,12 +38,14 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
* 04/28/2011 F.J.Yen Initial creation from pirep.
* 09/22/2011 286 qzhou Put new regex pattern to get header time. Do separate message accordingly.
* Modified doSeparate and added separate()
* Sep 05, 2013 2316 bsteffen Unify pirep and ncpirep.
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class NcPirepSeparator extends AbstractRecordSeparator {
public class PirepSeparator extends AbstractRecordSeparator {
/** The logger */
private Log logger = LogFactory.getLog(getClass());
@ -60,10 +62,10 @@ public class NcPirepSeparator extends AbstractRecordSeparator {
private int currentReport = -1;
public static NcPirepSeparator separate(byte[] data, Headers headers) {
NcPirepSeparator ncPirepSeparator = new NcPirepSeparator();
ncPirepSeparator.setData(data, headers);
return ncPirepSeparator;
public static PirepSeparator separate(byte[] data, Headers headers) {
PirepSeparator pirepSeparator = new PirepSeparator();
pirepSeparator.setData(data, headers);
return pirepSeparator;
}
/**

View file

@ -17,21 +17,21 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package gov.noaa.nws.ncep.edex.plugin.ncpirep.decoder;
package gov.noaa.nws.ncep.edex.plugin.pirep.decoder;
import gov.noaa.nws.ncep.common.tools.IDecoderConstantsN;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.List;
import java.util.ArrayList;
import java.util.Calendar;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import gov.noaa.nws.ncep.common.tools.IDecoderConstantsN;
import com.raytheon.uf.common.pointdata.spatial.ObStation;
import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.decodertools.aircraft.AircraftCloudLayer;
@ -71,12 +71,14 @@ import com.vividsolutions.jts.geom.Point;
* Handle abnormal location. /OV TBE 265040... Modified decodeLocationData() and parseLatLon()
* 10/20/2011 472 qzhou Added WX_COND_WORDS. Removed SKY_SKC, SKY_CLR and other _COND_WORDS
* 11/01/2011 286 Q.Zhou Added month and year to decodetime
* Sep 05, 2013 2316 bsteffen Unify pirep and ncpirep.
*
* </pre>
*
* @author jkorman
* @version Dec. 27, 2007
*/
public class NcPirepParser {
public class PirepParser {
private static final double ONE_NM_RADIANS = (2.0 * Math.PI) / 21637.5;
// Allowable future time in milliseconds (15 minutes).
@ -256,7 +258,7 @@ public class NcPirepParser {
private String traceId;
/**
* Construct a NcPirepParser from given String data. The report is completely
* Construct a PirepParser from given String data. The report is completely
* parsed and decoded upon success.
*
* @param report
@ -264,14 +266,14 @@ public class NcPirepParser {
* @throws DecodeException
* An error occurred within the parser.
*/
public NcPirepParser(String report, String traceId) {
public PirepParser(String report, String traceId) {
reportData = report;
this.traceId = traceId;
parse();
}
/**
* Construct a NcPirepParser from given byte array data. The report is
* Construct a PirepParser from given byte array data. The report is
* completely parsed and decoded upon success.
*
* @param report
@ -279,7 +281,7 @@ public class NcPirepParser {
* @throws DecodeException
* An error occurred within the parser.
*/
public NcPirepParser(byte[] report, String traceId) {
public PirepParser(byte[] report, String traceId) {
this(new String(report),traceId);
}
@ -2089,7 +2091,7 @@ public class NcPirepParser {
// String report = "BIG UA /OV BIG095040/TM 2343/FL090/TP SR22/TA M05/IC LGT RIME 090-100/RM CWSU ZAN=";
// String traceId = "1";
// new NcPirepParser(report, traceId);
// new PirepParser(report, traceId);
}
}

View file

@ -1,6 +1,6 @@
package gov.noaa.nws.ncep.edex.plugin.ncpirep.decoder;
package gov.noaa.nws.ncep.edex.plugin.pirep.decoder;
//import gov.noaa.nws.ncep.edex.plugin.ncpirep.common.AircraftFlightCondition;
//import gov.noaa.nws.ncep.edex.plugin.pirep.common.AircraftFlightCondition;
import gov.noaa.nws.ncep.common.tools.IDecoderConstantsN;
@ -22,6 +22,7 @@ import com.raytheon.uf.edex.decodertools.aircraft.WordTranslator;
* ------------ ---------- ----------- --------------------------
* Jun 10, 2011 jkorman Initial creation
* 2012/02/15 #680 Q.Zhou Changed CAT and CHOP typo
* Sep 05, 2013 2316 bsteffen Unify pirep and ncpirep.
* </pre>
*
* @author jkorman

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<PlotParameterDefns>
<plugin>ncpirep</plugin>
<plugin>pirep</plugin>
<!-- From NMAP ACFT params
brbk:1:2:112 1
brbm:1:2 1

View file

@ -2,7 +2,7 @@
<plotModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="plotModel.xsd"
plugin="ncpirep" name="standard"
plugin="pirep" name="standard"
svgTemplate="standardPlotModelTemplate.svg">
<!-- This was created from nmap full_standard plot model but some

View file

@ -3,7 +3,7 @@
<resourceDefnName>PIREP</resourceDefnName>
<resourceCategory>UPPER_AIR</resourceCategory>
<resourceParameters>
pluginName=ncpirep
pluginName=pirep
reportType=PIREP
legendString=Pilot Reports
spiFile=MTR.spi

View file

@ -1,4 +1,4 @@
! Parameters and Attributes for the default AIREP Resource
plotModel=@PlotModels/ncpirep/standard.xml
plotModel=@PlotModels/pirep/standard.xml
plotDensity=10
conditionalFilter=