From e542f1844050981c36ab0d4123a38ae1577ca46e Mon Sep 17 00:00:00 2001 From: Ben Steffensmeier Date: Thu, 5 Sep 2013 11:02:23 -0500 Subject: [PATCH] Issue #2316 Unify pirep and ncpirep. Former-commit-id: e07ea17d953739f853e87e6ed150e013a9b7ae07 --- .../feature.xml | 7 - .../feature.xml | 2 +- .../plotModels/pirepIcingDesign.svg | 17 +- .../plotModels/pirepPlotDesign.svg | 89 +- .../plotModels/pirepTurbDesign.svg | 17 +- .../viz/pointdata/PlotModelFactory2.java | 17 +- .../viz/pointdata/rsc/PlotResourceData.java | 17 +- deltaScripts/14.2.1/dropPirepAirep.sh | 7 + edexOsgi/build.edex/esb/conf/modes.xml | 1 - .../com.raytheon.edex.plugin.pirep/.classpath | 7 - .../.settings/org.eclipse.jdt.core.prefs | 7 - .../META-INF/MANIFEST.MF | 20 - .../build.properties | 5 - .../edex/plugin/pirep/PirepDecoder.java | 260 --- .../edex/plugin/pirep/PirepSeparator.java | 202 --- .../edex/plugin/pirep/dao/PirepDao.java | 95 -- .../plugin/pirep/decoder/PirepParser.java | 1496 ----------------- .../edex/plugin/pirep/decoder/PirepTools.java | 445 ----- .../edex/plugin/pirep/decoder/TEI.java | 124 -- .../edex/plugin/pirep/decoder/TEIInfo.java | 219 --- .../base/purge/pirepPurgeRules.xml | 6 - .../edex_static/base/distribution/pirep.xml | 23 - .../.settings/org.eclipse.jdt.core.prefs | 8 - .../META-INF/MANIFEST.MF | 24 - ...f.common.serialization.ISerializableObject | 2 - .../dataplugin/pirep/PirepLayerData.java | 430 ----- .../common/dataplugin/pirep/PirepRecord.java | 852 ---------- .../feature.xml | 14 - .../feature.xml | 4 +- .../.project | 28 - ...f.common.serialization.ISerializableObject | 2 - .../build.properties | 4 - ...oaa.nws.ncep.common.dataplugin.ncpirep.ecl | 0 .../.classpath | 0 .../.project | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 0 .../META-INF/MANIFEST.MF | 8 +- ...f.common.serialization.ISerializableObject | 2 + .../build.properties | 0 ....noaa.nws.ncep.common.dataplugin.pirep.ecl | 0 .../dataplugin/pirep/PirepLayerData.java} | 39 +- .../pirep/PirepPointDataTransform.java} | 73 +- .../common/dataplugin/pirep/PirepRecord.java} | 43 +- .../dataplugin/pirep/dao/PirepDao.java} | 33 +- .../NcInventoryDefinitions/NotUsed/PIREP.xml | 2 +- .../hold/NcInventoryDefinitions/PIREP.xml | 2 +- .../.classpath | 7 - .../.project | 28 - .../gov.noaa.nws.ncep.edex.plugin.ncpirep.ecl | 0 .../res/spring/ncpirep-common.xml | 23 - .../res/spring/ncpirep-ingest.xml | 81 - .../.classpath | 0 .../.project | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 0 .../META-INF/MANIFEST.MF | 10 +- .../build.properties | 0 .../gov.noaa.nws.ncep.edex.plugin.pirep.ecl | 0 .../res/pointdata/pirep.xml} | 1 + .../res/spring/pirep-common.xml | 7 +- .../res/spring/pirep-ingest.xml | 39 +- .../ncep/edex/plugin/pirep/PirepDecoder.java} | 49 +- .../edex/plugin/pirep/PirepSeparator.java} | 16 +- .../plugin/pirep/decoder/PirepParser.java} | 26 +- .../plugin/pirep}/decoder/PirepTools.java | 5 +- .../base/purge/pirepPurgeRules.xml} | 0 .../edex_static/base/distribution/pirep.xml} | 0 ...s_ncpirep.xml => plotParameters_pirep.xml} | 2 +- .../{ncpirep => pirep}/standard.xml | 2 +- .../ResourceDefns/UPPER_AIR/PIREP/PIREP.xml | 2 +- .../UPPER_AIR/PIREP/standard.attr | 2 +- 70 files changed, 294 insertions(+), 4663 deletions(-) create mode 100644 deltaScripts/14.2.1/dropPirepAirep.sh delete mode 100644 edexOsgi/com.raytheon.edex.plugin.pirep/.classpath delete mode 100644 edexOsgi/com.raytheon.edex.plugin.pirep/.settings/org.eclipse.jdt.core.prefs delete mode 100644 edexOsgi/com.raytheon.edex.plugin.pirep/META-INF/MANIFEST.MF delete mode 100644 edexOsgi/com.raytheon.edex.plugin.pirep/build.properties delete mode 100644 edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/PirepDecoder.java delete mode 100644 edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/PirepSeparator.java delete mode 100644 edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/dao/PirepDao.java delete mode 100644 edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/decoder/PirepParser.java delete mode 100644 edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/decoder/PirepTools.java delete mode 100644 edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/decoder/TEI.java delete mode 100644 edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/decoder/TEIInfo.java delete mode 100644 edexOsgi/com.raytheon.edex.plugin.pirep/utility/common_static/base/purge/pirepPurgeRules.xml delete mode 100644 edexOsgi/com.raytheon.edex.plugin.pirep/utility/edex_static/base/distribution/pirep.xml delete mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.pirep/.settings/org.eclipse.jdt.core.prefs delete mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.pirep/META-INF/MANIFEST.MF delete mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.pirep/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject delete mode 100755 edexOsgi/com.raytheon.uf.common.dataplugin.pirep/src/com/raytheon/uf/common/dataplugin/pirep/PirepLayerData.java delete mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.pirep/src/com/raytheon/uf/common/dataplugin/pirep/PirepRecord.java delete mode 100644 ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/.project delete mode 100644 ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject delete mode 100644 ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/build.properties delete mode 100644 ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/gov.noaa.nws.ncep.common.dataplugin.ncpirep.ecl rename {edexOsgi/com.raytheon.uf.common.dataplugin.pirep => ncep/gov.noaa.nws.ncep.common.dataplugin.pirep}/.classpath (100%) rename {edexOsgi/com.raytheon.uf.common.dataplugin.pirep => ncep/gov.noaa.nws.ncep.common.dataplugin.pirep}/.project (91%) rename ncep/{gov.noaa.nws.ncep.common.dataplugin.ncpirep => gov.noaa.nws.ncep.common.dataplugin.pirep}/.settings/org.eclipse.jdt.core.prefs (100%) rename ncep/{gov.noaa.nws.ncep.common.dataplugin.ncpirep => gov.noaa.nws.ncep.common.dataplugin.pirep}/META-INF/MANIFEST.MF (85%) create mode 100644 ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject rename {edexOsgi/com.raytheon.uf.common.dataplugin.pirep => ncep/gov.noaa.nws.ncep.common.dataplugin.pirep}/build.properties (100%) rename edexOsgi/com.raytheon.edex.plugin.pirep/com.raytheon.edex.plugin.pirep.ecl => ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/gov.noaa.nws.ncep.common.dataplugin.pirep.ecl (100%) rename ncep/{gov.noaa.nws.ncep.common.dataplugin.ncpirep/src/gov/noaa/nws/ncep/common/dataplugin/ncpirep/NcPirepLayerData.java => gov.noaa.nws.ncep.common.dataplugin.pirep/src/gov/noaa/nws/ncep/common/dataplugin/pirep/PirepLayerData.java} (93%) rename ncep/{gov.noaa.nws.ncep.common.dataplugin.ncpirep/src/gov/noaa/nws/ncep/common/dataplugin/ncpirep/NcPirepPointDataTransform.java => gov.noaa.nws.ncep.common.dataplugin.pirep/src/gov/noaa/nws/ncep/common/dataplugin/pirep/PirepPointDataTransform.java} (87%) rename ncep/{gov.noaa.nws.ncep.common.dataplugin.ncpirep/src/gov/noaa/nws/ncep/common/dataplugin/ncpirep/NcPirepRecord.java => gov.noaa.nws.ncep.common.dataplugin.pirep/src/gov/noaa/nws/ncep/common/dataplugin/pirep/PirepRecord.java} (94%) rename ncep/{gov.noaa.nws.ncep.common.dataplugin.ncpirep/src/gov/noaa/nws/ncep/common/dataplugin/ncpirep/dao/NcPirepDao.java => gov.noaa.nws.ncep.common.dataplugin.pirep/src/gov/noaa/nws/ncep/common/dataplugin/pirep/dao/PirepDao.java} (78%) delete mode 100644 ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/.classpath delete mode 100644 ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/.project delete mode 100644 ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/gov.noaa.nws.ncep.edex.plugin.ncpirep.ecl delete mode 100644 ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/res/spring/ncpirep-common.xml delete mode 100644 ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/res/spring/ncpirep-ingest.xml rename ncep/{gov.noaa.nws.ncep.common.dataplugin.ncpirep => gov.noaa.nws.ncep.edex.plugin.pirep}/.classpath (100%) rename {edexOsgi/com.raytheon.edex.plugin.pirep => ncep/gov.noaa.nws.ncep.edex.plugin.pirep}/.project (92%) rename ncep/{gov.noaa.nws.ncep.edex.plugin.ncpirep => gov.noaa.nws.ncep.edex.plugin.pirep}/.settings/org.eclipse.jdt.core.prefs (100%) rename ncep/{gov.noaa.nws.ncep.edex.plugin.ncpirep => gov.noaa.nws.ncep.edex.plugin.pirep}/META-INF/MANIFEST.MF (75%) rename ncep/{gov.noaa.nws.ncep.edex.plugin.ncpirep => gov.noaa.nws.ncep.edex.plugin.pirep}/build.properties (100%) rename edexOsgi/com.raytheon.uf.common.dataplugin.pirep/com.raytheon.uf.common.dataplugin.pirep.ecl => ncep/gov.noaa.nws.ncep.edex.plugin.pirep/gov.noaa.nws.ncep.edex.plugin.pirep.ecl (100%) rename ncep/{gov.noaa.nws.ncep.edex.plugin.ncpirep/res/pointdata/ncpirep.xml => gov.noaa.nws.ncep.edex.plugin.pirep/res/pointdata/pirep.xml} (99%) rename {edexOsgi/com.raytheon.edex.plugin.pirep => ncep/gov.noaa.nws.ncep.edex.plugin.pirep}/res/spring/pirep-common.xml (72%) rename {edexOsgi/com.raytheon.edex.plugin.pirep => ncep/gov.noaa.nws.ncep.edex.plugin.pirep}/res/spring/pirep-ingest.xml (65%) rename ncep/{gov.noaa.nws.ncep.edex.plugin.ncpirep/src/gov/noaa/nws/ncep/edex/plugin/ncpirep/NcPirepDecoder.java => gov.noaa.nws.ncep.edex.plugin.pirep/src/gov/noaa/nws/ncep/edex/plugin/pirep/PirepDecoder.java} (86%) rename ncep/{gov.noaa.nws.ncep.edex.plugin.ncpirep/src/gov/noaa/nws/ncep/edex/plugin/ncpirep/NcPirepSeparator.java => gov.noaa.nws.ncep.edex.plugin.pirep/src/gov/noaa/nws/ncep/edex/plugin/pirep/PirepSeparator.java} (93%) rename ncep/{gov.noaa.nws.ncep.edex.plugin.ncpirep/src/gov/noaa/nws/ncep/edex/plugin/ncpirep/decoder/NcPirepParser.java => gov.noaa.nws.ncep.edex.plugin.pirep/src/gov/noaa/nws/ncep/edex/plugin/pirep/decoder/PirepParser.java} (99%) rename ncep/{gov.noaa.nws.ncep.edex.plugin.ncpirep/src/gov/noaa/nws/ncep/edex/plugin/ncpirep => gov.noaa.nws.ncep.edex.plugin.pirep/src/gov/noaa/nws/ncep/edex/plugin/pirep}/decoder/PirepTools.java (98%) rename ncep/{gov.noaa.nws.ncep.edex.plugin.ncpirep/utility/common_static/base/purge/ncpirepPurgeRules.xml => gov.noaa.nws.ncep.edex.plugin.pirep/utility/common_static/base/purge/pirepPurgeRules.xml} (100%) rename ncep/{gov.noaa.nws.ncep.edex.plugin.ncpirep/utility/edex_static/base/distribution/ncpirep.xml => gov.noaa.nws.ncep.edex.plugin.pirep/utility/edex_static/base/distribution/pirep.xml} (100%) rename ncep/gov.noaa.nws.ncep.viz.localization/localization/ncep/PlotModels/PlotParameters/{plotParameters_ncpirep.xml => plotParameters_pirep.xml} (99%) rename ncep/gov.noaa.nws.ncep.viz.localization/localization/ncep/PlotModels/{ncpirep => pirep}/standard.xml (98%) diff --git a/cave/com.raytheon.uf.viz.dataplugins.feature/feature.xml b/cave/com.raytheon.uf.viz.dataplugins.feature/feature.xml index 152ee9176d..3db090c6d3 100644 --- a/cave/com.raytheon.uf.viz.dataplugins.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.dataplugins.feature/feature.xml @@ -128,13 +128,6 @@ version="0.0.0" unpack="false"/> - - font-family: WxSymbolFont; } - text.special - { - fill: none; - font-size: 1em; - stroke-width: 1px; - font-size: 1em; - font-family: SpecialSymbolFont; - } ]]> - 0 - 75 - 0 - - + + 0 + 75 + 0 diff --git a/cave/com.raytheon.viz.pointdata/localization/plotModels/pirepPlotDesign.svg b/cave/com.raytheon.viz.pointdata/localization/plotModels/pirepPlotDesign.svg index 89e4a73635..c9c55b5469 100644 --- a/cave/com.raytheon.viz.pointdata/localization/plotModels/pirepPlotDesign.svg +++ b/cave/com.raytheon.viz.pointdata/localization/plotModels/pirepPlotDesign.svg @@ -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);"> + - 75 - 75 - + + + 75 + 75 + 0 arrow diff --git a/cave/com.raytheon.viz.pointdata/localization/plotModels/pirepTurbDesign.svg b/cave/com.raytheon.viz.pointdata/localization/plotModels/pirepTurbDesign.svg index f924b90e18..dbb0e08d1f 100644 --- a/cave/com.raytheon.viz.pointdata/localization/plotModels/pirepTurbDesign.svg +++ b/cave/com.raytheon.viz.pointdata/localization/plotModels/pirepTurbDesign.svg @@ -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; - } ]]> - 0 - 75 - 0 - - + + 0 + 75 + 0 diff --git a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/PlotModelFactory2.java b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/PlotModelFactory2.java index 3c64ab5bc6..b88d4bf43a 100644 --- a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/PlotModelFactory2.java +++ b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/PlotModelFactory2.java @@ -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. * * * @@ -1015,7 +1014,7 @@ public class PlotModelFactory2 { sb.append(" "); sb.append(fields[i]); } - display = sb.toString(); + display = sb.toString().trim(); } if (element.lookup != null) { diff --git a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/rsc/PlotResourceData.java b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/rsc/PlotResourceData.java index 7070360006..4a2948fa05 100644 --- a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/rsc/PlotResourceData.java +++ b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/rsc/PlotResourceData.java @@ -51,12 +51,15 @@ import com.raytheon.viz.pointdata.rsc.retrieve.PointDataPlotInfoRetriever; *
  * 
  * 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.
