diff --git a/cave/com.raytheon.uf.viz.npp.crimss/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.npp.crimss/META-INF/MANIFEST.MF index 5400bdff33..4499ecca02 100644 --- a/cave/com.raytheon.uf.viz.npp.crimss/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.npp.crimss/META-INF/MANIFEST.MF @@ -5,50 +5,26 @@ Bundle-SymbolicName: com.raytheon.uf.viz.npp.crimss;singleton:=true Bundle-Version: 1.0.0.qualifier Bundle-Activator: com.raytheon.uf.viz.npp.crimss.Activator Bundle-Vendor: RAYTHEON -Eclipse-BuddyPolicy: registered, ext, global -Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization +Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization Require-Bundle: org.eclipse.core.runtime, org.eclipse.ui;bundle-version="3.6.1", + com.raytheon.uf.viz.core;bundle-version="1.12.1174", + com.raytheon.viz.ui;bundle-version="1.12.1174", + com.raytheon.uf.common.dataplugin.npp.crimss;bundle-version="1.0.0", + com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", + com.raytheon.uf.common.time;bundle-version="1.12.1174", + com.raytheon.uf.common.serialization;bundle-version="1.12.1174", + com.raytheon.uf.common.geospatial;bundle-version="1.12.1174", + com.raytheon.uf.viz.npp;bundle-version="1.0.0", + com.raytheon.uf.viz.npp.sounding;bundle-version="1.0.0", com.raytheon.uf.viz.points;bundle-version="1.0.0", - gov.noaa.nws.ncep.ui.nsharp;bundle-version="1.0.0" + com.raytheon.uf.common.pointdata;bundle-version="1.12.1174", + com.raytheon.viz.core.graphing;bundle-version="1.12.1174", + com.raytheon.uf.viz.d2d.nsharp;bundle-version="1.0.0", + gov.noaa.nws.ncep.ui.nsharp;bundle-version="1.0.0", + com.raytheon.uf.viz.productbrowser;bundle-version="1.12.1174", + javax.measure;bundle-version="1.0.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy -Import-Package: com.raytheon.uf.common.dataplugin, - com.raytheon.uf.common.dataplugin.npp.crimss, - com.raytheon.uf.common.dataquery.requests, - com.raytheon.uf.common.dataquery.responses, - com.raytheon.uf.common.geospatial, - com.raytheon.uf.common.pointdata, - com.raytheon.uf.common.serialization, - com.raytheon.uf.common.serialization.comm, - com.raytheon.uf.common.status, - com.raytheon.uf.common.time, - com.raytheon.uf.viz.core, - com.raytheon.uf.viz.core.drawables, - com.raytheon.uf.viz.core.exception, - com.raytheon.uf.viz.core.map, - com.raytheon.uf.viz.core.maps.display, - com.raytheon.uf.viz.core.procedures, - com.raytheon.uf.viz.core.requests, - com.raytheon.uf.viz.core.rsc, - com.raytheon.uf.viz.core.rsc.capabilities, - com.raytheon.uf.viz.d2d.core, - com.raytheon.uf.viz.d2d.core.map, - com.raytheon.uf.viz.d2d.nsharp.display, - com.raytheon.uf.viz.d2d.nsharp.rsc, - com.raytheon.uf.viz.productbrowser, - com.raytheon.viz.core.graphing, - com.raytheon.viz.pointdata, - com.raytheon.viz.ui, - com.raytheon.viz.ui.editor, - com.raytheon.viz.ui.input, - com.vividsolutions.jts.geom, - gov.noaa.nws.ncep.edex.common.sounding, - gov.noaa.nws.ncep.ui.nsharp, - gov.noaa.nws.ncep.ui.nsharp.natives, - javax.measure.converter, - javax.measure.unit, - org.eclipse.swt.graphics, - org.eclipse.swt.widgets -Export-Package: com.raytheon.uf.viz.npp.crimss, - com.raytheon.uf.viz.npp.crimss.map +Export-Package: com.raytheon.uf.viz.npp.crimss +Import-Package: gov.noaa.nws.ncep.edex.common.sounding diff --git a/cave/com.raytheon.uf.viz.npp.crimss/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/cave/com.raytheon.uf.viz.npp.crimss/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject index 5a3ce6aeeb..72dc694404 100644 --- a/cave/com.raytheon.uf.viz.npp.crimss/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject +++ b/cave/com.raytheon.uf.viz.npp.crimss/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject @@ -1,2 +1 @@ -com.raytheon.uf.viz.npp.crimss.CrimssNSharpResourceData -com.raytheon.uf.viz.npp.crimss.map.CrimssMapResourceData \ No newline at end of file +com.raytheon.uf.viz.npp.crimss.CrimssNSharpResourceData \ No newline at end of file diff --git a/cave/com.raytheon.uf.viz.npp.crimss/localization/menus/npp/crimss/crimssMenuItems.xml b/cave/com.raytheon.uf.viz.npp.crimss/localization/menus/npp/crimss/crimssMenuItems.xml index 2479336090..fbe2cabf5e 100644 --- a/cave/com.raytheon.uf.viz.npp.crimss/localization/menus/npp/crimss/crimssMenuItems.xml +++ b/cave/com.raytheon.uf.viz.npp.crimss/localization/menus/npp/crimss/crimssMenuItems.xml @@ -19,10 +19,10 @@ further_licensing_information. --> - - - + + + + - \ No newline at end of file diff --git a/cave/com.raytheon.uf.viz.npp.crimss/localization/menus/npp/crimss/index.xml b/cave/com.raytheon.uf.viz.npp.crimss/localization/menus/npp/crimss/index.xml new file mode 100644 index 0000000000..bda557fff1 --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp.crimss/localization/menus/npp/crimss/index.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/cave/com.raytheon.uf.viz.npp.crimss/src/com/raytheon/uf/viz/npp/crimss/CrimssDataDefinition.java b/cave/com.raytheon.uf.viz.npp.crimss/src/com/raytheon/uf/viz/npp/crimss/CrimssDataDefinition.java index 3613914da5..4ff2dfb379 100644 --- a/cave/com.raytheon.uf.viz.npp.crimss/src/com/raytheon/uf/viz/npp/crimss/CrimssDataDefinition.java +++ b/cave/com.raytheon.uf.viz.npp.crimss/src/com/raytheon/uf/viz/npp/crimss/CrimssDataDefinition.java @@ -44,7 +44,7 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.ResourceType; import com.raytheon.uf.viz.d2d.nsharp.display.D2DNSharpDescriptor; import com.raytheon.uf.viz.d2d.nsharp.display.D2DNSharpDisplay; -import com.raytheon.uf.viz.npp.crimss.map.CrimssMapResourceData; +import com.raytheon.uf.viz.npp.sounding.rsc.NPPSoundingMapResourceData; import com.raytheon.uf.viz.points.PointsDataManager; import com.raytheon.uf.viz.productbrowser.AbstractRequestableProductBrowserDataDefinition; import com.raytheon.uf.viz.productbrowser.ProductBrowserLabel; @@ -229,7 +229,10 @@ public class CrimssDataDefinition for (int i = 0; i < selection.length; i++) { if (order[i].equals(POINT)) { if (selection[i].equals(MAP_RESOURCE)) { - resourceData = new CrimssMapResourceData(); + NPPSoundingMapResourceData nsmrd = new NPPSoundingMapResourceData(); + nsmrd.setNsharpResourceData(CrimssNSharpResourceData.class); + nsmrd.setResourceName("CrIMSS"); + resourceData = nsmrd; } } } diff --git a/cave/com.raytheon.uf.viz.npp.crimss/src/com/raytheon/uf/viz/npp/crimss/CrimssNSharpResourceData.java b/cave/com.raytheon.uf.viz.npp.crimss/src/com/raytheon/uf/viz/npp/crimss/CrimssNSharpResourceData.java index 8993b83f32..8a0c52dc5c 100644 --- a/cave/com.raytheon.uf.viz.npp.crimss/src/com/raytheon/uf/viz/npp/crimss/CrimssNSharpResourceData.java +++ b/cave/com.raytheon.uf.viz.npp.crimss/src/com/raytheon/uf/viz/npp/crimss/CrimssNSharpResourceData.java @@ -19,15 +19,10 @@ **/ package com.raytheon.uf.viz.npp.crimss; -import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingCube; -import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingCube.QueryStatus; import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer; -import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingProfile; -import gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo; import gov.noaa.nws.ncep.ui.nsharp.natives.NsharpDataHandling; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -39,19 +34,12 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import com.raytheon.uf.common.dataplugin.npp.crimss.CrimssRecord; -import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.pointdata.PointDataView; -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.common.status.UFStatus.Priority; -import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.d2d.nsharp.rsc.D2DNSharpResourceData; -import com.raytheon.viz.pointdata.PointDataRequest; -import com.vividsolutions.jts.geom.Coordinate; +import com.raytheon.uf.viz.npp.sounding.rsc.AbstractNPPNSharpResourceData; /** - * TODO Add Description + * NSharp resource data capable of loading CrIMSS data * *
  * 
@@ -68,9 +56,7 @@ import com.vividsolutions.jts.geom.Coordinate;
  */
 
 @XmlAccessorType(XmlAccessType.NONE)
