diff --git a/cave/com.raytheon.viz.lightning/.settings/org.eclipse.jdt.core.prefs b/cave/com.raytheon.viz.lightning/.settings/org.eclipse.jdt.core.prefs index 7645aa80be..7341ab1683 100644 --- a/cave/com.raytheon.viz.lightning/.settings/org.eclipse.jdt.core.prefs +++ b/cave/com.raytheon.viz.lightning/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,11 @@ -#Thu Mar 26 10:52:01 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.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/cave/com.raytheon.viz.lightning/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.lightning/META-INF/MANIFEST.MF index cbce136de2..f13676a8cf 100644 --- a/cave/com.raytheon.viz.lightning/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.lightning/META-INF/MANIFEST.MF @@ -2,18 +2,12 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Lightning Plug-in Bundle-SymbolicName: com.raytheon.viz.lightning;singleton:=true -Bundle-Version: 1.12.1174.qualifier -Bundle-Activator: com.raytheon.viz.lightning.Activator +Bundle-Version: 1.14.0 Bundle-Vendor: Raytheon -Eclipse-RegisterBuddy: com.raytheon.viz.core, com.raytheon.uf.viz.core Require-Bundle: com.raytheon.uf.common.dataplugin.binlightning;bundle-version="1.0.0", - org.eclipse.ui, - org.eclipse.core.runtime, com.raytheon.viz.core, - org.geotools, - com.raytheon.viz.ui, - org.apache.commons.lang + com.raytheon.viz.ui Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.viz.lightning -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Import-Package: com.raytheon.uf.viz.productbrowser diff --git a/cave/com.raytheon.viz.lightning/localization/bundles/LightningCloudSeq.xml b/cave/com.raytheon.viz.lightning/localization/bundles/LightningCloudSeq.xml new file mode 100644 index 0000000000..eea5eefd87 --- /dev/null +++ b/cave/com.raytheon.viz.lightning/localization/bundles/LightningCloudSeq.xml @@ -0,0 +1,191 @@ + + + + + + + + + + + + PLAN_VIEW + + + + + + + + + + + + + + + + + + + + PLAN_VIEW + + + + + + + + + + + + + + + + + + + + PLAN_VIEW + + + + + + + + + + + + + + + + + + + + PLAN_VIEW + + + + + + + + + + + + + + + + + + + + PLAN_VIEW + + + + + + + + + + + + + + + + + + + + PLAN_VIEW + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.viz.lightning/localization/bundles/LightningPlot15Min.xml b/cave/com.raytheon.viz.lightning/localization/bundles/LightningPlot15Min.xml index a403cd3d1f..1c708eab95 100644 --- a/cave/com.raytheon.viz.lightning/localization/bundles/LightningPlot15Min.xml +++ b/cave/com.raytheon.viz.lightning/localization/bundles/LightningPlot15Min.xml @@ -42,6 +42,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.viz.lightning/localization/bundles/LightningPlot15MinPN.xml b/cave/com.raytheon.viz.lightning/localization/bundles/LightningPlot15MinPN.xml index d8b1b65423..f96e31e703 100644 --- a/cave/com.raytheon.viz.lightning/localization/bundles/LightningPlot15MinPN.xml +++ b/cave/com.raytheon.viz.lightning/localization/bundles/LightningPlot15MinPN.xml @@ -64,6 +64,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.viz.lightning/localization/bundles/LightningPlot5Min.xml b/cave/com.raytheon.viz.lightning/localization/bundles/LightningPlot5Min.xml index 2c6463c587..9700d1de52 100644 --- a/cave/com.raytheon.viz.lightning/localization/bundles/LightningPlot5Min.xml +++ b/cave/com.raytheon.viz.lightning/localization/bundles/LightningPlot5Min.xml @@ -42,6 +42,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.viz.lightning/localization/bundles/LightningPlot60Min.xml b/cave/com.raytheon.viz.lightning/localization/bundles/LightningPlot60Min.xml index 4b9aa8acb1..a2abcb9823 100644 --- a/cave/com.raytheon.viz.lightning/localization/bundles/LightningPlot60Min.xml +++ b/cave/com.raytheon.viz.lightning/localization/bundles/LightningPlot60Min.xml @@ -22,26 +22,68 @@ - - - - - - - - - - - + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.viz.lightning/localization/bundles/LightningPulseSeq.xml b/cave/com.raytheon.viz.lightning/localization/bundles/LightningPulseSeq.xml new file mode 100644 index 0000000000..c77986e427 --- /dev/null +++ b/cave/com.raytheon.viz.lightning/localization/bundles/LightningPulseSeq.xml @@ -0,0 +1,191 @@ + + + + + + + + + + + + PLAN_VIEW + + + + + + + + + + + + + + + + + + + + PLAN_VIEW + + + + + + + + + + + + + + + + + + + + PLAN_VIEW + + + + + + + + + + + + + + + + + + + + PLAN_VIEW + + + + + + + + + + + + + + + + + + + + PLAN_VIEW + + + + + + + + + + + + + + + + + + + + PLAN_VIEW + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.viz.lightning/localization/menus/lightning/entlnLightningBundleItems.xml b/cave/com.raytheon.viz.lightning/localization/menus/lightning/entlnLightningBundleItems.xml index ef77211bd9..dfa2abb0c2 100644 --- a/cave/com.raytheon.viz.lightning/localization/menus/lightning/entlnLightningBundleItems.xml +++ b/cave/com.raytheon.viz.lightning/localization/menus/lightning/entlnLightningBundleItems.xml @@ -20,18 +20,24 @@ --> + menuText="1hr plot" id="1HrLightningFlashPlot"> + menuText="15min plot" id="15MinLightningFlashPlot"> + menuText="15min Pos/Neg plot" id="15MinPNLightningFlashPlot"> + menuText="5min plot" id="5MinLightningFlashPlot"> + menuText="1min Lgtng Seq Plot" id="1MinLightningFlashSeq"> + + + + \ No newline at end of file diff --git a/cave/com.raytheon.viz.lightning/localization/menus/lightning/gldLightningBundleItems.xml b/cave/com.raytheon.viz.lightning/localization/menus/lightning/gldLightningBundleItems.xml index 022a151e0e..a36d998c96 100644 --- a/cave/com.raytheon.viz.lightning/localization/menus/lightning/gldLightningBundleItems.xml +++ b/cave/com.raytheon.viz.lightning/localization/menus/lightning/gldLightningBundleItems.xml @@ -20,18 +20,18 @@ --> + menuText="1hr plot" id="1HrLightningStrokePlot"> + menuText="15min plot" id="15MinLightningStrokePlot"> + menuText="15min Pos/Neg plot" id="15MinPNLightningStrokePlot"> + menuText="5min plot" id="5MinLightningStrokePlot"> + menuText="1min Lgtng Seq" id="1MinLightningStrokeSeq"> \ No newline at end of file diff --git a/cave/com.raytheon.viz.lightning/localization/menus/lightning/nldnLightningBundleItems.xml b/cave/com.raytheon.viz.lightning/localization/menus/lightning/nldnLightningBundleItems.xml index ef77211bd9..09971191c6 100644 --- a/cave/com.raytheon.viz.lightning/localization/menus/lightning/nldnLightningBundleItems.xml +++ b/cave/com.raytheon.viz.lightning/localization/menus/lightning/nldnLightningBundleItems.xml @@ -20,18 +20,21 @@ --> + menuText="1hr plot" id="1HrLightningFlashPlot"> + menuText="15min plot" id="15MinLightningFlashPlot"> + menuText="15min Pos/Neg plot" id="15MinPNLightningFlashPlot"> + menuText="5min plot" id="5MinLightningFlashPlot"> + menuText="1min Lgtng Seq Plot" id="1MinLightningFlashSeq"> + + \ No newline at end of file diff --git a/cave/com.raytheon.viz.lightning/plugin.xml b/cave/com.raytheon.viz.lightning/plugin.xml index 845785ab61..11af5d972e 100644 --- a/cave/com.raytheon.viz.lightning/plugin.xml +++ b/cave/com.raytheon.viz.lightning/plugin.xml @@ -25,7 +25,7 @@ diff --git a/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/Activator.java b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/Activator.java deleted file mode 100644 index 4cf63b5c7d..0000000000 --- a/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/Activator.java +++ /dev/null @@ -1,69 +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.viz.lightning; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "com.raytheon.viz.lightning"; - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - -} diff --git a/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java index 5bdf334bb1..bd7324433e 100644 --- a/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java +++ b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java @@ -23,6 +23,7 @@ import java.awt.Font; import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; +import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -34,12 +35,15 @@ import org.opengis.referencing.crs.CoordinateReferenceSystem; import com.raytheon.uf.common.dataplugin.HDF5Util; import com.raytheon.uf.common.dataplugin.PluginDataObject; +import com.raytheon.uf.common.dataplugin.annotations.DataURI; import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord; import com.raytheon.uf.common.dataplugin.binlightning.LightningConstants; +import com.raytheon.uf.common.dataplugin.binlightning.impl.LtgStrikeType; import com.raytheon.uf.common.datastorage.DataStoreFactory; import com.raytheon.uf.common.datastorage.IDataStore; import com.raytheon.uf.common.datastorage.Request; import com.raytheon.uf.common.datastorage.StorageException; +import com.raytheon.uf.common.datastorage.records.ByteDataRecord; import com.raytheon.uf.common.datastorage.records.FloatDataRecord; import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.datastorage.records.IntegerDataRecord; @@ -96,6 +100,7 @@ import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability; * Feb 27, 2013 DCS 152 jgerth/elau Support for WWLLN and multiple sources * Jan 21, 2014 2667 bclement renamed record's lightSource field to source * Jun 05, 2014 3226 bclement reference datarecords by LightningConstants + * Jun 19, 2014 3214 bclement added pulse and could flash support * * * @@ -118,6 +123,10 @@ public class LightningResource extends public List posLatLonList = new ArrayList(); public List negLatLonList = new ArrayList(); + + public List cloudLatLonList = new ArrayList(); + + public List pulseLatLonList = new ArrayList(); } private static class LightningFrameMetadata { @@ -242,9 +251,13 @@ public class LightningResource extends private IFont font; - private List currPosList = null; + private List currPosList = Collections.emptyList(); - private List currNegList = null; + private List currNegList = Collections.emptyList(); + + private List currCloudList = Collections.emptyList(); + + private List currPulseList = Collections.emptyList(); public LightningResource(LightningResourceData resourceData, LoadProperties loadProperties, String ls, int pa) { @@ -317,11 +330,20 @@ public class LightningResource extends } else { timeString = convertTimeIntervalToString(absTimeInterval); } - - if (!this.resourceData.isHandlingNegativeStrikes()) { - this.resourceName = timeString + "Positive"; - } else if (!this.resourceData.isHandlingPositiveStrikes()) { - this.resourceName = timeString + "Negative"; + if (this.resourceData.isExclusiveForType()) { + String modifier; + if (this.resourceData.isHandlingCloudFlashes()) { + modifier = "Cloud Flash"; + } else if (this.resourceData.isHandlingNegativeStrikes()) { + modifier = "Negative"; + } else if (this.resourceData.isHandlingPositiveStrikes()) { + modifier = "Positive"; + } else if (this.resourceData.isHandlingPulses()) { + modifier = "Pulse"; + } else { + modifier = ""; + } + this.resourceName = timeString + modifier; } else { this.resourceName = timeString; } @@ -376,6 +398,8 @@ public class LightningResource extends int posCount = 0; int negCount = 0; + int cloudCount = 0; + int pulseCount = 0; if (magnification == 0.0) magnification=(float) 0.01; @@ -393,49 +417,35 @@ public class LightningResource extends } else { if (needsUpdate) { needsUpdate = false; - currNegList = new ArrayList( - bundle.posLatLonList.size()); - currPosList = new ArrayList( - bundle.negLatLonList.size()); - - if (resourceData.isHandlingPositiveStrikes()) { - for (double[] pos : bundle.posLatLonList) { - currPosList.add(descriptor.worldToPixel(pos)); - } - } if (resourceData.isHandlingNegativeStrikes()) { - for (double[] neg : bundle.negLatLonList) { - currNegList.add(descriptor.worldToPixel(neg)); - } + currNegList = convertToPixel(bundle.negLatLonList); + } + if (resourceData.isHandlingPositiveStrikes()) { + currPosList = convertToPixel(bundle.posLatLonList); + } + if (resourceData.isHandlingCloudFlashes()) { + currCloudList = convertToPixel(bundle.cloudLatLonList); + } + if (resourceData.isHandlingPulses()) { + currPulseList = convertToPixel(bundle.pulseLatLonList); } } if (resourceData.isHandlingPositiveStrikes()) { - List positive = new ArrayList( - currPosList.size()); - for (double[] pos : currPosList) { - if (extent.contains(pos)) { - positive.add(pos); - } - } - posCount = positive.size(); - - target.drawPoints(positive, color, PointStyle.CROSS, - magnification); + posCount = drawFilteredPoints(target, magnification, + color, PointStyle.CROSS, extent, currPosList); } - if (resourceData.isHandlingNegativeStrikes()) { - List negative = new ArrayList( - currPosList.size()); - for (double[] neg : currNegList) { - if (extent.contains(neg)) { - negative.add(neg); - } - } - negCount = negative.size(); - - target.drawPoints(negative, color, PointStyle.DASH, - magnification); + negCount = drawFilteredPoints(target, magnification, + color, PointStyle.DASH, extent, currNegList); + } + if (resourceData.isHandlingCloudFlashes()) { + cloudCount = drawFilteredPoints(target, magnification, + color, PointStyle.CIRCLE, extent, currCloudList); + } + if (resourceData.isHandlingPulses()) { + pulseCount = drawFilteredPoints(target, magnification, + color, PointStyle.PIPE, extent, currPulseList); } } } @@ -447,32 +457,88 @@ public class LightningResource extends .getHeight(); if (this.resourceData.isHandlingPositiveStrikes()) { - DrawableString pos = new DrawableString(posCount + " + Strikes", - color); - pos.setCoordinates(225, height * (2 + 2*this.posAdj)); - // jjg above - pos.font = font; - pos.verticallAlignment = VerticalAlignment.TOP; - pos.horizontalAlignment = HorizontalAlignment.RIGHT; - strings.add(pos); + strings.add(createLegendString(color, posCount, " + Strikes", + height, 2)); } - if (this.resourceData.isHandlingNegativeStrikes()) { - DrawableString neg = new DrawableString(negCount + " - Strikes", - color); - neg.setCoordinates(225, height * (3 + 2*this.posAdj)); - // jjg above - neg.font = font; - neg.verticallAlignment = VerticalAlignment.TOP; - neg.horizontalAlignment = HorizontalAlignment.RIGHT; - strings.add(neg); + strings.add(createLegendString(color, negCount, " - Strikes", + height, 3)); + } + if (this.resourceData.isHandlingCloudFlashes()) { + strings.add(createLegendString(color, cloudCount, " Cloud Flashes", + height, 4)); + } + if (this.resourceData.isHandlingPulses()) { + strings.add(createLegendString(color, pulseCount, " Pulses", + height, 5)); } - target.getExtension(ICanvasRenderingExtension.class).drawStrings( paintProps, strings.toArray(new DrawableString[0])); } + /** + * Create lightning legend string in upper left corner of display + * + * @param color + * @param count + * @param msg + * @param height + * @param verticalOffset + * vertical position of legend string (starting at 2) + * @return + */ + private DrawableString createLegendString(RGB color, int count, String msg, + double height, int verticalOffset) { + DrawableString pos = new DrawableString(count + msg, color); + pos.setCoordinates(225, height * (verticalOffset + 2 * this.posAdj)); + // jjg above + pos.font = font; + pos.verticallAlignment = VerticalAlignment.TOP; + pos.horizontalAlignment = HorizontalAlignment.RIGHT; + return pos; + } + + /** + * Draw points on target using provided styling. Points are filtered by + * extent. + * + * @param target + * @param magnification + * @param color + * @param style + * @param extent + * @param pixelList + * @return count of points that matched filter + * @throws VizException + */ + private static int drawFilteredPoints(IGraphicsTarget target, + float magnification, RGB color, PointStyle style, IExtent extent, + List pixelList) throws VizException { + List filtered = new ArrayList(pixelList.size()); + for (double[] pxl : pixelList) { + if (extent.contains(pxl)) { + filtered.add(pxl); + } + } + target.drawPoints(filtered, color, style, magnification); + return filtered.size(); + } + + /** + * convert list of world coordinates to pixel coordinates + * + * @param lonLats + * @return + */ + private List convertToPixel(List lonLats) { + List rval = new ArrayList(lonLats.size()); + for (double[] lonLat : lonLats) { + rval.add(descriptor.worldToPixel(lonLat)); + } + return rval; + } + /* * (non-Javadoc) * @@ -628,29 +694,27 @@ public class LightningResource extends long tDS1 = System.currentTimeMillis(); dsTime += (tDS1 - tDS0); - Map> recordMap = new HashMap>(); // Throw in a map for easy accessibility - for (IDataRecord rec : records) { - List recordList = recordMap.get(rec.getName()); - if (recordList == null) { - recordList = new ArrayList(); - recordMap.put(rec.getName(), recordList); - } - recordList.add(rec); - } + Map> recordMap = createRecordMap(records); List times = recordMap .get(LightningConstants.TIME_DATASET); - List intensities = recordMap .get(LightningConstants.INTENSITY_DATASET); List lats = recordMap .get(LightningConstants.LAT_DATASET); List lons = recordMap .get(LightningConstants.LON_DATASET); + List types = recordMap + .get(LightningConstants.STRIKE_TYPE_DATASET); + List pulseIndexes = recordMap + .get(LightningConstants.PULSE_INDEX_DATASET); int k = 0; for (IDataRecord timeRec : times) { + if (hasPulseData(pulseIndexes, k)) { + populatePulseData(frame, bundle, timeRec.getGroup(), ds); + } LongDataRecord time = (LongDataRecord) timeRec; // Now loop through the obs times and intensities and // start categorizing strikes @@ -664,16 +728,26 @@ public class LightningResource extends .getFloatData(); float[] longitudeData = ((FloatDataRecord) lons.get(k)) .getFloatData(); + byte[] typeData = ((ByteDataRecord) types.get(k)) + .getByteData(); for (int i = 0; i < numRecords; i++) { DataTime dt = new DataTime(new Date(timeData[i])); dt = frame.offset.getNormalizedTime(dt); List list; - if (intensityData[i] > 0) { - list = bundle.posLatLonList; - } else { - list = bundle.negLatLonList; + LtgStrikeType type = LtgStrikeType.getById(typeData[i]); + switch(type){ + case CLOUD_TO_CLOUD: + list = bundle.cloudLatLonList; + break; + default: + if (intensityData[i] > 0) { + list = bundle.posLatLonList; + } else { + list = bundle.negLatLonList; + } + break; } double[] latLon = new double[] { longitudeData[i], @@ -689,7 +763,6 @@ public class LightningResource extends } k++; } - } catch (StorageException e) { statusHandler.handle(Priority.PROBLEM, "Storage error retrieving lightning data", e); @@ -706,4 +779,99 @@ public class LightningResource extends + (t1 - t0) + "ms (hdf5 time = " + dsTime + "ms)"); } + /** + * Unpack records into map keyed by record name + * + * @param records + * @return + */ + private static Map> createRecordMap( + IDataRecord[] records) { + Map> recordMap = new HashMap>(); + for (IDataRecord rec : records) { + List recordList = recordMap.get(rec.getName()); + if (recordList == null) { + recordList = new ArrayList(); + recordMap.put(rec.getName(), recordList); + } + recordList.add(rec); + } + return recordMap; + } + + /** + * Search records and return first found with name + * + * @param records + * @param name + * @return null if none found + */ + private static IDataRecord findDataRecord(IDataRecord[] records, String name) { + IDataRecord rval = null; + for (IDataRecord record : records) { + if (record.getName().equals(name)) { + rval = record; + break; + } + } + return rval; + } + + /** + * @param pulseIndexes + * @param recordIndex + * @return true if any data record in list has a valid pulse index + */ + private static boolean hasPulseData(List pulseIndexes, + int recordIndex) { + if (pulseIndexes != null) { + IDataRecord record = pulseIndexes.get(recordIndex); + int[] indexData = ((IntegerDataRecord) record).getIntData(); + for (int i = 0; i < indexData.length; ++i) { + if (indexData[i] >= 0) { + return true; + } + } + } + return false; + } + + /** + * Read pulse data from datastore and populate in frame + * + * @param frame + * @param bundle + * @param group + * @param ds + */ + private static void populatePulseData(LightningFrameMetadata frame, + LightningFrame bundle, String group, IDataStore ds) { + try { + IDataRecord[] records = ds.retrieve(group + DataURI.SEPARATOR + + LightningConstants.PULSE_HDF5_GROUP_SUFFIX); + FloatDataRecord latRecord = (FloatDataRecord) findDataRecord( + records, LightningConstants.LAT_DATASET); + FloatDataRecord lonRecord = (FloatDataRecord) findDataRecord( + records, LightningConstants.LON_DATASET); + if (latRecord == null || lonRecord == null) { + throw new StorageException( + "Missing pulse latitude and/or longitude data", null); + } + float[] lats = latRecord.getFloatData(); + float[] lons = lonRecord.getFloatData(); + if (lats.length != lons.length) { + throw new StorageException( + "Mismatched pulse latitude/longitude data", latRecord); + } + for (int i = 0; i < lats.length; ++i) { + bundle.pulseLatLonList.add(new double[] { lons[i], lats[i] }); + } + } catch (FileNotFoundException e) { + statusHandler.error("Unable to open lightning file", e); + } catch (StorageException e) { + statusHandler.error("Unable to read pulse datasets for group " + + group, e); + } + } + } diff --git a/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResourceData.java b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResourceData.java index 68a01c7ab7..3335cc48d1 100644 --- a/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResourceData.java +++ b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResourceData.java @@ -47,6 +47,7 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties; * ------------ ---------- ----------- -------------------------- * Feb 18, 2009 chammack Initial creation * Feb 27, 2013 DCS 152 jgerth Support for WWLLN and multiple sources + * Jun 19, 2014 3214 bclement added pulse and could flash support * * * @@ -64,6 +65,12 @@ public class LightningResourceData extends AbstractRequestableResourceData { @XmlAttribute private boolean handlingNegativeStrikes = true; + @XmlAttribute + private boolean handlingCloudFlashes = false; + + @XmlAttribute + private boolean handlingPulses = false; + @XmlAttribute private String plotLightSource = ""; @@ -146,8 +153,63 @@ public class LightningResourceData extends AbstractRequestableResourceData { } /** - * @return plotLightSource - * the lightSource to get - JJG + * @return the handlingCloudFlashes + */ + public boolean isHandlingCloudFlashes() { + return handlingCloudFlashes; + } + + /** + * @param handlingCloudFlashes + * the handlingCloudFlashes to set + */ + public void setHandlingCloudFlashes(boolean handlingCloudFlashes) { + this.handlingCloudFlashes = handlingCloudFlashes; + } + + /** + * @return the handlingPulses + */ + public boolean isHandlingPulses() { + return handlingPulses; + } + + /** + * @see #isHandlingCloudFlashes() + * @see #isHandlingNegativeStrikes() + * @see #isHandlingPositiveStrikes() + * @see #isHandlingPulses() + * @return true if resource data handles exactly one type of data + */ + public boolean isExclusiveForType() { + boolean[] bools = { isHandlingCloudFlashes(), + isHandlingNegativeStrikes(), isHandlingPositiveStrikes(), + isHandlingPulses() }; + boolean handlingZero = true; + boolean handlingMoreThanOne = false; + for (boolean handlingSomething : bools) { + if (handlingSomething) { + if (handlingZero) { + handlingZero = false; + } else { + handlingMoreThanOne = true; + break; + } + } + } + return !handlingZero && !handlingMoreThanOne; + } + + /** + * @param handlingPulses + * the handlingPulses to set + */ + public void setHandlingPulses(boolean handlingPulses) { + this.handlingPulses = handlingPulses; + } + + /** + * @return plotLightSource the lightSource to get - JJG */ public String getPlotLightSource() { return plotLightSource; @@ -177,20 +239,55 @@ public class LightningResourceData extends AbstractRequestableResourceData { this.countPosition = countPosition; } + /* + * (non-Javadoc) + * + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + countPosition; + result = prime * result + (handlingCloudFlashes ? 1231 : 1237); + result = prime * result + (handlingNegativeStrikes ? 1231 : 1237); + result = prime * result + (handlingPositiveStrikes ? 1231 : 1237); + result = prime * result + (handlingPulses ? 1231 : 1237); + result = prime * result + + ((plotLightSource == null) ? 0 : plotLightSource.hashCode()); + return result; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#equals(java.lang.Object) + */ @Override public boolean equals(Object obj) { - // TODO Auto-generated method stub - if (!super.equals(obj)) { + if (this == obj) + return true; + if (!super.equals(obj)) return false; - } - - if (obj instanceof LightningResourceData == false) { + if (getClass() != obj.getClass()) return false; - } - LightningResourceData other = (LightningResourceData) obj; - return (this.handlingNegativeStrikes == other.handlingNegativeStrikes && this.handlingPositiveStrikes == other.handlingPositiveStrikes && - this.plotLightSource == other.plotLightSource && this.countPosition == other.countPosition); + if (countPosition != other.countPosition) + return false; + if (handlingCloudFlashes != other.handlingCloudFlashes) + return false; + if (handlingNegativeStrikes != other.handlingNegativeStrikes) + return false; + if (handlingPositiveStrikes != other.handlingPositiveStrikes) + return false; + if (handlingPulses != other.handlingPulses) + return false; + if (plotLightSource == null) { + if (other.plotLightSource != null) + return false; + } else if (!plotLightSource.equals(other.plotLightSource)) + return false; + return true; } } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/.settings/org.eclipse.jdt.core.prefs index 204ea7149d..7341ab1683 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/.settings/org.eclipse.jdt.core.prefs +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,11 @@ -#Tue Nov 03 09:01:49 CST 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.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/META-INF/MANIFEST.MF index 261268366d..3826f339cb 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/META-INF/MANIFEST.MF @@ -2,22 +2,18 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Binlightning Plug-in Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.binlightning -Bundle-Version: 1.12.1174.qualifier +Bundle-Version: 1.14.0 Bundle-Vendor: RAYTHEON Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Export-Package: com.raytheon.uf.common.dataplugin.binlightning, com.raytheon.uf.common.dataplugin.binlightning.dataaccess, com.raytheon.uf.common.dataplugin.binlightning.impl Require-Bundle: com.raytheon.uf.common.serialization, - org.geotools, - javax.persistence, - javax.measure, com.raytheon.uf.common.dataplugin, com.raytheon.uf.common.datastorage, - com.raytheon.uf.common.dataaccess;bundle-version="1.0.0" + com.raytheon.uf.common.dataaccess;bundle-version="1.0.0", + javax.measure;bundle-version="1.0.0" Import-Package: com.raytheon.uf.common.dataquery.requests, com.raytheon.uf.common.dataquery.responses, - com.raytheon.uf.common.status, - com.raytheon.uf.edex.decodertools.core, - com.raytheon.uf.edex.decodertools.time + com.raytheon.uf.common.status diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/src/com/raytheon/uf/common/dataplugin/binlightning/BinLightningRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/src/com/raytheon/uf/common/dataplugin/binlightning/BinLightningRecord.java index f81f21d55c..ba2f65ef21 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/src/com/raytheon/uf/common/dataplugin/binlightning/BinLightningRecord.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/src/com/raytheon/uf/common/dataplugin/binlightning/BinLightningRecord.java @@ -90,6 +90,7 @@ import com.raytheon.uf.common.time.util.TimeUtil; * Jun 05, 2014 3226 bclement moved data arrays into map for easier management * replaced addStrike() with List constructor, added pulses * Jun 10, 2014 3226 bclement collections instead of lists, made data source logic public + * Jun 19, 2014 3214 bclement populated pulse index array with -1 when missing pulse data * * * @@ -114,6 +115,8 @@ public class BinLightningRecord extends PersistablePluginDataObject implements public static final String PLUGIN_NAME = "binlightning"; + public static final int MISSING_PULSE_INDEX_VALUE = -1; + // Data store data items @Transient private final Map strikeDataArrays = new TreeMap(); @@ -231,6 +234,8 @@ public class BinLightningRecord extends PersistablePluginDataObject implements if (pulseCounts[i] != pulses.size()) { pulseCounts[i] = (byte) pulses.size(); } + } else { + pulseIndexes[i] = MISSING_PULSE_INDEX_VALUE; } }