+ * 
  * 
  * 
* @@ -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()); } diff --git a/deltaScripts/14.2.1/dropPirepAirep.sh b/deltaScripts/14.2.1/dropPirepAirep.sh new file mode 100644 index 0000000000..a86325e864 --- /dev/null +++ b/deltaScripts/14.2.1/dropPirepAirep.sh @@ -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;" diff --git a/edexOsgi/build.edex/esb/conf/modes.xml b/edexOsgi/build.edex/esb/conf/modes.xml index ac23d2cb29..96b67c7db6 100644 --- a/edexOsgi/build.edex/esb/conf/modes.xml +++ b/edexOsgi/build.edex/esb/conf/modes.xml @@ -95,7 +95,6 @@ ncep-util-on-edex-ingestGrib ncscd-ingest.xml ncpafm-ingest.xml - ncpirep-ingest.xml nctaf-ingest.xml nctext-ingest.xml ncuair-ingest.xml diff --git a/edexOsgi/com.raytheon.edex.plugin.pirep/.classpath b/edexOsgi/com.raytheon.edex.plugin.pirep/.classpath deleted file mode 100644 index 1fa3e6803d..0000000000 --- a/edexOsgi/com.raytheon.edex.plugin.pirep/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/edexOsgi/com.raytheon.edex.plugin.pirep/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.edex.plugin.pirep/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index b7c28b0299..0000000000 --- a/edexOsgi/com.raytheon.edex.plugin.pirep/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -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 diff --git a/edexOsgi/com.raytheon.edex.plugin.pirep/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.edex.plugin.pirep/META-INF/MANIFEST.MF deleted file mode 100644 index c51b62a1d1..0000000000 --- a/edexOsgi/com.raytheon.edex.plugin.pirep/META-INF/MANIFEST.MF +++ /dev/null @@ -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 diff --git a/edexOsgi/com.raytheon.edex.plugin.pirep/build.properties b/edexOsgi/com.raytheon.edex.plugin.pirep/build.properties deleted file mode 100644 index 5791d48d5f..0000000000 --- a/edexOsgi/com.raytheon.edex.plugin.pirep/build.properties +++ /dev/null @@ -1,5 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - res/ diff --git a/edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/PirepDecoder.java b/edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/PirepDecoder.java deleted file mode 100644 index 8d8c3f6f66..0000000000 --- a/edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/PirepDecoder.java +++ /dev/null @@ -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. - * PirepDecoder dec = new PirepDecoder(); - * dec.setMessage(msgData); - * while(dec.hasNext()) - * { - * PluginDataObject r = dec.decode(); - * // do something with record. - * } - * - * - * - *
- * 
- * 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
- * 
- * - * @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 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 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 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; - } - -} diff --git a/edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/PirepSeparator.java b/edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/PirepSeparator.java deleted file mode 100644 index b05a479c35..0000000000 --- a/edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/PirepSeparator.java +++ /dev/null @@ -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. - * - *
- * 
- * 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.
- * 
- * - * @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 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 bodyRecords = new ArrayList(); - - bodyRecords = new ArrayList(); - while (matcher.find()) { - bodyRecords.add(matcher.start()); - } - - reports = new ArrayList(); - 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; - } - -} diff --git a/edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/dao/PirepDao.java b/edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/dao/PirepDao.java deleted file mode 100644 index da5ae36c3a..0000000000 --- a/edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/dao/PirepDao.java +++ /dev/null @@ -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. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * 20080103            384 jkorman     Initial Coding.
- * 
- * - * @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; - } - -} diff --git a/edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/decoder/PirepParser.java b/edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/decoder/PirepParser.java deleted file mode 100644 index f56f926d45..0000000000 --- a/edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/decoder/PirepParser.java +++ /dev/null @@ -1,1496 +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.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 org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.raytheon.edex.esb.Headers; -import com.raytheon.uf.common.dataplugin.pirep.PirepLayerData; -import com.raytheon.uf.common.pointdata.spatial.ObStation; -import com.raytheon.uf.edex.database.DataAccessLayerException; -import com.raytheon.uf.edex.decodertools.aircraft.AircraftCloudLayer; -import com.raytheon.uf.edex.decodertools.aircraft.AircraftFlightCondition; -import com.raytheon.uf.edex.decodertools.aircraft.AircraftFlightLevel; -import com.raytheon.uf.edex.decodertools.aircraft.AircraftRemarks; -import com.raytheon.uf.edex.decodertools.core.BasePoint; -import com.raytheon.uf.edex.decodertools.core.DecoderTools; -import com.raytheon.uf.edex.decodertools.core.IDecoderConstants; -import com.raytheon.uf.edex.decodertools.core.LatLonPoint; -import com.raytheon.uf.edex.decodertools.time.TimeTools; -import com.raytheon.uf.edex.pointdata.spatial.ObStationDao; -import com.vividsolutions.jts.geom.Geometry; -import com.vividsolutions.jts.geom.Point; - -/** - * This class parses Pirep reports. Some of the parsing is ported from the NCEP - * NWS decoder, and other parts use regular expressions based on information in - * AFMAN 15-124 and FMH No. 12. - * - *
- * SOFTWARE HISTORY
- * Date         PR#         Engineer    Description
- * -----------  ---------- ------------ --------------------------
- * 20080116            798 jkorman      Changed logging levels.
- * ======================================
- * AWIPS2 DR Work
- * 08/09/2012         1011 jkorman     Changed parser to use TEIInfo to
- * parse text elements properly. Removed test code to unit-test
- * parse TEIs.
- * 08/23/2012         1011 jkorman     Corrected test for icing NEG.
- * Feb 27, 2013 1638       mschenke     Moved ObStationDao to edex pointdata plugin
- * 
- * - * @author jkorman - * @version Dec. 27, 2007 - */ -public class PirepParser { - private static final double ONE_NM_RADIANS = (2.0 * Math.PI) / 21637.5; - - // Allowable future time in milliseconds (15 minutes). - private static final int ALLOWABLE_TIME = 15; - - private static final String SK_SKC = "SKC"; - - private static final String SK_CLR = "CLR"; - - private static final String BLO_HGT = "BLO"; - - private static final String ABV_HGT = "ABV"; - - private static final String NEG_ENTRY = "NEG"; - - private static final String NULL_ENTRY = "---"; - - private static final Map FL_COND_WORDS = new HashMap(); - static { - FL_COND_WORDS.put(NEG_ENTRY, NEG_ENTRY); - FL_COND_WORDS.put("TRACE", "TRACE"); - FL_COND_WORDS.put("LGT", "LGT"); - FL_COND_WORDS.put("MOD", "MOD"); - FL_COND_WORDS.put("MDT", "MOD"); - FL_COND_WORDS.put("SEV", "SEV"); - FL_COND_WORDS.put("SVR", "SEV"); - FL_COND_WORDS.put("SEVERE", "SEV"); - FL_COND_WORDS.put("EXTRM", "EXTRM"); - FL_COND_WORDS.put("SMOOTH", NULL_ENTRY); - FL_COND_WORDS.put("SMTH", NULL_ENTRY); - FL_COND_WORDS.put("CONS", NULL_ENTRY); - FL_COND_WORDS.put("HVY", NULL_ENTRY); - } - - private static final Map COND_TYPES = new HashMap(); - static { - COND_TYPES.put("MXD", "MXD"); - COND_TYPES.put("RIME", "RIME"); - COND_TYPES.put("CLR", "CLR"); - COND_TYPES.put("CLEAR", "CLEAR"); - COND_TYPES.put("CHOP", "CHOP"); - COND_TYPES.put("CAT", "CAT"); - } - - private static final Map DIR_POINTS = new HashMap(); - static { - DIR_POINTS.put("N", 0); - DIR_POINTS.put("NNE", 22); - DIR_POINTS.put("NE", 45); - DIR_POINTS.put("ENE", 67); - DIR_POINTS.put("E", 90); - DIR_POINTS.put("ESE", 112); - DIR_POINTS.put("SE", 135); - DIR_POINTS.put("SSE", 157); - DIR_POINTS.put("S", 180); - DIR_POINTS.put("SSW", 202); - DIR_POINTS.put("SW", 225); - DIR_POINTS.put("WSW", 247); - DIR_POINTS.put("W", 270); - DIR_POINTS.put("WNW", 292); - DIR_POINTS.put("NW", 315); - DIR_POINTS.put("NNW", 337); - } - - private static final String ICE_TURB_PREFIX = "([A-Z]{3,5})(?:((?:-)([A-Z]{3,5})))?"; - - private static final String ABV_BLO = BLO_HGT + "|" + ABV_HGT; - - private static final String ICE_TURB_SUFFIX = "(?: )?(((" + ABV_BLO - + ")(?: )(\\d{3}))|((\\d{3})(?:(-(\\d{3}))?)))?(?:/)?()"; - - private static final String ICE_REGEX = ICE_TURB_PREFIX - + "((?: )(RIME|MXD|CLR))" + ICE_TURB_SUFFIX; - - private static final String TRB_REGEX = ICE_TURB_PREFIX - + "((?: )(CHOP|CAT))?" + ICE_TURB_SUFFIX; - - // 3901N 08446W - private static final String LATLON_PTRN = "((([0-8]\\d[0-5]\\d)|(9000))[NS] ((0\\d{2}[0-5]\\d)|([1][0-7]\\d[0-5]\\d)|(18000))[EW])"; - - private static final String navaidPattern = "^[A-Z,0-9]{3,4}$"; - private static final String bearingDistPattern = "^([A-Z,0-9]{3,4})\\s*(\\d{3})(\\d{3})$"; - - /** The logger */ - private Log logger = LogFactory.getLog(getClass()); - - // Codes used in groupLikeTypes() - // Was the character whitespace? - private static final int NONE = 0; - - // Was character a digit? - private static final int DIGIT = 1; - - // Was character a letter? - private static final int LETTER = 2; - - // Was character non-alphanumeric but not whitespace? - private static final int NONALPHANUMERIC = 3; - - private String reportData = null; - - private String theReportingStationId = null; - - private BasePoint location = null; - - private LatLonPoint interLocation = null; - - private Calendar observationTime = null; - - private AircraftFlightLevel flightLevel = null; - - private String aircraftType = "UNKN"; - - private Double temperature = null; - - private Integer windDirection = null; - - private Double windSpeed = null; - - private Integer horzVisibility = null; - - private List cloudLayers = null; - - private AircraftRemarks theRemarks = null; - - private List turbulenceLayers = null; - - private List theIcingLayers = null; - - private String[] theWeatherCodes = null; - - // these values are only populated if the pirep contained explicit lat/lon; - // theLocation holds the location of the pirep; values in radians - private double latitude = Double.NaN; - - private double longitude = Double.NaN; - - private String traceId; - - private Headers headers; - - private int reportType = IDecoderConstants.PIREP_NORMAL; - /** - * Construct a PirepParser from given String data. The report is completely - * parsed and decoded upon success. - * - * @param report - * String data containing the possible PIREP. - * @throws DecodeException - * An error occurred within the parser. - */ - public PirepParser(String report, String traceId, Headers headers) { - reportData = report; - this.traceId = traceId; - this.headers = headers; - parse(); - } - - /** - * Construct a PirepParser from given byte array data. The report is - * completely parsed and decoded upon success. - * - * @param report - * Byte array data containing the possible PIREP. - * @throws DecodeException - * An error occurred within the parser. - */ - public PirepParser(byte[] report, String traceId, Headers headers) { - this(new String(report), traceId, headers); - } - - /** - * @return the reportData - */ - public String getReportData() { - return reportData; - } - - public Integer getReportType() { - return reportType; - } - - /** - * Get the station reporting id. - * - * @return Returns the theReportingStationId. - */ - public String getReportingStationId() { - return theReportingStationId; - } - - /** - * Get the reporting aircraft type. - * - * @return The aircraft type. - */ - public String getAircraftType() { - return aircraftType; - } - - /** - * Get the decoded flight level information. - * - * @return The decoded flight level in feet. - */ - public Integer getFlightLevel() { - Integer retValue = null; - if (flightLevel != null) { - retValue = flightLevel.getFlightLevel(); - } - return retValue; - } // getFlightLevel() - - /** - * Get the aircraft location or midpoint location. - * - * @return Returns the aircraft location. - */ - public BasePoint getLocation() { - return location; - } - - /** - * Get the PIREP observation time. - * - * @return Returns the observation time. - */ - public Calendar getObservationTime() { - return observationTime; - } - - /** - * Get the air temperature at altitude. - * - * @return Returns the air temperature. (May return null) - */ - public Double getTemperature() { - return temperature; - } - - /** - * Get the reported wind direction. - * - * @return Returns the wind direction. (May return null) - */ - public Integer getWindDirection() { - return windDirection; - } - - /** - * Get the reported wind speed. - * - * @return Returns the wind speed. (May return null) - */ - public Double getWindSpeed() { - return windSpeed; - } - - /** - * Get any remarks found in the report. - * - * @return Returns the remarks. (May return null) - */ - public String getRemarks() { - return (theRemarks != null) ? theRemarks.toString() : ""; - } - - /** - * Get the cloud layer information. - * - * @return Returns the decoded cloud layers. (May return null) - */ - public List getCloudLayers() { - return cloudLayers; - } - - /** - * Get the turbulence layer information. - * - * @return Returns the turbulence layers. (May return null) - */ - public List getTurbulenceLayers() { - return turbulenceLayers; - } - - /** - * Get the icing layer information. - * - * @return Returns the icing layers. (May return null) - */ - public List getIcingLayers() { - return theIcingLayers; - } - - /** - * Get the flight visibility if decoded. - * - * @return Returns the flight visibility. (May return null) - */ - public Integer getHorxVisibility() { - return horzVisibility; - } - - /** - * Get the decoded weather information. - * - * @return Returns the weather codes. (May return null) - */ - public String[] getWeatherCodes() { - return theWeatherCodes; - } - - /** - * This method parses the pirep based on TEIs and delegates the data for - * each to a different method. This method ported from NCEP decoder. - * - * @throws DecodeException - * An error occurred within this method. - */ - protected void parse() { - // if failed to decode reporting station id, this must be Canadian pirep - // TODO convert! - - List positions = TEIInfo.findTEIs(reportData); - // Look for a 'UUA' or 'UA' indicator to denote the start of - // the report. - if ((positions.size() > 0) && (TEI.PIREP.equals(positions.get(0).getTei()))) { - boolean success = false; - for (TEIInfo t : positions) { - switch (t.getTei()) { - case PIREP: { - // success = decodeReportingStationId(t.getTeiText()); - success = true; - break; - } - case OV: - // Decode and store the "/OV" (i.e. location) data. - success = decodeLocationData(t.getTeiText()); - break; - case TM: - // Decode and store the "/TM" (i.e. time) data. - success = decodeTimeData(t.getTeiText()); - break; - case FL: - // Decode and store the "/FL" (i.e. flight level) data. - success = decodeFlightLevelData(t.getTeiText()); - break; - case TP: - // Decode and store the "/TP" (i.e. aircraft type) data. - success = decodeAircraftTypeData(t.getTeiText()); - break; - case SK: - // Decode and store the "/SK" (i.e. sky cover) data. - success = decodeSkyCoverData(t.getTeiText()); - break; - case WX: - // Decode and store the "/WX" (i.e. weather) data. - success = decodeWeatherData(t.getTeiText()); - break; - case TA: - // Decode and store the "/TA" (i.e. temperature) data. - success = decodeTemperatureData(t.getTeiText()); - break; - case WV: - // Decode and store the "/WV" (i.e. wind) data. - success = decodeWindData(t.getTeiText()); - break; - case TB: - // Decode and store the "/TB" (i.e. turbulence) data. - success = decodeTurbulenceData(t.getTeiText()); - break; - case IC: - // Decode and store the "/IC" (i.e. icing) data. - success = decodeIcingData(t.getTeiText()); - break; - case RM: - // Decode and store the "/RM" (i.e. remarks) data. - success = decodeRemarksData(t.getTeiText()); - break; - default: { - logger.error(String.format("Invalid PIREP identifier [%s] found", t.getTeiText())); - break; - } - } // switch() - } // for - } else { - - } - } // parse() - - /** - * This method gets the reporting station id for a PIREP. The reporting - * station id is the station id which immediately precedes the characters UA - * or UUA. This method ported from NCEP decoder. - * - * @param str - * String preceding UA or UUA - * @return success or failure - */ - protected boolean decodeReportingStationId(String str) { - String id = str.trim(); - - this.theReportingStationId = id; - return true; - } // decodeReportingStationId() - - /** - * This method decodes and stores the location data from within a PIREP - * report. The location data may be a set of one or two "location points" - * (i.e. a "location point" is a navaid or a navaid/bearing/distance), or it - * may be a latitude/longitude combination such as is found in AIREP - * reports. - * - * @param locData - * All data located in the PIREP report "OV" section. - * @return Decode success or failure status. - * @throws DecodeException - * If a decode error occured. - */ - protected boolean decodeLocationData(String locData) { - boolean decodeStatus = false; - final int maxOVParts = 2; - - Pattern p = Pattern.compile(LATLON_PTRN); - Matcher m = p.matcher(locData); - if (m.find()) { - location = parseLatLon(m.group()); - decodeStatus = (location != null); - } else { - ArrayList ovParts = new ArrayList(); - - StringTokenizer st = new StringTokenizer(locData, "-", false); - while (st.hasMoreTokens()) { - String s = st.nextToken(); - ovParts.add(s.toUpperCase()); - } - // If there are more than 2 parts, this location data is in error - // BUT - // we will use the first two points and ignore trailing! - if (ovParts.size() == 1) { - decodeStatus = decodeLocation(ovParts.get(0).trim()); - } else if (ovParts.size() >= maxOVParts) { - // If valid, this will leave the first location in theLocation. - if (decodeLocation(ovParts.get(0).trim())) { - // Make sure to save the previous location. decodeLocation - // will trash it. - LatLonPoint firstPoint = interLocation; - // now get the second point. - if (decodeLocation(ovParts.get(1).trim())) { - LatLonPoint secondPoint = interLocation; - - // Now we have two valid points. - // get the midpoint distance from point 1 to point 2. - double dist = firstPoint.distanceTo(secondPoint) / 2; - // and use the bearing between the points to construct - // the - // midpoint location. - secondPoint = firstPoint.positionOf( - firstPoint.bearingTo(secondPoint), dist); - location = new BasePoint( - secondPoint.getLatitude(LatLonPoint.INDEGREES), - secondPoint.getLongitude(LatLonPoint.INDEGREES)); - decodeStatus = true; - if (ovParts.size() > maxOVParts) { - logger.info(traceId - + "- More than 2 locations reported, first 2 used"); - } - } else { - logger.error(traceId + "- Cound not decode location " - + ovParts.get(1).trim()); - } - } else { - logger.error(traceId + "- Cound not decode location " - + ovParts.get(0).trim()); - } - } - } - return decodeStatus; - } // decodeLocationData() - - /** - * Decode the individual location points found in an "OV" section. - * - * @param aLocation - * A possible location point. - * @return Was the decode successful (true|false). - */ - private boolean decodeLocation(String aLocation) { - - Pattern p = Pattern.compile(navaidPattern); - location = null; - boolean decodeStatus = false; - Matcher m = p.matcher(aLocation); - if (m.find()) { - BasePoint navaidLoc = getNavaidLocation(aLocation); - if (navaidLoc != null) { - location = navaidLoc; - - interLocation = new LatLonPoint(navaidLoc.getLatitude(), - navaidLoc.getLongitude(), LatLonPoint.INDEGREES); - - decodeStatus = true; - } - } else { - // try bearing and distance. - p = Pattern.compile(bearingDistPattern); - m = p.matcher(aLocation); - if (m.find()) { - String staId = m.group(1); - - BasePoint navaidLoc = getNavaidLocation(staId); - if (navaidLoc != null) { - String s = m.group(2); - Double bearing = Math.toRadians(PirepTools.parseInteger(s)); - - s = m.group(3); - Double dist = ONE_NM_RADIANS * PirepTools.parseInteger(s); - - LatLonPoint point1 = new LatLonPoint( - navaidLoc.getLatitude(), navaidLoc.getLongitude(), - LatLonPoint.INDEGREES); - - LatLonPoint point2 = point1.positionOf(-bearing, dist); - interLocation = point2; - - location = new BasePoint( - point2.getLatitude(LatLonPoint.INDEGREES), - point2.getLongitude(LatLonPoint.INDEGREES)); - - decodeStatus = true; - } else { - decodeStatus = false; - } - } else { - } - } - return decodeStatus; - } // decodeLocation() - - - /** - * Get the latitude/longitude pair for a given navigation point. - * - * @param aNavaid - * A possible navaid to look up. - * @return The location of the navaid or null if not found. - */ - private BasePoint getNavaidLocation(String navaid) { - BasePoint navaidLocation = null; - - ObStationDao obSta = null; - ObStation stationInfo = null; - if ((navaid != null) && (navaid.length() >= 0)) { - logger.debug(traceId + " - Processing Navaid [" + navaid + "]"); - try { - obSta = new ObStationDao(); - if (navaid.length() == 3) { - String gid = ObStation.createGID( - ObStation.CAT_TYPE_ACFT_PIREP, navaid); - - stationInfo = obSta.queryByGid(gid); - } else if (navaid.length() == 4) { - String gid = ObStation.createGID(ObStation.CAT_TYPE_ICAO, - navaid); - stationInfo = obSta.queryByGid(gid); - } - } catch (DataAccessLayerException e) { - logger.error(traceId + " - Unable to retrieve station info", e); - } - } else { - logger.info(traceId + " - Invalid navaid [" + navaid + "]"); - } - - if (stationInfo != null) { - Geometry g = stationInfo.getGeometry(); - if (g instanceof Point) { - Point p = (Point) g; - navaidLocation = new BasePoint(p.getY(), p.getX()); - } - } else { - logger.info(traceId + " - Station id not found [" + navaid + "]"); - } - return navaidLocation; - } // getNavaidLocation() - - /** - * - */ - private static BasePoint parseLatLon(String latlon) { - BasePoint point = null; - - // 012345678901 - // lldds llldds - - Integer lat_dd = PirepTools.parseInteger(latlon.substring(0, 2)); - Integer lat_mm = PirepTools.parseInteger(latlon.substring(2, 4)); - Integer lon_dd = PirepTools.parseInteger(latlon.substring(6, 9)); - Integer lon_mm = PirepTools.parseInteger(latlon.substring(9, 11)); - - if ((lat_dd != null) && (lat_mm) != null) { - if ((lon_dd != null) && (lon_mm) != null) { - - Double lat = lat_dd + (lat_mm / 60.0d); - Double lon = lon_dd + (lon_mm / 60.0d); - if (lat_dd.equals(0) && (lat_mm.equals(0))) { - lat = 0.0; - } else { - switch (latlon.charAt(4)) { - case 'N': { - break; - } - case 'S': { - lat = lat * -1; - break; - } - default: { - lat = null; - } - } - } - if (lon_dd.equals(0) && (lon_mm.equals(0))) { - lon = 0.0; - } else { - switch (latlon.charAt(11)) { - case 'E': { - break; - } - case 'W': { - lon = lon * -1; - break; - } - default: { - lon = null; - } - } - } - if (lat != null && lon != null) { - point = new BasePoint(lat, lon); - } - } - } - return point; - } - - /** - * This method decodes a location point (i.e. a "location point" is either a - * navaid or a navaid/bearing/distance) from within the location data of a - * PIREP report. This method ported from NCEP decoder. - * - * @param fields - * "like-type" fields which contain location data - * @param startIndex - * Index of "like-type" group which contains start of location - * point - * @param aLoc - * latitude and longitude of location - * @return Index of "like-type" group which contains end of location point, - * -1 on failure - * @throws DecodeException - * If a decode error occured. - */ - protected int decodeLocationPoint(String[] fields, int startIndex, - BasePoint aLoc) { - boolean offset = false; - boolean other = false; - boolean bad = false; - int endIndex = -1; - - // LatLonPoint point1Loc = null; - - // The "like-type" group should be a 3-letter or 4-letter navaid - // identifier. - BasePoint navaidLoc = null; - int i = startIndex; - if ((Character.isLetter(fields[i].charAt(0)) && ((fields[i].length() == 3) || (fields[i] - .length() == 4))) - || (Character.isDigit(fields[i].charAt(0)) && (fields[i] - .length() <= 2))) { - // Setting conditions if the navaid came after the reported - // distance and range. - if (Character.isDigit(fields[i].charAt(0))) { - if ((i + 2) < fields.length) { - i += 2; - endIndex = i; - other = true; - if (fields[i].length() <= 2) { - bad = true; - } - } else { - bad = true; - } - } - - // Locate the entry for this navaid in the PIREP navaids table - if (!bad) { - navaidLoc = getNavaidLocation(fields[i]); - if (navaidLoc == null) { - // LOG.error("Could not find " + fields[i] + " in Pirep - // Navaids table."); - return -1; - } - - // store the first location navaid as the platform station - if (navaidLoc == null) { - // thePlatformStation = platformStation; - } - - // create location for the navaid - // point1Loc = new LatLonPoint(navaidLoc.getLatitude(), - // navaidLoc.getLongitude(), - // LatLonPoint.INDEGREES); - } - } else { - bad = true; - } - - if (bad) { - // throw new DecodeException("Invalid Navaid in Pirep Location: " - // + fields[i]); - } - - // Looking for the bearing and distance offset, if there is one. - int bearingDegrees = -1; - int distanceNm = -1; - if (!other && ((i + 1) < fields.length) - && Character.isDigit(fields[i + 1].charAt(0)) - && (fields[i + 1].length() == 6)) { - endIndex = i + 1; - bearingDegrees = Integer.parseInt(fields[i + 1].substring(0, 3)); - distanceNm = Integer.parseInt(fields[i + 1].substring(3, 6)); - offset = true; - if ((bearingDegrees < 0) || (bearingDegrees > 360) - || (distanceNm < 0)) { - // throw new DecodeException("Invalid bearing / distance: " - // + bearingDegrees + " / " + distanceNm + " data: " - // + fields[i + 1]); - } - } else if (other) { - // getting bearing and distance of aircraft - distanceNm = Integer.parseInt(fields[i - 2]); - bearingDegrees = decodeLocationDirection(fields[i - 1]); - offset = true; - } - - BasePoint loc = null; - if (offset) { - // // convert distance from nautical miles to kilometers - // Length distance = distanceNm; - // // convert bearing from degrees to radians - // AngularMeasure bearing = new AngularMeasure() - // .fromDegree(bearingDegrees); - // - // // Compute the latitude and longitude of the location - // // point by applying the bearing and distance offsets - // // to the navaid latitude and longitude. - // // (assume spherical earth) - // double distanceRad = distance.getKilometers() - // / PhysPar.EARTH_RADIUS_KM; - // loc = LatLonPoint.positionOf(navaidLoc.getLatitude(), navaidLoc - // .getLongitude(), bearing.getRadians(), distanceRad); - // } else { - // // The location point is simply the navaid itself, so the - // // latitude and longitude of the location point are equal - // // to the latitude and longitude of the navaid. - // endIndex = i; - // loc = navaidLoc; - } - aLoc.setLatitude(loc.getLatitude()); - aLoc.setLongitude(loc.getLongitude()); - - return endIndex; - } - - /** - * This method decodes a location direction from a given compass point from - * within the location data of a PIREP report. This method ported from NCEP - * decoder. - * - * @param aField - * A possible location direction to decode. - * @return location direction in degrees, -1 on failure - */ - protected int decodeLocationDirection(String aField) { - int bearingDegrees = -1; - if (DIR_POINTS.containsKey(aField)) { - bearingDegrees = DIR_POINTS.get(aField).intValue(); - } - return bearingDegrees; - } - - /** - * This subroutine decodes and stores the time (i.e. report hour and report - * minutes) from AMDAR, AIREP, PIREP, and RECCO reports. This method ported - * from NCEP decoder. - * - * @param str - * time data - * @return true on success - * @throws DecodeException - * If a decode error occured. - */ - protected boolean decodeTimeData(String str) { - str = str.trim(); - if (str.length() != 4) { - // throw new DecodeException("Unrecognized time data format in - // Pirep: " + str); - } - - // Decode and store the report hour. - int hour = Integer.parseInt(str.substring(0, 2)); - // Decode and store the report minute. - int minute = Integer.parseInt(str.substring(2)); - - Calendar oTime = TimeTools.getSystemCalendar((String) headers - .get(DecoderTools.INGEST_FILE_NAME)); - - observationTime = TimeTools.copy(oTime); - observationTime.set(Calendar.HOUR_OF_DAY, hour); - observationTime.set(Calendar.MINUTE, minute); - observationTime.set(Calendar.SECOND, 0); - observationTime.set(Calendar.MILLISECOND, 0); - - oTime.add(Calendar.MINUTE, ALLOWABLE_TIME); - if (observationTime.compareTo(oTime) > 0) { - observationTime.add(Calendar.DAY_OF_MONTH, -1); - } - - return true; - } - - /** - * This method decodes PIREP flight level. - * - * @param str - * Flight Level Data - * @return true on success - */ - protected boolean decodeFlightLevelData(String str) { - String regex = "([0-9]{3})(?:-([0-9]{3}))?"; - Pattern pattern = Pattern.compile(regex); - - // Get a Matcher based on the target string. - Matcher matcher = pattern.matcher(str); - if (matcher.find()) { - Integer fltLevel = decodeHeight(matcher.group(1)); - - if (matcher.group(2) != null) { - Integer upperLevel = decodeHeight(matcher.group(2)); - - fltLevel = (fltLevel + upperLevel) / 2; - } - flightLevel = new AircraftFlightLevel(fltLevel); - } - - // if the flight level has anything non-numeric such as UNK, UNKN, DURC, - // DURD, VFR, etc. - // the flight level will be left null and stored by the decoder as - // unknown - - return true; - } - - /** - * This method decodes a 3-digit string containing a height value in units - * of hundreds-of-feet into a real height value in units of feet. This - * method ported from NCEP decoder. - * - * @param aHeight - * Height data to decode. - * @return The aircraft height information or null if the decode failed. - */ - protected Integer decodeHeight(String aHeight) { - Integer altHundredsFeet = null; - if (aHeight.length() == 3) { - if (!"UNKN".equals(aHeight)) { - // unknown heights - if ((aHeight.indexOf("UNK") != -1) - || (aHeight.indexOf("ABV") != -1) - || (aHeight.indexOf("BLO") != -1)) { - altHundredsFeet = null; - } else { - altHundredsFeet = Integer.parseInt(aHeight) * 100; - } - } - } - return altHundredsFeet; - } - - /** - * This method decodes and stores the aircraft type data from within a PIREP - * report. This method ported from NCEP decoder. - * - * @param aType - * Aircraft type data - * @return Was the aircraft type decoded. (always true) - */ - protected boolean decodeAircraftTypeData(String aType) { - aType = aType.trim(); - - // truncate at 8 characters - if (aType.length() <= 8) { - aircraftType = new String(aType); - } else { - aircraftType = new String(aType.substring(0, 8)); - } - - return true; - } - - /** - * This method decodes and stores the temperature data from within a PIREP - * report. This method ported from NCEP decoder. - * - * @param aTemperature - * A possible temperature to be decoded. - * @return Was the temperature data decoded. - * @throws DecodeException - * If a decode error occurred. - */ - protected boolean decodeTemperatureData(String aTemperature) { - // Break up the input string into groups of "like-type" in order - // to facilitate decoding. - String[] fields = groupLikeTypes(aTemperature); - if (fields.length == 0) { - return false; - } - - // Locate, decode, and store the temperature data from within - // the first 3 "like-type" groups. It is identifiable as a - // numeric "like-type" group of at least 1 digit, possibly - // preceded by a "like-type" group containing the sign of - // the temperature. - int numGroups = Math.min(3, fields.length); - for (int i = 0; i < numGroups; i++) { - if ((fields[i].length() >= 1) - && (Character.isDigit(fields[i].charAt(0)))) { - double temp; - if (i == 0) { - // This is the first "like-type" group, so assume - // that the sign of the temperature is positive. - temp = decodeTemperatureData("+", fields[i]); - } else { - // Assume that the previous "like-type" group - // contains the sign of the temperature. - temp = decodeTemperatureData(fields[i - 1], fields[i]); - } - - if (Double.isNaN(temp)) { - return false; - } - - // Check if temperature was reported in Fahrenheit. - if ((i < (fields.length - 1)) - && ((fields[i + 1].length() == 1) && (fields[i + 1] - .charAt(0) == 'F'))) { - // temperature = new Temperature().fromFahrenheit(temp); - } else { - temperature = temp; - } - break; - } - } - - return true; - } - - /** - * Helper method to decode temperature in PIREP. This method was ported from - * NCEP decoder. - * - * @param sign - * Sign of the data i.e. {"PS, P, +, MS, M, -}. - * @param temp - * Candidate temperature value. - * @return temperature on success, NaN on failure - * @throws DecodeException - * If a decode error occured. - */ - protected double decodeTemperatureData(String sign, String temp) { - double rmult = Double.NaN; - double rdiv = Double.NaN; - - // validate length - if ((temp.length() < 1) || (temp.length() > 3) || (sign.length() < 1) - || (sign.length() > 2)) { - // throw new DecodeException("Unrecognized temperature data format - // in Pirep: " + sign + temp); - } - - // Determine divisor based on the length of the input temperature - // string. - if (temp.length() == 3) { - rdiv = 10.0; - } else { - rdiv = 1.0; - } - - // Determine the length of the input temperature sign string, - // and then decode the sign of the temperature accordingly. - if (sign.length() == 2) { - if ("PS".equals(sign)) { - rmult = 1.0; - } else if ("MS".equals(sign)) { - rmult = -1.0; - } - } else { - if ("P".equals(sign) || "+".equals(sign)) { - rmult = 1.0; - } else if ("M".equals(sign) || "-".equals(sign)) { - rmult = -1.0; - } - } - if (Double.isNaN(rmult)) { - // throw new DecodeException("Unrecognized temperature sign data - // format in Pirep: " + sign); - } - - double t = (double) Integer.parseInt(temp) * rmult / rdiv; - return t; - } - - /** - * This method decodes the sky cover data. - * - * @param str - * Sky cover data to be decoded. - * @return Was the sky cover correctly decoded? - * @throws DecodeException - * If a decode error occured. - */ - protected boolean decodeSkyCoverData(String str) { - // Format is NNN(-NNN)bbb(-TOPttt)/NNN(-NNN)bbb, etc. - // NNN is the three-letter contraction for the amount of cloud cover - // bbb is the height of the base of a layer of clouds in hundreds of - // feet - // ttt is the top of the layer in hundreds of feet - String regex = "([A-Z]{3}|UNKN?)(?:-([A-Z]{3}))?([0-9]{3}|UNKN?)(?:-TOP([0-9]{3}|UNKN?))?/?"; - Pattern pattern = Pattern.compile(regex); - // Get a Matcher based on the target string. - Matcher matcher = pattern.matcher(str); - while (matcher.find()) { - if (cloudLayers == null) { - cloudLayers = new ArrayList(); - } - - // NNN - String cloud_1 = matcher.group(1); - // (NNN) - String cloud_2 = matcher.group(2); - // bbb - String baseHeight = matcher.group(3); - // (ttt) - String topHeight = matcher.group(4); - - if (cloud_1 == null) { - // throw new DecodeException("Unknown format of Sky Cover Data - // in Pirep: " + str); - } - - // TODO this should be mapped in the parameter lookups - if (SK_SKC.equals(cloud_1)) { - cloud_1 = SK_CLR; - } - if (SK_SKC.equals(cloud_2)) { - cloud_2 = SK_CLR; - } - - AircraftCloudLayer layer = new AircraftCloudLayer(); - layer.setCloudCover1(cloud_1); - layer.setCloudCover2(cloud_2); - - if ((baseHeight != null)) { - layer.setCloudBaseHeight(decodeHeight(baseHeight)); - } - if ((topHeight != null)) { - layer.setCloudTopHeight(decodeHeight(topHeight)); - } - cloudLayers.add(layer); - } - - // TODO alternate sky cover format and separator of cloud cover can be - // other than - - // also other possibilites in afpsky.f - // also TOP can be TPS, and can be second top height - - return true; - } - - /** - * This method decodes the wind data. - * - * @param str - * Wind data to be decoded. - * @return Was the wind data properly decoded? - * @throws DecodeException - * If a decode error occured. - */ - protected boolean decodeWindData(String str) { - // Format is dddff(f)KT - // ddd is three digit true direction in whole degrees from - // which the wind is blowing - // ff(f) is the wind speed in knots, followed by KT - String regex = "([0-9]{3})([0-9]{2,3})(?:KT)?"; - Pattern pattern = Pattern.compile(regex); - // Get a Matcher based on the target string. - Matcher matcher = pattern.matcher(str); - if (matcher.find()) { - windDirection = Integer.parseInt(matcher.group(1)); - - int windSpeedKnots = Integer.parseInt(matcher.group(2)); - windSpeed = new Double(windSpeedKnots); // Speed().fromKnots(windSpeedKnots); - } else { - // throw new DecodeException("Unrecognized wind data format in - // Pirep: " + str); - } - - return true; - } - - /** - * This method decodes the turbulence data. - * - * @param turbLayers - * Turbulence data to be decoded. - * @return Was the turbulence properly decoded? - * @throws DecodeException - * If a decode error occured. - */ - protected boolean decodeTurbulenceData(String turbLayers) { - // Format is III(-III)( CAT or CHOP ) (bbb-ttt)/III(-III) etc. - // III is the intesity of the turbulence - // CAT or CHOP is the type of turbulence - // bbb is the height of the base of a layer of clouds in hundreds of - // feet - // ttt is the top of the layer in hundreds of feet - // String regex = "([A-Z]{3,5})(?:((?:-)([A-Z]{3,5})))?((?: )" - // + "(CHOP|CAT))?(?: )?(((ABV|BLO)(?: )(\\d{3}))|((\\d{3})" - // + "(?:(-(\\d{3}))?)))?(?:/)?()"; - -// theTurbulenceLayers = new ArrayList(); -// -// if (str.indexOf(NEG_ENTRY) > 0) { -// AircraftFlightCondition at = new AircraftFlightCondition(); -// -// // NEG should be the only value! Used to indicate forecasted but -// // not observed! -// at.setIntensity1(NEG_ENTRY); -// if (flightLevel != null) { -// at.setBaseHeight(flightLevel.getFlightLevel()); -// theTurbulenceLayers.add(at); -// } -// } else { -// Pattern pattern = Pattern.compile(TRB_REGEX); -// // Get a Matcher based on the target string. -// Matcher matcher = pattern.matcher(str); -// // add each turbulence -// while (matcher.find()) { -// addFlightCondition(matcher, theTurbulenceLayers); -// } -// } - PirepTools tools = new PirepTools(turbLayers); - - turbulenceLayers = tools.decodeTurbulenceData(); - - - - if (turbulenceLayers.size() == 0) { - turbulenceLayers = null; - } - - return true; - } - - /** - * This method decodes the icing data. - * - * @param str - * Icing data to be decoded. - * @return Was the icing data decoded? - * @throws DecodeException - * If a decode error occurred. - */ - protected boolean decodeIcingData(String str) { - // Format is III(-III) (type) (bbb-ttt)/III(-III) etc. - // III is the intesity of the icing - // type is the type of icing - // bbb is the height of the base of a layer of clouds in hundreds of - // feet - // ttt is the top of the layer in hundreds of feet - // String regex = "([A-Z]{3,5})(?:((?:-)([A-Z]{3,5})))?((?: )" - // + "(RIME|MXD|CLR))(?: )?(((ABV|BLO)(?: )(\\d{3}))|((\\d{3})" - // + "(?:(-(\\d{3}))?)))?(?:/)?()"; - str = str.replaceAll("[\r\n]", " "); - str = str.replaceAll(" {2,}", " "); - - theIcingLayers = new ArrayList(); - - if (str.indexOf(NEG_ENTRY) >= 0) { - AircraftFlightCondition at = new AircraftFlightCondition(); - - // NEG should be the only value! Used to indicate forecasted but - // not observed! - at.setIntensity1(NEG_ENTRY); - if (flightLevel != null) { - at.setBaseHeight(flightLevel.getFlightLevel()); - theIcingLayers.add(at); - } - } else { - Pattern pattern = Pattern.compile(ICE_REGEX); - // Get a Matcher based on the target string. - Matcher matcher = pattern.matcher(str); - while (matcher.find()) { - addFlightCondition(matcher, theIcingLayers); - } - } - - if (theIcingLayers.size() == 0) { - theIcingLayers = null; - } - - return true; - } - - /** - * This method decodes the weather data. - * - * @param str - * Weather data to be decoded. - * @return Was the weather information decoded? - */ - protected boolean decodeWeatherData(String str) { - // Format is (FVvvSM )ww( ww)( ww) - // FVvvSM is flight visibility; vv is the value, SM indicates statute - // miles (km otherwise) - // type is the type of icing - // bbb is the height of the base of a layer of clouds in hundreds of - // feet - // ttt is the top of the layer in hundreds of feet - String regex = "^ ?(?:(FV)([0-9]{2})(SM)?)? ?(.*)"; - Pattern pattern = Pattern.compile(regex); - // Get a Matcher based on the target string. - Matcher matcher = pattern.matcher(str); - matcher.find(); - - if (matcher.group(1) != null) { - // parse flight visibility - if (matcher.group(3) != null) { - horzVisibility = Integer.parseInt(matcher.group(2)); - } else { - // theFlightVisibility = new - // Length().fromKilometers(Integer.parseInt(matcher.group(2))); - } - } - - // parse weather codes - regex = "([+|-]?[A-Z]{2,4})([0-9]{3}|UNKN?)?(?:-TOP([0-9]{3}|UNKN?))? ?"; - pattern = Pattern.compile(regex); - matcher = pattern.matcher(matcher.group(4)); - ArrayList codes = new ArrayList(); - while (matcher.find()) { - codes.add(matcher.group(1)); - // the level information is in groups 2 and 3 when provided, - // but the metoc model does not store this data - } - theWeatherCodes = codes.toArray(new String[0]); - - return true; - } - - /** - * This method decodes data in remarks section. - * - * @param str - * Remarks data to be decoded. - * @return Was the remarks data decoded? (Always returns true!) - */ - protected boolean decodeRemarksData(String str) { - theRemarks = new AircraftRemarks(str); - return true; - } - - /** - * Utility method for decoding flight level information for turbulence and - * icing layers. - * - * @param matcher - * A Matcher instance for the specific source data. - * @param layers - * The decoded layer information. - * @throws DecodeException - * If a decode error occured. - */ - protected void addFlightCondition(Matcher matcher, - List layers) { - - if (matcher.groupCount() >= 13) { - String s1 = matcher.group(1); - String s2 = matcher.group(3); - // Some words that may show up in group 1 or 3 that need to be - // thrown away! - s1 = FL_COND_WORDS.get(s1); - if ((s1 == null) || (NULL_ENTRY.equals(s1))) { - return; - } - // Need to allow s2 to be null, - if (s2 != null) { - // but not null after lookup! - s2 = FL_COND_WORDS.get(s2); - if ((s2 == null) || (NULL_ENTRY.equals(s2))) { - return; - } - } - // ****************************************************************** - - AircraftFlightCondition at = new AircraftFlightCondition(); - - // NEG should be the only value! Used to indicate forecasted but - // not observed! - if (NEG_ENTRY.equals(s1)) { - at.setIntensity1(s1); - if (flightLevel != null) { - at.setBaseHeight(flightLevel.getFlightLevel()); - } - } else { - at.setIntensity1(s1); - at.setIntensity2(s2); - - s1 = matcher.group(5); - s1 = COND_TYPES.get(s1); - if ((s1 != null) && (!s1.equals(NULL_ENTRY))) { - at.setType(s1); - } - - s1 = matcher.group(8); - s2 = matcher.group(9); - if (BLO_HGT.equals(s1)) { - at.setBaseHeight(PirepLayerData.INDETERMINATE); - at.setTopHeight(decodeHeight(s2)); - - } else if (ABV_HGT.equals(s1)) { - at.setBaseHeight(decodeHeight(s2)); - at.setTopHeight(PirepLayerData.INDETERMINATE); - } else { - // Check for one or more levels - s1 = matcher.group(11); - s2 = matcher.group(13); - if (s1 != null) { - at.setBaseHeight(decodeHeight(s1)); - } - if (s2 != null) { - at.setTopHeight(decodeHeight(s2)); - } - if ((s1 != null) && (s2 != null)) { - Integer base = at.getBaseHeight(); - Integer top = at.getTopHeight(); - if (base != PirepLayerData.INDETERMINATE) { - if (top != PirepLayerData.INDETERMINATE) { - if (base > top) { - logger.debug(traceId - + "- BASE-TOP inversion fixed"); - at.setBaseHeight(top); - at.setTopHeight(base); - } - } - } - } - if ((s1 == null) && (s2 == null)) { - // Use the flight level if heights are not specified. - if (flightLevel != null) { - at.setBaseHeight(flightLevel.getFlightLevel()); - } - } - } - } - layers.add(at); - } - } - - /** - * This method groups "like-types" of characters to facilitate decoding. - * This method provides equivalent functionality to the UT_BKGP subroutine - * in the ported code. - * - * @param str - * String data to check. - * @return An array of "like type" strings. - */ - protected String[] groupLikeTypes(String str) { - char[] chars = str.toCharArray(); - ArrayList strs = new ArrayList(); - int prevGroup = NONE; - int curGroup = NONE; - String group = new String(); - for (int i = 0; i < chars.length; i++) { - if (Character.isWhitespace(chars[i])) { - curGroup = NONE; - } else if (Character.isDigit(chars[i])) { - curGroup = DIGIT; - } else if (Character.isLetter(chars[i])) { - curGroup = LETTER; - } else { // non-alphanumeric - curGroup = NONALPHANUMERIC; - } - - if (prevGroup != curGroup) { - if (prevGroup != NONE) { - strs.add(group); - group = new String(); - } - } - if (curGroup != NONE) { - group = group.concat(String.valueOf(chars[i])); - } - prevGroup = curGroup; - } - - if (group.length() > 0) { - strs.add(group); - } - - return strs.toArray(new String[0]); - } -} \ No newline at end of file diff --git a/edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/decoder/PirepTools.java b/edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/decoder/PirepTools.java deleted file mode 100644 index b1421b4814..0000000000 --- a/edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/decoder/PirepTools.java +++ /dev/null @@ -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. - * - *
- * 
- * 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.
- * 
- * 
- * - * @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 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(); - 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 decodeTurbulenceData() { - List tbLayers = new ArrayList(); - 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 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 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 separateLayer(String layer) { - List words = new ArrayList(); - 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() - -} diff --git a/edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/decoder/TEI.java b/edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/decoder/TEI.java deleted file mode 100644 index 7547311a05..0000000000 --- a/edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/decoder/TEI.java +++ /dev/null @@ -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). - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * AWIPS2 DR Work
- * Aug 7, 2012        1011 jkorman     Initial creation
- * 
- * 
- * - * @author jkorman - * @version 1.0 - */ - -public enum TEI implements Iterable { - // 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 ID_MAP = new HashMap(); - 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 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; - } -} \ No newline at end of file diff --git a/edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/decoder/TEIInfo.java b/edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/decoder/TEIInfo.java deleted file mode 100644 index 7f39bc7d18..0000000000 --- a/edexOsgi/com.raytheon.edex.plugin.pirep/src/com/raytheon/edex/plugin/pirep/decoder/TEIInfo.java +++ /dev/null @@ -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 - * - * - *
- * 
- * 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. 
- * 
- * 
- * - * @author jkorman - * @version 1.0 - */ - -public class TEIInfo implements Comparable { - // 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 findTEIs(String str) { - List positions = new ArrayList(); - 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; - } -} diff --git a/edexOsgi/com.raytheon.edex.plugin.pirep/utility/common_static/base/purge/pirepPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.pirep/utility/common_static/base/purge/pirepPurgeRules.xml deleted file mode 100644 index d8401ec954..0000000000 --- a/edexOsgi/com.raytheon.edex.plugin.pirep/utility/common_static/base/purge/pirepPurgeRules.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - 01-00:00:00 - - diff --git a/edexOsgi/com.raytheon.edex.plugin.pirep/utility/edex_static/base/distribution/pirep.xml b/edexOsgi/com.raytheon.edex.plugin.pirep/utility/edex_static/base/distribution/pirep.xml deleted file mode 100644 index f330569031..0000000000 --- a/edexOsgi/com.raytheon.edex.plugin.pirep/utility/edex_static/base/distribution/pirep.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - ^UB.* - diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.pirep/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.common.dataplugin.pirep/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 1b4e250ae7..0000000000 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.pirep/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -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 diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.pirep/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.dataplugin.pirep/META-INF/MANIFEST.MF deleted file mode 100644 index e52f616128..0000000000 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.pirep/META-INF/MANIFEST.MF +++ /dev/null @@ -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 diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.pirep/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/edexOsgi/com.raytheon.uf.common.dataplugin.pirep/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject deleted file mode 100644 index 2d87881800..0000000000 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.pirep/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject +++ /dev/null @@ -1,2 +0,0 @@ -com.raytheon.uf.common.dataplugin.pirep.PirepRecord -com.raytheon.uf.common.dataplugin.pirep.PirepLayerData \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.pirep/src/com/raytheon/uf/common/dataplugin/pirep/PirepLayerData.java b/edexOsgi/com.raytheon.uf.common.dataplugin.pirep/src/com/raytheon/uf/common/dataplugin/pirep/PirepLayerData.java deleted file mode 100755 index a15038f128..0000000000 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.pirep/src/com/raytheon/uf/common/dataplugin/pirep/PirepLayerData.java +++ /dev/null @@ -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. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * 20080128            861 jkorman     Initial Coding.
- * 
- * 
- * - * @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(); - } - -} diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.pirep/src/com/raytheon/uf/common/dataplugin/pirep/PirepRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.pirep/src/com/raytheon/uf/common/dataplugin/pirep/PirepRecord.java deleted file mode 100644 index fe0e9f21fa..0000000000 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.pirep/src/com/raytheon/uf/common/dataplugin/pirep/PirepRecord.java +++ /dev/null @@ -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. - * - *
- * 
- * 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
- * 
- * - * @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_UNIT = SI.CELSIUS; - - public static final Unit ALTITUDE_UNIT = NonSI.FOOT; - - public static final Unit WIND_SPEED_UNIT = NonSI.KNOT; - - public static final Unit WIND_DIR_UNIT = NonSI.DEGREE_ANGLE; - - public static final Unit PRESSURE_UNIT = SI.PASCAL; - - public static final Unit LOCATION_UNIT = NonSI.DEGREE_ANGLE; - - private static final HashMap PARM_MAP = new HashMap(); - - private static final HashMap ICING_MAP = new HashMap(); - - private static final HashMap TURB_MAP = new HashMap(); - 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 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 getAncPirepData() { - return ancPirepData; - } - - /** - * @param ancPirepData - * the ancPirepData to set - */ - public void setAncPirepData(Set ancPirepData) { - this.ancPirepData = ancPirepData; - } - - /** - * - * @param cloud - */ - public void addLayer(PirepLayerData layer) { - layer.setParent(this); - if (ancPirepData == null) { - ancPirepData = new HashSet(); - } - 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 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"; - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml b/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml index 021e08805b..c71f9887bd 100644 --- a/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml +++ b/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml @@ -185,13 +185,6 @@ version="0.0.0" unpack="false"/> - - - - - - gov.noaa.nws.ncep.common.dataplugin.ncpirep - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject deleted file mode 100644 index e24fb20a4b..0000000000 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject +++ /dev/null @@ -1,2 +0,0 @@ -gov.noaa.nws.ncep.common.dataplugin.ncpirep.NcPirepRecord -gov.noaa.nws.ncep.common.dataplugin.ncpirep.NcPirepLayerData diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/build.properties b/ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/build.properties deleted file mode 100644 index 34d2e4d2da..0000000000 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - . diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/gov.noaa.nws.ncep.common.dataplugin.ncpirep.ecl b/ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/gov.noaa.nws.ncep.common.dataplugin.ncpirep.ecl deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.pirep/.classpath b/ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/.classpath similarity index 100% rename from edexOsgi/com.raytheon.uf.common.dataplugin.pirep/.classpath rename to ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/.classpath diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.pirep/.project b/ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/.project similarity index 91% rename from edexOsgi/com.raytheon.uf.common.dataplugin.pirep/.project rename to ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/.project index 8fe537804d..83e120875a 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.pirep/.project +++ b/ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/.project @@ -1,6 +1,6 @@ - com.raytheon.uf.common.dataplugin.pirep + gov.noaa.nws.ncep.common.dataplugin.pirep diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/.settings/org.eclipse.jdt.core.prefs b/ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/.settings/org.eclipse.jdt.core.prefs similarity index 100% rename from ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/.settings/org.eclipse.jdt.core.prefs rename to ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/.settings/org.eclipse.jdt.core.prefs diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/META-INF/MANIFEST.MF b/ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/META-INF/MANIFEST.MF similarity index 85% rename from ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/META-INF/MANIFEST.MF rename to ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/META-INF/MANIFEST.MF index 0c46bd7399..576a38ef53 100644 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/META-INF/MANIFEST.MF +++ b/ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/META-INF/MANIFEST.MF @@ -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 diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject new file mode 100644 index 0000000000..ca562c5359 --- /dev/null +++ b/ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject @@ -0,0 +1,2 @@ +gov.noaa.nws.ncep.common.dataplugin.pirep.PirepRecord +gov.noaa.nws.ncep.common.dataplugin.pirep.PirepLayerData diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.pirep/build.properties b/ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/build.properties similarity index 100% rename from edexOsgi/com.raytheon.uf.common.dataplugin.pirep/build.properties rename to ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/build.properties diff --git a/edexOsgi/com.raytheon.edex.plugin.pirep/com.raytheon.edex.plugin.pirep.ecl b/ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/gov.noaa.nws.ncep.common.dataplugin.pirep.ecl similarity index 100% rename from edexOsgi/com.raytheon.edex.plugin.pirep/com.raytheon.edex.plugin.pirep.ecl rename to ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/gov.noaa.nws.ncep.common.dataplugin.pirep.ecl diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/src/gov/noaa/nws/ncep/common/dataplugin/ncpirep/NcPirepLayerData.java b/ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/src/gov/noaa/nws/ncep/common/dataplugin/pirep/PirepLayerData.java similarity index 93% rename from ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/src/gov/noaa/nws/ncep/common/dataplugin/ncpirep/NcPirepLayerData.java rename to ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/src/gov/noaa/nws/ncep/common/dataplugin/pirep/PirepLayerData.java index 7ed5df7795..898ea7b0e3 100644 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/src/gov/noaa/nws/ncep/common/dataplugin/ncpirep/NcPirepLayerData.java +++ b/ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/src/gov/noaa/nws/ncep/common/dataplugin/pirep/PirepLayerData.java @@ -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. * * * * @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; diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/src/gov/noaa/nws/ncep/common/dataplugin/ncpirep/NcPirepPointDataTransform.java b/ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/src/gov/noaa/nws/ncep/common/dataplugin/pirep/PirepPointDataTransform.java similarity index 87% rename from ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/src/gov/noaa/nws/ncep/common/dataplugin/ncpirep/NcPirepPointDataTransform.java rename to ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/src/gov/noaa/nws/ncep/common/dataplugin/pirep/PirepPointDataTransform.java index b8dc4d28e1..eab9616058 100644 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/src/gov/noaa/nws/ncep/common/dataplugin/ncpirep/NcPirepPointDataTransform.java +++ b/ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/src/gov/noaa/nws/ncep/common/dataplugin/pirep/PirepPointDataTransform.java @@ -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. * *
  * 
@@ -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.
  * 
* * @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 pointMap = new HashMap(); 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 pldIterator = record.getAncPirepData().iterator(); + Iterator 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 pldList = new HashSet(); + Set pldList = new HashSet(); 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 records = new ArrayList(); + public static PirepRecord[] toPirepRecords(PointDataContainer container) { + List records = new ArrayList(); 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()]); } } diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/src/gov/noaa/nws/ncep/common/dataplugin/ncpirep/NcPirepRecord.java b/ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/src/gov/noaa/nws/ncep/common/dataplugin/pirep/PirepRecord.java similarity index 94% rename from ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/src/gov/noaa/nws/ncep/common/dataplugin/ncpirep/NcPirepRecord.java rename to ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/src/gov/noaa/nws/ncep/common/dataplugin/pirep/PirepRecord.java index 606409d6b6..41ee8516de 100644 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/src/gov/noaa/nws/ncep/common/dataplugin/ncpirep/NcPirepRecord.java +++ b/ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/src/gov/noaa/nws/ncep/common/dataplugin/pirep/PirepRecord.java @@ -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. * *
  * 