-public class CrimssNSharpResourceData extends D2DNSharpResourceData {
-    private static final transient IUFStatusHandler statusHandler = UFStatus
-            .getHandler(CrimssNSharpResourceData.class);
+public class CrimssNSharpResourceData extends AbstractNPPNSharpResourceData {
 
     private static final String PLUGIN = "crimss";
 
@@ -80,95 +66,28 @@ public class CrimssNSharpResourceData extends D2DNSharpResourceData {
             CrimssRecord.PDV_H2O, CrimssRecord.PDV_P_H2O,
             CrimssRecord.PDV_TEMPERATURE, CrimssRecord.PDV_P_TEMPERATURE };
 
-    private static final Unit PRESSURE_UNIT = SI.HECTO(SI.PASCAL);
-
-    private static final Unit HEIGHT_UNIT = SI.METER;
-
-    private static final Unit TEMPERATURE_UNIT = SI.CELSIUS;
-
-    private static final Unit H2O_UNIT = SI.GRAM.divide(SI.KILOGRAM);
-
-    private static final Unit DEWPOINT_UNIT = SI.CELSIUS;
-
     public CrimssNSharpResourceData() {
-        super("CRiMSS");
-    }
-
-    @Override
-    protected void preparePointInfo() throws VizException {
-        // everything should already be set
-        return;
+        super("CrIMSS", PLUGIN, PARAMETERS);
     }
 
     /*
      * (non-Javadoc)
      * 
-     * @see
-     * com.raytheon.uf.viz.d2d.nsharp.rsc.D2DNSharpResourceData#getSoundingCube
-     * (gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo)
+     * @see com.raytheon.uf.viz.npp.sounding.rsc.AbstractNPPNSharpResourceData#
+     * getSoundingLayers(com.raytheon.uf.common.pointdata.PointDataView)
      */
     @Override
-    protected NcSoundingCube getSoundingCube(NsharpStationInfo stnInfo) {
-        DataTime time = new DataTime(stnInfo.getReftime());
-        try {
-            PointDataContainer pdc = PointDataRequest
-                    .requestPointDataAllLevels(time, PLUGIN, PARAMETERS, null,
-                            getMetadataMap());
-            PointDataView pdv = null;
-            Coordinate closest = null;
-            for (int i = 0; i < pdc.getCurrentSz(); i++) {
-                PointDataView testPdv = pdc.readRandom(i);
-                Coordinate p = new Coordinate(
-                        testPdv.getFloat(CrimssRecord.LONGITUDE),
-                        testPdv.getFloat(CrimssRecord.LATITUDE));
-                if (closest == null
-                        || coordinate.distance(p) < coordinate
-                                .distance(closest)) {
-                    pdv = testPdv;
-                    closest = p;
-                }
-            }
-            if (pdv == null) {
-                return null;
-            }
-            List layers = new ArrayList();
-            layers.add(getSurfacePressureLayer(pdv));
-            layers.addAll(getHeightLayers(pdv));
-            layers.addAll(getTemperatureLayers(pdv));
-            layers.addAll(getDewpointLayers(pdv));
-            Collections.sort(layers,
-                    NsharpDataHandling.reversePressureHeightWindComparator());
-            mergeDuplicates(layers);
-            // We have to interpolate everything so that height,temperature, and
-            // dewpoint are available on all levels.
-            interpolateHeight(layers);
-            interpolateTemperature(layers);
-            interpolateDewpoint(layers);
-            Iterator iter = layers.iterator();
-            while (iter.hasNext()) {
-                NcSoundingLayer layer = iter.next();
-                if (layer.getPressure() < 0) {
-                    iter.remove();
-                } else if (layer.getGeoHeight() < 0) {
-                    iter.remove();
-
-                } else if (layer.getTemperature() < -300) {
-                    iter.remove();
-
-                } else if (layer.getDewpoint() < -300) {
-                    iter.remove();
-                }
-            }
-            NcSoundingProfile profile = new NcSoundingProfile();
-            profile.setSoundingLyLst(layers);
-            // TODO populate other fields in profile
-            NcSoundingCube cube = new NcSoundingCube(Arrays.asList(profile));
-            cube.setRtnStatus(QueryStatus.OK);
-            return cube;
-        } catch (VizException e) {
-            statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
-        }
-        return null;
+    protected List getSoundingLayers(PointDataView pdv)
+            throws VizException {
+        List layers = new ArrayList();
+        layers.add(getSurfacePressureLayer(pdv));
+        layers.addAll(getHeightLayers(pdv));
+        layers.addAll(getTemperatureLayers(pdv));
+        layers.addAll(getDewpointLayers(pdv));
+        Collections.sort(layers,
+                NsharpDataHandling.reversePressureHeightWindComparator());
+        mergeDuplicates(layers);
+        return layers;
     }
 
     private static NcSoundingLayer getSurfacePressureLayer(PointDataView pdv) {
@@ -278,7 +197,6 @@ public class CrimssNSharpResourceData extends D2DNSharpResourceData {
             float pressure = pressureArray[j].floatValue();
             pressure = (float) pressureConverter.convert(pressure);
             float h2o = h2oArray[j].floatValue();
-            h2o = (float) h2oConverter.convert(h2o);
             float dpt = convertH2OtoDewpoint(h2o, pressure);
             dpt = (float) dewpointConverter.convert(dpt);
             NcSoundingLayer layer = new NcSoundingLayer(pressure,
@@ -292,13 +210,6 @@ public class CrimssNSharpResourceData extends D2DNSharpResourceData {
         return layers;
     }
 
-    // convert h2o in g/kg and pressure in hPa to dewpoint in kelvin.
-    private static float convertH2OtoDewpoint(float h2o, float pressure) {
-        double eee = pressure * h2o / (622.0 + 0.378 * h2o);
-        double b = 26.66082 - Math.log(eee);
-        return (float) ((b - Math.sqrt(b * b - 223.1986)) / 0.0182758048);
-    }
-
     private static void mergeDuplicates(List layers) {
         // Merge any soundings at same pressure.
         Iterator iter = layers.iterator();
@@ -322,80 +233,4 @@ public class CrimssNSharpResourceData extends D2DNSharpResourceData {
         }
     }
 
-    private static void interpolateHeight(List layers) {
-        int belowIndex = -1;
-        for (int i = 0; i < layers.size(); i++) {
-            NcSoundingLayer layerAbove = layers.get(i);
-            if (layerAbove.getGeoHeight() < 0) {
-                continue;
-            }
-            if (belowIndex == -1) {
-                belowIndex = i;
-                continue;
-            }
-            NcSoundingLayer layerBelow = layers.get(belowIndex);
-            double diff = layerAbove.getGeoHeight() - layerBelow.getGeoHeight();
-            double pchg1 = Math.log(layerBelow.getPressure()
-                    / layerAbove.getPressure());
-            for (int j = belowIndex + 1; j < i; j += 1) {
-                NcSoundingLayer layer = layers.get(j);
-                double pchg2 = Math.log(layerBelow.getPressure()
-                        / layer.getPressure());
-                layer.setGeoHeight((float) (layerBelow.getGeoHeight() + ((pchg2 / pchg1) * diff)));
-            }
-            belowIndex = i;
-        }
-    }
-
-    private static void interpolateTemperature(List layers) {
-        int belowIndex = -1;
-        for (int i = 0; i < layers.size(); i++) {
-            NcSoundingLayer layerAbove = layers.get(i);
-            if (layerAbove.getTemperature() < -300) {
-                continue;
-            }
-            if (belowIndex == -1) {
-                belowIndex = i;
-                continue;
-            }
-            NcSoundingLayer layerBelow = layers.get(belowIndex);
-            double diff = layerAbove.getTemperature()
-                    - layerBelow.getTemperature();
-            double pchg1 = Math.log(layerBelow.getPressure()
-                    / layerAbove.getPressure());
-            for (int j = belowIndex + 1; j < i; j += 1) {
-                NcSoundingLayer layer = layers.get(j);
-                double pchg2 = Math.log(layerBelow.getPressure()
-                        / layer.getPressure());
-                layer.setTemperature((float) (layerBelow.getTemperature() + ((pchg2 / pchg1) * diff)));
-            }
-            belowIndex = i;
-        }
-    }
-
-    private static void interpolateDewpoint(List layers) {
-        int belowIndex = -1;
-        for (int i = 0; i < layers.size(); i++) {
-            NcSoundingLayer layerAbove = layers.get(i);
-            if (layerAbove.getDewpoint() < -300) {
-                continue;
-            }
-            if (belowIndex == -1) {
-                belowIndex = i;
-                continue;
-            }
-            NcSoundingLayer layerBelow = layers.get(belowIndex);
-            double diff = layerAbove.getDewpoint() - layerBelow.getDewpoint();
-            double pchg1 = Math.log(layerBelow.getPressure()
-                    / layerAbove.getPressure());
-            for (int j = belowIndex + 1; j < i; j += 1) {
-                NcSoundingLayer layer = layers.get(j);
-                double pchg2 = Math.log(layerBelow.getPressure()
-                        / layer.getPressure());
-                layer.setDewpoint((float) (layerBelow.getDewpoint() + ((pchg2 / pchg1) * diff)));
-            }
-            belowIndex = i;
-        }
-    }
-
 }
diff --git a/cave/com.raytheon.uf.viz.npp.crimss/src/com/raytheon/uf/viz/npp/crimss/map/CrimssMapResourceData.java b/cave/com.raytheon.uf.viz.npp.crimss/src/com/raytheon/uf/viz/npp/crimss/map/CrimssMapResourceData.java
deleted file mode 100644
index 450f48facb..0000000000
--- a/cave/com.raytheon.uf.viz.npp.crimss/src/com/raytheon/uf/viz/npp/crimss/map/CrimssMapResourceData.java
+++ /dev/null
@@ -1,65 +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.viz.npp.crimss.map;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-
-import com.raytheon.uf.common.dataplugin.PluginDataObject;
-import com.raytheon.uf.common.dataplugin.npp.crimss.CrimssRecord;
-import com.raytheon.uf.viz.core.exception.VizException;
-import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
-import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
-import com.raytheon.uf.viz.core.rsc.LoadProperties;
-
-/**
- * TODO Add Description
- * 
- * 
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 7, 2011            bsteffen     Initial creation
- * 
- * 
- * - * @author bsteffen - * @version 1.0 - */ - -@XmlAccessorType(XmlAccessType.NONE) -public class CrimssMapResourceData extends AbstractRequestableResourceData { - - @Override - protected AbstractVizResource constructResource( - LoadProperties loadProperties, PluginDataObject[] objects) - throws VizException { - CrimssMapResource resource = new CrimssMapResource(this, loadProperties); - for (PluginDataObject pdo : objects) { - if (pdo instanceof CrimssRecord) { - resource.addRecord((CrimssRecord) pdo); - } - } - return resource; - } - -} diff --git a/cave/com.raytheon.uf.viz.npp.feature/feature.xml b/cave/com.raytheon.uf.viz.npp.feature/feature.xml index ce92ce2d62..7fe4263141 100644 --- a/cave/com.raytheon.uf.viz.npp.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.npp.feature/feature.xml @@ -38,14 +38,33 @@ version="0.0.0"/> + + + + + + diff --git a/cave/com.raytheon.uf.viz.npp.nucaps/.classpath b/cave/com.raytheon.uf.viz.npp.nucaps/.classpath new file mode 100644 index 0000000000..ad32c83a78 --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp.nucaps/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/cave/com.raytheon.uf.viz.npp.nucaps/.project b/cave/com.raytheon.uf.viz.npp.nucaps/.project new file mode 100644 index 0000000000..28b94b9d0b --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp.nucaps/.project @@ -0,0 +1,28 @@ + + + com.raytheon.uf.viz.npp.nucaps + + + + + + 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/cave/com.raytheon.uf.viz.npp.nucaps/.settings/org.eclipse.jdt.core.prefs b/cave/com.raytheon.uf.viz.npp.nucaps/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..d2ea87f4d7 --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp.nucaps/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Thu Jan 17 15:46:54 CST 2013 +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/cave/com.raytheon.uf.viz.npp.nucaps/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.npp.nucaps/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..0e9809ab38 --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp.nucaps/META-INF/MANIFEST.MF @@ -0,0 +1,26 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: NUCAPS Viz Plugin +Bundle-SymbolicName: com.raytheon.uf.viz.npp.nucaps +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: com.raytheon.uf.viz.npp.nucaps.Activator +Bundle-Vendor: RAYTHEON +Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization +Require-Bundle: org.eclipse.core.runtime, + com.raytheon.uf.viz.core;bundle-version="1.12.1174", + com.raytheon.uf.common.dataplugin.npp.nucaps;bundle-version="1.0.0", + com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", + com.raytheon.uf.common.time;bundle-version="1.12.1174", + com.raytheon.uf.common.serialization;bundle-version="1.12.1174", + com.raytheon.uf.common.geospatial;bundle-version="1.12.1174", + com.raytheon.uf.viz.npp;bundle-version="1.0.0", + com.raytheon.uf.viz.npp.sounding;bundle-version="1.0.0", + com.raytheon.viz.pointdata;bundle-version="1.12.1174", + com.raytheon.uf.common.pointdata;bundle-version="1.12.1174", + com.raytheon.uf.viz.d2d.nsharp;bundle-version="1.0.0", + gov.noaa.nws.ncep.ui.nsharp;bundle-version="1.0.0", + javax.measure;bundle-version="1.0.0", + meteolib.jni;bundle-version="1.0.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Import-Package: gov.noaa.nws.ncep.edex.common.sounding diff --git a/cave/com.raytheon.uf.viz.npp.nucaps/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/cave/com.raytheon.uf.viz.npp.nucaps/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject new file mode 100644 index 0000000000..e637b8b243 --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp.nucaps/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject @@ -0,0 +1 @@ +com.raytheon.uf.viz.npp.nucaps.NucapsNSharpResourceData \ No newline at end of file diff --git a/cave/com.raytheon.uf.viz.npp.nucaps/build.properties b/cave/com.raytheon.uf.viz.npp.nucaps/build.properties new file mode 100644 index 0000000000..3459198753 --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp.nucaps/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + localization/ diff --git a/cave/com.raytheon.uf.viz.npp.nucaps/localization/menus/npp/nucaps/index.xml b/cave/com.raytheon.uf.viz.npp.nucaps/localization/menus/npp/nucaps/index.xml new file mode 100644 index 0000000000..4de0e544ae --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp.nucaps/localization/menus/npp/nucaps/index.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/cave/com.raytheon.uf.viz.npp.nucaps/localization/menus/npp/nucaps/nucapsMenuItems.xml b/cave/com.raytheon.uf.viz.npp.nucaps/localization/menus/npp/nucaps/nucapsMenuItems.xml new file mode 100644 index 0000000000..ccba47f49f --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp.nucaps/localization/menus/npp/nucaps/nucapsMenuItems.xml @@ -0,0 +1,28 @@ + + + + + + + + + \ No newline at end of file diff --git a/cave/com.raytheon.uf.viz.npp.nucaps/src/com/raytheon/uf/viz/npp/nucaps/Activator.java b/cave/com.raytheon.uf.viz.npp.nucaps/src/com/raytheon/uf/viz/npp/nucaps/Activator.java new file mode 100644 index 0000000000..20e95d22c1 --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp.nucaps/src/com/raytheon/uf/viz/npp/nucaps/Activator.java @@ -0,0 +1,30 @@ +package com.raytheon.uf.viz.npp.nucaps; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +public class Activator implements BundleActivator { + + private static BundleContext context; + + static BundleContext getContext() { + return context; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext bundleContext) throws Exception { + Activator.context = bundleContext; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext bundleContext) throws Exception { + Activator.context = null; + } + +} diff --git a/cave/com.raytheon.uf.viz.npp.nucaps/src/com/raytheon/uf/viz/npp/nucaps/NucapsNSharpResourceData.java b/cave/com.raytheon.uf.viz.npp.nucaps/src/com/raytheon/uf/viz/npp/nucaps/NucapsNSharpResourceData.java new file mode 100644 index 0000000000..49d732e03f --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp.nucaps/src/com/raytheon/uf/viz/npp/nucaps/NucapsNSharpResourceData.java @@ -0,0 +1,141 @@ +/** + * 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.viz.npp.nucaps; + +import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer; + +import java.util.ArrayList; +import java.util.List; + +import javax.measure.converter.UnitConverter; +import javax.measure.unit.SI; +import javax.measure.unit.Unit; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; + +import com.raytheon.edex.meteolibrary.Meteolibrary; +import com.raytheon.uf.common.dataplugin.npp.nucaps.NucapsRecord; +import com.raytheon.uf.common.pointdata.PointDataView; +import com.raytheon.uf.viz.core.exception.VizException; +import com.raytheon.uf.viz.npp.sounding.rsc.AbstractNPPNSharpResourceData; + +/** + * NSharp resource data capable of loading NUCAPS data + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jan 15, 2013            mschenke    Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ + +@XmlAccessorType(XmlAccessType.NONE) +public class NucapsNSharpResourceData extends AbstractNPPNSharpResourceData { + + private static final String PLUGIN = "nucaps"; + + private static final String[] PARAMETERS = { NucapsRecord.LONGITUDE, + NucapsRecord.LATITUDE, NucapsRecord.PDV_SURFACE_PRESSURE, + NucapsRecord.PDV_PRESSURE, NucapsRecord.PDV_TEMPERATURE, + NucapsRecord.PDV_WATER_VAPOR_MIXING_RATIO }; + + public NucapsNSharpResourceData() { + super("NUCAPS", PLUGIN, PARAMETERS); + } + + /* + * (non-Javadoc) + * + * @see com.raytheon.uf.viz.npp.sounding.rsc.AbstractNPPNSharpResourceData# + * getSoundingLayers(com.raytheon.uf.common.pointdata.PointDataView) + */ + @Override + protected List getSoundingLayers(PointDataView pdv) + throws VizException { + Number[] pressures = pdv.getNumberAllLevels(NucapsRecord.PDV_PRESSURE); + UnitConverter pressureConverter = getConverter( + pdv.getUnit(NucapsRecord.PDV_PRESSURE), PRESSURE_UNIT); + Number[] temperatures = pdv + .getNumberAllLevels(NucapsRecord.PDV_TEMPERATURE); + UnitConverter temperatureConverter = getConverter( + pdv.getUnit(NucapsRecord.PDV_TEMPERATURE), TEMPERATURE_UNIT); + UnitConverter temperatureCalcConverter = getConverter( + pdv.getUnit(NucapsRecord.PDV_TEMPERATURE), + TEMPERATURE_CALC_UNIT); + Number[] wvMixingRatios = pdv + .getNumberAllLevels(NucapsRecord.PDV_WATER_VAPOR_MIXING_RATIO); + UnitConverter wvMixingRatioConverter = getConverter( + pdv.getUnit(NucapsRecord.PDV_WATER_VAPOR_MIXING_RATIO), + H2O_UNIT); + UnitConverter dewPointConverter = getConverter(SI.KELVIN, SI.CELSIUS); + + if (pressures.length != temperatures.length + || pressures.length != wvMixingRatios.length) { + throw new VizException("NUCAPS PointData sizes incorrect"); + } + int length = pressures.length; + + List soundingLayers = new ArrayList( + length); + float surfacePressure = pdv.getFloat(NucapsRecord.PDV_SURFACE_PRESSURE); + for (int i = 0; i < length; ++i) { + int idx = i; + float pressure = (float) pressureConverter.convert(pressures[idx] + .doubleValue()); + if (pressure <= surfacePressure) { + // Don't add entries where pressure indicates below ground + float gh = Meteolibrary.ptozsa(new float[] { pressure }, 0); + Number temperature = temperatures[idx]; + float h20 = (float) wvMixingRatioConverter + .convert(wvMixingRatios[idx].doubleValue()); + float dewpoint = convertH2OtoDewpoint(h20, pressure); + float rh = convertH20ToRelativeHumidity(h20, + (float) temperatureCalcConverter.convert(temperature + .doubleValue()), pressure); + soundingLayers.add(new NcSoundingLayer(pressure, gh, + (float) temperatureConverter.convert(temperature + .doubleValue()), (float) dewPointConverter + .convert(dewpoint), NcSoundingLayer.MISSING, + NcSoundingLayer.MISSING, NcSoundingLayer.MISSING, + NcSoundingLayer.MISSING, NcSoundingLayer.MISSING, h20, + rh)); + } + } + + return soundingLayers; + } + + private UnitConverter getConverter(Unit fromUnit, Unit toUnit) + throws VizException { + if (fromUnit.isCompatible(toUnit)) { + return fromUnit.getConverterTo(toUnit); + } + throw new VizException("Unable to convert " + fromUnit + " to " + + toUnit); + } + +} diff --git a/cave/com.raytheon.uf.viz.npp.sounding/.classpath b/cave/com.raytheon.uf.viz.npp.sounding/.classpath new file mode 100644 index 0000000000..ad32c83a78 --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp.sounding/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/cave/com.raytheon.uf.viz.npp.sounding/.project b/cave/com.raytheon.uf.viz.npp.sounding/.project new file mode 100644 index 0000000000..4de0b6c0d5 --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp.sounding/.project @@ -0,0 +1,28 @@ + + + com.raytheon.uf.viz.npp.sounding + + + + + + 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/cave/com.raytheon.uf.viz.npp.sounding/.settings/org.eclipse.jdt.core.prefs b/cave/com.raytheon.uf.viz.npp.sounding/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..e51e55865e --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp.sounding/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Mon Jan 14 13:20:29 CST 2013 +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/cave/com.raytheon.uf.viz.npp.sounding/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.npp.sounding/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..95b5e702e9 --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp.sounding/META-INF/MANIFEST.MF @@ -0,0 +1,28 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: NPP Viz Sounding +Bundle-SymbolicName: com.raytheon.uf.viz.npp.sounding;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: com.raytheon.uf.viz.npp.sounding.Activator +Bundle-Vendor: RAYTHEON +Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.ui;bundle-version="3.6.1", + com.raytheon.uf.common.dataplugin.npp.sounding;bundle-version="1.0.0", + com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", + com.raytheon.uf.common.time;bundle-version="1.12.1174", + com.raytheon.uf.viz.npp;bundle-version="1.0.0", + com.raytheon.uf.common.serialization;bundle-version="1.12.1174", + com.raytheon.uf.viz.core;bundle-version="1.12.1174", + com.raytheon.uf.viz.d2d.nsharp;bundle-version="1.0.0", + gov.noaa.nws.ncep.ui.nsharp;bundle-version="1.0.0", + com.raytheon.viz.ui;bundle-version="1.12.1174", + com.raytheon.uf.common.geospatial;bundle-version="1.12.1174", + com.raytheon.uf.common.pointdata;bundle-version="1.12.1174", + com.raytheon.viz.pointdata;bundle-version="1.12.1174", + com.raytheon.viz.core.graphing;bundle-version="1.12.1174", + javax.measure;bundle-version="1.0.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Import-Package: gov.noaa.nws.ncep.edex.common.sounding +Export-Package: com.raytheon.uf.viz.npp.sounding.rsc diff --git a/cave/com.raytheon.uf.viz.npp.sounding/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/cave/com.raytheon.uf.viz.npp.sounding/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject new file mode 100644 index 0000000000..d0edc075a2 --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp.sounding/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject @@ -0,0 +1 @@ +com.raytheon.uf.viz.npp.sounding.rsc.NPPSoundingMapResourceData \ No newline at end of file diff --git a/cave/com.raytheon.uf.viz.npp.sounding/build.properties b/cave/com.raytheon.uf.viz.npp.sounding/build.properties new file mode 100644 index 0000000000..3459198753 --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp.sounding/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + localization/ diff --git a/cave/com.raytheon.uf.viz.npp.crimss/localization/bundles/crimssAvailability.xml b/cave/com.raytheon.uf.viz.npp.sounding/localization/bundles/npp/soundingAvailability.xml similarity index 80% rename from cave/com.raytheon.uf.viz.npp.crimss/localization/bundles/crimssAvailability.xml rename to cave/com.raytheon.uf.viz.npp.sounding/localization/bundles/npp/soundingAvailability.xml index c45a461ad3..4b9c06d659 100644 --- a/cave/com.raytheon.uf.viz.npp.crimss/localization/bundles/crimssAvailability.xml +++ b/cave/com.raytheon.uf.viz.npp.sounding/localization/bundles/npp/soundingAvailability.xml @@ -24,11 +24,12 @@ - - + + ${soundingResourceData} + ${name;Unknown} - + diff --git a/cave/com.raytheon.uf.viz.npp.sounding/src/com/raytheon/uf/viz/npp/sounding/Activator.java b/cave/com.raytheon.uf.viz.npp.sounding/src/com/raytheon/uf/viz/npp/sounding/Activator.java new file mode 100644 index 0000000000..1c8576d190 --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp.sounding/src/com/raytheon/uf/viz/npp/sounding/Activator.java @@ -0,0 +1,41 @@ +package com.raytheon.uf.viz.npp.sounding; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; + +public class Activator implements BundleActivator { + + public static final IUFStatusHandler statusHandler = UFStatus + .getHandler(Activator.class); + + private static BundleContext context; + + static BundleContext getContext() { + return context; + } + + /* + * (non-Javadoc) + * + * @see + * org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext + * ) + */ + public void start(BundleContext bundleContext) throws Exception { + Activator.context = bundleContext; + } + + /* + * (non-Javadoc) + * + * @see + * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext bundleContext) throws Exception { + Activator.context = null; + } + +} diff --git a/cave/com.raytheon.uf.viz.npp.sounding/src/com/raytheon/uf/viz/npp/sounding/rsc/AbstractNPPNSharpResourceData.java b/cave/com.raytheon.uf.viz.npp.sounding/src/com/raytheon/uf/viz/npp/sounding/rsc/AbstractNPPNSharpResourceData.java new file mode 100644 index 0000000000..27ceba81ce --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp.sounding/src/com/raytheon/uf/viz/npp/sounding/rsc/AbstractNPPNSharpResourceData.java @@ -0,0 +1,339 @@ +/** + * 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.viz.npp.sounding.rsc; + +import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingCube; +import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingCube.QueryStatus; +import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer; +import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingProfile; +import gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo; +import gov.noaa.nws.ncep.ui.nsharp.natives.NsharpDataHandling; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +import javax.measure.unit.SI; +import javax.measure.unit.Unit; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; + +import com.raytheon.uf.common.dataplugin.npp.sounding.NPPSoundingRecord; +import com.raytheon.uf.common.pointdata.PointDataContainer; +import com.raytheon.uf.common.pointdata.PointDataView; +import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.common.time.DataTime; +import com.raytheon.uf.common.time.DataTime.FLAG; +import com.raytheon.uf.common.time.TimeRange; +import com.raytheon.uf.viz.core.exception.VizException; +import com.raytheon.uf.viz.d2d.nsharp.rsc.D2DNSharpResourceData; +import com.raytheon.uf.viz.npp.sounding.Activator; +import com.raytheon.viz.pointdata.PointDataRequest; +import com.vividsolutions.jts.geom.Coordinate; + +/** + * Abstract NPP Sounding resource data + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jan 14, 2013            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ +@XmlAccessorType(XmlAccessType.NONE) +public abstract class AbstractNPPNSharpResourceData extends + D2DNSharpResourceData { + + public static class NPPNsharpStationInfo extends NsharpStationInfo { + + private TimeRange timeRange; + + public NPPNsharpStationInfo(NsharpStationInfo info, DataTime time) { + this.latitude = info.getLatitude(); + this.longitude = info.getLongitude(); + this.reftime = new Timestamp(info.getReftime().getTime()); + if (info.getRangestarttime() != null) { + this.rangestarttime = new Timestamp(info.getRangestarttime() + .getTime()); + } + this.sndType = info.getSndType(); + this.stnDisplayInfo = info.getStnDisplayInfo(); + this.timeLineSpList = new ArrayList( + info.getTimeLineSpList()); + setDataTime(time); + } + + public void setDataTime(DataTime time) { + this.reftime = new Timestamp(time.getMatchRef()); + if (time.getUtilityFlags().contains(FLAG.PERIOD_USED)) { + this.timeRange = time.getValidPeriod(); + } + } + + public DataTime getDataTime() { + if (timeRange != null) { + return new DataTime(getReftime().getTime(), timeRange); + } else { + return new DataTime(new Date(getReftime().getTime())); + } + } + } + + protected static final Unit PRESSURE_UNIT = SI.HECTO(SI.PASCAL); + + protected static final Unit HEIGHT_UNIT = SI.METER; + + protected static final Unit TEMPERATURE_UNIT = SI.CELSIUS; + + protected static final Unit TEMPERATURE_CALC_UNIT = SI.KELVIN; + + protected static final Unit H2O_UNIT = SI.GRAM.divide(SI.KILOGRAM); + + protected static final Unit DEWPOINT_UNIT = SI.CELSIUS; + + private final String plugin; + + private final String[] parameters; + + public AbstractNPPNSharpResourceData() { + // This constructor only exists so JAXB won't complain + throw new UnsupportedOperationException(); + } + + protected AbstractNPPNSharpResourceData(String name, String plugin, + String[] parameters) { + super(name); + this.plugin = plugin; + this.parameters = parameters; + } + + @Override + protected void preparePointInfo() throws VizException { + // everything should already be set + return; + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.d2d.nsharp.rsc.D2DNSharpResourceData#createStationInfo + * (com.raytheon.uf.common.time.DataTime) + */ + @Override + protected NsharpStationInfo createStationInfo(DataTime time) { + return new NPPNsharpStationInfo(super.createStationInfo(time), time); + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.d2d.nsharp.rsc.D2DNSharpResourceData#getSoundingCube + * (gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo) + */ + @Override + protected NcSoundingCube getSoundingCube(NsharpStationInfo stnInfo) { + DataTime time = new DataTime(stnInfo.getReftime()); + if (stnInfo instanceof NPPNsharpStationInfo) { + time = ((NPPNsharpStationInfo) stnInfo).getDataTime(); + } + try { + PointDataContainer pdc = PointDataRequest + .requestPointDataAllLevels(time, plugin, parameters, null, + getMetadataMap()); + PointDataView pdv = null; + Coordinate closest = null; + for (int i = 0; i < pdc.getCurrentSz(); i++) { + PointDataView testPdv = pdc.readRandom(i); + Coordinate p = new Coordinate( + testPdv.getFloat(NPPSoundingRecord.LONGITUDE), + testPdv.getFloat(NPPSoundingRecord.LATITUDE)); + if (closest == null + || coordinate.distance(p) < coordinate + .distance(closest)) { + pdv = testPdv; + closest = p; + } + } + if (pdv == null) { + return null; + } + + List layers = getSoundingLayers(pdv); + Collections.sort(layers, + NsharpDataHandling.reversePressureHeightWindComparator()); + + // We have to interpolate everything so that height,temperature, and + // dewpoint are available on all levels. + interpolateHeight(layers); + interpolateTemperature(layers); + interpolateDewpoint(layers); + Iterator iter = layers.iterator(); + while (iter.hasNext()) { + NcSoundingLayer layer = iter.next(); + if (layer.getPressure() < 0) { + iter.remove(); + } else if (layer.getGeoHeight() < 0) { + // TODO: Needed? + // iter.remove(); + } else if (layer.getTemperature() < -300) { + iter.remove(); + + } else if (layer.getDewpoint() < -300) { + iter.remove(); + } + } + NcSoundingProfile profile = new NcSoundingProfile(); + profile.setSoundingLyLst(layers); + // TODO populate other fields in profile + NcSoundingCube cube = new NcSoundingCube(Arrays.asList(profile)); + cube.setRtnStatus(QueryStatus.OK); + return cube; + } catch (VizException e) { + Activator.statusHandler.handle(Priority.PROBLEM, + e.getLocalizedMessage(), e); + } + return null; + } + + /** + * @param pdv + * @return + */ + protected abstract List getSoundingLayers(PointDataView pdv) + throws VizException; + + private static void interpolateHeight(List layers) { + int belowIndex = -1; + for (int i = 0; i < layers.size(); i++) { + NcSoundingLayer layerAbove = layers.get(i); + if (layerAbove.getGeoHeight() < 0) { + continue; + } + if (belowIndex == -1) { + belowIndex = i; + continue; + } + NcSoundingLayer layerBelow = layers.get(belowIndex); + double diff = layerAbove.getGeoHeight() - layerBelow.getGeoHeight(); + double pchg1 = Math.log(layerBelow.getPressure() + / layerAbove.getPressure()); + for (int j = belowIndex + 1; j < i; j += 1) { + NcSoundingLayer layer = layers.get(j); + double pchg2 = Math.log(layerBelow.getPressure() + / layer.getPressure()); + layer.setGeoHeight((float) (layerBelow.getGeoHeight() + ((pchg2 / pchg1) * diff))); + } + belowIndex = i; + } + } + + private static void interpolateTemperature(List layers) { + int belowIndex = -1; + for (int i = 0; i < layers.size(); i++) { + NcSoundingLayer layerAbove = layers.get(i); + if (layerAbove.getTemperature() < -300) { + continue; + } + if (belowIndex == -1) { + belowIndex = i; + continue; + } + NcSoundingLayer layerBelow = layers.get(belowIndex); + double diff = layerAbove.getTemperature() + - layerBelow.getTemperature(); + double pchg1 = Math.log(layerBelow.getPressure() + / layerAbove.getPressure()); + for (int j = belowIndex + 1; j < i; j += 1) { + NcSoundingLayer layer = layers.get(j); + double pchg2 = Math.log(layerBelow.getPressure() + / layer.getPressure()); + layer.setTemperature((float) (layerBelow.getTemperature() + ((pchg2 / pchg1) * diff))); + } + belowIndex = i; + } + } + + private static void interpolateDewpoint(List layers) { + int belowIndex = -1; + for (int i = 0; i < layers.size(); i++) { + NcSoundingLayer layerAbove = layers.get(i); + if (layerAbove.getDewpoint() < -300) { + continue; + } + if (belowIndex == -1) { + belowIndex = i; + continue; + } + NcSoundingLayer layerBelow = layers.get(belowIndex); + double diff = layerAbove.getDewpoint() - layerBelow.getDewpoint(); + double pchg1 = Math.log(layerBelow.getPressure() + / layerAbove.getPressure()); + for (int j = belowIndex + 1; j < i; j += 1) { + NcSoundingLayer layer = layers.get(j); + double pchg2 = Math.log(layerBelow.getPressure() + / layer.getPressure()); + layer.setDewpoint((float) (layerBelow.getDewpoint() + ((pchg2 / pchg1) * diff))); + } + belowIndex = i; + } + } + + // convert h2o in g/kg and pressure in hPa to dewpoint in kelvin. + protected static float convertH2OtoDewpoint(float h2o, float pressure) { + double eee = pressure * h2o / (622.0 + 0.378 * h2o); + double b = 26.66082 - Math.log(eee); + return (float) ((b - Math.sqrt(b * b - 223.1986)) / 0.0182758048); + } + + // convert h2o in g/kg and pressure in hPa to relative humidity. + protected static float convertH20ToRelativeHumidity(float h20, + float temperature, float pressure) { + double a = 22.05565; + double b = 0.0091379024; + double c = 6106.396; + double epsilonx1k = 622.0; + + double shxDenom = h20 * 0.378; + shxDenom += epsilonx1k; + + double tDenom = -b * temperature; + tDenom += a; + tDenom -= c / temperature; + + double RH = pressure * h20; + RH /= shxDenom; + RH /= Math.exp(tDenom); + + return (float) RH; + } +} diff --git a/cave/com.raytheon.uf.viz.npp.crimss/src/com/raytheon/uf/viz/npp/crimss/map/CrimssMapInputManager.java b/cave/com.raytheon.uf.viz.npp.sounding/src/com/raytheon/uf/viz/npp/sounding/rsc/NPPSoundingMapInputHandler.java similarity index 86% rename from cave/com.raytheon.uf.viz.npp.crimss/src/com/raytheon/uf/viz/npp/crimss/map/CrimssMapInputManager.java rename to cave/com.raytheon.uf.viz.npp.sounding/src/com/raytheon/uf/viz/npp/sounding/rsc/NPPSoundingMapInputHandler.java index a568b1b75c..73943bfe20 100644 --- a/cave/com.raytheon.uf.viz.npp.crimss/src/com/raytheon/uf/viz/npp/crimss/map/CrimssMapInputManager.java +++ b/cave/com.raytheon.uf.viz.npp.sounding/src/com/raytheon/uf/viz/npp/sounding/rsc/NPPSoundingMapInputHandler.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.viz.npp.crimss.map; +package com.raytheon.uf.viz.npp.sounding.rsc; import java.util.Collection; @@ -28,14 +28,14 @@ import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbenchPart; -import com.raytheon.uf.common.dataplugin.npp.crimss.CrimssRecord; +import com.raytheon.uf.common.dataplugin.npp.sounding.NPPSoundingRecord; import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.viz.ui.VizWorkbenchManager; import com.raytheon.viz.ui.input.InputAdapter; import com.vividsolutions.jts.geom.Coordinate; /** - * Input manager for the CrimssMapResource + * Input handler for npp sounding availability resource * *
  * 
@@ -43,7 +43,7 @@ import com.vividsolutions.jts.geom.Coordinate;
  * 
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
- * Jan 9, 2012            mschenke     Initial creation
+ * Jan 14, 2013            mschenke     Initial creation
  * 
  * 
* @@ -51,28 +51,24 @@ import com.vividsolutions.jts.geom.Coordinate; * @version 1.0 */ -public class CrimssMapInputManager extends InputAdapter { +public class NPPSoundingMapInputHandler extends InputAdapter { + + private NPPSoundingMapResource resource; private Cursor handCursor; - private Cursor arrowCursor; - - private CrimssMapResource resource; - - private CrimssRecord closestRecord; + private NPPSoundingRecord closestRecord; private int downX, downY; - public CrimssMapInputManager(CrimssMapResource resource) { + public NPPSoundingMapInputHandler(NPPSoundingMapResource resource) { this.resource = resource; Display display = Display.getCurrent(); handCursor = new Cursor(display, SWT.CURSOR_HAND); - arrowCursor = new Cursor(display, SWT.CURSOR_ARROW); } public void dispose() { handCursor.dispose(); - arrowCursor.dispose(); } /* @@ -86,12 +82,13 @@ public class CrimssMapInputManager extends InputAdapter { closestRecord = null; if (resource.isEditable()) { - Collection records = resource.getCurrentRecords(); + Collection records = resource + .getCurrentRecords(); if (records != null) { double radius = resource.getRadius(); Coordinate c = new Coordinate(x, y); double bestDist = Double.MAX_VALUE; - for (CrimssRecord record : records) { + for (NPPSoundingRecord record : records) { double lat = record.getLatitude(); double lon = record.getLongitude(); double[] pixel = resource.getResourceContainer() @@ -107,7 +104,7 @@ public class CrimssMapInputManager extends InputAdapter { } if (wasClosest && closestRecord == null) { - getShell().setCursor(arrowCursor); + getShell().setCursor(null); } else if (!wasClosest && closestRecord != null) { getShell().setCursor(handCursor); } @@ -159,7 +156,7 @@ public class CrimssMapInputManager extends InputAdapter { @Override public boolean handleMouseExit(Event event) { closestRecord = null; - getShell().setCursor(arrowCursor); + getShell().setCursor(null); return super.handleMouseExit(event); } diff --git a/cave/com.raytheon.uf.viz.npp.crimss/src/com/raytheon/uf/viz/npp/crimss/map/CrimssMapResource.java b/cave/com.raytheon.uf.viz.npp.sounding/src/com/raytheon/uf/viz/npp/sounding/rsc/NPPSoundingMapResource.java similarity index 66% rename from cave/com.raytheon.uf.viz.npp.crimss/src/com/raytheon/uf/viz/npp/crimss/map/CrimssMapResource.java rename to cave/com.raytheon.uf.viz.npp.sounding/src/com/raytheon/uf/viz/npp/sounding/rsc/NPPSoundingMapResource.java index ee7def0588..5ee95acf88 100644 --- a/cave/com.raytheon.uf.viz.npp.crimss/src/com/raytheon/uf/viz/npp/crimss/map/CrimssMapResource.java +++ b/cave/com.raytheon.uf.viz.npp.sounding/src/com/raytheon/uf/viz/npp/sounding/rsc/NPPSoundingMapResource.java @@ -17,26 +17,25 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.viz.npp.crimss.map; +package com.raytheon.uf.viz.npp.sounding.rsc; +import gov.noaa.nws.ncep.ui.nsharp.display.NsharpSkewTPaneDescriptor; import gov.noaa.nws.ncep.ui.nsharp.display.NsharpSkewTPaneDisplay; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.swt.graphics.RGB; import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.dataplugin.npp.crimss.CrimssRecord; +import com.raytheon.uf.common.dataplugin.npp.sounding.NPPSoundingRecord; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; -import com.raytheon.uf.common.time.BinOffset; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.DescriptorMap; import com.raytheon.uf.viz.core.DrawableCircle; @@ -53,7 +52,6 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability; import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability; import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability; -import com.raytheon.uf.viz.npp.crimss.CrimssNSharpResourceData; import com.raytheon.viz.ui.BundleProductLoader; import com.raytheon.viz.ui.UiUtil; import com.raytheon.viz.ui.editor.AbstractEditor; @@ -61,7 +59,7 @@ import com.raytheon.viz.ui.input.EditableManager; import com.vividsolutions.jts.geom.Coordinate; /** - * TODO Add Description + * Sounding available resource. Draws points on map where data is available * *
  * 
@@ -69,66 +67,72 @@ import com.vividsolutions.jts.geom.Coordinate;
  * 
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
- * Dec 7, 2011            bsteffen     Initial creation
+ * Jan 14, 2013            mschenke     Initial creation
  * 
  * 
* - * @author bsteffen + * @author mschenke * @version 1.0 */ -public class CrimssMapResource extends - AbstractVizResource { +public class NPPSoundingMapResource extends + AbstractVizResource { - private CrimssMapInputManager inputManager; + private NPPSoundingMapInputHandler inputManager; - private Map> records = new HashMap>(); + private Collection allRecords = new ArrayList(); - protected CrimssMapResource(CrimssMapResourceData resourceData, + private Map> groupedRecords = new HashMap>(); + + /** + * @param resourceData + * @param loadProperties + */ + protected NPPSoundingMapResource(NPPSoundingMapResourceData resourceData, LoadProperties loadProperties) { super(resourceData, loadProperties); - this.inputManager = new CrimssMapInputManager(this); + this.inputManager = new NPPSoundingMapInputHandler(this); this.dataTimes = new ArrayList(); getCapability(EditableCapability.class).setEditable(true); resourceData.addChangeListener(new IResourceDataChanged() { - @Override public void resourceChanged(ChangeType type, Object object) { if (type == ChangeType.DATA_UPDATE) { if (object instanceof PluginDataObject[]) { - for (PluginDataObject pdo : (PluginDataObject[]) object) { - addRecord((CrimssRecord) pdo); - } + addRecords((PluginDataObject[]) object); } } } }); } - Collection getCurrentRecords() { - return records.get(descriptor.getTimeForResource(this)); + Collection getCurrentRecords() { + return groupedRecords.get(descriptor.getTimeForResource(this)); } - public void addRecord(CrimssRecord record) { - DataTime time = record.getDataTime(); - BinOffset binOffset = resourceData.getBinOffset(); - if (binOffset != null) { - time = binOffset.getNormalizedTime(time); + public synchronized void addRecords(PluginDataObject... records) { + for (PluginDataObject record : records) { + if (record instanceof NPPSoundingRecord) { + if (allRecords.contains(record) == false) { + allRecords.add((NPPSoundingRecord) record); + } + } } - Set pdos = this.records.get(time); - if (pdos == null) { - pdos = new HashSet(); - this.records.put(time, pdos); - } - if (!this.dataTimes.contains(time)) { - this.dataTimes.add(time); - } - pdos.add(record); + Map> groupedRecords = resourceData + .groupRecordTimes(allRecords); + List dataTimes = new ArrayList( + groupedRecords.keySet()); + Collections.sort(dataTimes); + this.dataTimes = dataTimes; + this.groupedRecords = groupedRecords; } @Override - public void remove(DataTime dataTime) { - records.remove(dataTime); + public synchronized void remove(DataTime dataTime) { + Collection records = groupedRecords.remove(dataTime); + if (records != null) { + allRecords.removeAll(records); + } super.remove(dataTime); } @@ -145,20 +149,21 @@ public class CrimssMapResource extends if (time == null) { return; } - Set records = this.records.get(time); + Collection records = this.groupedRecords.get(time); if (records == null) { return; } RGB color = getCapability(ColorableCapability.class).getColor(); List circles = new ArrayList( records.size()); - for (CrimssRecord record : records) { + for (NPPSoundingRecord record : records) { double lat = record.getLatitude(); double lon = record.getLongitude(); double[] pixel = descriptor.worldToPixel(new double[] { lon, lat }); DrawableCircle circle = new DrawableCircle(); circle.setCoordinates(pixel[0], pixel[1]); - circle.screenRadius = getRadius() - 1; + circle.screenRadius = getRadius(); + circle.numberOfPoints = (int) (circle.screenRadius * 4); circle.basics.color = color; circle.filled = true; circles.add(circle); @@ -183,11 +188,20 @@ public class CrimssMapResource extends } double getRadius() { - return 8 * getCapability(MagnificationCapability.class) + return 5 * getCapability(MagnificationCapability.class) .getMagnification(); } - void loadSoundingResource(CrimssRecord record) { + @Override + public String getName() { + return resourceData.getResourceName() + " Availability"; + } + + /** + * @param closestRecord + */ + void loadSoundingResource(NPPSoundingRecord record) { + // Build metadata map for sounding resource HashMap metadataMap = new HashMap( resourceData.getMetadataMap()); RequestConstraint rc = new RequestConstraint(null, @@ -195,22 +209,24 @@ public class CrimssMapResource extends rc.setBetweenValueList(new String[] { String.valueOf(record.getLongitude() - 0.01), String.valueOf(record.getLongitude() + 0.01) }); - metadataMap.put(CrimssRecord.LONGITUDE, rc); + metadataMap.put(NPPSoundingRecord.LONGITUDE, rc); rc = new RequestConstraint(null, ConstraintType.BETWEEN); rc.setBetweenValueList(new String[] { String.valueOf(record.getLatitude() - 0.01), String.valueOf(record.getLatitude() + 0.01) }); - metadataMap.put(CrimssRecord.LATITUDE, rc); - CrimssNSharpResourceData resourceData = new CrimssNSharpResourceData(); - resourceData.setCoordinate(new Coordinate(record.getLongitude(), record - .getLatitude())); - resourceData.setPointName(String.format("CrIMSS-%.2f,%.2f", - record.getLongitude(), record.getLatitude())); - resourceData.setMetadataMap(metadataMap); + metadataMap.put(NPPSoundingRecord.LATITUDE, rc); + + // Construct nsharp resource data for loading + AbstractNPPNSharpResourceData nsResourceData = resourceData + .newNsharpResourceData(); + nsResourceData.setCoordinate(new Coordinate(record.getLongitude(), + record.getLatitude())); + nsResourceData.setMetadataMap(metadataMap); ResourcePair pair = new ResourcePair(); - pair.setResourceData(resourceData); + pair.setResourceData(nsResourceData); pair.setLoadProperties(new LoadProperties()); NsharpSkewTPaneDisplay display = new NsharpSkewTPaneDisplay(); + display.setDescriptor(new NsharpSkewTPaneDescriptor()); display.getDescriptor().getResourceList().add(pair); String editorId = DescriptorMap.getEditorId(display.getDescriptor() .getClass().getName()); @@ -221,10 +237,4 @@ public class CrimssMapResource extends Job j = new BundleProductLoader(editor, b); j.schedule(); } - - @Override - public String getName() { - return "CrIMSS Availability"; - } - } diff --git a/cave/com.raytheon.uf.viz.npp.sounding/src/com/raytheon/uf/viz/npp/sounding/rsc/NPPSoundingMapResourceData.java b/cave/com.raytheon.uf.viz.npp.sounding/src/com/raytheon/uf/viz/npp/sounding/rsc/NPPSoundingMapResourceData.java new file mode 100644 index 0000000000..64052aba8e --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp.sounding/src/com/raytheon/uf/viz/npp/sounding/rsc/NPPSoundingMapResourceData.java @@ -0,0 +1,161 @@ +/** + * 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.viz.npp.sounding.rsc; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; + +import com.raytheon.uf.common.dataplugin.PluginDataObject; +import com.raytheon.uf.viz.core.exception.VizException; +import com.raytheon.uf.viz.core.rsc.AbstractVizResource; +import com.raytheon.uf.viz.core.rsc.LoadProperties; +import com.raytheon.uf.viz.npp.AbstractNppResourceData; + +/** + * Resource data for availability map of npp soundings + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jan 14, 2013            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ +@XmlAccessorType(XmlAccessType.NONE) +public class NPPSoundingMapResourceData extends AbstractNppResourceData { + + @XmlElement + private Class nsharpResourceData; + + @XmlElement + private String resourceName; + + /* + * (non-Javadoc) + * + * @see com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData# + * constructResource(com.raytheon.uf.viz.core.rsc.LoadProperties, + * com.raytheon.uf.viz.core.rsc.PluginDataObject[]) + */ + @Override + protected AbstractVizResource constructResource( + LoadProperties loadProperties, PluginDataObject[] objects) + throws VizException { + NPPSoundingMapResource resource = new NPPSoundingMapResource(this, + loadProperties); + if (objects instanceof PluginDataObject[]) { + resource.addRecords((PluginDataObject[]) objects); + } + return resource; + } + + /** + * @return the nsharpResourceData + */ + public Class getNsharpResourceData() { + return nsharpResourceData; + } + + /** + * @param nsharpResourceData + * the nsharpResourceData to set + */ + public void setNsharpResourceData( + Class nsharpResourceData) { + this.nsharpResourceData = nsharpResourceData; + } + + /** + * @return the resourceName + */ + public String getResourceName() { + return resourceName; + } + + /** + * @param resourceName + * the resourceName to set + */ + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + public AbstractNPPNSharpResourceData newNsharpResourceData() { + try { + return getNsharpResourceData().newInstance(); + } catch (Exception e) { + throw new RuntimeException("Unable to create new instance of: " + + getNsharpResourceData()); + } + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime + * result + + ((nsharpResourceData == null) ? 0 : nsharpResourceData + .hashCode()); + result = prime * result + + ((resourceName == null) ? 0 : resourceName.hashCode()); + return result; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (getClass() != obj.getClass()) + return false; + NPPSoundingMapResourceData other = (NPPSoundingMapResourceData) obj; + if (nsharpResourceData == null) { + if (other.nsharpResourceData != null) + return false; + } else if (!nsharpResourceData.equals(other.nsharpResourceData)) + return false; + if (resourceName == null) { + if (other.resourceName != null) + return false; + } else if (!resourceName.equals(other.resourceName)) + return false; + return true; + } + +} diff --git a/cave/com.raytheon.uf.viz.npp.viirs/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.npp.viirs/META-INF/MANIFEST.MF index 133bab7321..c1559813f8 100644 --- a/cave/com.raytheon.uf.viz.npp.viirs/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.npp.viirs/META-INF/MANIFEST.MF @@ -24,6 +24,7 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.common.derivparam;bundle-version="1.12.1174", com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174", com.raytheon.uf.common.comm;bundle-version="1.12.1174", - com.raytheon.viz.alerts;bundle-version="1.12.1174" + com.raytheon.viz.alerts;bundle-version="1.12.1174", + com.raytheon.uf.viz.npp;bundle-version="1.0.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy diff --git a/cave/com.raytheon.uf.viz.npp.viirs/localization/menus/npp/viirs/index.xml b/cave/com.raytheon.uf.viz.npp.viirs/localization/menus/npp/viirs/index.xml new file mode 100644 index 0000000000..6435ca8625 --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp.viirs/localization/menus/npp/viirs/index.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/cave/com.raytheon.uf.viz.npp.viirs/localization/menus/npp/viirs/viirsMenuItems.xml b/cave/com.raytheon.uf.viz.npp.viirs/localization/menus/npp/viirs/viirsMenuItems.xml index a8363df496..46f9eb1fbf 100644 --- a/cave/com.raytheon.uf.viz.npp.viirs/localization/menus/npp/viirs/viirsMenuItems.xml +++ b/cave/com.raytheon.uf.viz.npp.viirs/localization/menus/npp/viirs/viirsMenuItems.xml @@ -19,7 +19,6 @@ further_licensing_information. --> - @@ -36,5 +35,4 @@ - \ No newline at end of file diff --git a/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/rsc/VIIRSDataCallback.java b/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/rsc/VIIRSDataCallback.java index 7d07cd90ae..cdc19ba769 100644 --- a/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/rsc/VIIRSDataCallback.java +++ b/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/rsc/VIIRSDataCallback.java @@ -25,6 +25,7 @@ import java.nio.FloatBuffer; import java.nio.ShortBuffer; import com.raytheon.uf.common.colormap.image.ColorMapData; +import com.raytheon.uf.common.colormap.image.ColorMapData.ColorMapDataType; import com.raytheon.uf.common.dataplugin.npp.viirs.VIIRSDataRecord; import com.raytheon.uf.common.datastorage.Request; import com.raytheon.uf.common.datastorage.records.FloatDataRecord; @@ -88,13 +89,13 @@ public class VIIRSDataCallback implements IColorMapDataRetrievalCallback { return new ColorMapData(shortData, new int[] { (int) rawData.getSizes()[0], (int) rawData.getSizes()[1] }, - ColorMapData.ColorMapDataType.UNSIGNED_SHORT); + ColorMapDataType.UNSIGNED_SHORT); } else if (rawData instanceof FloatDataRecord) { Buffer floatData = FloatBuffer.wrap(((FloatDataRecord) rawData) .getFloatData()); return new ColorMapData(floatData, new int[] { (int) rawData.getSizes()[0], - (int) rawData.getSizes()[1] }, ColorMapData.ColorMapDataType.FLOAT); + (int) rawData.getSizes()[1] }, ColorMapDataType.FLOAT); } else { throw new VizException("Could not handle IDataRecord: " + rawData); diff --git a/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/rsc/VIIRSResourceData.java b/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/rsc/VIIRSResourceData.java index 6ab2837909..ffec943e58 100644 --- a/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/rsc/VIIRSResourceData.java +++ b/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/rsc/VIIRSResourceData.java @@ -19,33 +19,18 @@ **/ package com.raytheon.uf.viz.npp.viirs.rsc; -import java.util.ArrayDeque; import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; import java.util.List; -import java.util.Map; -import java.util.Queue; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.npp.viirs.VIIRSDataRecord; -import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; -import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.common.time.TimeRange; -import com.raytheon.uf.viz.core.catalog.LayerProperty; -import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.LoadProperties; +import com.raytheon.uf.viz.npp.AbstractNppResourceData; /** * VIIRS Resource data @@ -66,38 +51,7 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties; * @version 1.0 */ @XmlAccessorType(XmlAccessType.NONE) -public class VIIRSResourceData extends AbstractRequestableResourceData { - - private static class DataTimeIterator - implements Iterator { - - private Iterator pdoIter; - - private T lastAccesed; - - private DataTimeIterator(Iterator pdoIter) { - this.pdoIter = pdoIter; - } - - @Override - public boolean hasNext() { - return pdoIter.hasNext(); - } - - @Override - public DataTime next() { - lastAccesed = pdoIter.next(); - return lastAccesed.getDataTime(); - } - - @Override - public void remove() { - pdoIter.remove(); - } - } - - @XmlElement - private int groupTimeRangeMinutes = 3; +public class VIIRSResourceData extends AbstractNppResourceData { /* * (non-Javadoc) @@ -119,176 +73,4 @@ public class VIIRSResourceData extends AbstractRequestableResourceData { return new VIIRSResource(this, loadProperties, viirsRecords); } - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData# - * requestPluginDataObjects(java.util.Collection) - */ - @Override - protected PluginDataObject[] requestPluginDataObjects( - Collection loadSet) throws VizException { - List timesToLoad = new ArrayList(loadSet); - Collections.sort(timesToLoad); - DataTime first = timesToLoad.get(0); - DataTime last = timesToLoad.get(timesToLoad.size() - 1); - Map requestMap = new HashMap( - getMetadataMap()); - RequestConstraint timeConst = new RequestConstraint(); - timeConst.setConstraintType(ConstraintType.BETWEEN); - timeConst.setBetweenValueList(new String[] { - new DataTime(first.getValidPeriod().getStart()).toString(), - new DataTime(last.getValidPeriod().getEnd()).toString() }); - requestMap.put("dataTime.refTime", timeConst); - - LayerProperty property = new LayerProperty(); - property.setEntryQueryParameters(requestMap, false); - property.setNumberOfImages(9999); - - List pdos = DataCubeContainer.getData(property, 60000); - List finalList = new ArrayList( - pdos != null ? pdos.size() : 0); - - if (pdos != null) { - for (Object obj : pdos) { - PluginDataObject pdo = (PluginDataObject) obj; - for (DataTime dt : loadSet) { - if (withinRange(dt.getValidPeriod(), pdo.getDataTime())) { - finalList.add(pdo); - break; - } - } - } - Collections.sort(finalList, layerComparator); - } - return finalList.toArray(new PluginDataObject[finalList.size()]); - } - - public static boolean withinRange(TimeRange range, DataTime time) { - long refTime = time.getMatchRef(); - return range.getStart().getTime() <= refTime - && range.getEnd().getTime() >= refTime; - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData# - * getAvailableTimes() - */ - @Override - public DataTime[] getAvailableTimes() throws VizException { - Collection dts = groupTimes(Arrays.asList(super - .getAvailableTimes())); - return dts.toArray(new DataTime[dts.size()]); - } - - /** - * Group times for a {@link PluginDataObject} collection based on - * {@link #groupTimeRangeMinutes} - * - * @param records - * @return - */ - public Map> groupRecordTimes( - Collection records) { - long groupTimeInMillis = groupTimeRangeMinutes * 60 * 1000; - Map> grouped = new HashMap>(); - Queue objects = new ArrayDeque(records); - while (objects.size() > 0) { - T record = objects.remove(); - DataTime current = record.getDataTime(); - TimeRange prev, curr; - prev = curr = current.getValidPeriod(); - - List group = new ArrayList(); - while (curr != null) { - prev = curr; - DataTimeIterator iter = new DataTimeIterator( - objects.iterator()); - curr = match(iter, current.getValidPeriod(), groupTimeInMillis); - if (curr != null) { - group.add(iter.lastAccesed); - } - } - - grouped.put(new DataTime(prev.getStart().getTime(), prev), group); - } - return grouped; - } - - /** - * Group the {@link DataTime} collection based on - * {@link #groupTimeRangeMinutes} - * - * @param dataTimes - * @return - */ - public Collection groupTimes(Collection dataTimes) { - long groupTimeInMillis = groupTimeRangeMinutes * 60 * 1000; - List grouped = new ArrayList(dataTimes.size()); - Queue objects = new ArrayDeque(dataTimes); - while (objects.size() > 0) { - DataTime current = objects.remove(); - TimeRange prev, curr; - prev = curr = current.getValidPeriod(); - while (curr != null) { - prev = curr; - curr = match(objects.iterator(), current.getValidPeriod(), - groupTimeInMillis); - } - - grouped.add(new DataTime(prev.getStart().getTime(), prev)); - } - return grouped; - } - - private TimeRange match(Iterator iter, TimeRange time, - long groupTimeInMillis) { - long startT = time.getStart().getTime(); - long endT = time.getEnd().getTime(); - while (iter.hasNext()) { - DataTime dt = iter.next(); - TimeRange dtRange = dt.getValidPeriod(); - long s = dtRange.getStart().getTime(); - long e = dtRange.getEnd().getTime(); - long startCheck = s - groupTimeInMillis; - long endCheck = e + groupTimeInMillis; - if ((startT <= startCheck && endT >= startCheck) - || (startCheck <= startT && endCheck >= startT)) { - iter.remove(); - return new TimeRange(Math.min(s, startT), Math.max(e, endT)); - } - } - return null; - } - - /** - * @return the groupTimeRangeMinutes - */ - public int getGroupTimeRangeMinutes() { - return groupTimeRangeMinutes; - } - - /** - * @param groupTimeRangeMinutes - * the groupTimeRangeMinutes to set - */ - public void setGroupTimeRangeMinutes(int groupTimeRangeMinutes) { - this.groupTimeRangeMinutes = groupTimeRangeMinutes; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData#update(java - * .lang.Object) - */ - @Override - public void update(Object updateData) { - super.update(updateData); - invalidateAvailableTimesCache(); - } - } diff --git a/cave/com.raytheon.uf.viz.npp/.classpath b/cave/com.raytheon.uf.viz.npp/.classpath new file mode 100644 index 0000000000..ad32c83a78 --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/cave/com.raytheon.uf.viz.npp/.project b/cave/com.raytheon.uf.viz.npp/.project new file mode 100644 index 0000000000..fca21894d3 --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp/.project @@ -0,0 +1,28 @@ + + + com.raytheon.uf.viz.npp + + + + + + 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/cave/com.raytheon.uf.viz.npp/.settings/org.eclipse.jdt.core.prefs b/cave/com.raytheon.uf.viz.npp/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..a54ddb4caa --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Tue Jan 08 13:23:52 CST 2013 +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/cave/com.raytheon.uf.viz.npp/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.npp/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..1afd385fcb --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp/META-INF/MANIFEST.MF @@ -0,0 +1,14 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: NPP Viz +Bundle-SymbolicName: com.raytheon.uf.viz.npp +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: com.raytheon.uf.viz.npp.Activator +Bundle-Vendor: RAYTHEON +Require-Bundle: org.eclipse.core.runtime, + com.raytheon.uf.viz.core;bundle-version="1.12.1174", + com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", + com.raytheon.uf.common.time;bundle-version="1.12.1174" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Export-Package: com.raytheon.uf.viz.npp diff --git a/cave/com.raytheon.uf.viz.npp/build.properties b/cave/com.raytheon.uf.viz.npp/build.properties new file mode 100644 index 0000000000..3459198753 --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + localization/ diff --git a/cave/com.raytheon.uf.viz.npp.viirs/localization/menus/npp/index.xml b/cave/com.raytheon.uf.viz.npp/localization/menus/npp/index.xml similarity index 100% rename from cave/com.raytheon.uf.viz.npp.viirs/localization/menus/npp/index.xml rename to cave/com.raytheon.uf.viz.npp/localization/menus/npp/index.xml diff --git a/cave/com.raytheon.uf.viz.npp.viirs/localization/menus/npp/nppMenuItems.xml b/cave/com.raytheon.uf.viz.npp/localization/menus/npp/nppMenuItems.xml similarity index 82% rename from cave/com.raytheon.uf.viz.npp.viirs/localization/menus/npp/nppMenuItems.xml rename to cave/com.raytheon.uf.viz.npp/localization/menus/npp/nppMenuItems.xml index 907dd3c8ce..02e2abf2c5 100644 --- a/cave/com.raytheon.uf.viz.npp.viirs/localization/menus/npp/nppMenuItems.xml +++ b/cave/com.raytheon.uf.viz.npp/localization/menus/npp/nppMenuItems.xml @@ -20,7 +20,8 @@ --> - - + + + \ No newline at end of file diff --git a/cave/com.raytheon.uf.viz.npp/src/com/raytheon/uf/viz/npp/AbstractNppResourceData.java b/cave/com.raytheon.uf.viz.npp/src/com/raytheon/uf/viz/npp/AbstractNppResourceData.java new file mode 100644 index 0000000000..a17e81cd85 --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp/src/com/raytheon/uf/viz/npp/AbstractNppResourceData.java @@ -0,0 +1,269 @@ +/** + * 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.viz.npp; + +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Queue; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; + +import com.raytheon.uf.common.dataplugin.PluginDataObject; +import com.raytheon.uf.common.dataquery.requests.RequestConstraint; +import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; +import com.raytheon.uf.common.time.DataTime; +import com.raytheon.uf.common.time.TimeRange; +import com.raytheon.uf.viz.core.catalog.LayerProperty; +import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; +import com.raytheon.uf.viz.core.exception.VizException; +import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; + +/** + * Abstract resource data for all NPP data. Groups frame times close together + * (within {@link #groupTimeRangeMinutes} minutes). + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jan 8, 2013            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ +@XmlAccessorType(XmlAccessType.NONE) +public abstract class AbstractNppResourceData extends + AbstractRequestableResourceData { + + private static class DataTimeIterator + implements Iterator { + + private Iterator pdoIter; + + private T lastAccesed; + + private DataTimeIterator(Iterator pdoIter) { + this.pdoIter = pdoIter; + } + + @Override + public boolean hasNext() { + return pdoIter.hasNext(); + } + + @Override + public DataTime next() { + lastAccesed = pdoIter.next(); + return lastAccesed.getDataTime(); + } + + @Override + public void remove() { + pdoIter.remove(); + } + } + + @XmlElement + private int groupTimeRangeMinutes = 15; + + /** + * @return the groupTimeRangeMinutes + */ + public int getGroupTimeRangeMinutes() { + return groupTimeRangeMinutes; + } + + /** + * @param groupTimeRangeMinutes + * the groupTimeRangeMinutes to set + */ + public void setGroupTimeRangeMinutes(int groupTimeRangeMinutes) { + this.groupTimeRangeMinutes = groupTimeRangeMinutes; + } + + /* + * (non-Javadoc) + * + * @see com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData# + * requestPluginDataObjects(java.util.Collection) + */ + @Override + protected PluginDataObject[] requestPluginDataObjects( + Collection loadSet) throws VizException { + List timesToLoad = new ArrayList(loadSet); + Collections.sort(timesToLoad); + DataTime first = timesToLoad.get(0); + DataTime last = timesToLoad.get(timesToLoad.size() - 1); + Map requestMap = new HashMap( + getMetadataMap()); + RequestConstraint timeConst = new RequestConstraint(); + timeConst.setConstraintType(ConstraintType.BETWEEN); + timeConst.setBetweenValueList(new String[] { + new DataTime(first.getValidPeriod().getStart()).toString(), + new DataTime(last.getValidPeriod().getEnd()).toString() }); + requestMap.put("dataTime.refTime", timeConst); + + LayerProperty property = new LayerProperty(); + property.setEntryQueryParameters(requestMap, false); + property.setNumberOfImages(9999); + + List pdos = DataCubeContainer.getData(property, 60000); + List finalList = new ArrayList( + pdos != null ? pdos.size() : 0); + + if (pdos != null) { + for (Object obj : pdos) { + PluginDataObject pdo = (PluginDataObject) obj; + for (DataTime dt : loadSet) { + if (withinRange(dt.getValidPeriod(), pdo.getDataTime())) { + finalList.add(pdo); + break; + } + } + } + Collections.sort(finalList, layerComparator); + } + return finalList.toArray(new PluginDataObject[finalList.size()]); + } + + public static boolean withinRange(TimeRange range, DataTime time) { + long refTime = time.getMatchRef(); + return range.getStart().getTime() <= refTime + && range.getEnd().getTime() >= refTime; + } + + /* + * (non-Javadoc) + * + * @see com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData# + * getAvailableTimes() + */ + @Override + public DataTime[] getAvailableTimes() throws VizException { + Collection dts = groupTimes(Arrays.asList(super + .getAvailableTimes())); + return dts.toArray(new DataTime[dts.size()]); + } + + /** + * Group times for a {@link PluginDataObject} collection based on + * {@link #groupTimeRangeMinutes} + * + * @param records + * @return + */ + public Map> groupRecordTimes( + Collection records) { + long groupTimeInMillis = groupTimeRangeMinutes * 60 * 1000; + Map> grouped = new HashMap>(); + Queue objects = new ArrayDeque(records); + while (objects.size() > 0) { + T record = objects.remove(); + DataTime current = record.getDataTime(); + TimeRange prev, curr; + prev = curr = current.getValidPeriod(); + + List group = new ArrayList(); + while (curr != null) { + prev = curr; + DataTimeIterator iter = new DataTimeIterator( + objects.iterator()); + curr = match(iter, prev, groupTimeInMillis); + if (curr != null) { + group.add(iter.lastAccesed); + } + } + + grouped.put(new DataTime(prev.getStart().getTime(), prev), group); + } + return grouped; + } + + /** + * Group the {@link DataTime} collection based on + * {@link #groupTimeRangeMinutes} + * + * @param dataTimes + * @return + */ + public Collection groupTimes(Collection dataTimes) { + long groupTimeInMillis = groupTimeRangeMinutes * 60 * 1000; + List grouped = new ArrayList(dataTimes.size()); + Queue objects = new ArrayDeque(dataTimes); + while (objects.size() > 0) { + DataTime current = objects.remove(); + TimeRange prev, curr; + prev = curr = current.getValidPeriod(); + while (curr != null) { + prev = curr; + curr = match(objects.iterator(), prev, groupTimeInMillis); + } + + grouped.add(new DataTime(prev.getStart().getTime(), prev)); + } + return grouped; + } + + private TimeRange match(Iterator iter, TimeRange time, + long groupTimeInMillis) { + long startT = time.getStart().getTime(); + long endT = time.getEnd().getTime(); + while (iter.hasNext()) { + DataTime dt = iter.next(); + TimeRange dtRange = dt.getValidPeriod(); + long s = dtRange.getStart().getTime(); + long e = dtRange.getEnd().getTime(); + long startCheck = s - groupTimeInMillis; + long endCheck = e + groupTimeInMillis; + if ((startT <= startCheck && endT >= startCheck) + || (startCheck <= startT && endCheck >= startT)) { + iter.remove(); + return new TimeRange(Math.min(s, startT), Math.max(e, endT)); + } + } + return null; + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData#update(java + * .lang.Object) + */ + @Override + public void update(Object updateData) { + super.update(updateData); + invalidateAvailableTimesCache(); + } +} diff --git a/cave/com.raytheon.uf.viz.npp/src/com/raytheon/uf/viz/npp/Activator.java b/cave/com.raytheon.uf.viz.npp/src/com/raytheon/uf/viz/npp/Activator.java new file mode 100644 index 0000000000..80b387e01c --- /dev/null +++ b/cave/com.raytheon.uf.viz.npp/src/com/raytheon/uf/viz/npp/Activator.java @@ -0,0 +1,30 @@ +package com.raytheon.uf.viz.npp; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +public class Activator implements BundleActivator { + + private static BundleContext context; + + static BundleContext getContext() { + return context; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext bundleContext) throws Exception { + Activator.context = bundleContext; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext bundleContext) throws Exception { + Activator.context = null; + } + +} diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.crimss/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.crimss/META-INF/MANIFEST.MF index e6c7996e47..a72caad9dd 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.crimss/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.crimss/META-INF/MANIFEST.MF @@ -7,10 +7,10 @@ Eclipse-BuddyPolicy: registered, ext, global 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.dataplugin.persist, - com.raytheon.uf.common.pointdata, - com.raytheon.uf.common.serialization.annotations, - javax.persistence Export-Package: com.raytheon.uf.common.dataplugin.npp.crimss +Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", + com.raytheon.uf.common.dataplugin.npp.sounding;bundle-version="1.0.0";visibility:=reexport, + com.raytheon.uf.common.pointdata;bundle-version="1.12.1174", + com.raytheon.uf.common.serialization;bundle-version="1.12.1174", + com.raytheon.uf.common.time;bundle-version="1.12.1174", + javax.persistence;bundle-version="1.0.0" diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.crimss/component-deploy.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.crimss/component-deploy.xml deleted file mode 100644 index 0c943ad113..0000000000 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.crimss/component-deploy.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.crimss/src/com/raytheon/uf/common/dataplugin/npp/crimss/CrimssRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.crimss/src/com/raytheon/uf/common/dataplugin/npp/crimss/CrimssRecord.java index 01e384a232..3011957631 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.crimss/src/com/raytheon/uf/common/dataplugin/npp/crimss/CrimssRecord.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.crimss/src/com/raytheon/uf/common/dataplugin/npp/crimss/CrimssRecord.java @@ -19,30 +19,18 @@ **/ package com.raytheon.uf.common.dataplugin.npp.crimss; -import java.util.Calendar; -import java.util.Date; -import java.util.TimeZone; - -import javax.persistence.Column; -import javax.persistence.Embedded; import javax.persistence.Entity; import javax.persistence.Table; 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.XmlRootElement; -import com.raytheon.uf.common.dataplugin.IDecoderGettable; -import com.raytheon.uf.common.dataplugin.annotations.DataURI; -import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject; -import com.raytheon.uf.common.pointdata.IPointData; -import com.raytheon.uf.common.pointdata.PointDataView; +import com.raytheon.uf.common.dataplugin.npp.sounding.NPPSoundingRecord; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; -import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; /** - * TODO Add Description + * PluginDataObject record for NPP CrIMSS data * *
  * 
@@ -62,8 +50,9 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
 @DynamicSerialize
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
-public class CrimssRecord extends PersistablePluginDataObject implements
-        IPointData {
+public class CrimssRecord extends NPPSoundingRecord {
+
+    private static final long serialVersionUID = 1L;
 
     public static final String PDV_SURFACE_PRESSURE = "SurfacePressure";
 
@@ -79,77 +68,4 @@ public class CrimssRecord extends PersistablePluginDataObject implements
 
     public static final String PDV_P_H2O = "PressureLevels_H2O";
 
-    public static final String LATITUDE = "latitude";
-
-    public static final String LONGITUDE = "longitude";
-
-    @Embedded
-    private PointDataView pdv;
-
-    @DataURI(position = 1)
-    @Column
-    @XmlAttribute
-    @DynamicSerializeElement
-    private Double latitude;
-
-    @DataURI(position = 2)
-    @Column
-    @XmlAttribute
-    @DynamicSerializeElement
-    private Double longitude;
-
-    public CrimssRecord() {
-        super();
-    }
-
-    public CrimssRecord(String uri) {
-        super(uri);
-    }
-
-    @Override
-    public Date getPersistenceTime() {
-        Calendar c = getInsertTime();
-        if (c == null)
-            return null;
-
-        return c.getTime();
-    }
-
-    public void setPersistenceTime(Date persistTime) {
-        Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
-        c.setTime(persistTime);
-        setInsertTime(c);
-    }
-
-    @Override
-    public IDecoderGettable getDecoderGettable() {
-        return null;
-    }
-
-    public Double getLatitude() {
-        return latitude;
-    }
-
-    public void setLatitude(Double latitude) {
-        this.latitude = latitude;
-    }
-
-    public Double getLongitude() {
-        return longitude;
-    }
-
-    public void setLongitude(Double longitude) {
-        this.longitude = longitude;
-    }
-
-    @Override
-    public PointDataView getPointDataView() {
-        return pdv;
-    }
-
-    @Override
-    public void setPointDataView(PointDataView pdv) {
-        this.pdv = pdv;
-    }
-
 }
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.nucaps/.classpath b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.nucaps/.classpath
new file mode 100644
index 0000000000..ad32c83a78
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.nucaps/.classpath
@@ -0,0 +1,7 @@
+
+
+	
+	
+	
+	
+
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.nucaps/.project b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.nucaps/.project
new file mode 100644
index 0000000000..fa2942ae2e
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.nucaps/.project
@@ -0,0 +1,28 @@
+
+
+	com.raytheon.uf.common.dataplugin.npp.nucaps
+	
+	
+	
+	
+		
+			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/edexOsgi/com.raytheon.uf.common.dataplugin.npp.nucaps/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.nucaps/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..7539073549
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.nucaps/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Tue Jan 15 10:15:18 CST 2013
+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.npp.nucaps/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.nucaps/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..89f956db43
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.nucaps/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: NUCAPS Common Plugin
+Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.npp.nucaps
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: RAYTHEON
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
+ com.raytheon.uf.common.dataplugin.npp.sounding;bundle-version="1.0.0";visibility:=reexport,
+ com.raytheon.uf.common.pointdata;bundle-version="1.12.1174",
+ com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
+ com.raytheon.uf.common.time;bundle-version="1.12.1174",
+ javax.persistence;bundle-version="1.0.0"
+Export-Package: com.raytheon.uf.common.dataplugin.npp.nucaps
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.nucaps/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.nucaps/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject
new file mode 100644
index 0000000000..8df0788254
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.nucaps/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject
@@ -0,0 +1 @@
+com.raytheon.uf.common.dataplugin.npp.nucaps.NucapsRecord
\ No newline at end of file
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.nucaps/build.properties b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.nucaps/build.properties
new file mode 100644
index 0000000000..34d2e4d2da
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.nucaps/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.nucaps/src/com/raytheon/uf/common/dataplugin/npp/nucaps/NucapsRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.nucaps/src/com/raytheon/uf/common/dataplugin/npp/nucaps/NucapsRecord.java
new file mode 100644
index 0000000000..4121190489
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.nucaps/src/com/raytheon/uf/common/dataplugin/npp/nucaps/NucapsRecord.java
@@ -0,0 +1,79 @@
+/**
+ * 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.npp.nucaps;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import javax.persistence.UniqueConstraint;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import com.raytheon.uf.common.dataplugin.npp.sounding.NPPSoundingRecord;
+import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
+
+/**
+ * PDO for NPP NUCAPS data
+ * 
+ * 
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jan 15, 2013            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ +@Entity +@Table(name = "nucaps", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) }) +@DynamicSerialize +@XmlRootElement +@XmlAccessorType(XmlAccessType.NONE) +public class NucapsRecord extends NPPSoundingRecord { + + private static final long serialVersionUID = 1L; + + public static final String PDV_SURFACE_PRESSURE = "Surface_Pressure"; + + public static final String PDV_PRESSURE = "Pressure"; + + public static final String PDV_SKIN_TEMPERATURE = "Skin_Temperature"; + + public static final String PDV_TEMPERATURE = "Temperature"; + + public static final String PDV_TOPOGRAPHY = "Topography"; + + public static final String PDV_EFFECTIVE_PRESSURE = "Effective_Pressure"; + + public static final String PDV_WATER_VAPOR_MIXING_RATIO = "H2O_MR"; + + public static final String PDV_LIQUID_WATER_MIXING_RATIO = "Liquid_H2O_MR"; + + public static final String PDV_OZONE_MIXING_RATIO = "O3_MR"; + + public static final String PDV_SULFER_DIOXIDE_MIXING_RATIO = "SO2_MR"; + + public static final String PDV_QUALITY_FLAG = "Quality_Flag"; + +} diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.sounding/.classpath b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.sounding/.classpath new file mode 100644 index 0000000000..ad32c83a78 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.sounding/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.sounding/.project b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.sounding/.project new file mode 100644 index 0000000000..91c8014fea --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.sounding/.project @@ -0,0 +1,28 @@ + + + com.raytheon.uf.common.dataplugin.npp.sounding + + + + + + 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/edexOsgi/com.raytheon.uf.common.dataplugin.npp.sounding/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.sounding/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..8088dc64fa --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.sounding/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Thu Jan 03 14:58:27 CST 2013 +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.npp.sounding/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.sounding/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..a84d8c6110 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.sounding/META-INF/MANIFEST.MF @@ -0,0 +1,12 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: NPP Sounding DataPlugin +Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.npp.sounding +Bundle-Version: 1.0.0.qualifier +Bundle-Vendor: RAYTHEON +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", + com.raytheon.uf.common.serialization;bundle-version="1.12.1174", + javax.persistence;bundle-version="1.0.0", + com.raytheon.uf.common.pointdata;bundle-version="1.12.1174" +Export-Package: com.raytheon.uf.common.dataplugin.npp.sounding diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.sounding/build.properties b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.sounding/build.properties new file mode 100644 index 0000000000..34d2e4d2da --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.sounding/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.sounding/src/com/raytheon/uf/common/dataplugin/npp/sounding/NPPSoundingRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.sounding/src/com/raytheon/uf/common/dataplugin/npp/sounding/NPPSoundingRecord.java new file mode 100644 index 0000000000..40b0481ff8 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.sounding/src/com/raytheon/uf/common/dataplugin/npp/sounding/NPPSoundingRecord.java @@ -0,0 +1,137 @@ +/** + * 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.npp.sounding; + +import javax.persistence.Column; +import javax.persistence.Embedded; +import javax.persistence.Entity; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; + +import com.raytheon.uf.common.dataplugin.IDecoderGettable; +import com.raytheon.uf.common.dataplugin.annotations.DataURI; +import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject; +import com.raytheon.uf.common.pointdata.IPointData; +import com.raytheon.uf.common.pointdata.PointDataView; +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; +import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; + +/** + * Abstract NPP sounding record class + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jan 3, 2013            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ +@Entity +@DynamicSerialize +@XmlAccessorType(XmlAccessType.NONE) +public abstract class NPPSoundingRecord extends PersistablePluginDataObject + implements IPointData { + + private static final long serialVersionUID = 1L; + + public static final String LATITUDE = "latitude"; + + public static final String LONGITUDE = "longitude"; + + @Embedded + private PointDataView pointDataView; + + @DataURI(position = 1) + @Column + @XmlAttribute + @DynamicSerializeElement + private Double latitude; + + @DataURI(position = 2) + @Column + @XmlAttribute + @DynamicSerializeElement + private Double longitude; + + @Override + public IDecoderGettable getDecoderGettable() { + return null; + } + + /** + * @return the latitude + */ + public Double getLatitude() { + return latitude; + } + + /** + * @param latitude + * the latitude to set + */ + public void setLatitude(Double latitude) { + this.latitude = latitude; + } + + /** + * @return the longitude + */ + public Double getLongitude() { + return longitude; + } + + /** + * @param longitude + * the longitude to set + */ + public void setLongitude(Double longitude) { + this.longitude = longitude; + } + + /* + * (non-Javadoc) + * + * @see com.raytheon.uf.common.pointdata.IPointData#getPointDataView() + */ + @Override + public PointDataView getPointDataView() { + return pointDataView; + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.common.pointdata.IPointData#setPointDataView(com.raytheon + * .uf.common.pointdata.PointDataView) + */ + @Override + public void setPointDataView(PointDataView pointDataView) { + this.pointDataView = pointDataView; + } + +} diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.viirs/component-deploy.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.viirs/component-deploy.xml deleted file mode 100644 index 7aa3626716..0000000000 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.viirs/component-deploy.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.viirs/src/com/raytheon/uf/common/dataplugin/npp/viirs/projection/VIIRSMapProjectionFactory.java b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.viirs/src/com/raytheon/uf/common/dataplugin/npp/viirs/projection/VIIRSMapProjectionFactory.java index bd4ac45ed2..3b7c5234a6 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.viirs/src/com/raytheon/uf/common/dataplugin/npp/viirs/projection/VIIRSMapProjectionFactory.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.viirs/src/com/raytheon/uf/common/dataplugin/npp/viirs/projection/VIIRSMapProjectionFactory.java @@ -19,6 +19,7 @@ **/ package com.raytheon.uf.common.dataplugin.npp.viirs.projection; +import org.geotools.referencing.crs.DefaultProjectedCRS; import org.geotools.referencing.operation.DefaultMathTransformFactory; import org.opengis.parameter.ParameterValueGroup; import org.opengis.referencing.FactoryException; @@ -49,8 +50,7 @@ public class VIIRSMapProjectionFactory { /** Using single factory is faster due to internal caching */ private static DefaultMathTransformFactory dmtFactory = new DefaultMathTransformFactory(); - public static synchronized ProjectedCRS construct( - VIIRSSpatialCoverage record) + public static ProjectedCRS construct(VIIRSSpatialCoverage record) throws FactoryException { try { ParameterValueGroup group = dmtFactory diff --git a/edexOsgi/com.raytheon.uf.edex.npp.feature/feature.xml b/edexOsgi/com.raytheon.uf.edex.npp.feature/feature.xml index 1ef52d0a15..a81fe3514a 100644 --- a/edexOsgi/com.raytheon.uf.edex.npp.feature/feature.xml +++ b/edexOsgi/com.raytheon.uf.edex.npp.feature/feature.xml @@ -23,13 +23,6 @@ - - - - + + + + + + + + diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/META-INF/MANIFEST.MF index 88f22f3dc4..a582ce9655 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/META-INF/MANIFEST.MF @@ -5,15 +5,8 @@ Bundle-SymbolicName: com.raytheon.uf.edex.plugin.npp.crimss Bundle-Version: 1.0.0.qualifier Bundle-Vendor: RAYTHEON Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Require-Bundle: com.raytheon.edex.common;bundle-version="1.12.1174", - org.geotools;bundle-version="2.6.4", - javax.measure;bundle-version="1.0.0", - javax.persistence;bundle-version="1.0.0", - com.raytheon.uf.common.dataplugin.npp.crimss;bundle-version="1.0.0", - org.apache.commons.logging;bundle-version="1.1.1", - ucar.nc2;bundle-version="1.0.0", - org.apache.commons.lang;bundle-version="2.3.0", - com.raytheon.uf.edex.plugin.npp;bundle-version="1.0.0", - com.raytheon.uf.common.pointdata;bundle-version="1.12.1174", +Require-Bundle: com.raytheon.uf.edex.plugin.npp;bundle-version="1.0.0", + com.raytheon.uf.edex.plugin.npp.sounding;bundle-version="1.0.0", + com.raytheon.uf.common.dataplugin.npp.crimss;bundle-version="1.0.0";visibility:=reexport, com.raytheon.uf.common.status;bundle-version="1.12.1174", com.raytheon.uf.edex.pointdata;bundle-version="1.12.1174" diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/component-deploy.xml b/edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/component-deploy.xml deleted file mode 100644 index f55d86c5e8..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/component-deploy.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/res/spring/crimss-common.xml b/edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/res/spring/crimss-common.xml index 605751d322..fa7f759aa4 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/res/spring/crimss-common.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/res/spring/crimss-common.xml @@ -9,7 +9,7 @@ - + diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/res/spring/crimss-ingest.xml b/edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/res/spring/crimss-ingest.xml index 4dbfd2f303..a8a97b7fe4 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/res/spring/crimss-ingest.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/res/spring/crimss-ingest.xml @@ -2,7 +2,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> - + diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/src/com/raytheon/uf/edex/plugin/npp/crimss/package-info.java b/edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/src/com/raytheon/uf/edex/plugin/npp/crimss/package-info.java new file mode 100644 index 0000000000..3146741d5d --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/src/com/raytheon/uf/edex/plugin/npp/crimss/package-info.java @@ -0,0 +1,21 @@ +/** + * 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.edex.plugin.npp.crimss; \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/.classpath b/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/.classpath new file mode 100644 index 0000000000..ad32c83a78 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/.project b/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/.project new file mode 100644 index 0000000000..f846f35bde --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/.project @@ -0,0 +1,28 @@ + + + com.raytheon.uf.edex.plugin.npp.nucaps + + + + + + 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/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..7f934ebc0d --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Tue Jan 15 10:22:03 CST 2013 +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.edex.plugin.npp.nucaps/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..5a15b0636c --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/META-INF/MANIFEST.MF @@ -0,0 +1,12 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: NUCAPS EDEX Plugin +Bundle-SymbolicName: com.raytheon.uf.edex.plugin.npp.nucaps +Bundle-Version: 1.0.0.qualifier +Bundle-Vendor: RAYTHEON +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Require-Bundle: com.raytheon.uf.edex.plugin.npp;bundle-version="1.0.0", + com.raytheon.uf.edex.plugin.npp.sounding;bundle-version="1.0.0", + com.raytheon.uf.common.dataplugin.npp.nucaps;bundle-version="1.0.0";visibility:=reexport, + com.raytheon.uf.common.status;bundle-version="1.12.1174", + com.raytheon.uf.edex.pointdata;bundle-version="1.12.1174" diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/build.properties b/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/build.properties new file mode 100644 index 0000000000..5791d48d5f --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + res/ diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/res/pointdata/nucaps.xml b/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/res/pointdata/nucaps.xml new file mode 100644 index 0000000000..4d281575b1 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/res/pointdata/nucaps.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/res/pointdata/nucapsdb.xml b/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/res/pointdata/nucapsdb.xml new file mode 100644 index 0000000000..77748f8223 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/res/pointdata/nucapsdb.xml @@ -0,0 +1,25 @@ + + + + + + + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/res/spring/nucaps-common.xml b/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/res/spring/nucaps-common.xml new file mode 100644 index 0000000000..852b796f1c --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/res/spring/nucaps-common.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/res/spring/nucaps-ingest.xml b/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/res/spring/nucaps-ingest.xml new file mode 100644 index 0000000000..3e51c839e3 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/res/spring/nucaps-ingest.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + nucaps + + + + + + + + + + java.lang.Throwable + + + + + + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/src/com/raytheon/uf/edex/plugin/npp/nucaps/package-info.java b/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/src/com/raytheon/uf/edex/plugin/npp/nucaps/package-info.java new file mode 100644 index 0000000000..cd8fa48064 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/src/com/raytheon/uf/edex/plugin/npp/nucaps/package-info.java @@ -0,0 +1,21 @@ +/** + * 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.edex.plugin.npp.nucaps; \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/utility/edex_static/base/distribution/nucaps.xml b/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/utility/edex_static/base/distribution/nucaps.xml new file mode 100644 index 0000000000..dccc339461 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.nucaps/utility/edex_static/base/distribution/nucaps.xml @@ -0,0 +1,23 @@ + + + + ^IUTN0[0-9] KNES* + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.sounding/.classpath b/edexOsgi/com.raytheon.uf.edex.plugin.npp.sounding/.classpath new file mode 100644 index 0000000000..ad32c83a78 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.sounding/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.sounding/.project b/edexOsgi/com.raytheon.uf.edex.plugin.npp.sounding/.project new file mode 100644 index 0000000000..86b549b46c --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.sounding/.project @@ -0,0 +1,28 @@ + + + com.raytheon.uf.edex.plugin.npp.sounding + + + + + + 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/edexOsgi/com.raytheon.uf.edex.plugin.npp.sounding/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.edex.plugin.npp.sounding/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..2e14d2ba18 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.sounding/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Thu Jan 03 14:37:22 CST 2013 +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.edex.plugin.npp.sounding/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.npp.sounding/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..750aa4622e --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.sounding/META-INF/MANIFEST.MF @@ -0,0 +1,14 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: NPP Sounding +Bundle-SymbolicName: com.raytheon.uf.edex.plugin.npp.sounding +Bundle-Version: 1.0.0.qualifier +Bundle-Vendor: RAYTHEON +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Require-Bundle: com.raytheon.uf.edex.plugin.npp;bundle-version="1.0.0", + com.raytheon.uf.common.dataplugin.npp.sounding;bundle-version="1.0.0";visibility:=reexport, + com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", + com.raytheon.uf.common.pointdata;bundle-version="1.12.1174", + com.raytheon.uf.edex.pointdata;bundle-version="1.12.1174", + com.raytheon.uf.common.status;bundle-version="1.12.1174" +Export-Package: com.raytheon.uf.edex.plugin.npp.sounding diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.sounding/build.properties b/edexOsgi/com.raytheon.uf.edex.plugin.npp.sounding/build.properties new file mode 100644 index 0000000000..34d2e4d2da --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.sounding/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/src/com/raytheon/uf/edex/plugin/npp/crimss/dao/CrimssDao.java b/edexOsgi/com.raytheon.uf.edex.plugin.npp.sounding/src/com/raytheon/uf/edex/plugin/npp/sounding/NPPSoundingDao.java similarity index 50% rename from edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/src/com/raytheon/uf/edex/plugin/npp/crimss/dao/CrimssDao.java rename to edexOsgi/com.raytheon.uf.edex.plugin.npp.sounding/src/com/raytheon/uf/edex/plugin/npp/sounding/NPPSoundingDao.java index 8b042e91bc..f4e1976115 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/src/com/raytheon/uf/edex/plugin/npp/crimss/dao/CrimssDao.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.sounding/src/com/raytheon/uf/edex/plugin/npp/sounding/NPPSoundingDao.java @@ -17,14 +17,15 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.edex.plugin.npp.crimss.dao; +package com.raytheon.uf.edex.plugin.npp.sounding; +import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginException; -import com.raytheon.uf.common.dataplugin.npp.crimss.CrimssRecord; +import com.raytheon.uf.edex.database.plugin.PluginFactory; import com.raytheon.uf.edex.pointdata.PointDataPluginDao; /** - * TODO Add Description + * Dao for all NPP Soundings * *
  * 
@@ -32,27 +33,46 @@ import com.raytheon.uf.edex.pointdata.PointDataPluginDao;
  * 
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
- * Dec 2, 2011            bsteffen     Initial creation
+ * Jan 4, 2013            mschenke     Initial creation
  * 
  * 
* - * @author bsteffen + * @author mschenke * @version 1.0 */ -public class CrimssDao extends PointDataPluginDao { +public class NPPSoundingDao extends PointDataPluginDao { + + private String[] fileNameKeys = new String[] { "dataTime.refTime" }; + + private Class recordClass; /** * @param pluginName * @throws PluginException */ - public CrimssDao(String pluginName) throws PluginException { + public NPPSoundingDao(String pluginName) throws PluginException { super(pluginName); } + /** + * @param fileNameKeys + * the fileNameKeys to set + */ + public void setFileNameKeys(String[] fileNameKeys) { + this.fileNameKeys = fileNameKeys; + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.edex.pointdata.PointDataPluginDao#getKeysRequiredForFileName + * () + */ @Override public String[] getKeysRequiredForFileName() { - return new String[] { "dataTime.refTime" }; + return fileNameKeys; } /* @@ -61,8 +81,21 @@ public class CrimssDao extends PointDataPluginDao { * @see com.raytheon.uf.edex.pointdata.PointDataPluginDao#newObject() */ @Override - public CrimssRecord newObject() { - return new CrimssRecord(); + public PluginDataObject newObject() { + if (recordClass == null) { + try { + recordClass = PluginFactory.getInstance().getPluginRecordClass( + pluginName); + } catch (PluginException e) { + throw new RuntimeException( + "Error getting record class for plugin: " + pluginName); + } + } + try { + return recordClass.newInstance(); + } catch (Exception e) { + throw new RuntimeException(e.getLocalizedMessage()); + } } /* @@ -73,8 +106,8 @@ public class CrimssDao extends PointDataPluginDao { * (com.raytheon.uf.common.dataplugin.PluginDataObject) */ @Override - public String getPointDataFileName(CrimssRecord p) { - return pluginName + ".h5"; + public String getPointDataFileName(PluginDataObject p) { + return pluginName; } } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/src/com/raytheon/uf/edex/plugin/npp/crimss/CrimssDecoder.java b/edexOsgi/com.raytheon.uf.edex.plugin.npp.sounding/src/com/raytheon/uf/edex/plugin/npp/sounding/NPPSoundingDecoder.java similarity index 67% rename from edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/src/com/raytheon/uf/edex/plugin/npp/crimss/CrimssDecoder.java rename to edexOsgi/com.raytheon.uf.edex.plugin.npp.sounding/src/com/raytheon/uf/edex/plugin/npp/sounding/NPPSoundingDecoder.java index 654004221d..8ca9ec0a69 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.npp.crimss/src/com/raytheon/uf/edex/plugin/npp/crimss/CrimssDecoder.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.sounding/src/com/raytheon/uf/edex/plugin/npp/sounding/NPPSoundingDecoder.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.edex.plugin.npp.crimss; +package com.raytheon.uf.edex.plugin.npp.sounding; import java.io.File; import java.io.IOException; @@ -35,7 +35,7 @@ import com.raytheon.edex.esb.Headers; import com.raytheon.edex.exception.DecoderException; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginException; -import com.raytheon.uf.common.dataplugin.npp.crimss.CrimssRecord; +import com.raytheon.uf.common.dataplugin.npp.sounding.NPPSoundingRecord; import com.raytheon.uf.common.pointdata.ParameterDescription; import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.pointdata.PointDataDescription; @@ -44,11 +44,12 @@ import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.DataTime; +import com.raytheon.uf.edex.database.plugin.PluginFactory; import com.raytheon.uf.edex.plugin.npp.AbstractNPPDecoder; -import com.raytheon.uf.edex.plugin.npp.crimss.dao.CrimssDao; /** - * TODO Add Description + * Common decoder for all NPP Soundings. Uses point data definition to find data + * records in netcdf file for persisting * *
  * 
@@ -56,32 +57,36 @@ import com.raytheon.uf.edex.plugin.npp.crimss.dao.CrimssDao;
  * 
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
- * Dec 2, 2011            bsteffen     Initial creation
+ * Jan 4, 2013            mschenke     Initial creation
  * 
  * 
* - * @author bsteffen + * @author mschenke * @version 1.0 */ -public class CrimssDecoder extends AbstractNPPDecoder { +public class NPPSoundingDecoder extends AbstractNPPDecoder { - private static final IUFStatusHandler statusHandler = UFStatus - .getHandler(CrimssDecoder.class); + private IUFStatusHandler statusHandler = UFStatus + .getHandler(NPPSoundingDecoder.class); - private final String pluginName; + private static final String LATITUDE_DATASET_ID = "Latitude@"; - private final CrimssDao dao; + private static final String LONGITUDE_DATASET_ID = "Longitude@"; - public CrimssDecoder(String pluginName) { + private String pluginName; + + private NPPSoundingDao pluginDao; + + public NPPSoundingDecoder(String pluginName) { this.pluginName = pluginName; - CrimssDao dao = null; try { - dao = new CrimssDao(pluginName); + this.pluginDao = (NPPSoundingDao) PluginFactory.getInstance() + .getPluginDao(pluginName); } catch (PluginException e) { - statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); + throw new RuntimeException("Could not get DAO from pluginName: " + + pluginName, e); } - this.dao = dao; } /* @@ -90,65 +95,79 @@ public class CrimssDecoder extends AbstractNPPDecoder { * @see * com.raytheon.uf.edex.plugin.npp.AbstractNPPDecoder#decodeNetcdf(ucar. * nc2.NetcdfFile, com.raytheon.uf.common.time.DataTime, - * com.raytheon.edex.esb.Headers) + * com.raytheon.uf.edex.plugin.npp.Headers) */ @Override protected Object decodeNetcdf(NetcdfFile dataFile, DataTime dataTime, Headers headers) { + PluginDataObject[] pdos = new PluginDataObject[0]; try { Group root = dataFile.getRootGroup(); - CrimssRecord[] records = decodeMetadata(root, dataTime); - decodeData(records, root); - return records; + NPPSoundingRecord[] metadata = decodeMetadata(root, dataTime); + decodePointData(root, metadata); + pdos = metadata; } catch (Exception e) { - statusHandler.handle(Priority.PROBLEM, "Error decoding CrIMSS", e); + statusHandler.handle( + Priority.WARN, + "Could not decode sounding file: " + + e.getLocalizedMessage(), e); } - return new PluginDataObject[0]; + + return pdos; } - private CrimssRecord[] decodeMetadata(Group root, DataTime time) + protected NPPSoundingRecord[] decodeMetadata(Group root, DataTime dataTime) throws DecoderException, PluginException, IOException { + NPPSoundingRecord[] pdos = new NPPSoundingRecord[0]; Variable latitude = null; Variable longitude = null; for (Variable var : root.getVariables()) { - if (var.getFullName().startsWith("Latitude@")) { + if (var.getFullName().startsWith(LATITUDE_DATASET_ID)) { latitude = var; - } else if (var.getFullName().startsWith("Longitude@")) { + } else if (var.getFullName().startsWith(LONGITUDE_DATASET_ID)) { longitude = var; } } if (latitude == null || longitude == null) { throw new DecoderException("Unable to find lat/lon information"); } - Map containerMap = new HashMap(); + Map containerMap = new HashMap(); Array latArray = latitude.read(); Array lonArray = longitude.read(); int numRecs = latitude.getDimension(0).getLength(); - CrimssRecord[] records = new CrimssRecord[numRecs]; + NPPSoundingRecord[] records = new NPPSoundingRecord[numRecs]; + for (int i = 0; i < numRecs; i++) { - records[i] = new CrimssRecord(); - records[i].setPluginName(pluginName); - records[i].setDataTime(time); - records[i].setLatitude((double) latArray.getFloat(i)); - records[i].setLongitude((double) lonArray.getFloat(i)); - records[i].constructDataURI(); - File storageFile = dao.getFullFilePath(records[i]); + // Create PDO for lat/lon entry + NPPSoundingRecord record = (NPPSoundingRecord) pluginDao + .newObject(); + record.setPluginName(pluginName); + record.setDataTime(dataTime); + record.setLatitude((double) latArray.getFloat(i)); + record.setLongitude((double) lonArray.getFloat(i)); + record.constructDataURI(); + + File storageFile = pluginDao.getFullFilePath(record); PointDataContainer pdc = containerMap.get(storageFile); if (pdc == null) { - pdc = PointDataContainer.build(dao + pdc = PointDataContainer.build(pluginDao .getPointDataDescription(null)); containerMap.put(storageFile, pdc); } PointDataView pdv = pdc.append(); - records[i].setPointDataView(pdv); + record.setPointDataView(pdv); + + records[i] = record; } - return records; + pdos = records; + + return pdos; } - private void decodeData(CrimssRecord[] records, Group root) + private void decodePointData(Group root, NPPSoundingRecord[] records) throws IOException { - PointDataDescription desc = dao.getPointDataDescription(null); + PointDataDescription desc = pluginDao.getPointDataDescription(null); for (Variable var : root.getVariables()) { String name = var.getFullName().split("@")[0]; for (ParameterDescription param : desc.parameters) { @@ -171,7 +190,7 @@ public class CrimssDecoder extends AbstractNPPDecoder { } } - private static void read1D(CrimssRecord[] records, Variable var, + private static void read1D(NPPSoundingRecord[] records, Variable var, String parameter) throws IOException { Array data = var.read(); for (int i = 0; i < records.length; i++) { @@ -186,7 +205,7 @@ public class CrimssDecoder extends AbstractNPPDecoder { * stored in one dimensional data. We need this pressure information stored * for each location so it becomes two dimensional in our storage. */ - private static void read1Dto2D(CrimssRecord[] records, Variable var, + private static void read1Dto2D(NPPSoundingRecord[] records, Variable var, String parameter) throws IOException { int numLevels = var.getDimension(0).getLength(); Array data = var.read(); @@ -199,7 +218,7 @@ public class CrimssDecoder extends AbstractNPPDecoder { } } - private static void read2D(CrimssRecord[] records, Variable var, + private static void read2D(NPPSoundingRecord[] records, Variable var, String parameter) throws IOException { int numLevels = var.getDimension(1).getLength(); Array data = var.read(); diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.viirs/component-deploy.xml b/edexOsgi/com.raytheon.uf.edex.plugin.npp.viirs/component-deploy.xml deleted file mode 100644 index ccb0855b0a..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.npp.viirs/component-deploy.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.npp/META-INF/MANIFEST.MF index 82618881dd..3730aceba1 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.npp/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp/META-INF/MANIFEST.MF @@ -5,11 +5,9 @@ Bundle-SymbolicName: com.raytheon.uf.edex.plugin.npp Bundle-Version: 1.0.0.qualifier Bundle-Vendor: RAYTHEON Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Require-Bundle: com.raytheon.edex.common;bundle-version="1.12.1174", +Require-Bundle: com.raytheon.edex.common;bundle-version="1.12.1174";visibility:=reexport, + ucar.nc2;bundle-version="1.0.0";visibility:=reexport, org.geotools;bundle-version="2.6.4", - javax.measure;bundle-version="1.0.0", - javax.persistence;bundle-version="1.0.0", org.apache.commons.logging;bundle-version="1.1.1", - ucar.nc2;bundle-version="1.0.0", org.apache.commons.lang;bundle-version="2.3.0" Export-Package: com.raytheon.uf.edex.plugin.npp diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp/component-deploy.xml b/edexOsgi/com.raytheon.uf.edex.plugin.npp/component-deploy.xml deleted file mode 100644 index 6c1833a986..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.npp/component-deploy.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file