From c22f135dbc1c08bbafc1db958939fdb70a114d6b Mon Sep 17 00:00:00 2001 From: Ben Steffensmeier Date: Mon, 30 Jan 2012 16:12:29 -0600 Subject: [PATCH] Issue #185 change LevelFactory to throw exceptions when there is no network connection so that everything can be reinitialized when the connection is restored.. Change-Id: Id5c82e7d01e7f229bc99366b1339bc38333ffa5a Former-commit-id: b3463d27fcfb62685dda9894c90711afa4f99c90 [formerly 1b2496a6db33fc65efecfdffb380d8b4e07ec590] Former-commit-id: 0d75fbf9422a5854e1fccf5748161b6a9828462c --- .../META-INF/MANIFEST.MF | 1 + .../ACARSSoundingDataCubeAdapter.java | 18 +- .../viz/core/level/DatabaseLevelMapping.java | 24 +- .../uf/viz/core/level/LevelMapping.java | 22 +- .../viz/core/level/LevelMappingFactory.java | 127 +++--- .../viz/core/level/LevelRetrievalAdapter.java | 31 +- .../uf/viz/core/level/LevelUtilities.java | 39 +- .../uf/viz/core/requests/ThriftClient.java | 9 + .../PointDataTimeSeriesAdapter.java | 26 +- .../META-INF/MANIFEST.MF | 1 + .../viz/derivparam/inv/AbstractInventory.java | 97 +++-- .../derivparam/library/DerivParamField.java | 8 +- .../derivparam/library/DerivParamMethod.java | 22 +- .../library/ValidLevelGenerator.java | 16 +- .../META-INF/MANIFEST.MF | 4 +- .../objectiveanalysis/rsc/OAResourceData.java | 15 +- .../META-INF/MANIFEST.MF | 2 + .../GridProductBrowserDataDefinition.java | 89 +++-- .../viz/grid/data/RadarRequestableData.java | 25 +- .../grid/data/StaticGridRequestableData.java | 23 +- .../viz/grid/data/TopoRequestableData.java | 22 +- .../raytheon/viz/grid/inv/GridInventory.java | 50 +-- .../raytheon/viz/grid/inv/GridUpdater.java | 18 +- .../raytheon/viz/grid/inv/RadarUpdater.java | 11 +- .../viz/grid/rsc/GridNameGenerator.java | 14 +- .../viz/grid/util/GribDataCubeAdapter.java | 30 +- .../raytheon/viz/grid/util/RadarAdapter.java | 8 +- .../META-INF/MANIFEST.MF | 1 + .../pointdata/PlotModelDataDefinition.java | 23 +- .../util/AbstractPointDataInventory.java | 16 +- .../pointdata/util/PointAccumLevelNode.java | 2 +- .../pointdata/util/PointDataCubeAdapter.java | 22 +- .../pointdata/util/PointDataInventory.java | 7 +- .../pointdata/util/PointRequestableData.java | 2 +- .../viz/radar/util/RadarDataCubeAdapter.java | 17 +- .../META-INF/MANIFEST.MF | 3 +- .../catalog/GridDataCatalog.java | 31 +- .../datacatalog/AbstractDataCatalog.java | 23 +- .../AbstractInventoryDataCatalog.java | 53 ++- .../datacatalog/GribDataCatalog.java | 54 ++- .../datacatalog/PointDataCatalog.java | 10 +- .../META-INF/MANIFEST.MF | 1 + .../edex/plugin/gfe/db/dao/GFEDao.java | 24 +- .../META-INF/MANIFEST.MF | 1 + .../edex/plugin/grib/Grib1Decoder.java | 15 +- .../LapsPostProcessor.java | 11 +- .../META-INF/MANIFEST.MF | 3 +- .../META-INF/MANIFEST.MF | 3 +- .../uf/common/dataplugin/level/Level.java | 9 +- .../common/dataplugin/level/LevelFactory.java | 72 +++- .../common/dataplugin/level/MasterLevel.java | 16 +- .../level/request/ILevelRetrievalAdapter.java | 18 +- .../META-INF/MANIFEST.MF | 1 + .../uf/common/derivparam/tree/LevelNode.java | 7 +- .../META-INF/MANIFEST.MF | 1 + .../META-INF/MANIFEST.MF | 1 + .../META-INF/MANIFEST.MF | 1 + .../pointdata/GetPointDataTreeHandler.java | 7 +- .../META-INF/MANIFEST.MF | 5 +- .../edex/plugin/ncgrib/Ncgrib1Decoder.java | 373 ++++++++++++------ 60 files changed, 1103 insertions(+), 482 deletions(-) diff --git a/cave/com.raytheon.uf.viz.acarssounding/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.acarssounding/META-INF/MANIFEST.MF index 79b138768d..f9312037eb 100644 --- a/cave/com.raytheon.uf.viz.acarssounding/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.acarssounding/META-INF/MANIFEST.MF @@ -20,6 +20,7 @@ Import-Package: com.raytheon.edex.meteoLib, com.raytheon.uf.common.pointdata, com.raytheon.uf.common.pointdata.spatial, com.raytheon.uf.common.serialization, + com.raytheon.uf.common.status, com.raytheon.uf.common.time, com.raytheon.uf.viz.core.alerts, com.raytheon.uf.viz.core.catalog, diff --git a/cave/com.raytheon.uf.viz.acarssounding/src/com/raytheon/uf/viz/acarssounding/ACARSSoundingDataCubeAdapter.java b/cave/com.raytheon.uf.viz.acarssounding/src/com/raytheon/uf/viz/acarssounding/ACARSSoundingDataCubeAdapter.java index c72f63b943..b1ce8f2863 100644 --- a/cave/com.raytheon.uf.viz.acarssounding/src/com/raytheon/uf/viz/acarssounding/ACARSSoundingDataCubeAdapter.java +++ b/cave/com.raytheon.uf.viz.acarssounding/src/com/raytheon/uf/viz/acarssounding/ACARSSoundingDataCubeAdapter.java @@ -39,14 +39,19 @@ import com.raytheon.uf.common.datastorage.records.IntegerDataRecord; import com.raytheon.uf.common.datastorage.records.LongDataRecord; import com.raytheon.uf.common.datastorage.records.StringDataRecord; import com.raytheon.uf.common.pointdata.PointDataContainer; +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.viz.core.catalog.ScriptCreator; import com.raytheon.uf.viz.core.comm.Loader; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.derivparam.library.DerivedParameterGenerator; -import com.raytheon.viz.pointdata.util.PointDataCubeAdapter; import com.raytheon.viz.pointdata.util.AbstractPointDataInventory; +import com.raytheon.viz.pointdata.util.PointDataCubeAdapter; public class ACARSSoundingDataCubeAdapter extends PointDataCubeAdapter { + private static final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(ACARSSoundingDataCubeAdapter.class); protected static final String REFTIME = AcarsSoundingInventory.REFTIME; @@ -101,11 +106,16 @@ public class ACARSSoundingDataCubeAdapter extends PointDataCubeAdapter { @Override public void initInventory() { - derParLibrary = DerivedParameterGenerator.getDerParLibrary(); if (inventory == null) { AbstractPointDataInventory pointInventory = new AcarsSoundingInventory(); - pointInventory.initTree(derParLibrary); - this.inventory = pointInventory; + try { + pointInventory.initTree(DerivedParameterGenerator + .getDerParLibrary()); + this.inventory = pointInventory; + } catch (VizException e) { + statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), + e); + } } } diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/level/DatabaseLevelMapping.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/level/DatabaseLevelMapping.java index 3a6d686744..592fa8ec11 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/level/DatabaseLevelMapping.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/level/DatabaseLevelMapping.java @@ -27,13 +27,13 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; +import com.raytheon.uf.common.comm.CommunicationException; import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.level.LevelFactory; 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.viz.core.Activator; -import com.raytheon.uf.viz.core.status.StatusConstants; +import com.raytheon.uf.viz.core.exception.VizCommunicationException; /** * Class defines a database level @@ -55,7 +55,9 @@ import com.raytheon.uf.viz.core.status.StatusConstants; @XmlAccessorType(XmlAccessType.NONE) @XmlRootElement public class DatabaseLevelMapping { - private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(DatabaseLevelMapping.class); + private static final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(DatabaseLevelMapping.class); + @XmlAttribute private String levelName = null; @@ -100,7 +102,7 @@ public class DatabaseLevelMapping { this.unit = unit; } - public List getLevels() { + public List getLevels() throws VizCommunicationException { String[] levelOneValues = new String[0]; String[] levelTwoValues = new String[0]; @@ -143,12 +145,16 @@ public class DatabaseLevelMapping { } // handle any aliasing etc - Level level = LevelFactory.getInstance().getLevel(levelName, lvl1, - lvl2, unit); - - if (level != null) { - rval.add(level); + try { + Level level = LevelFactory.getInstance().getLevel(levelName, + lvl1, lvl2, unit); + if (level != null) { + rval.add(level); + } + } catch (CommunicationException e) { + throw new VizCommunicationException(e); } + } return rval; diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/level/LevelMapping.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/level/LevelMapping.java index 15ad9695bf..9bb7d5c2dc 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/level/LevelMapping.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/level/LevelMapping.java @@ -31,6 +31,7 @@ import javax.xml.bind.annotation.XmlRootElement; import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.serialization.ISerializableObject; +import com.raytheon.uf.viz.core.exception.VizCommunicationException; /** * Class defines a mapping from a display level to one or more database levels. @@ -38,14 +39,14 @@ import com.raytheon.uf.common.serialization.ISerializableObject; * *
  * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * 11/01/2007    #518      S.Manoj     Initial version
- * 11/16/2009    #3120     rjpeter     Modifed to better integrate with level framework.
- * 11/21/2009    #3576     rjpeter     Added group
- *
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * 11/01/2007    #518      S.Manoj     Initial version
+ * 11/16/2009    #3120     rjpeter     Modifed to better integrate with level framework.
+ * 11/21/2009    #3576     rjpeter     Added group
+ * 
  * @author smanoj
  * @version 1.0
  */
@@ -118,12 +119,13 @@ public class LevelMapping implements ISerializableObject {
         this.databaseLevels = databaseLevels;
     }
 