@@ -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.
  * 
  * 
* @@ -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 ancPirepData; + // private Set ancPirepData; @Transient - private Set ancPirepData = new HashSet(); + private Set ancPirepData = new HashSet(); @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 getAncPirepData() { + public Set getAncPirepData() { return ancPirepData; } @@ -580,7 +581,7 @@ public class NcPirepRecord extends PluginDataObject implements ISpatialEnabled, * @param ancPirepData * the ancPirepData to set */ - public void setAncPirepData(Set ancPirepData) { + public void setAncPirepData(Set 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(); + ancPirepData = new HashSet(); } 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"; } } diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/src/gov/noaa/nws/ncep/common/dataplugin/ncpirep/dao/NcPirepDao.java b/ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/src/gov/noaa/nws/ncep/common/dataplugin/pirep/dao/PirepDao.java similarity index 78% rename from ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/src/gov/noaa/nws/ncep/common/dataplugin/ncpirep/dao/NcPirepDao.java rename to ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/src/gov/noaa/nws/ncep/common/dataplugin/pirep/dao/PirepDao.java index 92db022f61..174b85814c 100644 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/src/gov/noaa/nws/ncep/common/dataplugin/ncpirep/dao/NcPirepDao.java +++ b/ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/src/gov/noaa/nws/ncep/common/dataplugin/pirep/dao/PirepDao.java @@ -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. * * * @author qzhou * @version 1.0 */ -public class NcPirepDao extends PointDataPluginDao { +public class PirepDao extends PointDataPluginDao { 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 { 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 { 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 { */ 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 { } @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 { if (pdd == null) { pdd = PointDataDescription.fromStream(this.getClass() - .getResourceAsStream("/res/pointdata/ncpirep.xml")); + .getResourceAsStream("/res/pointdata/pirep.xml")); } return pdd; } diff --git a/ncep/gov.noaa.nws.ncep.edex.common/utility/common_static/base/ncep/hold/NcInventoryDefinitions/NotUsed/PIREP.xml b/ncep/gov.noaa.nws.ncep.edex.common/utility/common_static/base/ncep/hold/NcInventoryDefinitions/NotUsed/PIREP.xml index 5411e2f98c..572110095b 100644 --- a/ncep/gov.noaa.nws.ncep.edex.common/utility/common_static/base/ncep/hold/NcInventoryDefinitions/NotUsed/PIREP.xml +++ b/ncep/gov.noaa.nws.ncep.edex.common/utility/common_static/base/ncep/hold/NcInventoryDefinitions/NotUsed/PIREP.xml @@ -7,7 +7,7 @@ - + diff --git a/ncep/gov.noaa.nws.ncep.edex.common/utility/common_static/base/ncep/hold/NcInventoryDefinitions/PIREP.xml b/ncep/gov.noaa.nws.ncep.edex.common/utility/common_static/base/ncep/hold/NcInventoryDefinitions/PIREP.xml index 5411e2f98c..572110095b 100644 --- a/ncep/gov.noaa.nws.ncep.edex.common/utility/common_static/base/ncep/hold/NcInventoryDefinitions/PIREP.xml +++ b/ncep/gov.noaa.nws.ncep.edex.common/utility/common_static/base/ncep/hold/NcInventoryDefinitions/PIREP.xml @@ -7,7 +7,7 @@ - + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/.classpath b/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/.classpath deleted file mode 100644 index ad32c83a78..0000000000 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/.project b/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/.project deleted file mode 100644 index ee65e7dd00..0000000000 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - gov.noaa.nws.ncep.edex.plugin.ncpirep - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/gov.noaa.nws.ncep.edex.plugin.ncpirep.ecl b/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/gov.noaa.nws.ncep.edex.plugin.ncpirep.ecl deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/res/spring/ncpirep-common.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/res/spring/ncpirep-common.xml deleted file mode 100644 index 41fe94d28f..0000000000 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/res/spring/ncpirep-common.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/res/spring/ncpirep-ingest.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/res/spring/ncpirep-ingest.xml deleted file mode 100644 index c4d3dafb39..0000000000 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/res/spring/ncpirep-ingest.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ncpirep - - - - - - - - - - ncpirep - - - - - - - - - - - - - - - - java.lang.Throwable - - - - - - - java.lang.Throwable - - - - - - \ No newline at end of file diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/.classpath b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/.classpath similarity index 100% rename from ncep/gov.noaa.nws.ncep.common.dataplugin.ncpirep/.classpath rename to ncep/gov.noaa.nws.ncep.edex.plugin.pirep/.classpath diff --git a/edexOsgi/com.raytheon.edex.plugin.pirep/.project b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/.project similarity index 92% rename from edexOsgi/com.raytheon.edex.plugin.pirep/.project rename to ncep/gov.noaa.nws.ncep.edex.plugin.pirep/.project index 1b26506e9a..cfe1a95986 100644 --- a/edexOsgi/com.raytheon.edex.plugin.pirep/.project +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/.project @@ -1,6 +1,6 @@ - com.raytheon.edex.plugin.pirep + gov.noaa.nws.ncep.edex.plugin.pirep diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/.settings/org.eclipse.jdt.core.prefs b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/.settings/org.eclipse.jdt.core.prefs similarity index 100% rename from ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/.settings/org.eclipse.jdt.core.prefs rename to ncep/gov.noaa.nws.ncep.edex.plugin.pirep/.settings/org.eclipse.jdt.core.prefs diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/META-INF/MANIFEST.MF b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/META-INF/MANIFEST.MF similarity index 75% rename from ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/META-INF/MANIFEST.MF rename to ncep/gov.noaa.nws.ncep.edex.plugin.pirep/META-INF/MANIFEST.MF index db32cffc86..928b6a8104 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/META-INF/MANIFEST.MF +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/META-INF/MANIFEST.MF @@ -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 diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/build.properties b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/build.properties similarity index 100% rename from ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/build.properties rename to ncep/gov.noaa.nws.ncep.edex.plugin.pirep/build.properties diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.pirep/com.raytheon.uf.common.dataplugin.pirep.ecl b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/gov.noaa.nws.ncep.edex.plugin.pirep.ecl similarity index 100% rename from edexOsgi/com.raytheon.uf.common.dataplugin.pirep/com.raytheon.uf.common.dataplugin.pirep.ecl rename to ncep/gov.noaa.nws.ncep.edex.plugin.pirep/gov.noaa.nws.ncep.edex.plugin.pirep.ecl diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/res/pointdata/ncpirep.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/res/pointdata/pirep.xml similarity index 99% rename from ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/res/pointdata/ncpirep.xml rename to ncep/gov.noaa.nws.ncep.edex.plugin.pirep/res/pointdata/pirep.xml index 1eb6e888b9..42c733adab 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/res/pointdata/ncpirep.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/res/pointdata/pirep.xml @@ -5,6 +5,7 @@ * __________ _______ __________ __________________________ * 05/23/2011 F. J. Yen Initial creation. * 08/23/2011 286 qzhou Added 13 fields. Changed maxLayer to 3. + --> diff --git a/edexOsgi/com.raytheon.edex.plugin.pirep/res/spring/pirep-common.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/res/spring/pirep-common.xml similarity index 72% rename from edexOsgi/com.raytheon.edex.plugin.pirep/res/spring/pirep-common.xml rename to ncep/gov.noaa.nws.ncep.edex.plugin.pirep/res/spring/pirep-common.xml index 344c85092b..136a3c15ff 100644 --- a/edexOsgi/com.raytheon.edex.plugin.pirep/res/spring/pirep-common.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/res/spring/pirep-common.xml @@ -9,9 +9,10 @@ - - - + + + + diff --git a/edexOsgi/com.raytheon.edex.plugin.pirep/res/spring/pirep-ingest.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/res/spring/pirep-ingest.xml similarity index 65% rename from edexOsgi/com.raytheon.edex.plugin.pirep/res/spring/pirep-ingest.xml rename to ncep/gov.noaa.nws.ncep.edex.plugin.pirep/res/spring/pirep-ingest.xml index 8a3bc973bd..35e418d999 100644 --- a/edexOsgi/com.raytheon.edex.plugin.pirep/res/spring/pirep-ingest.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/res/spring/pirep-ingest.xml @@ -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"> - - + + + + + + + - + @@ -19,13 +26,12 @@ - - - - @@ -36,10 +42,11 @@ - --> - + + + - + pirep @@ -51,7 +58,11 @@ - + + + + java.lang.Throwable diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/src/gov/noaa/nws/ncep/edex/plugin/ncpirep/NcPirepDecoder.java b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/src/gov/noaa/nws/ncep/edex/plugin/pirep/PirepDecoder.java similarity index 86% rename from ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/src/gov/noaa/nws/ncep/edex/plugin/ncpirep/NcPirepDecoder.java rename to ncep/gov.noaa.nws.ncep.edex.plugin.pirep/src/gov/noaa/nws/ncep/edex/plugin/pirep/PirepDecoder.java index 659b884774..4791410108 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/src/gov/noaa/nws/ncep/edex/plugin/ncpirep/NcPirepDecoder.java +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/src/gov/noaa/nws/ncep/edex/plugin/pirep/PirepDecoder.java @@ -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. - * 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. * * * @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 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); diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/src/gov/noaa/nws/ncep/edex/plugin/ncpirep/NcPirepSeparator.java b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/src/gov/noaa/nws/ncep/edex/plugin/pirep/PirepSeparator.java similarity index 93% rename from ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/src/gov/noaa/nws/ncep/edex/plugin/ncpirep/NcPirepSeparator.java rename to ncep/gov.noaa.nws.ncep.edex.plugin.pirep/src/gov/noaa/nws/ncep/edex/plugin/pirep/PirepSeparator.java index 8f68c9365f..885f4e97c3 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/src/gov/noaa/nws/ncep/edex/plugin/ncpirep/NcPirepSeparator.java +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/src/gov/noaa/nws/ncep/edex/plugin/pirep/PirepSeparator.java @@ -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. + * * * * @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; } /** diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/src/gov/noaa/nws/ncep/edex/plugin/ncpirep/decoder/NcPirepParser.java b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/src/gov/noaa/nws/ncep/edex/plugin/pirep/decoder/PirepParser.java similarity index 99% rename from ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/src/gov/noaa/nws/ncep/edex/plugin/ncpirep/decoder/NcPirepParser.java rename to ncep/gov.noaa.nws.ncep.edex.plugin.pirep/src/gov/noaa/nws/ncep/edex/plugin/pirep/decoder/PirepParser.java index c07cb48b24..ee617e678c 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/src/gov/noaa/nws/ncep/edex/plugin/ncpirep/decoder/NcPirepParser.java +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/src/gov/noaa/nws/ncep/edex/plugin/pirep/decoder/PirepParser.java @@ -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. + * * * * @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); } } \ No newline at end of file diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/src/gov/noaa/nws/ncep/edex/plugin/ncpirep/decoder/PirepTools.java b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/src/gov/noaa/nws/ncep/edex/plugin/pirep/decoder/PirepTools.java similarity index 98% rename from ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/src/gov/noaa/nws/ncep/edex/plugin/ncpirep/decoder/PirepTools.java rename to ncep/gov.noaa.nws.ncep.edex.plugin.pirep/src/gov/noaa/nws/ncep/edex/plugin/pirep/decoder/PirepTools.java index b71c246b10..c871656b74 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/src/gov/noaa/nws/ncep/edex/plugin/ncpirep/decoder/PirepTools.java +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/src/gov/noaa/nws/ncep/edex/plugin/pirep/decoder/PirepTools.java @@ -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. * * * @author jkorman diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/utility/common_static/base/purge/ncpirepPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/utility/common_static/base/purge/pirepPurgeRules.xml similarity index 100% rename from ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/utility/common_static/base/purge/ncpirepPurgeRules.xml rename to ncep/gov.noaa.nws.ncep.edex.plugin.pirep/utility/common_static/base/purge/pirepPurgeRules.xml diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/utility/edex_static/base/distribution/ncpirep.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/utility/edex_static/base/distribution/pirep.xml similarity index 100% rename from ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/utility/edex_static/base/distribution/ncpirep.xml rename to ncep/gov.noaa.nws.ncep.edex.plugin.pirep/utility/edex_static/base/distribution/pirep.xml diff --git a/ncep/gov.noaa.nws.ncep.viz.localization/localization/ncep/PlotModels/PlotParameters/plotParameters_ncpirep.xml b/ncep/gov.noaa.nws.ncep.viz.localization/localization/ncep/PlotModels/PlotParameters/plotParameters_pirep.xml similarity index 99% rename from ncep/gov.noaa.nws.ncep.viz.localization/localization/ncep/PlotModels/PlotParameters/plotParameters_ncpirep.xml rename to ncep/gov.noaa.nws.ncep.viz.localization/localization/ncep/PlotModels/PlotParameters/plotParameters_pirep.xml index 178704d8a0..0a81df557d 100644 --- a/ncep/gov.noaa.nws.ncep.viz.localization/localization/ncep/PlotModels/PlotParameters/plotParameters_ncpirep.xml +++ b/ncep/gov.noaa.nws.ncep.viz.localization/localization/ncep/PlotModels/PlotParameters/plotParameters_pirep.xml @@ -1,7 +1,7 @@ - ncpirep + pirep