-    public List getLevels() {
+    public List getLevels() throws VizCommunicationException {
         if (levelList == null) {
-            levelList = new ArrayList();
+            List levelList = new ArrayList();
             for (DatabaseLevelMapping mapping : databaseLevels) {
                 levelList.addAll(mapping.getLevels());
             }
+            this.levelList = levelList;
         }
 
         return levelList;
diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/level/LevelMappingFactory.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/level/LevelMappingFactory.java
index 482bbfd467..234bec3cd1 100644
--- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/level/LevelMappingFactory.java
+++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/level/LevelMappingFactory.java
@@ -35,6 +35,7 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
 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.viz.core.exception.VizCommunicationException;
 
 /**
  * Factory for getting level mappings
@@ -56,15 +57,22 @@ public class LevelMappingFactory {
     private static final transient IUFStatusHandler statusHandler = UFStatus
             .getHandler(LevelMappingFactory.class);
 
-    private static LevelMappingFactory instance = new LevelMappingFactory();
+    private static LevelMappingFactory instance = null;
 
     private Map keyToLevelMappings = new HashMap();
 
+    private boolean levelToLevelMappingsInitialized = false;
+
     private Map levelToLevelMappings = new HashMap();
 
+    private boolean groupToMasterLevelsInitialized = false;
+
     private Map>> groupToMasterLevels = new HashMap>>();
 
-    public static LevelMappingFactory getInstance() {
+    public synchronized static LevelMappingFactory getInstance() {
+        if (instance == null) {
+            instance = new LevelMappingFactory();
+        }
         return instance;
     }
 
@@ -96,47 +104,6 @@ public class LevelMappingFactory {
                 }
             }
 
-            for (LevelMapping mapping : keyToLevelMappings.values()) {
-                String group = mapping.getGroup();
-                Map> masterLevels = null;
-
-                if (group != null) {
-                    masterLevels = groupToMasterLevels.get(mapping.getGroup());
-                    if (masterLevels == null) {
-                        masterLevels = new HashMap>();
-                        groupToMasterLevels.put(group, masterLevels);
-                    }
-                }
-
-                for (Level l : mapping.getLevels()) {
-                    if (levelToLevelMappings.containsKey(l)) {
-                        LevelMapping oldMapping = levelToLevelMappings.get(l);
-                        // Only replace the old level mapping if we have less
-                        // levels than the old mapping
-                        // This should cause the most specific mapping to be
-                        // used
-                        if (mapping.getLevels().size() < oldMapping.getLevels()
-                                .size()) {
-                            levelToLevelMappings.put(l, mapping);
-                        }
-                    } else {
-                        levelToLevelMappings.put(l, mapping);
-                    }
-
-                    // populate grouping map
-                    if (masterLevels != null) {
-                        MasterLevel ml = l.getMasterLevel();
-                        Set levels = masterLevels.get(ml);
-
-                        if (levels == null) {
-                            levels = new HashSet();
-                            masterLevels.put(ml, levels);
-                        }
-
-                        levels.add(l);
-                    }
-                }
-            }
         }
         long finish = System.currentTimeMillis();
         System.out.println("LevelMappingFactory initialization took ["
@@ -147,7 +114,11 @@ public class LevelMappingFactory {
         return keyToLevelMappings.get(key);
     }
 
-    public LevelMapping getLevelMappingForLevel(Level level) {
+    public LevelMapping getLevelMappingForLevel(Level level)
+            throws VizCommunicationException {
+        if (!levelToLevelMappingsInitialized) {
+            initializeLevelToLevelMappings();
+        }
         return levelToLevelMappings.get(level);
     }
 
@@ -155,11 +126,75 @@ public class LevelMappingFactory {
         return keyToLevelMappings.values();
     }
 
-    public Set getAllLevels() {
+    public Set getAllLevels() throws VizCommunicationException {
+        if (!levelToLevelMappingsInitialized) {
+            initializeLevelToLevelMappings();
+        }
         return levelToLevelMappings.keySet();
     }
 
-    public Map> getLevelMapForGroup(String group) {
+    public Map> getLevelMapForGroup(String group)
+            throws VizCommunicationException {
+        if (!groupToMasterLevelsInitialized) {
+            initializeGroupToMasterLevels();
+        }
         return groupToMasterLevels.get(group);
     }
+
+    private void initializeLevelToLevelMappings()
+            throws VizCommunicationException {
+        for (LevelMapping mapping : keyToLevelMappings.values()) {
+            String group = mapping.getGroup();
+
+            for (Level l : mapping.getLevels()) {
+                if (levelToLevelMappings.containsKey(l)) {
+                    LevelMapping oldMapping = levelToLevelMappings.get(l);
+                    // Only replace the old level mapping if we have less
+                    // levels than the old mapping
+                    // This should cause the most specific mapping to be
+                    // used
+                    if (mapping.getLevels().size() < oldMapping.getLevels()
+                            .size()) {
+                        levelToLevelMappings.put(l, mapping);
+                    }
+                } else {
+                    levelToLevelMappings.put(l, mapping);
+                }
+            }
+        }
+        levelToLevelMappingsInitialized = true;
+    }
+
+    private void initializeGroupToMasterLevels()
+            throws VizCommunicationException {
+        for (LevelMapping mapping : keyToLevelMappings.values()) {
+            String group = mapping.getGroup();
+            Map> masterLevels = null;
+
+            if (group != null) {
+                masterLevels = groupToMasterLevels.get(mapping.getGroup());
+                if (masterLevels == null) {
+                    masterLevels = new HashMap>();
+                    groupToMasterLevels.put(group, masterLevels);
+                }
+            }
+
+            for (Level l : mapping.getLevels()) {
+
+                // populate grouping map
+                if (masterLevels != null) {
+                    MasterLevel ml = l.getMasterLevel();
+                    Set levels = masterLevels.get(ml);
+
+                    if (levels == null) {
+                        levels = new HashSet();
+                        masterLevels.put(ml, levels);
+                    }
+
+                    levels.add(l);
+                }
+            }
+        }
+        groupToMasterLevelsInitialized = true;
+    }
 }
diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/level/LevelRetrievalAdapter.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/level/LevelRetrievalAdapter.java
index bcd824dad0..c1d3c57745 100644
--- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/level/LevelRetrievalAdapter.java
+++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/level/LevelRetrievalAdapter.java
@@ -22,6 +22,7 @@ package com.raytheon.uf.viz.core.level;
 import java.util.HashMap;
 import java.util.Map;
 
+import com.raytheon.uf.common.comm.CommunicationException;
 import com.raytheon.uf.common.dataplugin.level.Level;
 import com.raytheon.uf.common.dataplugin.level.LevelContainer;
 import com.raytheon.uf.common.dataplugin.level.MasterLevel;
@@ -37,6 +38,7 @@ import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
 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.viz.core.exception.VizCommunicationException;
 import com.raytheon.uf.viz.core.exception.VizException;
 import com.raytheon.uf.viz.core.requests.ThriftClient;
 
@@ -45,11 +47,14 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
             .getHandler(LevelRetrievalAdapter.class);
 
     @Override
-    public Level getLevel(GetLevelRequest request) {
+    public Level getLevel(GetLevelRequest request)
+            throws CommunicationException {
         Level rval = null;
 
         try {
             rval = (Level) ThriftClient.sendRequest(request);
+        } catch (VizCommunicationException e) {
+            throw new CommunicationException(e);
         } catch (VizException e) {
             statusHandler.handle(Priority.PROBLEM,
                     "Error occurred retrieving level information from server.",
@@ -60,11 +65,14 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
     }
 
     @Override
-    public Level getLevel(GetLevelByIdRequest request) {
+    public Level getLevel(GetLevelByIdRequest request)
+            throws CommunicationException {
         Level rval = null;
 
         try {
             rval = (Level) ThriftClient.sendRequest(request);
+        } catch (VizCommunicationException e) {
+            throw new CommunicationException(e);
         } catch (VizException e) {
             statusHandler.handle(Priority.PROBLEM,
                     "Error occurred retrieving level information from server.",
@@ -75,10 +83,13 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
     }
 
     @Override
-    public MasterLevel getMasterLevel(GetMasterLevelRequest request) {
+    public MasterLevel getMasterLevel(GetMasterLevelRequest request)
+            throws CommunicationException {
         MasterLevel rval = null;
         try {
             rval = (MasterLevel) ThriftClient.sendRequest(request);
+        } catch (VizCommunicationException e) {
+            throw new CommunicationException(e);
         } catch (VizException e) {
             statusHandler.handle(Priority.PROBLEM,
                     "Error occurred retrieving level information from server.",
@@ -89,10 +100,13 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
 
     @Override
     public LevelContainer getAllLevelsForMasterLevel(
-            GetAllLevelsForMasterLevelRequest request) {
+            GetAllLevelsForMasterLevelRequest request)
+            throws CommunicationException {
         LevelContainer rval = null;
         try {
             rval = (LevelContainer) ThriftClient.sendRequest(request);
+        } catch (VizCommunicationException e) {
+            throw new CommunicationException(e);
         } catch (VizException e) {
             statusHandler.handle(Priority.PROBLEM,
                     "Error occurred retrieving level information from server.",
@@ -102,7 +116,7 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
     }
 
     @Override
-    public LevelContainer getAllLevels() {
+    public LevelContainer getAllLevels() throws CommunicationException {
         LevelContainer rval = null;
         DbQueryRequest query = new DbQueryRequest();
         query.setConstraints(new HashMap());
@@ -114,6 +128,8 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
             for (Map result : resp.getResults()) {
                 rval.add((Level) result.get(null));
             }
+        } catch (VizCommunicationException e) {
+            throw new CommunicationException(e);
         } catch (VizException e) {
             statusHandler.handle(Priority.PROBLEM,
                     "Error occurred retrieving level information from server.",
@@ -123,7 +139,8 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
     }
 
     @Override
-    public MasterLevelContainer getAllMasterLevels() {
+    public MasterLevelContainer getAllMasterLevels()
+            throws CommunicationException {
         MasterLevelContainer rval = null;
         DbQueryRequest query = new DbQueryRequest();
         query.setConstraints(new HashMap());
@@ -135,6 +152,8 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
             for (Map result : resp.getResults()) {
                 rval.add((MasterLevel) result.get(null));
             }
+        } catch (VizCommunicationException e) {
+            throw new CommunicationException(e);
         } catch (VizException e) {
             statusHandler
                     .handle(Priority.PROBLEM,
diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/level/LevelUtilities.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/level/LevelUtilities.java
index cb92905a99..f6cf111c91 100644
--- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/level/LevelUtilities.java
+++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/level/LevelUtilities.java
@@ -29,10 +29,12 @@ import java.util.TreeSet;
 import javax.measure.unit.Unit;
 import javax.measure.unit.UnitFormat;
 
+import com.raytheon.uf.common.comm.CommunicationException;
 import com.raytheon.uf.common.dataplugin.level.CompareType;
 import com.raytheon.uf.common.dataplugin.level.Level;
 import com.raytheon.uf.common.dataplugin.level.LevelFactory;
 import com.raytheon.uf.common.dataplugin.level.MasterLevel;
+import com.raytheon.uf.viz.core.exception.VizCommunicationException;
 
 /**
  * Level utilities
@@ -62,14 +64,24 @@ public class LevelUtilities {
         }
     }
 
-    public static boolean isPressureLevel(long levelId) {
-        return isPressureLevel(LevelFactory.getInstance().getLevel(levelId)
-                .getMasterLevel());
+    public static boolean isPressureLevel(long levelId)
+            throws VizCommunicationException {
+        try {
+            return isPressureLevel(LevelFactory.getInstance().getLevel(levelId)
+                    .getMasterLevel());
+        } catch (CommunicationException e) {
+            throw new VizCommunicationException(e);
+        }
     }
 
-    public static boolean isPressureLevel(String masterLevelName) {
-        return isPressureLevel(LevelFactory.getInstance().getMasterLevel(
-                masterLevelName));
+    public static boolean isPressureLevel(String masterLevelName)
+            throws VizCommunicationException {
+        try {
+            return isPressureLevel(LevelFactory.getInstance().getMasterLevel(
+                    masterLevelName));
+        } catch (CommunicationException e) {
+            throw new VizCommunicationException(e);
+        }
     }
 
     public static boolean isPressureLevel(Level level) {
@@ -89,9 +101,10 @@ public class LevelUtilities {
      * 
      * @param masterLevelName
      * @return
+     * @throws CommunicationException
      */
     public synchronized static NavigableSet getOrderedSetOfStandardLevels(
-            String masterLevelName) {
+            String masterLevelName) throws VizCommunicationException {
         if (masterLevelToOrderedSet == null) {
             Comparator levelComparator = new Comparator() {
 
@@ -108,7 +121,7 @@ public class LevelUtilities {
                 }
 
             };
-            masterLevelToOrderedSet = new HashMap>();
+            Map> masterLevelToOrderedSet = new HashMap>();
             for (Level level : LevelMappingFactory.getInstance().getAllLevels()) {
                 NavigableSet levels = masterLevelToOrderedSet.get(level
                         .getMasterLevel().getName());
@@ -118,12 +131,18 @@ public class LevelUtilities {
                             .getName(), levels);
                 }
                 if (level.isRangeLevel()) {
-                    levels.add(level.getUpperLevel());
-                    levels.add(level.getLowerLevel());
+
+                    try {
+                        levels.add(level.getUpperLevel());
+                        levels.add(level.getLowerLevel());
+                    } catch (CommunicationException e) {
+                        throw new VizCommunicationException(e);
+                    }
                 } else {
                     levels.add(level);
                 }
             }
+            LevelUtilities.masterLevelToOrderedSet = masterLevelToOrderedSet;
         }
         return masterLevelToOrderedSet.get(masterLevelName);
 
diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/requests/ThriftClient.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/requests/ThriftClient.java
index db130f35d6..c75e8c66d7 100644
--- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/requests/ThriftClient.java
+++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/requests/ThriftClient.java
@@ -1,5 +1,6 @@
 package com.raytheon.uf.viz.core.requests;
 
+import java.io.IOException;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
@@ -12,6 +13,7 @@ import com.raytheon.uf.common.auth.req.AbstractPrivilegedRequest;
 import com.raytheon.uf.common.auth.resp.SuccessfulExecution;
 import com.raytheon.uf.common.auth.resp.UserNotAuthenticated;
 import com.raytheon.uf.common.auth.resp.UserNotAuthorized;
+import com.raytheon.uf.common.comm.CommunicationException;
 import com.raytheon.uf.common.comm.HttpClient;
 import com.raytheon.uf.common.comm.NetworkStatistics;
 import com.raytheon.uf.common.serialization.SerializationException;
@@ -23,6 +25,7 @@ import com.raytheon.uf.common.serialization.comm.response.ServerErrorResponse;
 import com.raytheon.uf.common.serialization.comm.util.ExceptionWrapper;
 import com.raytheon.uf.viz.core.VizApp;
 import com.raytheon.uf.viz.core.auth.UserController;
+import com.raytheon.uf.viz.core.exception.VizCommunicationException;
 import com.raytheon.uf.viz.core.exception.VizException;
 import com.raytheon.uf.viz.core.localization.LocalizationManager;
 
@@ -311,6 +314,12 @@ public class ThriftClient {
             // Log request stats
             stats.log(request.getClass().getSimpleName(), message.length,
                     responseLen);
+        } catch (IOException e) {
+            throw new VizCommunicationException(
+                    "unable to post request to server", e);
+        } catch (CommunicationException e) {
+            throw new VizCommunicationException(
+                    "unable to post request to server", e);
         } catch (Exception e) {
             throw new VizException("unable to post request to server", e);
         }
diff --git a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/PointDataTimeSeriesAdapter.java b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/PointDataTimeSeriesAdapter.java
index 7f69de5004..8ad51cafd0 100644
--- a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/PointDataTimeSeriesAdapter.java
+++ b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/PointDataTimeSeriesAdapter.java
@@ -245,19 +245,23 @@ public class PointDataTimeSeriesAdapter extends
             // The level mapping for surface has way to much junk in it.
             return level;
         }
-        LevelMapping mapping = LevelMappingFactory.getInstance()
-                .getLevelMappingForKey(resourceData.getLevelKey());
-        for (Level l : mapping.getLevels()) {
-            if (LevelUtilities.isPressureLevel(l)) {
-                try {
-                    level = new SingleLevel(l.getMasterLevel().getName());
-                    level.setValue(l.getLevelonevalue());
-                    break;
-                } catch (IllegalArgumentException e) {
-                    level = new SingleLevel("SURFACE");
-                    level.setValue(0.0);
+        try {
+            LevelMapping mapping = LevelMappingFactory.getInstance()
+                    .getLevelMappingForKey(resourceData.getLevelKey());
+            for (Level l : mapping.getLevels()) {
+                if (LevelUtilities.isPressureLevel(l)) {
+                    try {
+                        level = new SingleLevel(l.getMasterLevel().getName());
+                        level.setValue(l.getLevelonevalue());
+                        break;
+                    } catch (IllegalArgumentException e) {
+                        level = new SingleLevel("SURFACE");
+                        level.setValue(0.0);
+                    }
                 }
             }
+        } catch (VizException e) {
+            // return the default
         }
         return level;
     }
diff --git a/cave/com.raytheon.uf.viz.derivparam/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.derivparam/META-INF/MANIFEST.MF
index 6af06d9017..ec54322b93 100644
--- a/cave/com.raytheon.uf.viz.derivparam/META-INF/MANIFEST.MF
+++ b/cave/com.raytheon.uf.viz.derivparam/META-INF/MANIFEST.MF
@@ -13,6 +13,7 @@ Bundle-ActivationPolicy: lazy
 Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
 Import-Package: com.raytheon.edex.meteoLib,
  com.raytheon.edex.util,
+ com.raytheon.uf.common.comm,
  com.raytheon.uf.common.dataplugin,
  com.raytheon.uf.common.dataplugin.level,
  com.raytheon.uf.common.dataplugin.persist,
diff --git a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/inv/AbstractInventory.java b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/inv/AbstractInventory.java
index cd8b274578..3470c673e2 100644
--- a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/inv/AbstractInventory.java
+++ b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/inv/AbstractInventory.java
@@ -22,6 +22,7 @@ package com.raytheon.uf.viz.derivparam.inv;
 import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Deque;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -32,6 +33,7 @@ import java.util.Set;
 import java.util.SortedSet;
 import java.util.concurrent.BlockingQueue;
 
+import com.raytheon.uf.common.comm.CommunicationException;
 import com.raytheon.uf.common.dataplugin.level.Level;
 import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
 import com.raytheon.uf.common.derivparam.tree.AbstractNode;
@@ -43,6 +45,7 @@ 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.VizCommunicationException;
 import com.raytheon.uf.viz.core.exception.VizException;
 import com.raytheon.uf.viz.core.level.LevelMappingFactory;
 import com.raytheon.uf.viz.core.level.LevelUtilities;
@@ -179,9 +182,12 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
      * tree and populates it with available derived parameters based on what is
      * available from the base parameters.
      * 
+     * @throws VizException
+     * 
      * 
      */
-    public synchronized void initTree(Map derParLibrary) {
+    public synchronized void initTree(Map derParLibrary)
+            throws VizException {
         DerivedParameterGenerator.registerUpdateListener(this);
         if (derParLibrary == null) {
             this.derParLibrary = new HashMap(0);
@@ -189,7 +195,8 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
             this.derParLibrary = derParLibrary;
         }
         long startTime = System.currentTimeMillis();
-        DataTree newTree = createBaseTree();
+        DataTree newTree = null;
+        newTree = createBaseTree();
         if (newTree == null) {
             return;
         }
@@ -198,7 +205,13 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
         allLevels = null;
         dataTree = newTree;
         for (SourceNode sourceNode : dataTree.getSourceNodes().values()) {
-            doSupplement(sourceNode);
+            try {
+                doSupplement(sourceNode);
+            } catch (VizCommunicationException e) {
+                // TODO need to recover from this
+                statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
+                        e);
+            }
             for (ParameterNode parameterNode : sourceNode.getChildNodes()
                     .values()) {
                 String value = parameterNode.getValue();
@@ -216,7 +229,11 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
 
     @Override
     public void updateDerParLibrary(Map derParLibrary) {
-        initTree(derParLibrary);
+        try {
+            initTree(derParLibrary);
+        } catch (VizException e) {
+            statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
+        }
     }
 
     public String getParameterUnit(String source, String parameter) {
@@ -254,8 +271,10 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
      * Resolve any Supplement Derived Parameters.
      * 
      * @param sNode
+     * @throws VizCommunicationException
      */
-    private void doSupplement(SourceNode sNode) {
+    private void doSupplement(SourceNode sNode)
+            throws VizCommunicationException {
         Set nodata = new HashSet();
         Deque stack = new ArrayDeque();
         for (DerivParamDesc desc : derParLibrary.values()) {
@@ -300,7 +319,7 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
         }
     }
 
-    protected abstract DataTree createBaseTree();
+    protected abstract DataTree createBaseTree() throws VizException;
 
     /**
      * Handle a query for a time agnostic node.
@@ -320,7 +339,7 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
     protected Collection getAllSources() {
         if (allSources == null) {
             if (dataTree == null) {
-                return null;
+                return Collections.emptyList();
             } else {
                 return new ArrayList(dataTree.getSources());
             }
@@ -452,10 +471,18 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
      * See get allSources, same function but for levels
      * 
      * @return
+     * @throws VizCommunicationException
      */
     protected Collection getAllLevels() {
         if (allLevels == null) {
-            return LevelMappingFactory.getInstance().getAllLevels();
+            try {
+                return LevelMappingFactory.getInstance().getAllLevels();
+            } catch (VizCommunicationException e) {
+                // TODO recover from this.
+                statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
+                        e);
+                return Collections.emptyList();
+            }
         } else {
             return allLevels;
         }
@@ -605,8 +632,13 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
                         Level level = lit.next();
                         AbstractRequestableLevelNode result = null;
                         if (derive) {
-                            result = resolveNode(node, param, level, stack,
-                                    nodata);
+                            try {
+                                result = resolveNode(node, param, level, stack,
+                                        nodata);
+                            } catch (VizCommunicationException e) {
+                                statusHandler.handle(Priority.PROBLEM,
+                                        e.getLocalizedMessage(), e);
+                            }
                         } else {
                             ParameterNode pNode = node.getChildNode(param);
                             result = (AbstractRequestableLevelNode) (pNode == null ? null
@@ -654,11 +686,17 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
                                 List choices = new ArrayList();
                                 for (String aliasModel : sourceAliases
                                         .get(source)) {
-                                    AbstractRequestableLevelNode alias;
+                                    AbstractRequestableLevelNode alias = null;
                                     if (derive) {
-                                        alias = resolveNode(
-                                                dataTree.getSourceNode(aliasModel),
-                                                param, level, stack, nodata);
+                                        try {
+                                            alias = resolveNode(
+                                                    dataTree.getSourceNode(aliasModel),
+                                                    param, level, stack, nodata);
+                                        } catch (VizCommunicationException e) {
+                                            statusHandler.handle(
+                                                    Priority.PROBLEM,
+                                                    e.getLocalizedMessage(), e);
+                                        }
                                     } else {
                                         ParameterNode pNode = node
                                                 .getChildNode(param);
@@ -722,10 +760,12 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
      * @param stack
      * @param nodata
      * @return
+     * @throws VizCommunicationException
      */
     protected synchronized AbstractRequestableLevelNode resolveNode(
             SourceNode sourceNode, String param, Level level,
-            Deque stack, Set nodata) {
+            Deque stack, Set nodata)
+            throws VizCommunicationException {
         ParameterNode pNode = sourceNode.getChildNode(param);
         LevelNode lNode = pNode == null ? null : pNode.getChildNode(Long
                 .toString(level.getId()));
@@ -861,8 +901,14 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
             }// method loop
         }
         if (level.isRangeLevel()) {
-            Level upperLevel = level.getUpperLevel();
-            Level lowerLevel = level.getLowerLevel();
+            Level upperLevel;
+            Level lowerLevel;
+            try {
+                upperLevel = level.getUpperLevel();
+                lowerLevel = level.getLowerLevel();
+            } catch (CommunicationException e) {
+                throw new VizCommunicationException(e);
+            }
 
             List nodes = new ArrayList();
             int endCount = 0;
@@ -956,10 +1002,11 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
      * @param nodata
      * @return Should be Either some IStaticData or an
      *         AbstractRequestableLevelNode
+     * @throws VizCommunicationException
      */
     private synchronized Object resolveField(SourceNode sourceNode,
             Level level, IDerivParamField ifield, Deque stack,
-            Set nodata) {
+            Set nodata) throws VizCommunicationException {
         // process the next field
         if (ifield.getClass() == DerivParamConstantField.class) {
             return new FloatRequestableData(
@@ -1004,10 +1051,14 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
             if (type == null) {
                 fieldLevel = level;
             } else if (level.isRangeLevel()) {
-                if (type == LevelType.Upper) {
-                    fieldLevel = level.getUpperLevel();
-                } else {
-                    fieldLevel = level.getLowerLevel();
+                try {
+                    if (type == LevelType.Upper) {
+                        fieldLevel = level.getUpperLevel();
+                    } else {
+                        fieldLevel = level.getLowerLevel();
+                    }
+                } catch (CommunicationException e) {
+                    throw new VizCommunicationException(e);
                 }
             } else {
                 SortedSet levels = null;
@@ -1067,7 +1118,7 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
 
     protected abstract LevelNode getCubeNode(SourceNode sNode,
             DerivParamField field, Deque stack,
-            Set nodata);
+            Set nodata) throws VizCommunicationException;
 
     protected abstract AbstractDerivedLevelNode getImportNode(
             AbstractRequestableData nodeToImport, SourceNode destSourceNode,
diff --git a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/DerivParamField.java b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/DerivParamField.java
index 7ecc6b23c9..7f1859e02a 100644
--- a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/DerivParamField.java
+++ b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/DerivParamField.java
@@ -29,6 +29,7 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 
 import com.raytheon.uf.common.serialization.ISerializableObject;
 import com.raytheon.uf.common.serialization.adapters.UnitAdapter;
+import com.raytheon.uf.viz.core.exception.VizCommunicationException;
 import com.raytheon.uf.viz.core.level.LevelMapping;
 import com.raytheon.uf.viz.core.level.LevelMappingFactory;
 
@@ -82,14 +83,14 @@ public class DerivParamField implements ISerializableObject, IDerivParamField {
         this.param = param;
     }
 
-    public LevelMapping getLevelMapping() {
+    public LevelMapping getLevelMapping() throws VizCommunicationException {
         if (levelType == null && level != null) {
             setLevel(level);
         }
         return levelMapping;
     }
 
-    public LevelType getLevelType() {
+    public LevelType getLevelType() throws VizCommunicationException {
         if (levelType == null && level != null) {
             setLevel(level);
         }
@@ -125,8 +126,9 @@ public class DerivParamField implements ISerializableObject, IDerivParamField {
      * @param level
      * @return true upon success, false if the token is not recognized, in which
      *         case levelType and levelMapping will both be reset to null
+     * @throws VizCommunicationException
      */
-    public boolean setLevel(String level) {
+    public boolean setLevel(String level) throws VizCommunicationException {
         levelType = LevelType.parseLevel(level);
         if (levelType == LevelType.LevelMapping) {
             levelMapping = LevelMappingFactory.getInstance()
diff --git a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/DerivParamMethod.java b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/DerivParamMethod.java
index 508177bc7f..d4945a3cbf 100644
--- a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/DerivParamMethod.java
+++ b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/DerivParamMethod.java
@@ -38,9 +38,8 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
 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.viz.core.exception.VizCommunicationException;
 import com.raytheon.uf.viz.core.exception.VizException;
-import com.raytheon.uf.viz.core.status.StatusConstants;
-import com.raytheon.uf.viz.derivparam.Activator;
 
 /**
  * Metadata about a derived parameter method.
@@ -61,7 +60,8 @@ import com.raytheon.uf.viz.derivparam.Activator;
 @XmlAccessorType(XmlAccessType.NONE)
 @XmlRootElement
 public class DerivParamMethod implements ISerializableObject {
-    private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(DerivParamMethod.class);
+    private static final transient IUFStatusHandler statusHandler = UFStatus
+            .getHandler(DerivParamMethod.class);
 
     public enum FrameworkMethod {
         ALIAS, MODELRUN, TIMERANGE, OR, UNION, SUPPLEMENT, IMPORT, NODERIVATION;
@@ -149,7 +149,7 @@ public class DerivParamMethod implements ISerializableObject {
         fields.add(field);
     }
 
-    public Set getValidLevels() {
+    public Set getValidLevels() throws VizCommunicationException {
         if (validLevels == null && levels != null && levels.length() > 0) {
             ValidLevelGenerator lvlGen = new ValidLevelGenerator();
             validLevels = lvlGen.generateLevels(levels);
@@ -253,13 +253,13 @@ public class DerivParamMethod implements ISerializableObject {
                         tmp.append(pFieldTokens[k]);
                     }
 
-                    statusHandler.handle(
-                            Priority.SIGNIFICANT,
-                            "Derived parameter ["
-                                    + "field ["
-                                    + field.getParam()
-                                    + "], contains unknown parameter modifier ["
-                                    + tmp.toString() + "]");
+                    statusHandler
+                            .handle(Priority.SIGNIFICANT,
+                                    "Derived parameter ["
+                                            + "field ["
+                                            + field.getParam()
+                                            + "], contains unknown parameter modifier ["
+                                            + tmp.toString() + "]");
                 }
             }
         }
diff --git a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/ValidLevelGenerator.java b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/ValidLevelGenerator.java
index c63deba983..2e7888f7a6 100644
--- a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/ValidLevelGenerator.java
+++ b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/ValidLevelGenerator.java
@@ -28,10 +28,12 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 
+import com.raytheon.uf.common.comm.CommunicationException;
 import com.raytheon.uf.common.dataplugin.level.CompareType;
 import com.raytheon.uf.common.dataplugin.level.Level;
 import com.raytheon.uf.common.dataplugin.level.LevelFactory;
 import com.raytheon.uf.common.dataplugin.level.MasterLevel;
+import com.raytheon.uf.viz.core.exception.VizCommunicationException;
 import com.raytheon.uf.viz.core.level.LevelMapping;
 import com.raytheon.uf.viz.core.level.LevelMappingFactory;
 
@@ -72,7 +74,7 @@ public class ValidLevelGenerator {
     }
 
     public Set generateLevels(String validLevelsString)
-            throws IllegalArgumentException {
+            throws IllegalArgumentException, VizCommunicationException {
         masterLevels = new HashMap>();
         validLevels = new HashSet();
         masterLevelsHandled = new HashSet();
@@ -121,7 +123,11 @@ public class ValidLevelGenerator {
 
             if (tokensToProcess.size() > 0) {
                 for (String token : tokensToProcess) {
-                    processLevelToken(token);
+                    try {
+                        processLevelToken(token);
+                    } catch (CommunicationException e) {
+                        throw new VizCommunicationException(e);
+                    }
                 }
             } else {
                 for (Set levels : masterLevels.values()) {
@@ -133,7 +139,8 @@ public class ValidLevelGenerator {
         return validLevels;
     }
 
-    private void processLevelToken(String token) {
+    private void processLevelToken(String token)
+            throws VizCommunicationException, CommunicationException {
         boolean negate = token.charAt(0) == '!';
         int rangeIndex = token.indexOf('>');
 
@@ -318,7 +325,8 @@ public class ValidLevelGenerator {
         }
     }
 
-    private Type determineType(String token) {
+    private Type determineType(String token) throws CommunicationException,
+            VizCommunicationException {
         Type rval = null;
         LevelMapping mapping = lmf.getLevelMappingForKey(token);
 
diff --git a/cave/com.raytheon.uf.viz.objectiveanalysis/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.objectiveanalysis/META-INF/MANIFEST.MF
index df29ed5ed1..5f8f57f3fd 100644
--- a/cave/com.raytheon.uf.viz.objectiveanalysis/META-INF/MANIFEST.MF
+++ b/cave/com.raytheon.uf.viz.objectiveanalysis/META-INF/MANIFEST.MF
@@ -27,8 +27,10 @@ Require-Bundle: org.eclipse.ui,
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ActivationPolicy: lazy
 Export-Package: com.raytheon.uf.viz.objectiveanalysis.rsc
-Import-Package: com.raytheon.uf.common.dataplugin.grib.spatial.projections,
+Import-Package: com.raytheon.uf.common.comm,
+ com.raytheon.uf.common.dataplugin.grib.spatial.projections,
  com.raytheon.uf.common.dataplugin.level,
+ com.raytheon.uf.common.dataplugin.radar,
  com.raytheon.uf.viz.derivparam.library,
  com.raytheon.uf.viz.derivparam.tree,
  com.raytheon.viz.ui,
diff --git a/cave/com.raytheon.uf.viz.objectiveanalysis/src/com/raytheon/uf/viz/objectiveanalysis/rsc/OAResourceData.java b/cave/com.raytheon.uf.viz.objectiveanalysis/src/com/raytheon/uf/viz/objectiveanalysis/rsc/OAResourceData.java
index 0f7b26f8bb..63c9cd9839 100644
--- a/cave/com.raytheon.uf.viz.objectiveanalysis/src/com/raytheon/uf/viz/objectiveanalysis/rsc/OAResourceData.java
+++ b/cave/com.raytheon.uf.viz.objectiveanalysis/src/com/raytheon/uf/viz/objectiveanalysis/rsc/OAResourceData.java
@@ -27,18 +27,20 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
 
+import com.raytheon.uf.common.comm.CommunicationException;
 import com.raytheon.uf.common.dataplugin.PluginDataObject;
 import com.raytheon.uf.common.dataplugin.level.Level;
 import com.raytheon.uf.common.dataplugin.level.LevelFactory;
 import com.raytheon.uf.common.dataplugin.level.MasterLevel;
 import com.raytheon.uf.common.time.DataTime;
+import com.raytheon.uf.viz.core.exception.VizCommunicationException;
 import com.raytheon.uf.viz.core.exception.VizException;
 import com.raytheon.uf.viz.core.level.LevelMappingFactory;
 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.core.style.level.SingleLevel;
 import com.raytheon.uf.viz.core.style.level.Level.LevelType;
+import com.raytheon.uf.viz.core.style.level.SingleLevel;
 
 /**
  * Resource Data for Objective Analysis
@@ -161,8 +163,8 @@ public class OAResourceData extends AbstractRequestableResourceData {
             throw new UnsupportedOperationException("Unsupported level for OA "
                     + levelKey);
         }
-        level.setValue(Double.parseDouble(levelKey.substring(0, levelKey
-                .length() - 2)));
+        level.setValue(Double.parseDouble(levelKey.substring(0,
+                levelKey.length() - 2)));
         return level;
     }
 
@@ -194,7 +196,12 @@ public class OAResourceData extends AbstractRequestableResourceData {
         DataTime[] times = super.getAvailableTimes();
         if (this.levelKey.equals(ALL_TILTS)) {
             LevelFactory factory = LevelFactory.getInstance();
-            MasterLevel ml = factory.getMasterLevel("TILT");
+            MasterLevel ml;
+            try {
+                ml = factory.getMasterLevel("TILT");
+            } catch (CommunicationException e) {
+                throw new VizCommunicationException(e);
+            }
             Set allLevels = LevelMappingFactory.getInstance()
                     .getAllLevels();
             List levels = new ArrayList();
diff --git a/cave/com.raytheon.viz.grid/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.grid/META-INF/MANIFEST.MF
index 908cc9fbfa..d5e22ebb93 100644
--- a/cave/com.raytheon.viz.grid/META-INF/MANIFEST.MF
+++ b/cave/com.raytheon.viz.grid/META-INF/MANIFEST.MF
@@ -32,6 +32,7 @@ Export-Package: com.raytheon.viz.grid,
  com.raytheon.viz.grid.xml
 Import-Package: com.raytheon.edex.scriptfactory,
  com.raytheon.uf.common.colormap,
+ com.raytheon.uf.common.comm,
  com.raytheon.uf.common.dataplugin.grib,
  com.raytheon.uf.common.dataplugin.grib.exception,
  com.raytheon.uf.common.dataplugin.grib.request,
@@ -47,6 +48,7 @@ Import-Package: com.raytheon.edex.scriptfactory,
  com.raytheon.uf.common.serialization,
  com.raytheon.uf.common.time,
  com.raytheon.uf.common.topo,
+ com.raytheon.uf.viz.d2d.core.map,
  com.raytheon.uf.viz.d2d.core.time,
  com.raytheon.uf.viz.derivparam,
  com.raytheon.uf.viz.derivparam.data,
diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/GridProductBrowserDataDefinition.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/GridProductBrowserDataDefinition.java
index dd1a585fbf..ee963d6d51 100644
--- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/GridProductBrowserDataDefinition.java
+++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/GridProductBrowserDataDefinition.java
@@ -33,12 +33,16 @@ import java.util.Set;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.LinkedBlockingQueue;
 
+import com.raytheon.uf.common.comm.CommunicationException;
 import com.raytheon.uf.common.dataplugin.grib.util.GribModelLookup;
 import com.raytheon.uf.common.dataplugin.grib.util.GridModel;
 import com.raytheon.uf.common.dataplugin.level.Level;
 import com.raytheon.uf.common.dataplugin.level.LevelFactory;
 import com.raytheon.uf.common.dataplugin.level.MasterLevel;
 import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
+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.viz.core.datastructure.DataCubeContainer;
 import com.raytheon.uf.viz.core.rsc.DisplayType;
 import com.raytheon.uf.viz.core.rsc.LoadProperties;
@@ -70,6 +74,8 @@ import com.raytheon.viz.grid.rsc.GridResourceData;
  */
 public class GridProductBrowserDataDefinition extends
         AbstractRequestableProductBrowserDataDefinition {
+    private static final transient IUFStatusHandler statusHandler = UFStatus
+            .getHandler(GridProductBrowserDataDefinition.class);
 
     private static final String SHOW_UNKNOWN_MODELS = "Show Unknown Models";
 
@@ -166,27 +172,32 @@ public class GridProductBrowserDataDefinition extends
             e.printStackTrace();
         }
         LevelFactory lf = LevelFactory.getInstance();
-        if (selection.length > 3) {
-            List availLevels = new ArrayList();
-            for (String levelid : returnQueue) {
-                Level level = lf.getLevel(levelid);
-                if (level.getMasterLevel().getName().equals(selection[3])) {
-                    availLevels.add(levelid);
+        try {
+            if (selection.length > 3) {
+                List availLevels = new ArrayList();
+                for (String levelid : returnQueue) {
+                    Level level = lf.getLevel(levelid);
+                    if (level.getMasterLevel().getName().equals(selection[3])) {
+                        availLevels.add(levelid);
+                    }
                 }
+                return formatData(GridInventory.LEVEL_ID_QUERY,
+                        availLevels.toArray(new String[availLevels.size()]));
+            } else {
+                Set masterLevels = new HashSet();
+                for (String levelid : returnQueue) {
+                    Level level = lf.getLevel(levelid);
+                    masterLevels.add(level.getMasterLevel().getName());
+                }
+                List results = formatData(
+                        GridInventory.MASTER_LEVEL_QUERY,
+                        masterLevels.toArray(new String[masterLevels.size()]));
+                Collections.sort(results);
+                return results;
             }
-            return formatData(GridInventory.LEVEL_ID_QUERY,
-                    availLevels.toArray(new String[availLevels.size()]));
-        } else {
-            Set masterLevels = new HashSet();
-            for (String levelid : returnQueue) {
-                Level level = lf.getLevel(levelid);
-                masterLevels.add(level.getMasterLevel().getName());
-            }
-            List results = formatData(
-                    GridInventory.MASTER_LEVEL_QUERY,
-                    masterLevels.toArray(new String[masterLevels.size()]));
-            Collections.sort(results);
-            return results;
+        } catch (CommunicationException e) {
+            statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
+            return super.populateData(selection);
         }
 
     }
@@ -249,8 +260,13 @@ public class GridProductBrowserDataDefinition extends
         } else if (GridInventory.LEVEL_ID_QUERY.equals(param)) {
             Level[] levels = new Level[parameters.length];
             LevelFactory lf = LevelFactory.getInstance();
-            for (int i = 0; i < levels.length; i++) {
-                levels[i] = lf.getLevel(parameters[i]);
+            try {
+                for (int i = 0; i < levels.length; i++) {
+                    levels[i] = lf.getLevel(parameters[i]);
+                }
+            } catch (CommunicationException e) {
+                statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
+                        e);
             }
             Arrays.sort(levels, levelComparator);
             for (int i = 0; i < parameters.length; i++) {
@@ -264,10 +280,15 @@ public class GridProductBrowserDataDefinition extends
             return labels;
         } else if (GridInventory.MASTER_LEVEL_QUERY.equals(param)) {
             LevelFactory lf = LevelFactory.getInstance();
-            for (int i = 0; i < parameters.length; i++) {
-                MasterLevel masterLevel = lf.getMasterLevel(parameters[i]);
-                labels.add(new ProductBrowserLabel(
-                        masterLevel.getDescription(), masterLevel.getName()));
+            try {
+                for (int i = 0; i < parameters.length; i++) {
+                    MasterLevel masterLevel = lf.getMasterLevel(parameters[i]);
+                    labels.add(new ProductBrowserLabel(masterLevel
+                            .getDescription(), masterLevel.getName()));
+                }
+            } catch (CommunicationException e) {
+                statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
+                        e);
             }
         }
         return super.formatData(param, parameters);
@@ -281,14 +302,18 @@ public class GridProductBrowserDataDefinition extends
         }
         HashMap queryList = super
                 .getProductParameters(selection, order);
+        try {
+            // Convert Level id to level one and level two values.
+            Level level = LevelFactory.getInstance().getLevel(selection[4]);
+            queryList.put(GridInventory.LEVEL_ONE_QUERY, new RequestConstraint(
+                    level.getLevelOneValueAsString()));
+            queryList.put(GridInventory.LEVEL_TWO_QUERY, new RequestConstraint(
+                    level.getLevelTwoValueAsString()));
+            queryList.remove(order[4]);
+        } catch (CommunicationException e) {
+            statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
 
-        queryList.remove(order[4]);
-        // Convert Level id to level one and level two values.
-        Level level = LevelFactory.getInstance().getLevel(selection[4]);
-        queryList.put(GridInventory.LEVEL_ONE_QUERY, new RequestConstraint(
-                level.getLevelOneValueAsString()));
-        queryList.put(GridInventory.LEVEL_TWO_QUERY, new RequestConstraint(
-                level.getLevelTwoValueAsString()));
+        }
         return queryList;
     }
 
diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/data/RadarRequestableData.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/data/RadarRequestableData.java
index 9d13977ca6..df22c50f35 100644
--- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/data/RadarRequestableData.java
+++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/data/RadarRequestableData.java
@@ -25,6 +25,7 @@ import java.lang.ref.WeakReference;
 import javax.measure.converter.UnitConverter;
 import javax.measure.unit.Unit;
 
+import com.raytheon.uf.common.comm.CommunicationException;
 import com.raytheon.uf.common.dataplugin.grib.GribModel;
 import com.raytheon.uf.common.dataplugin.grib.GribRecord;
 import com.raytheon.uf.common.dataplugin.grib.spatial.projections.GridCoverage;
@@ -37,6 +38,9 @@ import com.raytheon.uf.common.datastorage.IDataStore;
 import com.raytheon.uf.common.datastorage.Request;
 import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
 import com.raytheon.uf.common.datastorage.records.IDataRecord;
+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.viz.core.HDF5Util;
 import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
 import com.raytheon.uf.viz.core.exception.VizException;
@@ -61,6 +65,8 @@ import com.raytheon.viz.radar.util.DataUtilities;
  */
 
 public class RadarRequestableData extends GribRequestableData {
+    private static final transient IUFStatusHandler statusHandler = UFStatus
+            .getHandler(RadarRequestableData.class);
 
     private RadarRecord radarSource;
 
@@ -80,8 +86,13 @@ public class RadarRequestableData extends GribRequestableData {
                 RadarAdapter.getGridSpacing());
         this.source = "radar";
         this.dataTime = source.getDataTime();
-        this.level = LevelFactory.getInstance().getLevel("TILT",
-                source.getPrimaryElevationAngle());
+        try {
+            this.level = LevelFactory.getInstance().getLevel("TILT",
+                    source.getPrimaryElevationAngle());
+        } catch (CommunicationException e1) {
+            statusHandler
+                    .handle(Priority.PROBLEM, e1.getLocalizedMessage(), e1);
+        }
         this.parameter = parameterAbbrev;
         this.parameterName = "";
         this.unit = unit;
@@ -146,14 +157,12 @@ public class RadarRequestableData extends GribRequestableData {
             fdr.setDimension(2);
             cache = new WeakReference(fdr);
         }
-        if (arg == null) {
-            return new IDataRecord[] { fdr };
-        } else if (arg instanceof Request) {
+        if (arg instanceof Request) {
             fdr = SliceUtil.slice(fdr, (Request) arg);
             return new IDataRecord[] { fdr };
+        } else {
+            return new IDataRecord[] { fdr };
         }
-        throw new VizException(this.getClass().getSimpleName()
-                + " cannot process request of type: "
-                + arg.getClass().getSimpleName());
+
     }
 }
diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/data/StaticGridRequestableData.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/data/StaticGridRequestableData.java
index b1224e25db..a5a72b9e01 100644
--- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/data/StaticGridRequestableData.java
+++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/data/StaticGridRequestableData.java
@@ -21,6 +21,7 @@ package com.raytheon.viz.grid.data;
 
 import javax.measure.unit.SI;
 
+import com.raytheon.uf.common.comm.CommunicationException;
 import com.raytheon.uf.common.dataplugin.grib.spatial.projections.GridCoverage;
 import com.raytheon.uf.common.dataplugin.grib.util.GribModelLookup;
 import com.raytheon.uf.common.dataplugin.grib.util.GridModel;
@@ -29,6 +30,9 @@ import com.raytheon.uf.common.dataplugin.grib.util.StaticGridDataType;
 import com.raytheon.uf.common.dataplugin.level.LevelFactory;
 import com.raytheon.uf.common.datastorage.Request;
 import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
+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.viz.core.exception.VizException;
 import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
 import com.raytheon.viz.grid.util.CoverageUtils;
@@ -51,6 +55,9 @@ import com.raytheon.viz.grid.util.SliceUtil;
  */
 
 public class StaticGridRequestableData extends AbstractRequestableData {
+    private static final transient IUFStatusHandler statusHandler = UFStatus
+            .getHandler(StaticGridRequestableData.class);
+
     private StaticGridDataType dataType;
 
     public StaticGridRequestableData(StaticGridDataType dataType, String source) {
@@ -63,7 +70,11 @@ public class StaticGridRequestableData extends AbstractRequestableData {
         } else {
             this.unit = SI.METER;
         }
-        this.level = LevelFactory.getInstance().getLevel("SFC", 0.0);
+        try {
+            this.level = LevelFactory.getInstance().getLevel("SFC", 0.0);
+        } catch (CommunicationException e) {
+            statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
+        }
     }
 
     /*
@@ -107,13 +118,11 @@ public class StaticGridRequestableData extends AbstractRequestableData {
                 break;
             }
         }
-        if (arg == null) {
-            return rval;
-        } else if (arg instanceof Request) {
+        if (arg instanceof Request) {
             return SliceUtil.slice(rval, (Request) arg);
+        } else {
+            return rval;
         }
-        throw new VizException(this.getClass().getSimpleName()
-                + " cannot process request of type: "
-                + arg.getClass().getSimpleName());
+
     }
 }
\ No newline at end of file
diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/data/TopoRequestableData.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/data/TopoRequestableData.java
index 5ad8c7baca..8bf10dbf3d 100644
--- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/data/TopoRequestableData.java
+++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/data/TopoRequestableData.java
@@ -26,10 +26,14 @@ import javax.measure.unit.SI;
 
 import org.geotools.coverage.grid.GridGeometry2D;
 
+import com.raytheon.uf.common.comm.CommunicationException;
 import com.raytheon.uf.common.dataplugin.grib.spatial.projections.GridCoverage;
 import com.raytheon.uf.common.dataplugin.level.LevelFactory;
 import com.raytheon.uf.common.datastorage.Request;
 import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
+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.viz.core.exception.VizException;
 import com.raytheon.uf.viz.core.topo.TopoQuery;
 import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
@@ -53,6 +57,9 @@ import com.raytheon.viz.grid.util.SliceUtil;
  */
 
 public class TopoRequestableData extends AbstractRequestableData {
+    private static final transient IUFStatusHandler statusHandler = UFStatus
+            .getHandler(TopoRequestableData.class);
+
     // need to move to a static timed cache
     private static Map topoCache = new HashMap();
 
@@ -61,7 +68,11 @@ public class TopoRequestableData extends AbstractRequestableData {
         this.parameter = "staticTopo";
         this.parameterName = "Topography";
         this.unit = SI.METER;
-        this.level = LevelFactory.getInstance().getLevel("SFC", 0.0);
+        try {
+            this.level = LevelFactory.getInstance().getLevel("SFC", 0.0);
+        } catch (CommunicationException e) {
+            statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
+        }
     }
 
     /*
@@ -85,13 +96,10 @@ public class TopoRequestableData extends AbstractRequestableData {
                 topoCache.put(coverage, rval);
             }
         }
-        if (arg == null) {
-            return rval;
-        } else if (arg instanceof Request) {
+        if (arg instanceof Request) {
             return SliceUtil.slice(rval, (Request) arg);
+        } else {
+            return rval;
         }
-        throw new VizException(this.getClass().getSimpleName()
-                + " cannot process request of type: "
-                + arg.getClass().getSimpleName());
     }
 }
diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/GridInventory.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/GridInventory.java
index a8514e8694..ac9eb491c5 100644
--- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/GridInventory.java
+++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/GridInventory.java
@@ -131,7 +131,8 @@ public class GridInventory extends AbstractInventory implements
     private List> failedRequests = new ArrayList>();
 
     @Override
-    public void initTree(Map derParLibrary) {
+    public void initTree(Map derParLibrary)
+            throws VizException {
         super.initTree(derParLibrary);
         if (updater == null) {
             updater = new GridUpdater(this);
@@ -144,32 +145,28 @@ public class GridInventory extends AbstractInventory implements
     }
 
     public void reinitTree() {
-        initTree(derParLibrary);
-        // reprocess all failed requests to see if data has become available.
-        List> constraintsToTry = this.failedRequests;
-        this.failedRequests = new ArrayList>(
-                failedRequests.size());
-        for (Map constraints : constraintsToTry) {
-            evaluateRequestConstraints(constraints);
+        try {
+            initTree(derParLibrary);
+            // reprocess all failed requests to see if data has become
+            // available.
+            List> constraintsToTry = this.failedRequests;
+            this.failedRequests = new ArrayList>(
+                    failedRequests.size());
+            for (Map constraints : constraintsToTry) {
+                evaluateRequestConstraints(constraints);
+            }
+        } catch (VizException e) {
+            statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
         }
-
     }
 
-    private DataTree getTreeFromEdex() {
+    private DataTree getTreeFromEdex() throws VizException {
         String request = "from com.raytheon.edex.uengine.tasks.grib import GridCatalog\n"
                 + "from com.raytheon.uf.common.message.response import ResponseMessageGeneric\n"
                 + "test = GridCatalog()\n"
                 + "return ResponseMessageGeneric(test.execute())";
         Object[] tree = null;
-        try {
-            tree = Connector.getInstance().connect(request, null, 60000);
-        } catch (VizCommunicationException e) {
-            statusHandler.handle(Priority.PROBLEM,
-                    "Error communicating with server.", e);
-        } catch (VizException e) {
-            statusHandler.handle(Priority.PROBLEM,
-                    "Error occurred while retrieving grid tree.", e);
-        }
+        tree = Connector.getInstance().connect(request, null, 60000);
         if (tree != null) {
             return (DataTree) tree[0];
         }
@@ -266,7 +263,7 @@ public class GridInventory extends AbstractInventory implements
         return null;
     }
 
-    protected DataTree createBaseTree() {
+    protected DataTree createBaseTree() throws VizException {
         DataTree newTree = getTreeFromEdex();
         if (newTree == null) {
             return newTree;
@@ -639,7 +636,8 @@ public class GridInventory extends AbstractInventory implements
 
     @Override
     protected LevelNode getCubeNode(SourceNode sNode, DerivParamField field,
-            Deque stack, Set nodata) {
+            Deque stack, Set nodata)
+            throws VizCommunicationException {
         StackEntry se = new StackEntry(sNode.getValue(), field.getParam(),
                 Long.MIN_VALUE);
         if (stack.contains(se)) {
@@ -654,8 +652,14 @@ public class GridInventory extends AbstractInventory implements
         String masterLevelName = get3DMasterLevel(sNode.getValue());
         boolean isRadar = sNode.getValue().equals(RadarAdapter.RADAR_SOURCE);
 
-        NavigableSet levels = LevelUtilities
-                .getOrderedSetOfStandardLevels(masterLevelName);
+        NavigableSet levels = null;
+        try {
+            levels = LevelUtilities
+                    .getOrderedSetOfStandardLevels(masterLevelName);
+        } catch (VizCommunicationException e) {
+            statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
+            return null;
+        }
         List> cubeLevels = new ArrayList>(
                 levels.size());
 
diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/GridUpdater.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/GridUpdater.java
index c89b400566..a828ac2f1b 100644
--- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/GridUpdater.java
+++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/GridUpdater.java
@@ -28,6 +28,7 @@ import java.util.Map;
 import java.util.Set;
 
 import com.raytheon.edex.util.Util;
+import com.raytheon.uf.common.comm.CommunicationException;
 import com.raytheon.uf.common.dataplugin.PluginException;
 import com.raytheon.uf.common.dataplugin.grib.GribModel;
 import com.raytheon.uf.common.dataplugin.grib.GribRecord;
@@ -215,11 +216,18 @@ public class GridUpdater implements IAlertObserver {
             }
             GribMapKey updateKey = new GribMapKey(alert.decodedAlert);
             GribTimeCache.getInstance().clearTimes(updateKey);
-            Level level = LevelFactory.getInstance().getLevel(
-                    updateKey.masterLevel, updateKey.levelone,
-                    updateKey.leveltwo);
-            LevelNode lNode = inventory.getNode(updateKey.modelName,
-                    updateKey.parameter, level);
+            LevelNode lNode = null;
+            try {
+                Level level = LevelFactory.getInstance().getLevel(
+                        updateKey.masterLevel, updateKey.levelone,
+                        updateKey.leveltwo);
+                lNode = inventory.getNode(updateKey.modelName,
+                        updateKey.parameter, level);
+            } catch (CommunicationException e) {
+                statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
+                        e);
+            }
+
             if (lNode == null) {
                 inventory.reinitTree();
                 // System.out.println(alert.dataURI);
diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/RadarUpdater.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/RadarUpdater.java
index 1476fd5dfd..2544f574d4 100644
--- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/RadarUpdater.java
+++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/RadarUpdater.java
@@ -7,6 +7,7 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 
+import com.raytheon.uf.common.comm.CommunicationException;
 import com.raytheon.uf.common.dataplugin.PluginException;
 import com.raytheon.uf.common.dataplugin.grib.GribModel;
 import com.raytheon.uf.common.dataplugin.grib.GribRecord;
@@ -157,8 +158,14 @@ public class RadarUpdater implements IAlertObserver {
             }
             Double elevationAngle = (Double) obj;
             cache.remove(new CacheKey(productCode, elevationAngle));
-            Level level = LevelFactory.getInstance().getLevel(
-                    RadarAdapter.CUBE_MASTER_LEVEL_NAME, elevationAngle);
+            Level level = null;
+            try {
+                level = LevelFactory.getInstance().getLevel(
+                        RadarAdapter.CUBE_MASTER_LEVEL_NAME, elevationAngle);
+            } catch (CommunicationException e1) {
+                statusHandler.handle(Priority.PROBLEM,
+                        e1.getLocalizedMessage(), e1);
+            }
             GribRecord fakeRec = new GribRecord();
             fakeRec.setPluginName("grib");
             fakeRec.setDataTime(time);
diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/GridNameGenerator.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/GridNameGenerator.java
index 5bd44574ec..325d21bc54 100644
--- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/GridNameGenerator.java
+++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/GridNameGenerator.java
@@ -22,6 +22,7 @@ package com.raytheon.viz.grid.rsc;
 import com.raytheon.uf.common.dataplugin.grib.GribModel;
 import com.raytheon.uf.common.dataplugin.level.Level;
 import com.raytheon.uf.common.time.DataTime;
+import com.raytheon.uf.viz.core.exception.VizCommunicationException;
 import com.raytheon.uf.viz.core.level.LevelMapping;
 import com.raytheon.uf.viz.core.level.LevelMappingFactory;
 import com.raytheon.uf.viz.core.rsc.AbstractNameGenerator;
@@ -118,12 +119,17 @@ public class GridNameGenerator extends AbstractNameGenerator {
     }
 
     private String lookupPlane(Level level) {
-        LevelMapping mapping = LevelMappingFactory.getInstance()
-                .getLevelMappingForLevel(level);
-        if (mapping == null) {
+        try {
+            LevelMapping mapping = LevelMappingFactory.getInstance()
+                    .getLevelMappingForLevel(level);
+            if (mapping == null) {
+                return level.getMasterLevel().getName();
+            }
+            return mapping.getDisplayName();
+        } catch (VizCommunicationException e) {
             return level.getMasterLevel().getName();
+
         }
-        return mapping.getDisplayName();
     }
 
     public void setPlaneLabelString(String planeLabelString) {
diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/util/GribDataCubeAdapter.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/util/GribDataCubeAdapter.java
index 78ff2716ce..96936a68e1 100644
--- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/util/GribDataCubeAdapter.java
+++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/util/GribDataCubeAdapter.java
@@ -56,6 +56,9 @@ import com.raytheon.uf.common.datastorage.records.IDataRecord;
 import com.raytheon.uf.common.geospatial.ISpatialEnabled;
 import com.raytheon.uf.common.geospatial.ISpatialObject;
 import com.raytheon.uf.common.pointdata.PointDataContainer;
+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.HDF5Util;
 import com.raytheon.uf.viz.core.catalog.LayerProperty;
@@ -65,7 +68,6 @@ import com.raytheon.uf.viz.core.datastructure.VizDataCubeException;
 import com.raytheon.uf.viz.core.exception.VizException;
 import com.raytheon.uf.viz.core.requests.ThriftClient;
 import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
-import com.raytheon.uf.viz.derivparam.library.DerivParamDesc;
 import com.raytheon.uf.viz.derivparam.library.DerivedParameterGenerator;
 import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableLevelNode;
 import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableLevelNode.Dependency;
@@ -89,13 +91,13 @@ import com.raytheon.viz.grid.record.RequestableDataRecord;
  * @version 1.0
  */
 public class GribDataCubeAdapter implements IDataCubeAdapter {
+    private static final transient IUFStatusHandler statusHandler = UFStatus
+            .getHandler(GribDataCubeAdapter.class);
 
     private static final String DERIVED = "DERIVED";
 
     private GridInventory gridInventory;
 
-    private Map derParLibrary;
-
     protected void getTimeQuery(
             AbstractRequestableLevelNode req,
             boolean latestOnly,
@@ -293,17 +295,33 @@ public class GribDataCubeAdapter implements IDataCubeAdapter {
 
     @Override
     public void initInventory() {
-        derParLibrary = DerivedParameterGenerator.getDerParLibrary();
         if (gridInventory == null) {
             GridInventory gridInventory = new GridInventory();
-            gridInventory.initTree(derParLibrary);
-            this.gridInventory = gridInventory;
+            try {
+                gridInventory.initTree(DerivedParameterGenerator
+                        .getDerParLibrary());
+                this.gridInventory = gridInventory;
+            } catch (VizException e) {
+                statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
+                        e);
+            }
         }
 
     }
 
     @Override
     public Object getInventory() {
+        if (gridInventory == null) {
+            GridInventory gridInventory = new GridInventory();
+            try {
+                gridInventory.initTree(DerivedParameterGenerator
+                        .getDerParLibrary());
+                this.gridInventory = gridInventory;
+            } catch (VizException e) {
+                statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
+                        e);
+            }
+        }
         return gridInventory;
     }
 
diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/util/RadarAdapter.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/util/RadarAdapter.java
index 78c0d75788..7d2c2b252a 100644
--- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/util/RadarAdapter.java
+++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/util/RadarAdapter.java
@@ -34,6 +34,7 @@ import org.opengis.geometry.DirectPosition;
 import org.opengis.referencing.crs.ProjectedCRS;
 import org.opengis.referencing.operation.MathTransform;
 
+import com.raytheon.uf.common.comm.CommunicationException;
 import com.raytheon.uf.common.dataplugin.level.Level;
 import com.raytheon.uf.common.dataplugin.level.LevelFactory;
 import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
@@ -309,7 +310,12 @@ public class RadarAdapter {
      * @param level
      */
     private void initTopoParam(SourceNode modelNameNode) {
-        Level sfc = LevelFactory.getInstance().getLevel("SFC", 0.0);
+        Level sfc = null;
+        try {
+            sfc = LevelFactory.getInstance().getLevel("SFC", 0.0);
+        } catch (CommunicationException e) {
+            statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
+        }
         DerivParamDesc topo = new DerivParamDesc();
         topo.setAbbreviation("Topo");
         topo.setName("Topography");
diff --git a/cave/com.raytheon.viz.pointdata/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.pointdata/META-INF/MANIFEST.MF
index c09543c2e8..844efe3063 100644
--- a/cave/com.raytheon.viz.pointdata/META-INF/MANIFEST.MF
+++ b/cave/com.raytheon.viz.pointdata/META-INF/MANIFEST.MF
@@ -26,6 +26,7 @@ Export-Package: com.raytheon.viz.pointdata,
  com.raytheon.viz.pointdata.rsc.retrieve,
  com.raytheon.viz.pointdata.util
 Import-Package: com.raytheon.edex.meteoLib,
+ com.raytheon.uf.common.comm,
  com.raytheon.uf.common.dataplugin.level,
  com.raytheon.uf.common.derivparam.tree,
  com.raytheon.uf.common.message.response,
diff --git a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/PlotModelDataDefinition.java b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/PlotModelDataDefinition.java
index 1240785ba5..e7af85ceba 100644
--- a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/PlotModelDataDefinition.java
+++ b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/PlotModelDataDefinition.java
@@ -15,6 +15,7 @@ import java.util.Set;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.LinkedBlockingQueue;
 
+import com.raytheon.uf.common.comm.CommunicationException;
 import com.raytheon.uf.common.dataplugin.level.Level;
 import com.raytheon.uf.common.dataplugin.level.LevelFactory;
 import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
@@ -23,8 +24,12 @@ import com.raytheon.uf.common.localization.LocalizationContext;
 import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
 import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
 import com.raytheon.uf.common.localization.PathManagerFactory;
+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.BinOffset;
 import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
+import com.raytheon.uf.viz.core.exception.VizCommunicationException;
 import com.raytheon.uf.viz.core.exception.VizException;
 import com.raytheon.uf.viz.core.level.LevelMappingFactory;
 import com.raytheon.uf.viz.core.map.MapDescriptor;
@@ -39,6 +44,8 @@ import com.raytheon.viz.pointdata.util.PointDataInventory;
 
 public class PlotModelDataDefinition extends
         AbstractRequestableProductBrowserDataDefinition {
+    private static final transient IUFStatusHandler statusHandler = UFStatus
+            .getHandler(PlotModelDataDefinition.class);
 
     private static final String PLOTLOCATION = "plotModels";
 
@@ -271,10 +278,18 @@ public class PlotModelDataDefinition extends
         }
         List validLevels = new ArrayList();
         for (String levelid : possibleLevels) {
-            Level level = LevelFactory.getInstance().getLevel(
-                    Long.parseLong(levelid));
-            validLevels.add(LevelMappingFactory.getInstance()
-                    .getLevelMappingForLevel(level).getDisplayName());
+            try {
+                Level level = LevelFactory.getInstance().getLevel(
+                        Long.parseLong(levelid));
+                validLevels.add(LevelMappingFactory.getInstance()
+                        .getLevelMappingForLevel(level).getDisplayName());
+            } catch (CommunicationException e) {
+                statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
+                        e);
+            } catch (VizCommunicationException e) {
+                statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
+                        e);
+            }
         }
         return validLevels.toArray(new String[0]);
     }
diff --git a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/AbstractPointDataInventory.java b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/AbstractPointDataInventory.java
index 215d780b09..cec653fa2a 100644
--- a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/AbstractPointDataInventory.java
+++ b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/AbstractPointDataInventory.java
@@ -40,6 +40,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
 import com.raytheon.uf.common.time.DataTime;
 import com.raytheon.uf.viz.core.RecordFactory;
 import com.raytheon.uf.viz.core.catalog.CatalogQuery;
+import com.raytheon.uf.viz.core.exception.VizCommunicationException;
 import com.raytheon.uf.viz.core.exception.VizException;
 import com.raytheon.uf.viz.core.level.LevelMappingFactory;
 import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
@@ -71,9 +72,6 @@ public abstract class AbstractPointDataInventory extends AbstractInventory {
     private static final transient IUFStatusHandler statusHandler = UFStatus
             .getHandler(AbstractPointDataInventory.class);
 
-    public static final Level STATION = LevelMappingFactory.getInstance()
-            .getLevelMappingForKey("Station").getLevels().get(0);
-
     public static String PLUGIN_NAME = "pluginName";
 
     protected List plugins;
@@ -135,7 +133,7 @@ public abstract class AbstractPointDataInventory extends AbstractInventory {
 
     protected DataTree getInitialTree() {
         DataTree tree = new DataTree();
-        String stationId = Long.toString(STATION.getId());
+        String stationId = Long.toString(getStationLevel().getId());
         for (String pluginName : plugins) {
             try {
                 String[] types = getAvailableTypes(pluginName);
@@ -276,4 +274,14 @@ public abstract class AbstractPointDataInventory extends AbstractInventory {
         return plugins;
     }
 
+    public static Level getStationLevel() {
+        try {
+            return LevelMappingFactory.getInstance()
+                    .getLevelMappingForKey("Station").getLevels().get(0);
+        } catch (VizCommunicationException e) {
+            statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
+            return null;
+        }
+    }
+
 }
diff --git a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/PointAccumLevelNode.java b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/PointAccumLevelNode.java
index 61c7d2c2b3..75d5305eee 100644
--- a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/PointAccumLevelNode.java
+++ b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/PointAccumLevelNode.java
@@ -65,7 +65,7 @@ public class PointAccumLevelNode extends AbstractDerivedLevelNode {
     public PointAccumLevelNode(DerivParamDesc desc, DerivParamMethod method,
             List idNodes,
             AbstractRequestableLevelNode timeNode) {
-        super(PointDataInventory.STATION, desc, method, null);
+        super(PointDataInventory.getStationLevel(), desc, method, null);
         this.idNodes = idNodes;
         this.timeNode = timeNode;
     }
diff --git a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/PointDataCubeAdapter.java b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/PointDataCubeAdapter.java
index 27772327a4..3203d28b3b 100644
--- a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/PointDataCubeAdapter.java
+++ b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/PointDataCubeAdapter.java
@@ -37,6 +37,9 @@ import com.raytheon.uf.common.datastorage.Request;
 import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
 import com.raytheon.uf.common.datastorage.records.IDataRecord;
 import com.raytheon.uf.common.pointdata.PointDataContainer;
+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.RecordFactory;
 import com.raytheon.uf.viz.core.catalog.LayerProperty;
@@ -49,7 +52,6 @@ import com.raytheon.uf.viz.core.exception.VizException;
 import com.raytheon.uf.viz.core.level.LevelMappingFactory;
 import com.raytheon.uf.viz.core.requests.ThriftClient;
 import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
-import com.raytheon.uf.viz.derivparam.library.DerivParamDesc;
 import com.raytheon.uf.viz.derivparam.library.DerivedParameterGenerator;
 import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableLevelNode;
 import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableLevelNode.Dependency;
@@ -76,6 +78,8 @@ import com.raytheon.viz.pointdata.PointDataRequest;
  */
 
 public class PointDataCubeAdapter implements IDataCubeAdapter {
+    private static final transient IUFStatusHandler statusHandler = UFStatus
+            .getHandler(PointDataCubeAdapter.class);
 
     public static String PLUGIN_NAME = PointDataInventory.PLUGIN_NAME;
 
@@ -88,8 +92,6 @@ public class PointDataCubeAdapter implements IDataCubeAdapter {
 
     protected AbstractPointDataInventory inventory;
 
-    protected Map derParLibrary;
-
     /*
      * (non-Javadoc)
      * 
@@ -112,6 +114,9 @@ public class PointDataCubeAdapter implements IDataCubeAdapter {
      */
     @Override
     public Object getInventory() {
+        if (inventory == null) {
+            initInventory();
+        }
         return this.inventory;
     }
 
@@ -301,12 +306,17 @@ public class PointDataCubeAdapter implements IDataCubeAdapter {
      */
     @Override
     public void initInventory() {
-        derParLibrary = DerivedParameterGenerator.getDerParLibrary();
         if (inventory == null) {
             PointDataInventory pointInventory = new PointDataInventory(
                     Arrays.asList(supportedPlugins));
-            pointInventory.initTree(derParLibrary);
-            this.inventory = pointInventory;
+            try {
+                pointInventory.initTree(DerivedParameterGenerator
+                        .getDerParLibrary());
+                this.inventory = pointInventory;
+            } catch (VizException e) {
+                statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
+                        e);
+            }
         }
     }
 
diff --git a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/PointDataInventory.java b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/PointDataInventory.java
index 5b0b07c122..8b99479f3e 100644
--- a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/PointDataInventory.java
+++ b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/PointDataInventory.java
@@ -112,7 +112,12 @@ public class PointDataInventory extends AbstractPointDataInventory implements
             }
 
             if (getAllSources() != null && !getAllSources().contains(source)) {
-                initTree(derParLibrary);
+                try {
+                    initTree(derParLibrary);
+                } catch (VizException e) {
+                    statusHandler.handle(Priority.PROBLEM,
+                            e.getLocalizedMessage(), e);
+                }
             }
         }
     }
diff --git a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/PointRequestableData.java b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/PointRequestableData.java
index ae1a4c015e..52b4fcc14c 100644
--- a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/PointRequestableData.java
+++ b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/PointRequestableData.java
@@ -48,7 +48,7 @@ public class PointRequestableData extends AbstractRequestableData {
     public PointRequestableData(IDataRecord rec, Unit unit) {
         this.unit = unit;
         this.rec = rec;
-        this.level = PointDataInventory.STATION;
+        this.level = PointDataInventory.getStationLevel();
         this.parameter = rec.getName();
     }
 
diff --git a/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/util/RadarDataCubeAdapter.java b/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/util/RadarDataCubeAdapter.java
index c13d3b4122..7bec38cf7c 100644
--- a/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/util/RadarDataCubeAdapter.java
+++ b/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/util/RadarDataCubeAdapter.java
@@ -35,6 +35,9 @@ import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
 import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
 import com.raytheon.uf.common.dataquery.responses.DbQueryResponseSet;
 import com.raytheon.uf.common.pointdata.PointDataContainer;
+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.BinOffset;
 import com.raytheon.uf.common.time.DataTime;
 import com.raytheon.uf.viz.core.exception.VizException;
@@ -61,6 +64,9 @@ import com.raytheon.viz.pointdata.util.PointDataCubeAdapter;
  * @version 1.0
  */
 public class RadarDataCubeAdapter extends PointDataCubeAdapter {
+    private static final transient IUFStatusHandler statusHandler = UFStatus
+            .getHandler(RadarDataCubeAdapter.class);
+
     private static final String DATA_TIME_FIELD = "dataTime";
 
     private static final String LATEST_DATA_TIME_FIELD = "dataTime.refTime";
@@ -74,11 +80,16 @@ public class RadarDataCubeAdapter extends PointDataCubeAdapter {
 
     @Override
     public void initInventory() {
-        derParLibrary = DerivedParameterGenerator.getDerParLibrary();
         if (inventory == null) {
             AbstractPointDataInventory pointInventory = new VwpInventory();
-            pointInventory.initTree(derParLibrary);
-            this.inventory = pointInventory;
+            try {
+                pointInventory.initTree(DerivedParameterGenerator
+                        .getDerParLibrary());
+                this.inventory = pointInventory;
+            } catch (VizException e) {
+                statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
+                        e);
+            }
         }
     }
 
diff --git a/cave/com.raytheon.viz.volumebrowser/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.volumebrowser/META-INF/MANIFEST.MF
index 81b5aae3a0..487536aafc 100644
--- a/cave/com.raytheon.viz.volumebrowser/META-INF/MANIFEST.MF
+++ b/cave/com.raytheon.viz.volumebrowser/META-INF/MANIFEST.MF
@@ -38,7 +38,8 @@ Export-Package: com.raytheon.viz.volumebrowser,
  com.raytheon.viz.volumebrowser.datacatalog,
  com.raytheon.viz.volumebrowser.vbui,
  com.raytheon.viz.volumebrowser.xml
-Import-Package: com.raytheon.uf.common.dataplugin.grib,
+Import-Package: com.raytheon.uf.common.comm,
+ com.raytheon.uf.common.dataplugin.grib,
  com.raytheon.uf.common.dataplugin.grib.spatial.projections,
  com.raytheon.uf.common.dataplugin.grib.util,
  com.raytheon.uf.common.dataplugin.level,
diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/catalog/GridDataCatalog.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/catalog/GridDataCatalog.java
index c0985b8dad..afaf9cbc4a 100644
--- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/catalog/GridDataCatalog.java
+++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/catalog/GridDataCatalog.java
@@ -40,6 +40,7 @@ import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Label;
 
+import com.raytheon.uf.common.comm.CommunicationException;
 import com.raytheon.uf.common.dataplugin.grib.util.GribModelLookup;
 import com.raytheon.uf.common.dataplugin.grib.util.GridModel;
 import com.raytheon.uf.common.dataplugin.level.Level;
@@ -58,15 +59,15 @@ import com.raytheon.viz.grid.rsc.GridResourceData;
  * 
  * 
  * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * 11/29/2006   #7         brockwoo    Initial creation
- * 12/05/2006   #98        brockwoo    Fix for the grid parameter list not
- *                                     updating when only the model time
- *                                     changes
- * Aug 27, 2008 1502       dglazesk    Updated to use JAXB marshalling
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * 11/29/2006   #7         brockwoo    Initial creation
+ * 12/05/2006   #98        brockwoo    Fix for the grid parameter list not
+ *                                     updating when only the model time
+ *                                     changes
+ * Aug 27, 2008 1502       dglazesk    Updated to use JAXB marshalling
  *                                     Switched to GridModel from plugin-grib
  * 
  * 
@@ -267,10 +268,14 @@ public class GridDataCatalog implements IDataCatalog { LevelFactory lf = LevelFactory.getInstance(); for (int i = 0; i < levelIds.length; i++) { - Level level = lf.getLevel(levelIds[i]); - levelNames[i] = level.getMasterLevel().getName() - + level.getLevelInfo(); - this.levelList.put(levelNames[i], level); + try { + Level level = lf.getLevel(levelIds[i]); + levelNames[i] = level.getMasterLevel().getName() + + level.getLevelInfo(); + this.levelList.put(levelNames[i], level); + } catch (CommunicationException e) { + e.printStackTrace(); + } } Arrays.sort(levelNames); diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractDataCatalog.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractDataCatalog.java index d463f5ea27..045eb99f11 100644 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractDataCatalog.java +++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractDataCatalog.java @@ -33,6 +33,7 @@ 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.viz.core.drawables.ResourcePair; +import com.raytheon.uf.viz.core.exception.VizCommunicationException; import com.raytheon.uf.viz.core.level.LevelMapping; import com.raytheon.uf.viz.core.level.LevelMappingFactory; import com.raytheon.uf.viz.core.level.LevelUtilities; @@ -344,15 +345,25 @@ public abstract class AbstractDataCatalog implements IDataCatalog { String planesKey = catalogEntry.getSelectedData().getPlanesKey(); - LevelMappingFactory lmf = LevelMappingFactory.getInstance(); Collection levels = Collections.emptyList(); if (planesKey.startsWith("spatial-")) { - levels = LevelUtilities.getOrderedSetOfStandardLevels(planesKey - .replace("spatial-", "")); + try { + levels = LevelUtilities.getOrderedSetOfStandardLevels(planesKey + .replace("spatial-", "")); + } catch (VizCommunicationException e) { + statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), + e); + } } else { - LevelMapping lm = lmf.getLevelMappingForKey(planesKey); - if (lm != null) { - levels = lm.getLevels(); + try { + LevelMappingFactory lmf = LevelMappingFactory.getInstance(); + LevelMapping lm = lmf.getLevelMappingForKey(planesKey); + if (lm != null) { + levels = lm.getLevels(); + } + } catch (VizCommunicationException e) { + statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), + e); } } ParamLevelMatchCriteria match = new ParamLevelMatchCriteria(); diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractInventoryDataCatalog.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractInventoryDataCatalog.java index bdc23ad46b..e4bc9d0202 100644 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractInventoryDataCatalog.java +++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractInventoryDataCatalog.java @@ -35,12 +35,14 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; +import com.raytheon.uf.common.comm.CommunicationException; import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.level.LevelFactory; 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.viz.core.datastructure.DataCubeContainer; +import com.raytheon.uf.viz.core.exception.VizCommunicationException; import com.raytheon.uf.viz.core.level.LevelMapping; import com.raytheon.uf.viz.core.level.LevelMappingFactory; import com.raytheon.uf.viz.core.level.LevelUtilities; @@ -172,22 +174,31 @@ public abstract class AbstractInventoryDataCatalog extends AbstractDataCatalog { String levelStr = levelQueue.poll(); while (levelStr != null) { // Convert levels into planes. - Level level = LevelFactory.getInstance().getLevel(levelStr); + try { + Level level = LevelFactory.getInstance().getLevel(levelStr); - if (levels3D.contains(level)) { - for (String plane : get3DPlanes(sourcesToProcess)) { - request.addAvailablePlane(plane); + if (levels3D.contains(level)) { + for (String plane : get3DPlanes(sourcesToProcess)) { + request.addAvailablePlane(plane); + } } - } - request.addAvailablePlane("spatial-" - + level.getMasterLevel().getName()); - LevelMapping lm = LevelMappingFactory.getInstance() - .getLevelMappingForLevel(level); + request.addAvailablePlane("spatial-" + + level.getMasterLevel().getName()); + try { + LevelMapping lm = LevelMappingFactory.getInstance() + .getLevelMappingForLevel(level); - if (lm != null) { - request.addAvailablePlane(lm.getKey()); + if (lm != null) { + request.addAvailablePlane(lm.getKey()); + } + } catch (VizCommunicationException e) { + statusHandler.handle(Priority.PROBLEM, + e.getLocalizedMessage(), e); + } + } catch (CommunicationException e) { + statusHandler.handle(Priority.PROBLEM, + e.getLocalizedMessage(), e); } - levelStr = levelQueue.poll(); } @@ -273,13 +284,23 @@ public abstract class AbstractInventoryDataCatalog extends AbstractDataCatalog { for (String plane : selectedPlanes) { Collection levels = Collections.emptyList(); if (plane.startsWith("spatial-")) { - levels = LevelUtilities.getOrderedSetOfStandardLevels(plane - .replace("spatial-", "")); - + try { + levels = LevelUtilities + .getOrderedSetOfStandardLevels(plane.replace( + "spatial-", "")); + } catch (VizCommunicationException e) { + statusHandler.handle(Priority.PROBLEM, + e.getLocalizedMessage(), e); + } } else { LevelMapping lm = lmf.getLevelMappingForKey(plane); if (lm != null) { - levels = lm.getLevels(); + try { + levels = lm.getLevels(); + } catch (VizCommunicationException e) { + statusHandler.handle(Priority.PROBLEM, + e.getLocalizedMessage(), e); + } } } for (Level l : levels) { diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/GribDataCatalog.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/GribDataCatalog.java index aa46799050..9006de54e8 100644 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/GribDataCatalog.java +++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/GribDataCatalog.java @@ -21,6 +21,7 @@ package com.raytheon.viz.volumebrowser.datacatalog; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -43,6 +44,7 @@ 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.viz.core.drawables.ResourcePair; +import com.raytheon.uf.viz.core.exception.VizCommunicationException; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.level.LevelMappingFactory; import com.raytheon.uf.viz.core.level.LevelUtilities; @@ -177,11 +179,16 @@ public class GribDataCatalog extends AbstractInventoryDataCatalog { .getInvalidLevelValueAsString())); } else { // Get all possible levels for the selected levels - LevelMappingFactory lmf = LevelMappingFactory.getInstance(); - List selectedLevels = new ArrayList(lmf - .getLevelMappingForKey(catalogEntry.selectedPlanesKey) - .getLevels()); - + List selectedLevels = Collections.emptyList(); + try { + LevelMappingFactory lmf = LevelMappingFactory.getInstance(); + selectedLevels = new ArrayList(lmf + .getLevelMappingForKey( + catalogEntry.selectedPlanesKey).getLevels()); + } catch (VizCommunicationException e) { + statusHandler.handle(Priority.PROBLEM, + e.getLocalizedMessage(), e); + } RequestConstraint masterRC = new RequestConstraint(null, ConstraintType.IN); RequestConstraint oneRC = new RequestConstraint(null, @@ -355,21 +362,34 @@ public class GribDataCatalog extends AbstractInventoryDataCatalog { @Override protected Collection get3DLevels() { ArrayList all = new ArrayList(); - NavigableSet tilts = LevelUtilities - .getOrderedSetOfStandardLevels("TILT"); - if (tilts != null) { - all.addAll(tilts); + try { + NavigableSet tilts = LevelUtilities + .getOrderedSetOfStandardLevels("TILT"); + if (tilts != null) { + all.addAll(tilts); + } + } catch (VizCommunicationException e) { + statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); } - NavigableSet pres = LevelUtilities - .getOrderedSetOfStandardLevels("MB"); - if (pres != null) { - all.addAll(pres); + try { + NavigableSet pres = LevelUtilities + .getOrderedSetOfStandardLevels("MB"); + if (pres != null) { + all.addAll(pres); + } + } catch (VizCommunicationException e) { + statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); } - NavigableSet theta = LevelUtilities - .getOrderedSetOfStandardLevels("K"); - if (theta != null) { - all.addAll(theta); + try { + NavigableSet theta = LevelUtilities + .getOrderedSetOfStandardLevels("K"); + if (theta != null) { + all.addAll(theta); + } + } catch (VizCommunicationException e) { + statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); } + return all; } diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/PointDataCatalog.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/PointDataCatalog.java index 298adadb7b..d0f3ded83e 100644 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/PointDataCatalog.java +++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/PointDataCatalog.java @@ -41,6 +41,7 @@ import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.BinOffset; import com.raytheon.uf.viz.core.catalog.DbQuery; +import com.raytheon.uf.viz.core.exception.VizCommunicationException; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.level.LevelMappingFactory; import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; @@ -386,8 +387,13 @@ public class PointDataCatalog extends AbstractInventoryDataCatalog { */ @Override protected Collection get3DLevels() { - return LevelMappingFactory.getInstance() - .getLevelMappingForKey("Station").getLevels(); + try { + return LevelMappingFactory.getInstance() + .getLevelMappingForKey("Station").getLevels(); + } catch (VizCommunicationException e) { + statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); + return Collections.emptyList(); + } } @Override diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.edex.plugin.gfe/META-INF/MANIFEST.MF index 0ce63b9f2b..507e7d408f 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/META-INF/MANIFEST.MF @@ -58,6 +58,7 @@ Import-Package: com.raytheon.edex.db.dao, com.raytheon.edex.util, com.raytheon.edex.util.grib, com.raytheon.uf.common.activetable, + com.raytheon.uf.common.comm, com.raytheon.uf.common.dataplugin, com.raytheon.uf.common.dataplugin.annotations, com.raytheon.uf.common.dataplugin.grib, diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/db/dao/GFEDao.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/db/dao/GFEDao.java index feab28a660..9799c8fb70 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/db/dao/GFEDao.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/db/dao/GFEDao.java @@ -57,6 +57,7 @@ import com.raytheon.edex.plugin.gfe.server.GridParmManager; import com.raytheon.edex.plugin.gfe.server.database.GridDatabase; import com.raytheon.edex.plugin.gfe.util.GridTranslator; import com.raytheon.edex.plugin.gfe.util.SendNotifications; +import com.raytheon.uf.common.comm.CommunicationException; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.gfe.GridDataHistory; @@ -651,16 +652,19 @@ public class GFEDao extends DefaultPluginDao { Level level = null; // to have a level 2, must have a level one - if (levelOnePresent && levelTwoPresent) { - level = LevelFactory.getInstance().getLevel(levelName, - levelValues[0], levelValues[1]); - } else if (levelOnePresent) { - level = LevelFactory.getInstance().getLevel(levelName, - levelValues[0]); - } else { - level = LevelFactory.getInstance().getLevel(levelName, 0.0); + try { + if (levelOnePresent && levelTwoPresent) { + level = LevelFactory.getInstance().getLevel(levelName, + levelValues[0], levelValues[1]); + } else if (levelOnePresent) { + level = LevelFactory.getInstance().getLevel(levelName, + levelValues[0]); + } else { + level = LevelFactory.getInstance().getLevel(levelName, 0.0); + } + } catch (CommunicationException e) { + logger.error(e.getLocalizedMessage(), e); } - if (level == null) { logger.warn("Unable to query D2D parms, ParmID " + id + " does not map to a level"); @@ -1013,7 +1017,7 @@ public class GFEDao extends DefaultPluginDao { throws DataAccessLayerException { QueryResult result = (QueryResult) this .executeNativeSql("select max(dbid) as maxdbid from awips.gfe where dbid like '" - + siteId + "!_GRID!_!_" + modelName + "!_%' escape '!'"); + + siteId + "!_GRID!_!_" + modelName + "!_%' escape '!'"); if (result.getResultCount() == 0) { return null; } else { diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.edex.plugin.grib/META-INF/MANIFEST.MF index 3c252d3631..d199bd7e6f 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.edex.plugin.grib/META-INF/MANIFEST.MF @@ -24,6 +24,7 @@ Require-Bundle: javax.measure, com.raytheon.uf.common.awipstools;bundle-version="1.12.1174", ucar.nc2;bundle-version="1.0.0" Import-Package: com.raytheon.edex.exception, + com.raytheon.uf.common.comm, com.raytheon.uf.common.dataplugin.grib, com.raytheon.uf.common.dataplugin.grib.exception, com.raytheon.uf.common.dataplugin.grib.request, diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/Grib1Decoder.java b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/Grib1Decoder.java index 79b335ed0c..ad605149b9 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/Grib1Decoder.java +++ b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/Grib1Decoder.java @@ -53,6 +53,7 @@ import com.raytheon.edex.util.Util; import com.raytheon.edex.util.grib.Grib1TableMap; import com.raytheon.edex.util.grib.GribParamTranslator; import com.raytheon.edex.util.grib.GribTableLookup; +import com.raytheon.uf.common.comm.CommunicationException; import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.grib.GribModel; import com.raytheon.uf.common.dataplugin.grib.GribRecord; @@ -1225,10 +1226,12 @@ public class Grib1Decoder extends AbstractDecoder { * The level two scale factor * @param value2 * The level two value + * @throws GribException */ private void getLevelInfo(GribModel model, int centerID, int subcenterID, float levelOneNumber, float scaleFactor1, float value1, - float levelTwoNumber, float scaleFactor2, float value2) { + float levelTwoNumber, float scaleFactor2, float value2) + throws GribException { String levelName = null; String levelUnit = null; double levelOneValue = Level.getInvalidLevelValue(); @@ -1281,9 +1284,13 @@ public class Grib1Decoder extends AbstractDecoder { levelOneValue = 0.0; levelTwoValue = Level.getInvalidLevelValue(); } - Level level = LevelFactory.getInstance().getLevel(levelName, - levelOneValue, levelTwoValue, levelUnit); - model.setLevel(level); + try { + Level level = LevelFactory.getInstance().getLevel(levelName, + levelOneValue, levelTwoValue, levelUnit); + model.setLevel(level); + } catch (CommunicationException e) { + throw new GribException("Error requesting levels", e); + } } /** diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/LapsPostProcessor.java b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/LapsPostProcessor.java index fdb2824b5e..e7b7056919 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/LapsPostProcessor.java +++ b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/LapsPostProcessor.java @@ -21,6 +21,7 @@ package com.raytheon.edex.plugin.grib.decoderpostprocessors; import com.raytheon.edex.plugin.grib.util.GribModelCache; +import com.raytheon.uf.common.comm.CommunicationException; import com.raytheon.uf.common.dataplugin.grib.GribModel; import com.raytheon.uf.common.dataplugin.grib.GribRecord; import com.raytheon.uf.common.dataplugin.grib.exception.GribException; @@ -62,9 +63,13 @@ public class LapsPostProcessor implements IDecoderPostProcessor { GribModel gribModel = record.getModelInfo(); boolean modelInfoModified = false; if (levelName.equals(FHAG)) { - Level sfcLevel = LevelFactory.getInstance().getLevel(SFC, 0); - gribModel.setLevel(sfcLevel); - modelInfoModified = true; + try { + Level sfcLevel = LevelFactory.getInstance().getLevel(SFC, 0); + gribModel.setLevel(sfcLevel); + modelInfoModified = true; + } catch (CommunicationException e) { + throw new GribException("Error modifying LAPS records.", e); + } } if (gribModel.getParameterAbbreviation().equals(PMSL)) { diff --git a/edexOsgi/com.raytheon.edex.plugin.radar/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.edex.plugin.radar/META-INF/MANIFEST.MF index 7e1e3df782..4223f2e7f6 100644 --- a/edexOsgi/com.raytheon.edex.plugin.radar/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.edex.plugin.radar/META-INF/MANIFEST.MF @@ -21,7 +21,8 @@ Export-Package: com.raytheon.edex.plugin.radar, com.raytheon.edex.plugin.radar.level2, com.raytheon.edex.uengine.tasks.radar Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Import-Package: com.raytheon.uf.common.menus, +Import-Package: com.raytheon.uf.common.comm, + com.raytheon.uf.common.menus, com.raytheon.uf.common.menus.xml, com.raytheon.uf.common.site.ingest, org.apache.commons.logging, diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.level/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.dataplugin.level/META-INF/MANIFEST.MF index b8934fcc66..062600939d 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.level/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.level/META-INF/MANIFEST.MF @@ -19,4 +19,5 @@ Export-Package: com.raytheon.uf.common.dataplugin.level, com.raytheon.uf.common.dataplugin.level.request, com.raytheon.uf.common.dataplugin.level.xml Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Import-Package: org.hibernate.annotations +Import-Package: com.raytheon.uf.common.comm, + org.hibernate.annotations diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/Level.java b/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/Level.java index 3a10a8fa03..db553ce4bd 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/Level.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/Level.java @@ -38,8 +38,8 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; +import com.raytheon.uf.common.comm.CommunicationException; import com.raytheon.uf.common.dataplugin.annotations.DataURI; -import com.raytheon.uf.common.dataplugin.level.util.Constants; import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject; import com.raytheon.uf.common.serialization.ISerializableObject; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; @@ -71,7 +71,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority; @XmlRootElement @XmlType(namespace = "dataplugin-level") public class Level extends PersistableDataObject implements ISerializableObject { - private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(Level.class); + private static final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(Level.class); public static final double INVALID_VALUE = -999999; @@ -216,7 +217,7 @@ public class Level extends PersistableDataObject implements ISerializableObject dirtyFlag = false; } - public Level getUpperLevel() { + public Level getUpperLevel() throws CommunicationException { Level rval = null; if (isRangeLevel()) { @@ -278,7 +279,7 @@ public class Level extends PersistableDataObject implements ISerializableObject return bestLevel; } - public Level getLowerLevel() { + public Level getLowerLevel() throws CommunicationException { Level rval = null; if (isRangeLevel()) { diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/LevelFactory.java b/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/LevelFactory.java index ed8008a3d0..0ccc5759c5 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/LevelFactory.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/LevelFactory.java @@ -37,6 +37,7 @@ import javax.xml.bind.JAXB; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import com.raytheon.uf.common.comm.CommunicationException; import com.raytheon.uf.common.dataplugin.level.request.GetLevelByIdRequest; import com.raytheon.uf.common.dataplugin.level.request.GetLevelRequest; import com.raytheon.uf.common.dataplugin.level.request.GetMasterLevelRequest; @@ -98,6 +99,10 @@ public class LevelFactory { private ILevelRetrievalAdapter retrievalAdapter = null; + private boolean hasRequestedAllLevels = false; + + private boolean hasRequestedAllMasterLevels = false; + private static final double INVALID_LEVEL = Level.getInvalidLevelValue(); public static LevelFactory getInstance() { @@ -119,43 +124,58 @@ public class LevelFactory { } loadLevelAliases(); - LoadAllMasterLevels(); - loadMasterLevelFiles(); - loadAllLevels(); + try { + loadAllMasterLevels(); + } catch (CommunicationException e) { + ; // This is non-fatal, master levels should still be retrieved + // individually + statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); + } + try { + loadAllLevels(); + } catch (CommunicationException e) { + ; // This is non-fatal, master levels should still be retrieved + // individually + statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); + } } - public void checkMasterLevel(MasterLevel level) { + public void checkMasterLevel(MasterLevel level) + throws CommunicationException { loadMasterLevel(level, true); } - public MasterLevel getMasterLevel(String name) { + public MasterLevel getMasterLevel(String name) + throws CommunicationException { MasterLevel request = new MasterLevel(name); return loadMasterLevel(request, false); } - public Level getLevel(long id) { + public Level getLevel(long id) throws CommunicationException { return loadLevel(id); } - public Level getLevel(String name) { + public Level getLevel(String name) throws CommunicationException { return loadLevel(name); } - public Level getLevel(String name, double levelOneValue) { + public Level getLevel(String name, double levelOneValue) + throws CommunicationException { return getLevel(name, levelOneValue, INVALID_LEVEL, null); } - public Level getLevel(String name, double levelOneValue, String unit) { + public Level getLevel(String name, double levelOneValue, String unit) + throws CommunicationException { return getLevel(name, levelOneValue, INVALID_LEVEL, unit); } public Level getLevel(String name, double levelOneValue, - double levelTwoValue) { + double levelTwoValue) throws CommunicationException { return getLevel(name, levelOneValue, levelTwoValue, null); } public Level getLevel(String name, double levelOneValue, - double levelTwoValue, String unit) { + double levelTwoValue, String unit) throws CommunicationException { Level rval = null; // lookup master level @@ -204,7 +224,8 @@ public class LevelFactory { return rval; } - private MasterLevel loadMasterLevel(MasterLevel level, boolean createFlag) { + private MasterLevel loadMasterLevel(MasterLevel level, boolean createFlag) + throws CommunicationException { MasterLevel rval = null; String levelName = level.getName(); @@ -213,6 +234,9 @@ public class LevelFactory { levelName = levelAliasMap.get(levelName); } + if (!hasRequestedAllMasterLevels) { + loadAllMasterLevels(); + } if (masterLevelCache.containsKey(levelName)) { rval = masterLevelCache.get(levelName); } else if (retrievalAdapter != null) { @@ -243,7 +267,7 @@ public class LevelFactory { return rval; } - private Level loadLevel(Level level) { + private Level loadLevel(Level level) throws CommunicationException { // limit precision to 3 places past the decimal double levelone = ((int) (level.getLevelonevalue() * 1000)) / 1000.0; double leveltwo = ((int) (level.getLeveltwovalue() * 1000)) / 1000.0; @@ -259,6 +283,9 @@ public class LevelFactory { } level.setLevelonevalue(levelone); level.setLeveltwovalue(leveltwo); + if (!hasRequestedAllLevels) { + loadAllLevels(); + } // check if we have already loaded level Level rval = levelCache.get(level); @@ -280,7 +307,10 @@ public class LevelFactory { return rval; } - private Level loadLevel(long id) { + private Level loadLevel(long id) throws CommunicationException { + if (!hasRequestedAllLevels) { + loadAllLevels(); + } // check if we have already loaded level Level rval = levelCacheById.get(id); @@ -298,7 +328,10 @@ public class LevelFactory { return rval; } - private Level loadLevel(String id) { + private Level loadLevel(String id) throws CommunicationException { + if (!hasRequestedAllLevels) { + loadAllLevels(); + } // check if we have already loaded level Level rval = levelCacheByIdAsString.get(id); @@ -386,7 +419,7 @@ public class LevelFactory { } } - private void loadAllLevels() { + private void loadAllLevels() throws CommunicationException { if (retrievalAdapter != null) { LevelContainer container = retrievalAdapter.getAllLevels(); if (container != null) { @@ -408,10 +441,11 @@ public class LevelFactory { } } } + hasRequestedAllLevels = true; } } - private void LoadAllMasterLevels() { + private void loadAllMasterLevels() throws CommunicationException { if (retrievalAdapter != null) { MasterLevelContainer container = retrievalAdapter .getAllMasterLevels(); @@ -426,6 +460,8 @@ public class LevelFactory { } } } + hasRequestedAllMasterLevels = true; + loadMasterLevelFiles(); } } @@ -450,7 +486,7 @@ public class LevelFactory { } - private void loadMasterLevelFile(File file) { + private void loadMasterLevelFile(File file) throws CommunicationException { if (file == null || !file.exists()) { return; } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/MasterLevel.java b/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/MasterLevel.java index 2491294a09..55701cc22f 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/MasterLevel.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/MasterLevel.java @@ -34,11 +34,15 @@ import javax.xml.bind.annotation.XmlRootElement; import org.apache.commons.lang.builder.ToStringBuilder; +import com.raytheon.uf.common.comm.CommunicationException; import com.raytheon.uf.common.dataplugin.annotations.DataURI; import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject; import com.raytheon.uf.common.serialization.ISerializableObject; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.uf.common.status.UFStatus.Priority; /** * MasterLevel - once a field is set it cannot be changed. @@ -61,6 +65,9 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; @XmlRootElement public class MasterLevel extends PersistableDataObject implements ISerializableObject { + private static final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(MasterLevel.class); + private static final long serialVersionUID = 1L; @Id @@ -151,7 +158,12 @@ public class MasterLevel extends PersistableDataObject implements public Progression getProgression() { if (processType) { - processTypeField(); + try { + processTypeField(); + } catch (CommunicationException e) { + statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), + e); + } } return progression; @@ -216,7 +228,7 @@ public class MasterLevel extends PersistableDataObject implements return rval; } - private void processTypeField() { + private void processTypeField() throws CommunicationException { if (type != null && type.trim().length() > 0) { try { setProgression(Progression.valueOf(type)); diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/request/ILevelRetrievalAdapter.java b/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/request/ILevelRetrievalAdapter.java index abaaa13b49..2b92acffd3 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/request/ILevelRetrievalAdapter.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/request/ILevelRetrievalAdapter.java @@ -19,6 +19,7 @@ **/ package com.raytheon.uf.common.dataplugin.level.request; +import com.raytheon.uf.common.comm.CommunicationException; import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.level.LevelContainer; import com.raytheon.uf.common.dataplugin.level.MasterLevel; @@ -39,16 +40,21 @@ import com.raytheon.uf.common.dataplugin.level.MasterLevelContainer; * @version 1.0 */ public interface ILevelRetrievalAdapter { - public abstract Level getLevel(GetLevelRequest request); + public abstract Level getLevel(GetLevelRequest request) + throws CommunicationException; - public abstract Level getLevel(GetLevelByIdRequest request); + public abstract Level getLevel(GetLevelByIdRequest request) + throws CommunicationException; - public abstract MasterLevel getMasterLevel(GetMasterLevelRequest request); + public abstract MasterLevel getMasterLevel(GetMasterLevelRequest request) + throws CommunicationException; public abstract LevelContainer getAllLevelsForMasterLevel( - GetAllLevelsForMasterLevelRequest request); + GetAllLevelsForMasterLevelRequest request) + throws CommunicationException; - public abstract LevelContainer getAllLevels(); + public abstract LevelContainer getAllLevels() throws CommunicationException; - public abstract MasterLevelContainer getAllMasterLevels(); + public abstract MasterLevelContainer getAllMasterLevels() + throws CommunicationException; } diff --git a/edexOsgi/com.raytheon.uf.common.derivparam/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.derivparam/META-INF/MANIFEST.MF index fb343199b5..b67a06b60c 100644 --- a/edexOsgi/com.raytheon.uf.common.derivparam/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.derivparam/META-INF/MANIFEST.MF @@ -9,6 +9,7 @@ Bundle-ActivationPolicy: lazy Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization Eclipse-BuddyPolicy: registered, ext, global Import-Package: com.raytheon.edex.scriptfactory, + com.raytheon.uf.common.comm, com.raytheon.uf.common.dataplugin.level, com.raytheon.uf.common.serialization, com.raytheon.uf.common.serialization.annotations, diff --git a/edexOsgi/com.raytheon.uf.common.derivparam/src/com/raytheon/uf/common/derivparam/tree/LevelNode.java b/edexOsgi/com.raytheon.uf.common.derivparam/src/com/raytheon/uf/common/derivparam/tree/LevelNode.java index 611421be01..fa5f231a00 100644 --- a/edexOsgi/com.raytheon.uf.common.derivparam/src/com/raytheon/uf/common/derivparam/tree/LevelNode.java +++ b/edexOsgi/com.raytheon.uf.common.derivparam/src/com/raytheon/uf/common/derivparam/tree/LevelNode.java @@ -21,6 +21,7 @@ package com.raytheon.uf.common.derivparam.tree; import javax.persistence.Transient; +import com.raytheon.uf.common.comm.CommunicationException; import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.level.LevelFactory; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; @@ -67,7 +68,11 @@ public class LevelNode extends AbstractNode { */ public Level getLevel() { if (value != null && level == null) { - level = LevelFactory.getInstance().getLevel(value); + try { + level = LevelFactory.getInstance().getLevel(value); + } catch (CommunicationException e) { + e.printStackTrace(); + } } return level; } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.level.handler/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.level.handler/META-INF/MANIFEST.MF index cf9c17493b..2437a39d63 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.level.handler/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.plugin.level.handler/META-INF/MANIFEST.MF @@ -9,6 +9,7 @@ Require-Bundle: com.raytheon.uf.common.dataplugin, com.raytheon.uf.common.dataplugin.level, com.raytheon.uf.edex.plugin.level Import-Package: com.raytheon.edex.db.dao, + com.raytheon.uf.common.comm, com.raytheon.uf.common.serialization.comm, com.raytheon.uf.edex.database.plugin, org.apache.commons.logging, diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.level/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.level/META-INF/MANIFEST.MF index 4740682bd5..7687178a07 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.level/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.plugin.level/META-INF/MANIFEST.MF @@ -18,3 +18,4 @@ Require-Bundle: com.raytheon.edex.common, Export-Package: com.raytheon.uf.edex.plugin.level.adapter, com.raytheon.uf.edex.plugin.level.dao Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Import-Package: com.raytheon.uf.common.comm diff --git a/edexOsgi/com.raytheon.uf.edex.pointdata/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.pointdata/META-INF/MANIFEST.MF index c8af37a701..c301a3864f 100644 --- a/edexOsgi/com.raytheon.uf.edex.pointdata/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.pointdata/META-INF/MANIFEST.MF @@ -10,6 +10,7 @@ Import-Package: com.raytheon.edex.db.dao, com.raytheon.edex.exception, com.raytheon.edex.plugin, com.raytheon.edex.uengine.tasks.query, + com.raytheon.uf.common.comm, com.raytheon.uf.common.dataplugin, com.raytheon.uf.common.dataplugin.level, com.raytheon.uf.common.dataplugin.persist, diff --git a/edexOsgi/com.raytheon.uf.edex.pointdata/src/com/raytheon/uf/edex/pointdata/GetPointDataTreeHandler.java b/edexOsgi/com.raytheon.uf.edex.pointdata/src/com/raytheon/uf/edex/pointdata/GetPointDataTreeHandler.java index 6a03fafd3f..5f148cde32 100644 --- a/edexOsgi/com.raytheon.uf.edex.pointdata/src/com/raytheon/uf/edex/pointdata/GetPointDataTreeHandler.java +++ b/edexOsgi/com.raytheon.uf.edex.pointdata/src/com/raytheon/uf/edex/pointdata/GetPointDataTreeHandler.java @@ -26,7 +26,6 @@ import java.util.Map.Entry; import com.raytheon.edex.uengine.tasks.query.CatalogQuery; import com.raytheon.edex.uengine.tasks.query.MetadataCatalogQuery; -import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.level.LevelFactory; import com.raytheon.uf.common.derivparam.tree.DataTree; import com.raytheon.uf.common.pointdata.GetPointDataTreeRequest; @@ -52,16 +51,14 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler; public class GetPointDataTreeHandler implements IRequestHandler { - public static final Level STATION = LevelFactory.getInstance().getLevel( - LevelFactory.UNKNOWN_LEVEL, 0.0); - public static final String PLUGIN_NAME = "pluginName"; @Override public DataTree handleRequest(GetPointDataTreeRequest request) throws Exception { DataTree tree = new DataTree(); - String stationId = Long.toString(STATION.getId()); + String stationId = Long.toString(LevelFactory.getInstance() + .getLevel(LevelFactory.UNKNOWN_LEVEL, 0.0).getId()); for (Entry entry : request.getPluginTypeKeyMap() .entrySet()) { String[] types = getAvailableTypes(entry.getKey(), entry.getValue()); diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncgrib/META-INF/MANIFEST.MF b/ncep/gov.noaa.nws.ncep.edex.plugin.ncgrib/META-INF/MANIFEST.MF index e5844586eb..d5d48f949d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncgrib/META-INF/MANIFEST.MF +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.ncgrib/META-INF/MANIFEST.MF @@ -19,8 +19,9 @@ Require-Bundle: javax.measure, com.raytheon.uf.common.serialization.comm, com.raytheon.uf.edex.python.decoder;bundle-version="1.11.26", gov.noaa.nws.ncep.common.dataplugin.ncgrib;bundle-version="1.0.0", - ucar.nc2;bundle-version="1.0.0" -Import-Package: com.raytheon.uf.common.dataplugin.level, + ucar.nc2 +Import-Package: com.raytheon.uf.common.comm, + com.raytheon.uf.common.dataplugin.level, com.raytheon.uf.common.derivparam.tree, com.raytheon.uf.common.status, gov.noaa.nws.ncep.common.dataplugin.ncgrib, diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncgrib/src/gov/noaa/nws/ncep/edex/plugin/ncgrib/Ncgrib1Decoder.java b/ncep/gov.noaa.nws.ncep.edex.plugin.ncgrib/src/gov/noaa/nws/ncep/edex/plugin/ncgrib/Ncgrib1Decoder.java index 2cf90c3708..0c33ef93ac 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncgrib/src/gov/noaa/nws/ncep/edex/plugin/ncgrib/Ncgrib1Decoder.java +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.ncgrib/src/gov/noaa/nws/ncep/edex/plugin/ncgrib/Ncgrib1Decoder.java @@ -20,6 +20,29 @@ package gov.noaa.nws.ncep.edex.plugin.ncgrib; +import gov.noaa.nws.ncep.common.dataplugin.ncgrib.NcgribLevel; +import gov.noaa.nws.ncep.common.dataplugin.ncgrib.NcgribModel; +import gov.noaa.nws.ncep.common.dataplugin.ncgrib.NcgribParameter; +import gov.noaa.nws.ncep.common.dataplugin.ncgrib.NcgribRecord; +import gov.noaa.nws.ncep.common.dataplugin.ncgrib.exception.GribException; +import gov.noaa.nws.ncep.common.dataplugin.ncgrib.spatial.projections.LambertConformalNcgridCoverage; +import gov.noaa.nws.ncep.common.dataplugin.ncgrib.spatial.projections.LatLonNcgridCoverage; +import gov.noaa.nws.ncep.common.dataplugin.ncgrib.spatial.projections.MercatorNcgridCoverage; +import gov.noaa.nws.ncep.common.dataplugin.ncgrib.spatial.projections.NcgridCoverage; +import gov.noaa.nws.ncep.common.dataplugin.ncgrib.spatial.projections.PolarStereoNcgridCoverage; +import gov.noaa.nws.ncep.common.dataplugin.ncgrib.subgrid.SubNcgrid; +import gov.noaa.nws.ncep.common.dataplugin.ncgrib.util.NcgridModel; +import gov.noaa.nws.ncep.edex.plugin.ncgrib.dao.NcgribDao; +import gov.noaa.nws.ncep.edex.plugin.ncgrib.spatial.NcgribSpatialCache; +import gov.noaa.nws.ncep.edex.plugin.ncgrib.util.NcgribModelCache; +import gov.noaa.nws.ncep.edex.util.grib2vars.Grib2VarsTableLookup; +import gov.noaa.nws.ncep.edex.util.grib2vcrd.Grib2Vcrd; +import gov.noaa.nws.ncep.edex.util.grib2vcrd.Grib2VcrdTableLookup; +import gov.noaa.nws.ncep.edex.util.ncgrib.Ncgrib1TableMap; +import gov.noaa.nws.ncep.edex.util.ncgrib.NcgribModelLookup; +import gov.noaa.nws.ncep.edex.util.ncgrib.NcgribParamTranslator; +import gov.noaa.nws.ncep.edex.util.ncgrib.NcgribTableLookup; + import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -27,6 +50,7 @@ import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.HashSet; +import java.util.List; import java.util.Set; import ucar.grib.GribNumbers; @@ -42,35 +66,20 @@ import ucar.grib.grib1.GribPDSParamTable; import ucar.grid.GridParameter; import ucar.unidata.io.RandomAccessFile; -import gov.noaa.nws.ncep.edex.plugin.ncgrib.dao.NcgribDao; -import gov.noaa.nws.ncep.edex.plugin.ncgrib.spatial.NcgribSpatialCache; -import gov.noaa.nws.ncep.edex.plugin.ncgrib.util.NcgribModelCache; -import gov.noaa.nws.ncep.edex.util.ncgrib.Ncgrib1TableMap; -import gov.noaa.nws.ncep.edex.util.ncgrib.NcgribModelLookup; -import gov.noaa.nws.ncep.edex.util.ncgrib.NcgribParamTranslator; -import gov.noaa.nws.ncep.edex.util.ncgrib.NcgribTableLookup; -import gov.noaa.nws.ncep.common.dataplugin.ncgrib.NcgribLevel; -import gov.noaa.nws.ncep.common.dataplugin.ncgrib.NcgribModel; -import gov.noaa.nws.ncep.common.dataplugin.ncgrib.NcgribParameter; -import gov.noaa.nws.ncep.common.dataplugin.ncgrib.NcgribRecord; -import gov.noaa.nws.ncep.common.dataplugin.ncgrib.exception.GribException; -import gov.noaa.nws.ncep.common.dataplugin.ncgrib.spatial.projections.NcgridCoverage; -import gov.noaa.nws.ncep.common.dataplugin.ncgrib.spatial.projections.LambertConformalNcgridCoverage; -import gov.noaa.nws.ncep.common.dataplugin.ncgrib.spatial.projections.LatLonNcgridCoverage; -import gov.noaa.nws.ncep.common.dataplugin.ncgrib.spatial.projections.MercatorNcgridCoverage; -import gov.noaa.nws.ncep.common.dataplugin.ncgrib.spatial.projections.PolarStereoNcgridCoverage; -import gov.noaa.nws.ncep.common.dataplugin.ncgrib.subgrid.SubNcgrid; -import gov.noaa.nws.ncep.common.dataplugin.ncgrib.util.NcgridModel; -import gov.noaa.nws.ncep.edex.util.grib2vcrd.Grib2VcrdTableLookup; -import gov.noaa.nws.ncep.edex.util.grib2vars.Grib2VarsTableLookup; -import gov.noaa.nws.ncep.edex.util.grib2vcrd.Grib2Vcrd; - -import com.raytheon.edex.util.Util; -import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.edex.plugin.AbstractDecoder; +import com.raytheon.edex.util.Util; +import com.raytheon.uf.common.comm.CommunicationException; +import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.level.LevelFactory; import com.raytheon.uf.common.dataquery.db.QueryResult; +import com.raytheon.uf.common.localization.IPathManager; +import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; +import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; +import com.raytheon.uf.common.localization.PathManagerFactory; +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.common.time.TimeRange; import com.raytheon.uf.edex.database.DataAccessLayerException; @@ -86,6 +95,8 @@ import com.raytheon.uf.edex.database.plugin.PluginFactory; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 3/11/10 4758 bphillip Initial Creation + * 9/08/10 X. Guo Add new column + * 11/02/11 X. Guo Check octet size for isEnsmble() * *
* @@ -93,6 +104,8 @@ import com.raytheon.uf.edex.database.plugin.PluginFactory; * @version 1 */ public class Ncgrib1Decoder extends AbstractDecoder { + private static final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(Ncgrib1Decoder.class); /** Missing value string */ private static final String MISSING = "Missing"; @@ -101,15 +114,41 @@ public class Ncgrib1Decoder extends AbstractDecoder { private static final Set AVG_ACCUM_LIST = new HashSet(); private String traceId = ""; - private NcgribDao dao; - - private String fileName=""; - + + private NcgribDao dao; + + private String fileName = ""; + + private boolean addCol = false; + + private static final int[] fourtyOne = new int[] { 1, 1, 2, 3, 2, 3, 2, 3, + 2, 3, 2, 3 }; + + private static final int[] fourtyTwo = new int[] { 1, 2, 1, 1, 2, 2, 3, 3, + 4, 4, 5, 5 }; + + private static final int[] perturbation = new int[] { 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12 }; + static { AVG_ACCUM_LIST.add(3); AVG_ACCUM_LIST.add(4); AVG_ACCUM_LIST.add(6); AVG_ACCUM_LIST.add(7); + + IPathManager pm = PathManagerFactory.getPathManager(); + String ucarUserFile = pm.getFile( + pm.getContext(LocalizationType.EDEX_STATIC, + LocalizationLevel.BASE), "/ncgrib/ucar/userTables.lst") + .getPath(); + try { + GribPDSParamTable.addParameterUserLookup(ucarUserFile); + } catch (IOException e) { + statusHandler + .handle(Priority.PROBLEM, + "Error reading user parameter tables for ucar grib decoder", + e); + } } /** @@ -120,13 +159,13 @@ public class Ncgrib1Decoder extends AbstractDecoder { } public NcgribDao getDao() { - return dao; - } + return dao; + } + + public void setDao(NcgribDao dao) { + this.dao = dao; + } - public void setDao(NcgribDao dao) { - this.dao = dao; - } - /** * Decodes the grib file provided. * @@ -140,8 +179,8 @@ public class Ncgrib1Decoder extends AbstractDecoder { File gribFile = new File(gribFileName); fileName = gribFileName; RandomAccessFile raf = null; - - //System.out.println (" grib file name =" + gribFileName); + + // System.out.println (" grib file name =" + gribFileName); try { try { @@ -160,11 +199,16 @@ public class Ncgrib1Decoder extends AbstractDecoder { + gribFile + "]"); } ArrayList records = g1i.getRecords(); - NcgribRecord[] gribRecords = new NcgribRecord[records.size()]; + // NcgribRecord[] gribRecords = new NcgribRecord[records.size()]; + List gribRecords = new ArrayList(); for (int i = 0; i < records.size(); i++) { - gribRecords[i] = decodeRecord((Grib1Record) records.get(i), raf); + NcgribRecord rec = decodeRecord((Grib1Record) records.get(i), + raf); + if (rec != null) { + gribRecords.add(rec); + } } - return gribRecords; + return gribRecords.toArray(new NcgribRecord[] {}); } finally { if (raf != null) { try { @@ -192,7 +236,7 @@ public class Ncgrib1Decoder extends AbstractDecoder { private NcgribRecord decodeRecord(Grib1Record rec, RandomAccessFile raf) throws GribException { - int discipline=255,category=255,pid=255; + int discipline = 255, category = 255, pid = 255; NcgribRecord retVal = new NcgribRecord(); // Extract the sections from the grib record @@ -210,20 +254,23 @@ public class Ncgrib1Decoder extends AbstractDecoder { // Some centers use other center's parameter tables so we need to check // for that - int[] tableValue = Ncgrib1TableMap.getInstance().getTableAlias(centerid, - subcenterid, pdsVars.getParameterTableVersion()); + // System.out.println ("==centerid:" + centerid + " subcenterid:" + + // subcenterid + " pdsVars.getTableVersion():" + + // pdsVars.getTableVersion()); + int[] tableValue = Ncgrib1TableMap.getInstance().getTableAlias( + centerid, subcenterid, pdsVars.getParameterTableVersion()); int centerAlias = tableValue[0]; int subcenterAlias = tableValue[1]; int tableAlias = tableValue[2]; int vcrdid = pdsVars.getLevelType1(); - + /* * Decodes the parameter information from the record. An attempt is - * first made to map the gribimport gov.noaa.nws.ncep.common.dataplugin.ncgrib.subgrid.SubNcgrid; - 1 parameter to the equivalent grib 2 - * parameter. If this cannot be successfully executed, the grib 1 - * parameter will be used from the parameter tables contained in the - * unidata decoder. + * first made to map the gribimport + * gov.noaa.nws.ncep.common.dataplugin.ncgrib.subgrid.SubNcgrid; 1 + * parameter to the equivalent grib 2 parameter. If this cannot be + * successfully executed, the grib 1 parameter will be used from the + * parameter tables contained in the unidata decoder. */ NcgribParameter parameter = NcgribTableLookup.getInstance() .getNcgrib2Parameter(centerAlias, subcenterAlias, tableAlias, @@ -231,19 +278,19 @@ public class Ncgrib1Decoder extends AbstractDecoder { if (parameter == null || parameter.getName().equals(MISSING)) { try { - logger - .warn("Unable to map Grib 1 parameter to equivalent Grib 2 parameter for center [" - + centerid - + "] subcenter [" - + subcenterid - + "] table number [" - + pdsVars.getParameterTableVersion() - + "] parameter number [" - + pdsVars.getParameterNumber() - + "] Using grib 1 parameter mapping"); + logger.warn("Unable to map Grib 1 parameter to equivalent Grib 2 parameter for center [" + + centerid + + "] subcenter [" + + subcenterid + + "] table number [" + + pdsVars.getParameterTableVersion() + + "] parameter number [" + + pdsVars.getParameterNumber() + + "] Using grib 1 parameter mapping"); GridParameter param = GribPDSParamTable.getParameterTable( - centerid, subcenterid, pdsVars.getParameterTableVersion()) - .getParameter(pdsVars.getParameterNumber()); + centerid, subcenterid, + pdsVars.getParameterTableVersion()).getParameter( + pdsVars.getParameterNumber()); parameterName = param.getDescription(); parameterAbbreviation = param.getName(); parameterUnit = param.getUnit(); @@ -277,10 +324,24 @@ public class Ncgrib1Decoder extends AbstractDecoder { model.setParameterName(parameterName); model.setParameterAbbreviation(parameterAbbreviation); model.setParameterUnit(parameterUnit); - if (pdsVars.isEnsemble()) { + + // unidata does not handle isEnsemble call when + // octet size is less than 40. + if (pdsVars.getLength() > 40 && pdsVars.isEnsemble()) { model.setNumForecasts(pdsVars.getNumberForecasts()); model.setTypeEnsemble(pdsVars.getType()); - model.setPerturbationNumber(pdsVars.getPerturbationNumber()); + // rcg: added code to get perturbation + int pos41 = pdsVars.getOctet(42); + int pos42 = pdsVars.getOctet(43); + int pert = pdsVars.getID(); + for (int i = 0; i < perturbation.length; i++) { + if (pos41 == fourtyOne[i] && pos42 == fourtyTwo[i]) { + pert = perturbation[i]; + break; + } + } + model.setPerturbationNumber(pert); + // model.setPerturbationNumber(pdsVars.getPerturbation()); } else { model.setNumForecasts(null); model.setTypeEnsemble(null); @@ -291,11 +352,9 @@ public class Ncgrib1Decoder extends AbstractDecoder { createModelName(model); // Get the level information - float[] levelMetadata = this.convertGrib1LevelInfo(pdsVars - .getLevelType1(), (float) pdsVars - .getLevelValue1(), pdsVars - .getLevelType2(), (float) pdsVars - .getLevelValue2()); + float[] levelMetadata = this.convertGrib1LevelInfo( + pdsVars.getLevelType1(), (float) pdsVars.getLevelValue1(), + pdsVars.getLevelType2(), (float) pdsVars.getLevelValue2()); getLevelInfo(model, centerid, subcenterid, levelMetadata[0], levelMetadata[1], levelMetadata[2], levelMetadata[3], levelMetadata[4], levelMetadata[5]); @@ -303,11 +362,13 @@ public class Ncgrib1Decoder extends AbstractDecoder { // Construct the DataTime GregorianCalendar refTime = new GregorianCalendar(); refTime.setTimeInMillis(pdsVars.getReferenceTime()); - int forecastTime = convertToSeconds(pdsVars.getForecastTime(), pdsVars - .getTimeUnit()); - DataTime dataTime = constructDataTime(refTime, forecastTime, - getTimeInformation(refTime, pdsVars.getTimeRangeIndicator(), pdsVars - .getP1(), pdsVars.getP2()), model); + int forecastTime = convertToSeconds(pdsVars.getForecastTime(), + pdsVars.getTimeUnit()); + DataTime dataTime = constructDataTime( + refTime, + forecastTime, + getTimeInformation(refTime, pdsVars.getTimeRangeIndicator(), + pdsVars.getP1(), pdsVars.getP2()), model); /* * Extract the data values from the file. The AVG_ACCUM_LIST is checked @@ -316,6 +377,7 @@ public class Ncgrib1Decoder extends AbstractDecoder { */ Grib1Data gd = new Grib1Data(raf); float[] data = null; + try { boolean bmsPresent = pdsVars.bmsExists(); int scanMode = gdsVars.getScanMode(); @@ -327,12 +389,17 @@ public class Ncgrib1Decoder extends AbstractDecoder { data = new float[gdsVars.getNx() * gdsVars.getNy()]; } else { data = gd.getData(rec.getDataOffset() - gdsVars.getLength(), - rec.getDataOffset(), pdsVars.getDecimalScale(), pdsVars - .bmsExists()); + rec.getDataOffset(), pdsVars.getDecimalScale(), + pdsVars.bmsExists()); } correctForScanMode(data, gdsVars.getNx(), gdsVars.getNy(), bmsPresent, scanMode); - retVal.setMessageData(data); + if (getAddCol()) { + float[] dataArry = this.addOneColumnDataTo1D(data, + gdsVars.getNx(), gdsVars.getNy()); + retVal.setMessageData(dataArry); + } else + retVal.setMessageData(data); } catch (IOException e) { throw new GribException("Error getting data from grib file", e); } @@ -345,19 +412,29 @@ public class Ncgrib1Decoder extends AbstractDecoder { if (subCoverage != null) { SubNcgrid subGrid = NcgribSpatialCache.getInstance().getSubGrid( modelName); + int nx = gridCoverage.getNx(); + if (getAddCol()) { + nx = nx - 1; + } // resize the data array - float[][] dataArray = this.resizeDataTo2D(data, gridCoverage - .getNx(), gridCoverage.getNy()); - dataArray = this.subGrid(dataArray, subGrid.getStartX(), subGrid - .getStartY(), subGrid.getNX(), subGrid.getNY()); - data = this.resizeDataTo1D(dataArray, subGrid.getNY(), subGrid - .getNX()); - retVal.setMessageData(data); + float[][] dataArray = this.resizeDataTo2D(data, nx, + gridCoverage.getNy()); + dataArray = this.subGrid(dataArray, subGrid.getStartX(), + subGrid.getStartY(), subGrid.getNX(), subGrid.getNY()); + data = this.resizeDataTo1D(dataArray, subGrid.getNY(), + subGrid.getNX()); + if (getAddCol()) { + float[] dataArray1 = this.addOneColumnDataTo1D(data, + subGrid.getNX(), subGrid.getNY()); + retVal.setMessageData(dataArray1); + } else + retVal.setMessageData(data); model.setLocation(subCoverage); } + setAddCol(false); - String newAbbr = NcgribParamTranslator.getInstance().translateParameter( - 1, model, dataTime); + String newAbbr = NcgribParamTranslator.getInstance() + .translateParameter(1, model, dataTime); if (newAbbr == null) { if (!model.getParameterName().equals(MISSING) @@ -371,6 +448,9 @@ public class Ncgrib1Decoder extends AbstractDecoder { } if (!model.getParameterName().equals(MISSING)) { + if (modelName.toUpperCase().equals("GFS")) { + model.generateId(fileName); + } try { model = NcgribModelCache.getInstance().getModel(model); } catch (DataAccessLayerException e) { @@ -385,41 +465,43 @@ public class Ncgrib1Decoder extends AbstractDecoder { retVal.setDataTime(dataTime); retVal.setResCompFlags(gdsVars.getResolution()); retVal.setModelName(model.getModelName()); - String []fileTokens = fileName.split("/"); - String flName=""; - if ( fileTokens.length > 0 ) { - flName = fileTokens[fileTokens.length-1]; + String[] fileTokens = fileName.split("/"); + String flName = ""; + if (fileTokens.length > 0) { + flName = fileTokens[fileTokens.length - 1]; } retVal.setFileName(flName); - String eventName=flName; + String eventName = flName; int index = flName.indexOf("."); - - if ( index > 0) { - eventName = flName.substring(0, index); + + if (index > 0) { + eventName = flName.substring(0, index); } retVal.setEventName(eventName); retVal.setDiscipline(discipline); retVal.setCategory(category); retVal.setParameterId(pid); retVal.setProcessedDataType(pdsVars.getGenProcessId()); - retVal.setGlevel1((int)model.getLevel().getLevelonevalue()); - retVal.setGlevel2((int)model.getLevel().getLeveltwovalue()); + retVal.setGlevel1((int) model.getLevel().getLevelonevalue()); + retVal.setGlevel2((int) model.getLevel().getLeveltwovalue()); retVal.setVcrdId1(vcrdid); retVal.setVcrdId2(vcrdid); retVal.setGridVersion(1); String vcord = "NONE"; String scale = ""; - Grib2Vcrd grib2Vcrd = Grib2VcrdTableLookup.getGrib2VcrdByGrib1VcrdId (vcrdid); - if ( grib2Vcrd != null ) { - vcord = grib2Vcrd.getGnam(); - scale = grib2Vcrd.getScale(); + Grib2Vcrd grib2Vcrd = Grib2VcrdTableLookup + .getGrib2VcrdByGrib1VcrdId(vcrdid); + if (grib2Vcrd != null) { + vcord = grib2Vcrd.getGnam(); + scale = grib2Vcrd.getScale(); } retVal.setVcord(vcord); - retVal.setScale(scale); - String parm = Grib2VarsTableLookup.getVarGnam4Grib1 (discipline,category,pid); + retVal.setScale(scale); + String parm = Grib2VarsTableLookup.getVarGnam4Grib1(discipline, + category, pid); retVal.setParm(parm); - + // Special case handling for ffg grids try { if (model.getCenterid() == 9) { @@ -474,6 +556,32 @@ public class Ncgrib1Decoder extends AbstractDecoder { return newGrid; } + /** + * Resizes a 1-D data array into a 2-D array based on the provided row and + * column count and add one column for each row, then convert to 1-D array. + * + * @param data + * The 1-D array of data + * @param columnCount + * The number of columns to map the data to + * @param rowCount + * The number of rows to map the data to + * @return The 1-D array of data + */ + private float[] addOneColumnDataTo1D(float[] data, int columnCount, + int rowCount) { + float[][] newGrid = new float[rowCount][columnCount + 1]; + + for (int row = 0; row < rowCount; row++) { + for (int column = 0; column < columnCount; column++) { + newGrid[row][column] = data[row * columnCount + column]; + } + newGrid[row][columnCount] = newGrid[row][0]; + } + + return resizeDataTo1D(newGrid, rowCount, columnCount + 1); + } + /** * Resizes a 2-D array of data to a 1-D array * @@ -620,15 +728,26 @@ public class Ncgrib1Decoder extends AbstractDecoder { NcgridCoverage coverage = null; int gridType = gdsVars.getGdtn(); + int nx; + float Lon1, Lon2, lo2; switch (gridType) { case 0: LatLonNcgridCoverage latLonCoverage = new LatLonNcgridCoverage(); - latLonCoverage.setNx(gdsVars.getNx()); + nx = gdsVars.getNx(); + lo2 = gdsVars.getLo2() + 360.0F; + Lon1 = gdsVars.getLo1() + lo2; + Lon2 = lo2 + gdsVars.getDx(); + if (Lon1 == 360.0 || Lon2 == 360.0) { + nx = nx + 1; + lo2 = Lon2; + setAddCol(true); + } + latLonCoverage.setNx(nx); latLonCoverage.setNy(gdsVars.getNy()); latLonCoverage.setLa1(gdsVars.getLa1()); latLonCoverage.setLo1(gdsVars.getLo1()); latLonCoverage.setLa2(gdsVars.getLa2()); - latLonCoverage.setLo2(gdsVars.getLo2()); + latLonCoverage.setLo2(lo2); if (gdsVars.getGridUnits().equals("degrees")) { latLonCoverage.setSpacingUnit("degree"); latLonCoverage.setDx(gdsVars.getDx()); @@ -648,12 +767,23 @@ public class Ncgrib1Decoder extends AbstractDecoder { MercatorNcgridCoverage mercator = new MercatorNcgridCoverage(); mercator.setMajorAxis(gdsVars.getMajorAxis() * 1000); mercator.setMinorAxis(gdsVars.getMinorAxis() * 1000); - mercator.setNx(gdsVars.getNx()); + nx = gdsVars.getNx(); + lo2 = gdsVars.getLo2() + 360.0F; + Lon1 = gdsVars.getLo1() + lo2; + Lon2 = lo2 + gdsVars.getDx(); + if (Lon1 == 360.0 || Lon2 == 360.0) { + nx = nx + 1; + lo2 = Lon2; + setAddCol(true); + } else { + lo2 = correctLon(lo2); + } + mercator.setNx(nx); mercator.setNy(gdsVars.getNy()); mercator.setLa1(correctLat(gdsVars.getLa1())); mercator.setLo1(correctLon(gdsVars.getLo1())); mercator.setLa2(correctLat(gdsVars.getLa2())); - mercator.setLo2(correctLon(gdsVars.getLo2())); + mercator.setLo2(lo2); mercator.setLatin(correctLat(gdsVars.getLatin1())); if (gdsVars.getGridUnits().equals("degrees")) { mercator.setSpacingUnit("degree"); @@ -732,7 +862,8 @@ public class Ncgrib1Decoder extends AbstractDecoder { private NcgridCoverage getGridFromCache(NcgridCoverage coverage) throws GribException { - NcgridCoverage grid = NcgribSpatialCache.getInstance().getGrid(coverage); + NcgridCoverage grid = NcgribSpatialCache.getInstance() + .getGrid(coverage); if (grid == null) { NcgribSpatialCache.getInstance().putGrid(coverage, true); @@ -753,8 +884,8 @@ public class Ncgrib1Decoder extends AbstractDecoder { String gridid = model.getGridid(); int process = model.getGenprocess(); - NcgridModel gridModel = NcgribModelLookup.getInstance().getModel(center, - subcenter, gridid, process); + NcgridModel gridModel = NcgribModelLookup.getInstance().getModel( + center, subcenter, gridid, process); String name = null; if (gridModel == null) { name = "UnknownModel:" + String.valueOf(center) + ":" @@ -789,7 +920,8 @@ public class Ncgrib1Decoder extends AbstractDecoder { if (endTime == null) { dataTime = new DataTime(refTime, forecastTime); } else { - TimeRange timeRange = new TimeRange(startTime.getTimeInMillis(),endTime.getTimeInMillis()); + TimeRange timeRange = new TimeRange(startTime.getTimeInMillis(), + endTime.getTimeInMillis()); dataTime = new DataTime(refTime, forecastTime, timeRange); } return dataTime; @@ -1093,8 +1225,16 @@ public class Ncgrib1Decoder extends AbstractDecoder { * -1)); } } - Level level = LevelFactory.getInstance().getLevel(levelName, - levelOneValue, levelTwoValue, levelUnit); + Level level = null; + try { + level = LevelFactory.getInstance().getLevel(levelName, + levelOneValue, levelTwoValue, levelUnit); + } catch (CommunicationException e) { + // TODO njensen: didn't know how to merge, needs to be handled + // better + // TODO Auto-generated catch block. Please revise as appropriate. + statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); + } model.setLevel(level); } @@ -1144,5 +1284,12 @@ public class Ncgrib1Decoder extends AbstractDecoder { } return lat; } - + + private void setAddCol(boolean addCol) { + this.addCol = addCol; + } + + private boolean getAddCol() { + return this.addCol; + } }