Merge "Issue #185 change LevelFactory to throw exceptions when there is no network connection so that everything can be reinitialized when the connection is restored.." into 4-Thin_Client
Former-commit-id:dc7c3ea979
[formerlyb85da11f1b
] [formerly5f7b1e87b4
] [formerlydc7c3ea979
[formerlyb85da11f1b
] [formerly5f7b1e87b4
] [formerlycc1cf725b7
[formerly5f7b1e87b4
[formerly 48179dbabb5cd5a60c345ad0bdd8bda9fdcf9bd9]]]] Former-commit-id:cc1cf725b7
Former-commit-id:d045890f8b
[formerlya7a6ed0b78
] [formerly 6c196987094f5957eec981b7ec767d0480bca0d1 [formerlyf4fe967eba
]] Former-commit-id: 7d6d2446ea413e83e268dfe14d5110082fcf1a31 [formerly213cc51b86
] Former-commit-id:2571a16a4e
This commit is contained in:
commit
3cb5894e3f
60 changed files with 1103 additions and 482 deletions
|
@ -20,6 +20,7 @@ Import-Package: com.raytheon.edex.meteoLib,
|
||||||
com.raytheon.uf.common.pointdata,
|
com.raytheon.uf.common.pointdata,
|
||||||
com.raytheon.uf.common.pointdata.spatial,
|
com.raytheon.uf.common.pointdata.spatial,
|
||||||
com.raytheon.uf.common.serialization,
|
com.raytheon.uf.common.serialization,
|
||||||
|
com.raytheon.uf.common.status,
|
||||||
com.raytheon.uf.common.time,
|
com.raytheon.uf.common.time,
|
||||||
com.raytheon.uf.viz.core.alerts,
|
com.raytheon.uf.viz.core.alerts,
|
||||||
com.raytheon.uf.viz.core.catalog,
|
com.raytheon.uf.viz.core.catalog,
|
||||||
|
|
|
@ -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.LongDataRecord;
|
||||||
import com.raytheon.uf.common.datastorage.records.StringDataRecord;
|
import com.raytheon.uf.common.datastorage.records.StringDataRecord;
|
||||||
import com.raytheon.uf.common.pointdata.PointDataContainer;
|
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.catalog.ScriptCreator;
|
||||||
import com.raytheon.uf.viz.core.comm.Loader;
|
import com.raytheon.uf.viz.core.comm.Loader;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
import com.raytheon.uf.viz.derivparam.library.DerivedParameterGenerator;
|
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.AbstractPointDataInventory;
|
||||||
|
import com.raytheon.viz.pointdata.util.PointDataCubeAdapter;
|
||||||
|
|
||||||
public class ACARSSoundingDataCubeAdapter extends PointDataCubeAdapter {
|
public class ACARSSoundingDataCubeAdapter extends PointDataCubeAdapter {
|
||||||
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(ACARSSoundingDataCubeAdapter.class);
|
||||||
|
|
||||||
protected static final String REFTIME = AcarsSoundingInventory.REFTIME;
|
protected static final String REFTIME = AcarsSoundingInventory.REFTIME;
|
||||||
|
|
||||||
|
@ -101,11 +106,16 @@ public class ACARSSoundingDataCubeAdapter extends PointDataCubeAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initInventory() {
|
public void initInventory() {
|
||||||
derParLibrary = DerivedParameterGenerator.getDerParLibrary();
|
|
||||||
if (inventory == null) {
|
if (inventory == null) {
|
||||||
AbstractPointDataInventory pointInventory = new AcarsSoundingInventory();
|
AbstractPointDataInventory pointInventory = new AcarsSoundingInventory();
|
||||||
pointInventory.initTree(derParLibrary);
|
try {
|
||||||
|
pointInventory.initTree(DerivedParameterGenerator
|
||||||
|
.getDerParLibrary());
|
||||||
this.inventory = pointInventory;
|
this.inventory = pointInventory;
|
||||||
|
} catch (VizException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||||
|
e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,13 +27,13 @@ import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
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.Level;
|
||||||
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.uf.viz.core.Activator;
|
import com.raytheon.uf.viz.core.exception.VizCommunicationException;
|
||||||
import com.raytheon.uf.viz.core.status.StatusConstants;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class defines a database level
|
* Class defines a database level
|
||||||
|
@ -55,7 +55,9 @@ import com.raytheon.uf.viz.core.status.StatusConstants;
|
||||||
@XmlAccessorType(XmlAccessType.NONE)
|
@XmlAccessorType(XmlAccessType.NONE)
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
public class DatabaseLevelMapping {
|
public class DatabaseLevelMapping {
|
||||||
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(DatabaseLevelMapping.class);
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(DatabaseLevelMapping.class);
|
||||||
|
|
||||||
@XmlAttribute
|
@XmlAttribute
|
||||||
private String levelName = null;
|
private String levelName = null;
|
||||||
|
|
||||||
|
@ -100,7 +102,7 @@ public class DatabaseLevelMapping {
|
||||||
this.unit = unit;
|
this.unit = unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Level> getLevels() {
|
public List<Level> getLevels() throws VizCommunicationException {
|
||||||
String[] levelOneValues = new String[0];
|
String[] levelOneValues = new String[0];
|
||||||
String[] levelTwoValues = new String[0];
|
String[] levelTwoValues = new String[0];
|
||||||
|
|
||||||
|
@ -143,12 +145,16 @@ public class DatabaseLevelMapping {
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle any aliasing etc
|
// handle any aliasing etc
|
||||||
Level level = LevelFactory.getInstance().getLevel(levelName, lvl1,
|
try {
|
||||||
lvl2, unit);
|
Level level = LevelFactory.getInstance().getLevel(levelName,
|
||||||
|
lvl1, lvl2, unit);
|
||||||
if (level != null) {
|
if (level != null) {
|
||||||
rval.add(level);
|
rval.add(level);
|
||||||
}
|
}
|
||||||
|
} catch (CommunicationException e) {
|
||||||
|
throw new VizCommunicationException(e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return rval;
|
return rval;
|
||||||
|
|
|
@ -31,6 +31,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
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.
|
* Class defines a mapping from a display level to one or more database levels.
|
||||||
|
@ -118,12 +119,13 @@ public class LevelMapping implements ISerializableObject {
|
||||||
this.databaseLevels = databaseLevels;
|
this.databaseLevels = databaseLevels;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Level> getLevels() {
|
public List<Level> getLevels() throws VizCommunicationException {
|
||||||
if (levelList == null) {
|
if (levelList == null) {
|
||||||
levelList = new ArrayList<Level>();
|
List<Level> levelList = new ArrayList<Level>();
|
||||||
for (DatabaseLevelMapping mapping : databaseLevels) {
|
for (DatabaseLevelMapping mapping : databaseLevels) {
|
||||||
levelList.addAll(mapping.getLevels());
|
levelList.addAll(mapping.getLevels());
|
||||||
}
|
}
|
||||||
|
this.levelList = levelList;
|
||||||
}
|
}
|
||||||
|
|
||||||
return levelList;
|
return levelList;
|
||||||
|
|
|
@ -35,6 +35,7 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
|
import com.raytheon.uf.viz.core.exception.VizCommunicationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory for getting level mappings
|
* Factory for getting level mappings
|
||||||
|
@ -56,15 +57,22 @@ public class LevelMappingFactory {
|
||||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
.getHandler(LevelMappingFactory.class);
|
.getHandler(LevelMappingFactory.class);
|
||||||
|
|
||||||
private static LevelMappingFactory instance = new LevelMappingFactory();
|
private static LevelMappingFactory instance = null;
|
||||||
|
|
||||||
private Map<String, LevelMapping> keyToLevelMappings = new HashMap<String, LevelMapping>();
|
private Map<String, LevelMapping> keyToLevelMappings = new HashMap<String, LevelMapping>();
|
||||||
|
|
||||||
|
private boolean levelToLevelMappingsInitialized = false;
|
||||||
|
|
||||||
private Map<Level, LevelMapping> levelToLevelMappings = new HashMap<Level, LevelMapping>();
|
private Map<Level, LevelMapping> levelToLevelMappings = new HashMap<Level, LevelMapping>();
|
||||||
|
|
||||||
|
private boolean groupToMasterLevelsInitialized = false;
|
||||||
|
|
||||||
private Map<String, Map<MasterLevel, Set<Level>>> groupToMasterLevels = new HashMap<String, Map<MasterLevel, Set<Level>>>();
|
private Map<String, Map<MasterLevel, Set<Level>>> groupToMasterLevels = new HashMap<String, Map<MasterLevel, Set<Level>>>();
|
||||||
|
|
||||||
public static LevelMappingFactory getInstance() {
|
public synchronized static LevelMappingFactory getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new LevelMappingFactory();
|
||||||
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,17 +104,47 @@ public class LevelMappingFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
long finish = System.currentTimeMillis();
|
||||||
|
System.out.println("LevelMappingFactory initialization took ["
|
||||||
|
+ (finish - start) + "] ms");
|
||||||
|
}
|
||||||
|
|
||||||
|
public LevelMapping getLevelMappingForKey(String key) {
|
||||||
|
return keyToLevelMappings.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LevelMapping getLevelMappingForLevel(Level level)
|
||||||
|
throws VizCommunicationException {
|
||||||
|
if (!levelToLevelMappingsInitialized) {
|
||||||
|
initializeLevelToLevelMappings();
|
||||||
|
}
|
||||||
|
return levelToLevelMappings.get(level);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<LevelMapping> getAllLevelMappings() {
|
||||||
|
return keyToLevelMappings.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<Level> getAllLevels() throws VizCommunicationException {
|
||||||
|
if (!levelToLevelMappingsInitialized) {
|
||||||
|
initializeLevelToLevelMappings();
|
||||||
|
}
|
||||||
|
return levelToLevelMappings.keySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<MasterLevel, Set<Level>> getLevelMapForGroup(String group)
|
||||||
|
throws VizCommunicationException {
|
||||||
|
if (!groupToMasterLevelsInitialized) {
|
||||||
|
initializeGroupToMasterLevels();
|
||||||
|
}
|
||||||
|
return groupToMasterLevels.get(group);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeLevelToLevelMappings()
|
||||||
|
throws VizCommunicationException {
|
||||||
for (LevelMapping mapping : keyToLevelMappings.values()) {
|
for (LevelMapping mapping : keyToLevelMappings.values()) {
|
||||||
String group = mapping.getGroup();
|
String group = mapping.getGroup();
|
||||||
Map<MasterLevel, Set<Level>> masterLevels = null;
|
|
||||||
|
|
||||||
if (group != null) {
|
|
||||||
masterLevels = groupToMasterLevels.get(mapping.getGroup());
|
|
||||||
if (masterLevels == null) {
|
|
||||||
masterLevels = new HashMap<MasterLevel, Set<Level>>();
|
|
||||||
groupToMasterLevels.put(group, masterLevels);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Level l : mapping.getLevels()) {
|
for (Level l : mapping.getLevels()) {
|
||||||
if (levelToLevelMappings.containsKey(l)) {
|
if (levelToLevelMappings.containsKey(l)) {
|
||||||
|
@ -122,6 +160,26 @@ public class LevelMappingFactory {
|
||||||
} else {
|
} else {
|
||||||
levelToLevelMappings.put(l, mapping);
|
levelToLevelMappings.put(l, mapping);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
levelToLevelMappingsInitialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeGroupToMasterLevels()
|
||||||
|
throws VizCommunicationException {
|
||||||
|
for (LevelMapping mapping : keyToLevelMappings.values()) {
|
||||||
|
String group = mapping.getGroup();
|
||||||
|
Map<MasterLevel, Set<Level>> masterLevels = null;
|
||||||
|
|
||||||
|
if (group != null) {
|
||||||
|
masterLevels = groupToMasterLevels.get(mapping.getGroup());
|
||||||
|
if (masterLevels == null) {
|
||||||
|
masterLevels = new HashMap<MasterLevel, Set<Level>>();
|
||||||
|
groupToMasterLevels.put(group, masterLevels);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Level l : mapping.getLevels()) {
|
||||||
|
|
||||||
// populate grouping map
|
// populate grouping map
|
||||||
if (masterLevels != null) {
|
if (masterLevels != null) {
|
||||||
|
@ -137,29 +195,6 @@ public class LevelMappingFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
groupToMasterLevelsInitialized = true;
|
||||||
long finish = System.currentTimeMillis();
|
|
||||||
System.out.println("LevelMappingFactory initialization took ["
|
|
||||||
+ (finish - start) + "] ms");
|
|
||||||
}
|
|
||||||
|
|
||||||
public LevelMapping getLevelMappingForKey(String key) {
|
|
||||||
return keyToLevelMappings.get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LevelMapping getLevelMappingForLevel(Level level) {
|
|
||||||
return levelToLevelMappings.get(level);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<LevelMapping> getAllLevelMappings() {
|
|
||||||
return keyToLevelMappings.values();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<Level> getAllLevels() {
|
|
||||||
return levelToLevelMappings.keySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<MasterLevel, Set<Level>> getLevelMapForGroup(String group) {
|
|
||||||
return groupToMasterLevels.get(group);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ package com.raytheon.uf.viz.core.level;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
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.Level;
|
||||||
import com.raytheon.uf.common.dataplugin.level.LevelContainer;
|
import com.raytheon.uf.common.dataplugin.level.LevelContainer;
|
||||||
import com.raytheon.uf.common.dataplugin.level.MasterLevel;
|
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.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
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.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||||
|
|
||||||
|
@ -45,11 +47,14 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
|
||||||
.getHandler(LevelRetrievalAdapter.class);
|
.getHandler(LevelRetrievalAdapter.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Level getLevel(GetLevelRequest request) {
|
public Level getLevel(GetLevelRequest request)
|
||||||
|
throws CommunicationException {
|
||||||
Level rval = null;
|
Level rval = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
rval = (Level) ThriftClient.sendRequest(request);
|
rval = (Level) ThriftClient.sendRequest(request);
|
||||||
|
} catch (VizCommunicationException e) {
|
||||||
|
throw new CommunicationException(e);
|
||||||
} catch (VizException e) {
|
} catch (VizException e) {
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
"Error occurred retrieving level information from server.",
|
"Error occurred retrieving level information from server.",
|
||||||
|
@ -60,11 +65,14 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Level getLevel(GetLevelByIdRequest request) {
|
public Level getLevel(GetLevelByIdRequest request)
|
||||||
|
throws CommunicationException {
|
||||||
Level rval = null;
|
Level rval = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
rval = (Level) ThriftClient.sendRequest(request);
|
rval = (Level) ThriftClient.sendRequest(request);
|
||||||
|
} catch (VizCommunicationException e) {
|
||||||
|
throw new CommunicationException(e);
|
||||||
} catch (VizException e) {
|
} catch (VizException e) {
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
"Error occurred retrieving level information from server.",
|
"Error occurred retrieving level information from server.",
|
||||||
|
@ -75,10 +83,13 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MasterLevel getMasterLevel(GetMasterLevelRequest request) {
|
public MasterLevel getMasterLevel(GetMasterLevelRequest request)
|
||||||
|
throws CommunicationException {
|
||||||
MasterLevel rval = null;
|
MasterLevel rval = null;
|
||||||
try {
|
try {
|
||||||
rval = (MasterLevel) ThriftClient.sendRequest(request);
|
rval = (MasterLevel) ThriftClient.sendRequest(request);
|
||||||
|
} catch (VizCommunicationException e) {
|
||||||
|
throw new CommunicationException(e);
|
||||||
} catch (VizException e) {
|
} catch (VizException e) {
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
"Error occurred retrieving level information from server.",
|
"Error occurred retrieving level information from server.",
|
||||||
|
@ -89,10 +100,13 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LevelContainer getAllLevelsForMasterLevel(
|
public LevelContainer getAllLevelsForMasterLevel(
|
||||||
GetAllLevelsForMasterLevelRequest request) {
|
GetAllLevelsForMasterLevelRequest request)
|
||||||
|
throws CommunicationException {
|
||||||
LevelContainer rval = null;
|
LevelContainer rval = null;
|
||||||
try {
|
try {
|
||||||
rval = (LevelContainer) ThriftClient.sendRequest(request);
|
rval = (LevelContainer) ThriftClient.sendRequest(request);
|
||||||
|
} catch (VizCommunicationException e) {
|
||||||
|
throw new CommunicationException(e);
|
||||||
} catch (VizException e) {
|
} catch (VizException e) {
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
"Error occurred retrieving level information from server.",
|
"Error occurred retrieving level information from server.",
|
||||||
|
@ -102,7 +116,7 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LevelContainer getAllLevels() {
|
public LevelContainer getAllLevels() throws CommunicationException {
|
||||||
LevelContainer rval = null;
|
LevelContainer rval = null;
|
||||||
DbQueryRequest query = new DbQueryRequest();
|
DbQueryRequest query = new DbQueryRequest();
|
||||||
query.setConstraints(new HashMap<String, RequestConstraint>());
|
query.setConstraints(new HashMap<String, RequestConstraint>());
|
||||||
|
@ -114,6 +128,8 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
|
||||||
for (Map<String, Object> result : resp.getResults()) {
|
for (Map<String, Object> result : resp.getResults()) {
|
||||||
rval.add((Level) result.get(null));
|
rval.add((Level) result.get(null));
|
||||||
}
|
}
|
||||||
|
} catch (VizCommunicationException e) {
|
||||||
|
throw new CommunicationException(e);
|
||||||
} catch (VizException e) {
|
} catch (VizException e) {
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
"Error occurred retrieving level information from server.",
|
"Error occurred retrieving level information from server.",
|
||||||
|
@ -123,7 +139,8 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MasterLevelContainer getAllMasterLevels() {
|
public MasterLevelContainer getAllMasterLevels()
|
||||||
|
throws CommunicationException {
|
||||||
MasterLevelContainer rval = null;
|
MasterLevelContainer rval = null;
|
||||||
DbQueryRequest query = new DbQueryRequest();
|
DbQueryRequest query = new DbQueryRequest();
|
||||||
query.setConstraints(new HashMap<String, RequestConstraint>());
|
query.setConstraints(new HashMap<String, RequestConstraint>());
|
||||||
|
@ -135,6 +152,8 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
|
||||||
for (Map<String, Object> result : resp.getResults()) {
|
for (Map<String, Object> result : resp.getResults()) {
|
||||||
rval.add((MasterLevel) result.get(null));
|
rval.add((MasterLevel) result.get(null));
|
||||||
}
|
}
|
||||||
|
} catch (VizCommunicationException e) {
|
||||||
|
throw new CommunicationException(e);
|
||||||
} catch (VizException e) {
|
} catch (VizException e) {
|
||||||
statusHandler
|
statusHandler
|
||||||
.handle(Priority.PROBLEM,
|
.handle(Priority.PROBLEM,
|
||||||
|
|
|
@ -29,10 +29,12 @@ import java.util.TreeSet;
|
||||||
import javax.measure.unit.Unit;
|
import javax.measure.unit.Unit;
|
||||||
import javax.measure.unit.UnitFormat;
|
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.CompareType;
|
||||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||||
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
||||||
import com.raytheon.uf.common.dataplugin.level.MasterLevel;
|
import com.raytheon.uf.common.dataplugin.level.MasterLevel;
|
||||||
|
import com.raytheon.uf.viz.core.exception.VizCommunicationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Level utilities
|
* Level utilities
|
||||||
|
@ -62,14 +64,24 @@ public class LevelUtilities {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPressureLevel(long levelId) {
|
public static boolean isPressureLevel(long levelId)
|
||||||
|
throws VizCommunicationException {
|
||||||
|
try {
|
||||||
return isPressureLevel(LevelFactory.getInstance().getLevel(levelId)
|
return isPressureLevel(LevelFactory.getInstance().getLevel(levelId)
|
||||||
.getMasterLevel());
|
.getMasterLevel());
|
||||||
|
} catch (CommunicationException e) {
|
||||||
|
throw new VizCommunicationException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPressureLevel(String masterLevelName) {
|
public static boolean isPressureLevel(String masterLevelName)
|
||||||
|
throws VizCommunicationException {
|
||||||
|
try {
|
||||||
return isPressureLevel(LevelFactory.getInstance().getMasterLevel(
|
return isPressureLevel(LevelFactory.getInstance().getMasterLevel(
|
||||||
masterLevelName));
|
masterLevelName));
|
||||||
|
} catch (CommunicationException e) {
|
||||||
|
throw new VizCommunicationException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPressureLevel(Level level) {
|
public static boolean isPressureLevel(Level level) {
|
||||||
|
@ -89,9 +101,10 @@ public class LevelUtilities {
|
||||||
*
|
*
|
||||||
* @param masterLevelName
|
* @param masterLevelName
|
||||||
* @return
|
* @return
|
||||||
|
* @throws CommunicationException
|
||||||
*/
|
*/
|
||||||
public synchronized static NavigableSet<Level> getOrderedSetOfStandardLevels(
|
public synchronized static NavigableSet<Level> getOrderedSetOfStandardLevels(
|
||||||
String masterLevelName) {
|
String masterLevelName) throws VizCommunicationException {
|
||||||
if (masterLevelToOrderedSet == null) {
|
if (masterLevelToOrderedSet == null) {
|
||||||
Comparator<Level> levelComparator = new Comparator<Level>() {
|
Comparator<Level> levelComparator = new Comparator<Level>() {
|
||||||
|
|
||||||
|
@ -108,7 +121,7 @@ public class LevelUtilities {
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
masterLevelToOrderedSet = new HashMap<String, NavigableSet<Level>>();
|
Map<String, NavigableSet<Level>> masterLevelToOrderedSet = new HashMap<String, NavigableSet<Level>>();
|
||||||
for (Level level : LevelMappingFactory.getInstance().getAllLevels()) {
|
for (Level level : LevelMappingFactory.getInstance().getAllLevels()) {
|
||||||
NavigableSet<Level> levels = masterLevelToOrderedSet.get(level
|
NavigableSet<Level> levels = masterLevelToOrderedSet.get(level
|
||||||
.getMasterLevel().getName());
|
.getMasterLevel().getName());
|
||||||
|
@ -118,12 +131,18 @@ public class LevelUtilities {
|
||||||
.getName(), levels);
|
.getName(), levels);
|
||||||
}
|
}
|
||||||
if (level.isRangeLevel()) {
|
if (level.isRangeLevel()) {
|
||||||
|
|
||||||
|
try {
|
||||||
levels.add(level.getUpperLevel());
|
levels.add(level.getUpperLevel());
|
||||||
levels.add(level.getLowerLevel());
|
levels.add(level.getLowerLevel());
|
||||||
|
} catch (CommunicationException e) {
|
||||||
|
throw new VizCommunicationException(e);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
levels.add(level);
|
levels.add(level);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
LevelUtilities.masterLevelToOrderedSet = masterLevelToOrderedSet;
|
||||||
}
|
}
|
||||||
return masterLevelToOrderedSet.get(masterLevelName);
|
return masterLevelToOrderedSet.get(masterLevelName);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.raytheon.uf.viz.core.requests;
|
package com.raytheon.uf.viz.core.requests;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.lang.reflect.InvocationHandler;
|
import java.lang.reflect.InvocationHandler;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Proxy;
|
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.SuccessfulExecution;
|
||||||
import com.raytheon.uf.common.auth.resp.UserNotAuthenticated;
|
import com.raytheon.uf.common.auth.resp.UserNotAuthenticated;
|
||||||
import com.raytheon.uf.common.auth.resp.UserNotAuthorized;
|
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.HttpClient;
|
||||||
import com.raytheon.uf.common.comm.NetworkStatistics;
|
import com.raytheon.uf.common.comm.NetworkStatistics;
|
||||||
import com.raytheon.uf.common.serialization.SerializationException;
|
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.common.serialization.comm.util.ExceptionWrapper;
|
||||||
import com.raytheon.uf.viz.core.VizApp;
|
import com.raytheon.uf.viz.core.VizApp;
|
||||||
import com.raytheon.uf.viz.core.auth.UserController;
|
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.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||||
|
|
||||||
|
@ -311,6 +314,12 @@ public class ThriftClient {
|
||||||
// Log request stats
|
// Log request stats
|
||||||
stats.log(request.getClass().getSimpleName(), message.length,
|
stats.log(request.getClass().getSimpleName(), message.length,
|
||||||
responseLen);
|
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) {
|
} catch (Exception e) {
|
||||||
throw new VizException("unable to post request to server", e);
|
throw new VizException("unable to post request to server", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,6 +245,7 @@ public class PointDataTimeSeriesAdapter extends
|
||||||
// The level mapping for surface has way to much junk in it.
|
// The level mapping for surface has way to much junk in it.
|
||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
LevelMapping mapping = LevelMappingFactory.getInstance()
|
LevelMapping mapping = LevelMappingFactory.getInstance()
|
||||||
.getLevelMappingForKey(resourceData.getLevelKey());
|
.getLevelMappingForKey(resourceData.getLevelKey());
|
||||||
for (Level l : mapping.getLevels()) {
|
for (Level l : mapping.getLevels()) {
|
||||||
|
@ -259,6 +260,9 @@ public class PointDataTimeSeriesAdapter extends
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (VizException e) {
|
||||||
|
// return the default
|
||||||
|
}
|
||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ Bundle-ActivationPolicy: lazy
|
||||||
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
|
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
|
||||||
Import-Package: com.raytheon.edex.meteoLib,
|
Import-Package: com.raytheon.edex.meteoLib,
|
||||||
com.raytheon.edex.util,
|
com.raytheon.edex.util,
|
||||||
|
com.raytheon.uf.common.comm,
|
||||||
com.raytheon.uf.common.dataplugin,
|
com.raytheon.uf.common.dataplugin,
|
||||||
com.raytheon.uf.common.dataplugin.level,
|
com.raytheon.uf.common.dataplugin.level,
|
||||||
com.raytheon.uf.common.dataplugin.persist,
|
com.raytheon.uf.common.dataplugin.persist,
|
||||||
|
|
|
@ -22,6 +22,7 @@ package com.raytheon.uf.viz.derivparam.inv;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Deque;
|
import java.util.Deque;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -32,6 +33,7 @@ import java.util.Set;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
import java.util.concurrent.BlockingQueue;
|
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.dataplugin.level.Level;
|
||||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||||
import com.raytheon.uf.common.derivparam.tree.AbstractNode;
|
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;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.uf.common.time.DataTime;
|
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.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
||||||
import com.raytheon.uf.viz.core.level.LevelUtilities;
|
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
|
* tree and populates it with available derived parameters based on what is
|
||||||
* available from the base parameters.
|
* available from the base parameters.
|
||||||
*
|
*
|
||||||
|
* @throws VizException
|
||||||
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public synchronized void initTree(Map<String, DerivParamDesc> derParLibrary) {
|
public synchronized void initTree(Map<String, DerivParamDesc> derParLibrary)
|
||||||
|
throws VizException {
|
||||||
DerivedParameterGenerator.registerUpdateListener(this);
|
DerivedParameterGenerator.registerUpdateListener(this);
|
||||||
if (derParLibrary == null) {
|
if (derParLibrary == null) {
|
||||||
this.derParLibrary = new HashMap<String, DerivParamDesc>(0);
|
this.derParLibrary = new HashMap<String, DerivParamDesc>(0);
|
||||||
|
@ -189,7 +195,8 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
||||||
this.derParLibrary = derParLibrary;
|
this.derParLibrary = derParLibrary;
|
||||||
}
|
}
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
DataTree newTree = createBaseTree();
|
DataTree newTree = null;
|
||||||
|
newTree = createBaseTree();
|
||||||
if (newTree == null) {
|
if (newTree == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -198,7 +205,13 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
||||||
allLevels = null;
|
allLevels = null;
|
||||||
dataTree = newTree;
|
dataTree = newTree;
|
||||||
for (SourceNode sourceNode : dataTree.getSourceNodes().values()) {
|
for (SourceNode sourceNode : dataTree.getSourceNodes().values()) {
|
||||||
|
try {
|
||||||
doSupplement(sourceNode);
|
doSupplement(sourceNode);
|
||||||
|
} catch (VizCommunicationException e) {
|
||||||
|
// TODO need to recover from this
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||||
|
e);
|
||||||
|
}
|
||||||
for (ParameterNode parameterNode : sourceNode.getChildNodes()
|
for (ParameterNode parameterNode : sourceNode.getChildNodes()
|
||||||
.values()) {
|
.values()) {
|
||||||
String value = parameterNode.getValue();
|
String value = parameterNode.getValue();
|
||||||
|
@ -216,7 +229,11 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateDerParLibrary(Map<String, DerivParamDesc> derParLibrary) {
|
public void updateDerParLibrary(Map<String, DerivParamDesc> derParLibrary) {
|
||||||
|
try {
|
||||||
initTree(derParLibrary);
|
initTree(derParLibrary);
|
||||||
|
} catch (VizException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getParameterUnit(String source, String parameter) {
|
public String getParameterUnit(String source, String parameter) {
|
||||||
|
@ -254,8 +271,10 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
||||||
* Resolve any Supplement Derived Parameters.
|
* Resolve any Supplement Derived Parameters.
|
||||||
*
|
*
|
||||||
* @param sNode
|
* @param sNode
|
||||||
|
* @throws VizCommunicationException
|
||||||
*/
|
*/
|
||||||
private void doSupplement(SourceNode sNode) {
|
private void doSupplement(SourceNode sNode)
|
||||||
|
throws VizCommunicationException {
|
||||||
Set<StackEntry> nodata = new HashSet<StackEntry>();
|
Set<StackEntry> nodata = new HashSet<StackEntry>();
|
||||||
Deque<StackEntry> stack = new ArrayDeque<StackEntry>();
|
Deque<StackEntry> stack = new ArrayDeque<StackEntry>();
|
||||||
for (DerivParamDesc desc : derParLibrary.values()) {
|
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.
|
* Handle a query for a time agnostic node.
|
||||||
|
@ -320,7 +339,7 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
||||||
protected Collection<String> getAllSources() {
|
protected Collection<String> getAllSources() {
|
||||||
if (allSources == null) {
|
if (allSources == null) {
|
||||||
if (dataTree == null) {
|
if (dataTree == null) {
|
||||||
return null;
|
return Collections.emptyList();
|
||||||
} else {
|
} else {
|
||||||
return new ArrayList<String>(dataTree.getSources());
|
return new ArrayList<String>(dataTree.getSources());
|
||||||
}
|
}
|
||||||
|
@ -452,10 +471,18 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
||||||
* See get allSources, same function but for levels
|
* See get allSources, same function but for levels
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
|
* @throws VizCommunicationException
|
||||||
*/
|
*/
|
||||||
protected Collection<Level> getAllLevels() {
|
protected Collection<Level> getAllLevels() {
|
||||||
if (allLevels == null) {
|
if (allLevels == null) {
|
||||||
|
try {
|
||||||
return LevelMappingFactory.getInstance().getAllLevels();
|
return LevelMappingFactory.getInstance().getAllLevels();
|
||||||
|
} catch (VizCommunicationException e) {
|
||||||
|
// TODO recover from this.
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||||
|
e);
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return allLevels;
|
return allLevels;
|
||||||
}
|
}
|
||||||
|
@ -605,8 +632,13 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
||||||
Level level = lit.next();
|
Level level = lit.next();
|
||||||
AbstractRequestableLevelNode result = null;
|
AbstractRequestableLevelNode result = null;
|
||||||
if (derive) {
|
if (derive) {
|
||||||
|
try {
|
||||||
result = resolveNode(node, param, level, stack,
|
result = resolveNode(node, param, level, stack,
|
||||||
nodata);
|
nodata);
|
||||||
|
} catch (VizCommunicationException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
e.getLocalizedMessage(), e);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ParameterNode pNode = node.getChildNode(param);
|
ParameterNode pNode = node.getChildNode(param);
|
||||||
result = (AbstractRequestableLevelNode) (pNode == null ? null
|
result = (AbstractRequestableLevelNode) (pNode == null ? null
|
||||||
|
@ -654,11 +686,17 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
||||||
List<AbstractRequestableLevelNode> choices = new ArrayList<AbstractRequestableLevelNode>();
|
List<AbstractRequestableLevelNode> choices = new ArrayList<AbstractRequestableLevelNode>();
|
||||||
for (String aliasModel : sourceAliases
|
for (String aliasModel : sourceAliases
|
||||||
.get(source)) {
|
.get(source)) {
|
||||||
AbstractRequestableLevelNode alias;
|
AbstractRequestableLevelNode alias = null;
|
||||||
if (derive) {
|
if (derive) {
|
||||||
|
try {
|
||||||
alias = resolveNode(
|
alias = resolveNode(
|
||||||
dataTree.getSourceNode(aliasModel),
|
dataTree.getSourceNode(aliasModel),
|
||||||
param, level, stack, nodata);
|
param, level, stack, nodata);
|
||||||
|
} catch (VizCommunicationException e) {
|
||||||
|
statusHandler.handle(
|
||||||
|
Priority.PROBLEM,
|
||||||
|
e.getLocalizedMessage(), e);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ParameterNode pNode = node
|
ParameterNode pNode = node
|
||||||
.getChildNode(param);
|
.getChildNode(param);
|
||||||
|
@ -722,10 +760,12 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
||||||
* @param stack
|
* @param stack
|
||||||
* @param nodata
|
* @param nodata
|
||||||
* @return
|
* @return
|
||||||
|
* @throws VizCommunicationException
|
||||||
*/
|
*/
|
||||||
protected synchronized AbstractRequestableLevelNode resolveNode(
|
protected synchronized AbstractRequestableLevelNode resolveNode(
|
||||||
SourceNode sourceNode, String param, Level level,
|
SourceNode sourceNode, String param, Level level,
|
||||||
Deque<StackEntry> stack, Set<StackEntry> nodata) {
|
Deque<StackEntry> stack, Set<StackEntry> nodata)
|
||||||
|
throws VizCommunicationException {
|
||||||
ParameterNode pNode = sourceNode.getChildNode(param);
|
ParameterNode pNode = sourceNode.getChildNode(param);
|
||||||
LevelNode lNode = pNode == null ? null : pNode.getChildNode(Long
|
LevelNode lNode = pNode == null ? null : pNode.getChildNode(Long
|
||||||
.toString(level.getId()));
|
.toString(level.getId()));
|
||||||
|
@ -861,8 +901,14 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
||||||
}// method loop
|
}// method loop
|
||||||
}
|
}
|
||||||
if (level.isRangeLevel()) {
|
if (level.isRangeLevel()) {
|
||||||
Level upperLevel = level.getUpperLevel();
|
Level upperLevel;
|
||||||
Level lowerLevel = level.getLowerLevel();
|
Level lowerLevel;
|
||||||
|
try {
|
||||||
|
upperLevel = level.getUpperLevel();
|
||||||
|
lowerLevel = level.getLowerLevel();
|
||||||
|
} catch (CommunicationException e) {
|
||||||
|
throw new VizCommunicationException(e);
|
||||||
|
}
|
||||||
|
|
||||||
List<AbstractRequestableLevelNode> nodes = new ArrayList<AbstractRequestableLevelNode>();
|
List<AbstractRequestableLevelNode> nodes = new ArrayList<AbstractRequestableLevelNode>();
|
||||||
int endCount = 0;
|
int endCount = 0;
|
||||||
|
@ -956,10 +1002,11 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
||||||
* @param nodata
|
* @param nodata
|
||||||
* @return Should be Either some IStaticData or an
|
* @return Should be Either some IStaticData or an
|
||||||
* AbstractRequestableLevelNode
|
* AbstractRequestableLevelNode
|
||||||
|
* @throws VizCommunicationException
|
||||||
*/
|
*/
|
||||||
private synchronized Object resolveField(SourceNode sourceNode,
|
private synchronized Object resolveField(SourceNode sourceNode,
|
||||||
Level level, IDerivParamField ifield, Deque<StackEntry> stack,
|
Level level, IDerivParamField ifield, Deque<StackEntry> stack,
|
||||||
Set<StackEntry> nodata) {
|
Set<StackEntry> nodata) throws VizCommunicationException {
|
||||||
// process the next field
|
// process the next field
|
||||||
if (ifield.getClass() == DerivParamConstantField.class) {
|
if (ifield.getClass() == DerivParamConstantField.class) {
|
||||||
return new FloatRequestableData(
|
return new FloatRequestableData(
|
||||||
|
@ -1004,11 +1051,15 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
fieldLevel = level;
|
fieldLevel = level;
|
||||||
} else if (level.isRangeLevel()) {
|
} else if (level.isRangeLevel()) {
|
||||||
|
try {
|
||||||
if (type == LevelType.Upper) {
|
if (type == LevelType.Upper) {
|
||||||
fieldLevel = level.getUpperLevel();
|
fieldLevel = level.getUpperLevel();
|
||||||
} else {
|
} else {
|
||||||
fieldLevel = level.getLowerLevel();
|
fieldLevel = level.getLowerLevel();
|
||||||
}
|
}
|
||||||
|
} catch (CommunicationException e) {
|
||||||
|
throw new VizCommunicationException(e);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
SortedSet<Level> levels = null;
|
SortedSet<Level> levels = null;
|
||||||
if (type == LevelType.Upper) {
|
if (type == LevelType.Upper) {
|
||||||
|
@ -1067,7 +1118,7 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
||||||
|
|
||||||
protected abstract LevelNode getCubeNode(SourceNode sNode,
|
protected abstract LevelNode getCubeNode(SourceNode sNode,
|
||||||
DerivParamField field, Deque<StackEntry> stack,
|
DerivParamField field, Deque<StackEntry> stack,
|
||||||
Set<StackEntry> nodata);
|
Set<StackEntry> nodata) throws VizCommunicationException;
|
||||||
|
|
||||||
protected abstract AbstractDerivedLevelNode getImportNode(
|
protected abstract AbstractDerivedLevelNode getImportNode(
|
||||||
AbstractRequestableData nodeToImport, SourceNode destSourceNode,
|
AbstractRequestableData nodeToImport, SourceNode destSourceNode,
|
||||||
|
|
|
@ -29,6 +29,7 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||||
|
|
||||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||||
import com.raytheon.uf.common.serialization.adapters.UnitAdapter;
|
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.LevelMapping;
|
||||||
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
||||||
|
|
||||||
|
@ -82,14 +83,14 @@ public class DerivParamField implements ISerializableObject, IDerivParamField {
|
||||||
this.param = param;
|
this.param = param;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LevelMapping getLevelMapping() {
|
public LevelMapping getLevelMapping() throws VizCommunicationException {
|
||||||
if (levelType == null && level != null) {
|
if (levelType == null && level != null) {
|
||||||
setLevel(level);
|
setLevel(level);
|
||||||
}
|
}
|
||||||
return levelMapping;
|
return levelMapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LevelType getLevelType() {
|
public LevelType getLevelType() throws VizCommunicationException {
|
||||||
if (levelType == null && level != null) {
|
if (levelType == null && level != null) {
|
||||||
setLevel(level);
|
setLevel(level);
|
||||||
}
|
}
|
||||||
|
@ -125,8 +126,9 @@ public class DerivParamField implements ISerializableObject, IDerivParamField {
|
||||||
* @param level
|
* @param level
|
||||||
* @return true upon success, false if the token is not recognized, in which
|
* @return true upon success, false if the token is not recognized, in which
|
||||||
* case levelType and levelMapping will both be reset to null
|
* 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);
|
levelType = LevelType.parseLevel(level);
|
||||||
if (levelType == LevelType.LevelMapping) {
|
if (levelType == LevelType.LevelMapping) {
|
||||||
levelMapping = LevelMappingFactory.getInstance()
|
levelMapping = LevelMappingFactory.getInstance()
|
||||||
|
|
|
@ -38,9 +38,8 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
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.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.status.StatusConstants;
|
|
||||||
import com.raytheon.uf.viz.derivparam.Activator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Metadata about a derived parameter method.
|
* Metadata about a derived parameter method.
|
||||||
|
@ -61,7 +60,8 @@ import com.raytheon.uf.viz.derivparam.Activator;
|
||||||
@XmlAccessorType(XmlAccessType.NONE)
|
@XmlAccessorType(XmlAccessType.NONE)
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
public class DerivParamMethod implements ISerializableObject {
|
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 {
|
public enum FrameworkMethod {
|
||||||
ALIAS, MODELRUN, TIMERANGE, OR, UNION, SUPPLEMENT, IMPORT, NODERIVATION;
|
ALIAS, MODELRUN, TIMERANGE, OR, UNION, SUPPLEMENT, IMPORT, NODERIVATION;
|
||||||
|
@ -149,7 +149,7 @@ public class DerivParamMethod implements ISerializableObject {
|
||||||
fields.add(field);
|
fields.add(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<Level> getValidLevels() {
|
public Set<Level> getValidLevels() throws VizCommunicationException {
|
||||||
if (validLevels == null && levels != null && levels.length() > 0) {
|
if (validLevels == null && levels != null && levels.length() > 0) {
|
||||||
ValidLevelGenerator lvlGen = new ValidLevelGenerator();
|
ValidLevelGenerator lvlGen = new ValidLevelGenerator();
|
||||||
validLevels = lvlGen.generateLevels(levels);
|
validLevels = lvlGen.generateLevels(levels);
|
||||||
|
@ -253,8 +253,8 @@ public class DerivParamMethod implements ISerializableObject {
|
||||||
tmp.append(pFieldTokens[k]);
|
tmp.append(pFieldTokens[k]);
|
||||||
}
|
}
|
||||||
|
|
||||||
statusHandler.handle(
|
statusHandler
|
||||||
Priority.SIGNIFICANT,
|
.handle(Priority.SIGNIFICANT,
|
||||||
"Derived parameter ["
|
"Derived parameter ["
|
||||||
+ "field ["
|
+ "field ["
|
||||||
+ field.getParam()
|
+ field.getParam()
|
||||||
|
|
|
@ -28,10 +28,12 @@ import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
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.CompareType;
|
||||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||||
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
||||||
import com.raytheon.uf.common.dataplugin.level.MasterLevel;
|
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.LevelMapping;
|
||||||
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
||||||
|
|
||||||
|
@ -72,7 +74,7 @@ public class ValidLevelGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<Level> generateLevels(String validLevelsString)
|
public Set<Level> generateLevels(String validLevelsString)
|
||||||
throws IllegalArgumentException {
|
throws IllegalArgumentException, VizCommunicationException {
|
||||||
masterLevels = new HashMap<MasterLevel, Set<Level>>();
|
masterLevels = new HashMap<MasterLevel, Set<Level>>();
|
||||||
validLevels = new HashSet<Level>();
|
validLevels = new HashSet<Level>();
|
||||||
masterLevelsHandled = new HashSet<MasterLevel>();
|
masterLevelsHandled = new HashSet<MasterLevel>();
|
||||||
|
@ -121,7 +123,11 @@ public class ValidLevelGenerator {
|
||||||
|
|
||||||
if (tokensToProcess.size() > 0) {
|
if (tokensToProcess.size() > 0) {
|
||||||
for (String token : tokensToProcess) {
|
for (String token : tokensToProcess) {
|
||||||
|
try {
|
||||||
processLevelToken(token);
|
processLevelToken(token);
|
||||||
|
} catch (CommunicationException e) {
|
||||||
|
throw new VizCommunicationException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (Set<Level> levels : masterLevels.values()) {
|
for (Set<Level> levels : masterLevels.values()) {
|
||||||
|
@ -133,7 +139,8 @@ public class ValidLevelGenerator {
|
||||||
return validLevels;
|
return validLevels;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processLevelToken(String token) {
|
private void processLevelToken(String token)
|
||||||
|
throws VizCommunicationException, CommunicationException {
|
||||||
boolean negate = token.charAt(0) == '!';
|
boolean negate = token.charAt(0) == '!';
|
||||||
int rangeIndex = token.indexOf('>');
|
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;
|
Type rval = null;
|
||||||
LevelMapping mapping = lmf.getLevelMappingForKey(token);
|
LevelMapping mapping = lmf.getLevelMappingForKey(token);
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,10 @@ Require-Bundle: org.eclipse.ui,
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Export-Package: com.raytheon.uf.viz.objectiveanalysis.rsc
|
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.level,
|
||||||
|
com.raytheon.uf.common.dataplugin.radar,
|
||||||
com.raytheon.uf.viz.derivparam.library,
|
com.raytheon.uf.viz.derivparam.library,
|
||||||
com.raytheon.uf.viz.derivparam.tree,
|
com.raytheon.uf.viz.derivparam.tree,
|
||||||
com.raytheon.viz.ui,
|
com.raytheon.viz.ui,
|
||||||
|
|
|
@ -27,18 +27,20 @@ import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
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.PluginDataObject;
|
||||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||||
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
||||||
import com.raytheon.uf.common.dataplugin.level.MasterLevel;
|
import com.raytheon.uf.common.dataplugin.level.MasterLevel;
|
||||||
import com.raytheon.uf.common.time.DataTime;
|
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.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
||||||
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
|
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
|
||||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
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.Level.LevelType;
|
||||||
|
import com.raytheon.uf.viz.core.style.level.SingleLevel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resource Data for Objective Analysis
|
* Resource Data for Objective Analysis
|
||||||
|
@ -161,8 +163,8 @@ public class OAResourceData extends AbstractRequestableResourceData {
|
||||||
throw new UnsupportedOperationException("Unsupported level for OA "
|
throw new UnsupportedOperationException("Unsupported level for OA "
|
||||||
+ levelKey);
|
+ levelKey);
|
||||||
}
|
}
|
||||||
level.setValue(Double.parseDouble(levelKey.substring(0, levelKey
|
level.setValue(Double.parseDouble(levelKey.substring(0,
|
||||||
.length() - 2)));
|
levelKey.length() - 2)));
|
||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +196,12 @@ public class OAResourceData extends AbstractRequestableResourceData {
|
||||||
DataTime[] times = super.getAvailableTimes();
|
DataTime[] times = super.getAvailableTimes();
|
||||||
if (this.levelKey.equals(ALL_TILTS)) {
|
if (this.levelKey.equals(ALL_TILTS)) {
|
||||||
LevelFactory factory = LevelFactory.getInstance();
|
LevelFactory factory = LevelFactory.getInstance();
|
||||||
MasterLevel ml = factory.getMasterLevel("TILT");
|
MasterLevel ml;
|
||||||
|
try {
|
||||||
|
ml = factory.getMasterLevel("TILT");
|
||||||
|
} catch (CommunicationException e) {
|
||||||
|
throw new VizCommunicationException(e);
|
||||||
|
}
|
||||||
Set<Level> allLevels = LevelMappingFactory.getInstance()
|
Set<Level> allLevels = LevelMappingFactory.getInstance()
|
||||||
.getAllLevels();
|
.getAllLevels();
|
||||||
List<Level> levels = new ArrayList<Level>();
|
List<Level> levels = new ArrayList<Level>();
|
||||||
|
|
|
@ -32,6 +32,7 @@ Export-Package: com.raytheon.viz.grid,
|
||||||
com.raytheon.viz.grid.xml
|
com.raytheon.viz.grid.xml
|
||||||
Import-Package: com.raytheon.edex.scriptfactory,
|
Import-Package: com.raytheon.edex.scriptfactory,
|
||||||
com.raytheon.uf.common.colormap,
|
com.raytheon.uf.common.colormap,
|
||||||
|
com.raytheon.uf.common.comm,
|
||||||
com.raytheon.uf.common.dataplugin.grib,
|
com.raytheon.uf.common.dataplugin.grib,
|
||||||
com.raytheon.uf.common.dataplugin.grib.exception,
|
com.raytheon.uf.common.dataplugin.grib.exception,
|
||||||
com.raytheon.uf.common.dataplugin.grib.request,
|
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.serialization,
|
||||||
com.raytheon.uf.common.time,
|
com.raytheon.uf.common.time,
|
||||||
com.raytheon.uf.common.topo,
|
com.raytheon.uf.common.topo,
|
||||||
|
com.raytheon.uf.viz.d2d.core.map,
|
||||||
com.raytheon.uf.viz.d2d.core.time,
|
com.raytheon.uf.viz.d2d.core.time,
|
||||||
com.raytheon.uf.viz.derivparam,
|
com.raytheon.uf.viz.derivparam,
|
||||||
com.raytheon.uf.viz.derivparam.data,
|
com.raytheon.uf.viz.derivparam.data,
|
||||||
|
|
|
@ -33,12 +33,16 @@ import java.util.Set;
|
||||||
import java.util.concurrent.BlockingQueue;
|
import java.util.concurrent.BlockingQueue;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
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.GribModelLookup;
|
||||||
import com.raytheon.uf.common.dataplugin.grib.util.GridModel;
|
import com.raytheon.uf.common.dataplugin.grib.util.GridModel;
|
||||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||||
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
||||||
import com.raytheon.uf.common.dataplugin.level.MasterLevel;
|
import com.raytheon.uf.common.dataplugin.level.MasterLevel;
|
||||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
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.datastructure.DataCubeContainer;
|
||||||
import com.raytheon.uf.viz.core.rsc.DisplayType;
|
import com.raytheon.uf.viz.core.rsc.DisplayType;
|
||||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||||
|
@ -70,6 +74,8 @@ import com.raytheon.viz.grid.rsc.GridResourceData;
|
||||||
*/
|
*/
|
||||||
public class GridProductBrowserDataDefinition extends
|
public class GridProductBrowserDataDefinition extends
|
||||||
AbstractRequestableProductBrowserDataDefinition<GridResourceData> {
|
AbstractRequestableProductBrowserDataDefinition<GridResourceData> {
|
||||||
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(GridProductBrowserDataDefinition.class);
|
||||||
|
|
||||||
private static final String SHOW_UNKNOWN_MODELS = "Show Unknown Models";
|
private static final String SHOW_UNKNOWN_MODELS = "Show Unknown Models";
|
||||||
|
|
||||||
|
@ -166,6 +172,7 @@ public class GridProductBrowserDataDefinition extends
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
LevelFactory lf = LevelFactory.getInstance();
|
LevelFactory lf = LevelFactory.getInstance();
|
||||||
|
try {
|
||||||
if (selection.length > 3) {
|
if (selection.length > 3) {
|
||||||
List<String> availLevels = new ArrayList<String>();
|
List<String> availLevels = new ArrayList<String>();
|
||||||
for (String levelid : returnQueue) {
|
for (String levelid : returnQueue) {
|
||||||
|
@ -188,6 +195,10 @@ public class GridProductBrowserDataDefinition extends
|
||||||
Collections.sort(results);
|
Collections.sort(results);
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
} catch (CommunicationException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||||
|
return super.populateData(selection);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,9 +260,14 @@ public class GridProductBrowserDataDefinition extends
|
||||||
} else if (GridInventory.LEVEL_ID_QUERY.equals(param)) {
|
} else if (GridInventory.LEVEL_ID_QUERY.equals(param)) {
|
||||||
Level[] levels = new Level[parameters.length];
|
Level[] levels = new Level[parameters.length];
|
||||||
LevelFactory lf = LevelFactory.getInstance();
|
LevelFactory lf = LevelFactory.getInstance();
|
||||||
|
try {
|
||||||
for (int i = 0; i < levels.length; i++) {
|
for (int i = 0; i < levels.length; i++) {
|
||||||
levels[i] = lf.getLevel(parameters[i]);
|
levels[i] = lf.getLevel(parameters[i]);
|
||||||
}
|
}
|
||||||
|
} catch (CommunicationException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||||
|
e);
|
||||||
|
}
|
||||||
Arrays.sort(levels, levelComparator);
|
Arrays.sort(levels, levelComparator);
|
||||||
for (int i = 0; i < parameters.length; i++) {
|
for (int i = 0; i < parameters.length; i++) {
|
||||||
String levelName = levels[i].toString().replace("_", "-");
|
String levelName = levels[i].toString().replace("_", "-");
|
||||||
|
@ -264,10 +280,15 @@ public class GridProductBrowserDataDefinition extends
|
||||||
return labels;
|
return labels;
|
||||||
} else if (GridInventory.MASTER_LEVEL_QUERY.equals(param)) {
|
} else if (GridInventory.MASTER_LEVEL_QUERY.equals(param)) {
|
||||||
LevelFactory lf = LevelFactory.getInstance();
|
LevelFactory lf = LevelFactory.getInstance();
|
||||||
|
try {
|
||||||
for (int i = 0; i < parameters.length; i++) {
|
for (int i = 0; i < parameters.length; i++) {
|
||||||
MasterLevel masterLevel = lf.getMasterLevel(parameters[i]);
|
MasterLevel masterLevel = lf.getMasterLevel(parameters[i]);
|
||||||
labels.add(new ProductBrowserLabel(
|
labels.add(new ProductBrowserLabel(masterLevel
|
||||||
masterLevel.getDescription(), masterLevel.getName()));
|
.getDescription(), masterLevel.getName()));
|
||||||
|
}
|
||||||
|
} catch (CommunicationException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||||
|
e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return super.formatData(param, parameters);
|
return super.formatData(param, parameters);
|
||||||
|
@ -281,14 +302,18 @@ public class GridProductBrowserDataDefinition extends
|
||||||
}
|
}
|
||||||
HashMap<String, RequestConstraint> queryList = super
|
HashMap<String, RequestConstraint> queryList = super
|
||||||
.getProductParameters(selection, order);
|
.getProductParameters(selection, order);
|
||||||
|
try {
|
||||||
queryList.remove(order[4]);
|
|
||||||
// Convert Level id to level one and level two values.
|
// Convert Level id to level one and level two values.
|
||||||
Level level = LevelFactory.getInstance().getLevel(selection[4]);
|
Level level = LevelFactory.getInstance().getLevel(selection[4]);
|
||||||
queryList.put(GridInventory.LEVEL_ONE_QUERY, new RequestConstraint(
|
queryList.put(GridInventory.LEVEL_ONE_QUERY, new RequestConstraint(
|
||||||
level.getLevelOneValueAsString()));
|
level.getLevelOneValueAsString()));
|
||||||
queryList.put(GridInventory.LEVEL_TWO_QUERY, new RequestConstraint(
|
queryList.put(GridInventory.LEVEL_TWO_QUERY, new RequestConstraint(
|
||||||
level.getLevelTwoValueAsString()));
|
level.getLevelTwoValueAsString()));
|
||||||
|
queryList.remove(order[4]);
|
||||||
|
} catch (CommunicationException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||||
|
|
||||||
|
}
|
||||||
return queryList;
|
return queryList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.lang.ref.WeakReference;
|
||||||
import javax.measure.converter.UnitConverter;
|
import javax.measure.converter.UnitConverter;
|
||||||
import javax.measure.unit.Unit;
|
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.GribModel;
|
||||||
import com.raytheon.uf.common.dataplugin.grib.GribRecord;
|
import com.raytheon.uf.common.dataplugin.grib.GribRecord;
|
||||||
import com.raytheon.uf.common.dataplugin.grib.spatial.projections.GridCoverage;
|
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.Request;
|
||||||
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
|
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
|
||||||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
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.HDF5Util;
|
||||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
|
@ -61,6 +65,8 @@ import com.raytheon.viz.radar.util.DataUtilities;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class RadarRequestableData extends GribRequestableData {
|
public class RadarRequestableData extends GribRequestableData {
|
||||||
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(RadarRequestableData.class);
|
||||||
|
|
||||||
private RadarRecord radarSource;
|
private RadarRecord radarSource;
|
||||||
|
|
||||||
|
@ -80,8 +86,13 @@ public class RadarRequestableData extends GribRequestableData {
|
||||||
RadarAdapter.getGridSpacing());
|
RadarAdapter.getGridSpacing());
|
||||||
this.source = "radar";
|
this.source = "radar";
|
||||||
this.dataTime = source.getDataTime();
|
this.dataTime = source.getDataTime();
|
||||||
|
try {
|
||||||
this.level = LevelFactory.getInstance().getLevel("TILT",
|
this.level = LevelFactory.getInstance().getLevel("TILT",
|
||||||
source.getPrimaryElevationAngle());
|
source.getPrimaryElevationAngle());
|
||||||
|
} catch (CommunicationException e1) {
|
||||||
|
statusHandler
|
||||||
|
.handle(Priority.PROBLEM, e1.getLocalizedMessage(), e1);
|
||||||
|
}
|
||||||
this.parameter = parameterAbbrev;
|
this.parameter = parameterAbbrev;
|
||||||
this.parameterName = "";
|
this.parameterName = "";
|
||||||
this.unit = unit;
|
this.unit = unit;
|
||||||
|
@ -146,14 +157,12 @@ public class RadarRequestableData extends GribRequestableData {
|
||||||
fdr.setDimension(2);
|
fdr.setDimension(2);
|
||||||
cache = new WeakReference<FloatDataRecord>(fdr);
|
cache = new WeakReference<FloatDataRecord>(fdr);
|
||||||
}
|
}
|
||||||
if (arg == null) {
|
if (arg instanceof Request) {
|
||||||
return new IDataRecord[] { fdr };
|
|
||||||
} else if (arg instanceof Request) {
|
|
||||||
fdr = SliceUtil.slice(fdr, (Request) arg);
|
fdr = SliceUtil.slice(fdr, (Request) arg);
|
||||||
return new IDataRecord[] { fdr };
|
return new IDataRecord[] { fdr };
|
||||||
|
} else {
|
||||||
|
return new IDataRecord[] { fdr };
|
||||||
}
|
}
|
||||||
throw new VizException(this.getClass().getSimpleName()
|
|
||||||
+ " cannot process request of type: "
|
|
||||||
+ arg.getClass().getSimpleName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ package com.raytheon.viz.grid.data;
|
||||||
|
|
||||||
import javax.measure.unit.SI;
|
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.spatial.projections.GridCoverage;
|
||||||
import com.raytheon.uf.common.dataplugin.grib.util.GribModelLookup;
|
import com.raytheon.uf.common.dataplugin.grib.util.GribModelLookup;
|
||||||
import com.raytheon.uf.common.dataplugin.grib.util.GridModel;
|
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.dataplugin.level.LevelFactory;
|
||||||
import com.raytheon.uf.common.datastorage.Request;
|
import com.raytheon.uf.common.datastorage.Request;
|
||||||
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
|
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.exception.VizException;
|
||||||
import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
|
import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
|
||||||
import com.raytheon.viz.grid.util.CoverageUtils;
|
import com.raytheon.viz.grid.util.CoverageUtils;
|
||||||
|
@ -51,6 +55,9 @@ import com.raytheon.viz.grid.util.SliceUtil;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class StaticGridRequestableData extends AbstractRequestableData {
|
public class StaticGridRequestableData extends AbstractRequestableData {
|
||||||
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(StaticGridRequestableData.class);
|
||||||
|
|
||||||
private StaticGridDataType dataType;
|
private StaticGridDataType dataType;
|
||||||
|
|
||||||
public StaticGridRequestableData(StaticGridDataType dataType, String source) {
|
public StaticGridRequestableData(StaticGridDataType dataType, String source) {
|
||||||
|
@ -63,7 +70,11 @@ public class StaticGridRequestableData extends AbstractRequestableData {
|
||||||
} else {
|
} else {
|
||||||
this.unit = SI.METER;
|
this.unit = SI.METER;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
this.level = LevelFactory.getInstance().getLevel("SFC", 0.0);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (arg == null) {
|
if (arg instanceof Request) {
|
||||||
return rval;
|
|
||||||
} else if (arg instanceof Request) {
|
|
||||||
return SliceUtil.slice(rval, (Request) arg);
|
return SliceUtil.slice(rval, (Request) arg);
|
||||||
|
} else {
|
||||||
|
return rval;
|
||||||
}
|
}
|
||||||
throw new VizException(this.getClass().getSimpleName()
|
|
||||||
+ " cannot process request of type: "
|
|
||||||
+ arg.getClass().getSimpleName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -26,10 +26,14 @@ import javax.measure.unit.SI;
|
||||||
|
|
||||||
import org.geotools.coverage.grid.GridGeometry2D;
|
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.grib.spatial.projections.GridCoverage;
|
||||||
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
||||||
import com.raytheon.uf.common.datastorage.Request;
|
import com.raytheon.uf.common.datastorage.Request;
|
||||||
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
|
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.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.topo.TopoQuery;
|
import com.raytheon.uf.viz.core.topo.TopoQuery;
|
||||||
import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
|
import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
|
||||||
|
@ -53,6 +57,9 @@ import com.raytheon.viz.grid.util.SliceUtil;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class TopoRequestableData extends AbstractRequestableData {
|
public class TopoRequestableData extends AbstractRequestableData {
|
||||||
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(TopoRequestableData.class);
|
||||||
|
|
||||||
// need to move to a static timed cache
|
// need to move to a static timed cache
|
||||||
private static Map<GridCoverage, FloatDataRecord> topoCache = new HashMap<GridCoverage, FloatDataRecord>();
|
private static Map<GridCoverage, FloatDataRecord> topoCache = new HashMap<GridCoverage, FloatDataRecord>();
|
||||||
|
|
||||||
|
@ -61,7 +68,11 @@ public class TopoRequestableData extends AbstractRequestableData {
|
||||||
this.parameter = "staticTopo";
|
this.parameter = "staticTopo";
|
||||||
this.parameterName = "Topography";
|
this.parameterName = "Topography";
|
||||||
this.unit = SI.METER;
|
this.unit = SI.METER;
|
||||||
|
try {
|
||||||
this.level = LevelFactory.getInstance().getLevel("SFC", 0.0);
|
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);
|
topoCache.put(coverage, rval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (arg == null) {
|
if (arg instanceof Request) {
|
||||||
return rval;
|
|
||||||
} else if (arg instanceof Request) {
|
|
||||||
return SliceUtil.slice(rval, (Request) arg);
|
return SliceUtil.slice(rval, (Request) arg);
|
||||||
|
} else {
|
||||||
|
return rval;
|
||||||
}
|
}
|
||||||
throw new VizException(this.getClass().getSimpleName()
|
|
||||||
+ " cannot process request of type: "
|
|
||||||
+ arg.getClass().getSimpleName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,8 @@ public class GridInventory extends AbstractInventory implements
|
||||||
private List<Map<String, RequestConstraint>> failedRequests = new ArrayList<Map<String, RequestConstraint>>();
|
private List<Map<String, RequestConstraint>> failedRequests = new ArrayList<Map<String, RequestConstraint>>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initTree(Map<String, DerivParamDesc> derParLibrary) {
|
public void initTree(Map<String, DerivParamDesc> derParLibrary)
|
||||||
|
throws VizException {
|
||||||
super.initTree(derParLibrary);
|
super.initTree(derParLibrary);
|
||||||
if (updater == null) {
|
if (updater == null) {
|
||||||
updater = new GridUpdater(this);
|
updater = new GridUpdater(this);
|
||||||
|
@ -144,32 +145,28 @@ public class GridInventory extends AbstractInventory implements
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reinitTree() {
|
public void reinitTree() {
|
||||||
|
try {
|
||||||
initTree(derParLibrary);
|
initTree(derParLibrary);
|
||||||
// reprocess all failed requests to see if data has become available.
|
// reprocess all failed requests to see if data has become
|
||||||
|
// available.
|
||||||
List<Map<String, RequestConstraint>> constraintsToTry = this.failedRequests;
|
List<Map<String, RequestConstraint>> constraintsToTry = this.failedRequests;
|
||||||
this.failedRequests = new ArrayList<Map<String, RequestConstraint>>(
|
this.failedRequests = new ArrayList<Map<String, RequestConstraint>>(
|
||||||
failedRequests.size());
|
failedRequests.size());
|
||||||
for (Map<String, RequestConstraint> constraints : constraintsToTry) {
|
for (Map<String, RequestConstraint> constraints : constraintsToTry) {
|
||||||
evaluateRequestConstraints(constraints);
|
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"
|
String request = "from com.raytheon.edex.uengine.tasks.grib import GridCatalog\n"
|
||||||
+ "from com.raytheon.uf.common.message.response import ResponseMessageGeneric\n"
|
+ "from com.raytheon.uf.common.message.response import ResponseMessageGeneric\n"
|
||||||
+ "test = GridCatalog()\n"
|
+ "test = GridCatalog()\n"
|
||||||
+ "return ResponseMessageGeneric(test.execute())";
|
+ "return ResponseMessageGeneric(test.execute())";
|
||||||
Object[] tree = null;
|
Object[] tree = null;
|
||||||
try {
|
|
||||||
tree = Connector.getInstance().connect(request, null, 60000);
|
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);
|
|
||||||
}
|
|
||||||
if (tree != null) {
|
if (tree != null) {
|
||||||
return (DataTree) tree[0];
|
return (DataTree) tree[0];
|
||||||
}
|
}
|
||||||
|
@ -266,7 +263,7 @@ public class GridInventory extends AbstractInventory implements
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DataTree createBaseTree() {
|
protected DataTree createBaseTree() throws VizException {
|
||||||
DataTree newTree = getTreeFromEdex();
|
DataTree newTree = getTreeFromEdex();
|
||||||
if (newTree == null) {
|
if (newTree == null) {
|
||||||
return newTree;
|
return newTree;
|
||||||
|
@ -639,7 +636,8 @@ public class GridInventory extends AbstractInventory implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected LevelNode getCubeNode(SourceNode sNode, DerivParamField field,
|
protected LevelNode getCubeNode(SourceNode sNode, DerivParamField field,
|
||||||
Deque<StackEntry> stack, Set<StackEntry> nodata) {
|
Deque<StackEntry> stack, Set<StackEntry> nodata)
|
||||||
|
throws VizCommunicationException {
|
||||||
StackEntry se = new StackEntry(sNode.getValue(), field.getParam(),
|
StackEntry se = new StackEntry(sNode.getValue(), field.getParam(),
|
||||||
Long.MIN_VALUE);
|
Long.MIN_VALUE);
|
||||||
if (stack.contains(se)) {
|
if (stack.contains(se)) {
|
||||||
|
@ -654,8 +652,14 @@ public class GridInventory extends AbstractInventory implements
|
||||||
String masterLevelName = get3DMasterLevel(sNode.getValue());
|
String masterLevelName = get3DMasterLevel(sNode.getValue());
|
||||||
boolean isRadar = sNode.getValue().equals(RadarAdapter.RADAR_SOURCE);
|
boolean isRadar = sNode.getValue().equals(RadarAdapter.RADAR_SOURCE);
|
||||||
|
|
||||||
NavigableSet<Level> levels = LevelUtilities
|
NavigableSet<Level> levels = null;
|
||||||
|
try {
|
||||||
|
levels = LevelUtilities
|
||||||
.getOrderedSetOfStandardLevels(masterLevelName);
|
.getOrderedSetOfStandardLevels(masterLevelName);
|
||||||
|
} catch (VizCommunicationException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
List<CubeLevel<AbstractRequestableLevelNode, AbstractRequestableLevelNode>> cubeLevels = new ArrayList<CubeLevel<AbstractRequestableLevelNode, AbstractRequestableLevelNode>>(
|
List<CubeLevel<AbstractRequestableLevelNode, AbstractRequestableLevelNode>> cubeLevels = new ArrayList<CubeLevel<AbstractRequestableLevelNode, AbstractRequestableLevelNode>>(
|
||||||
levels.size());
|
levels.size());
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.raytheon.edex.util.Util;
|
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.PluginException;
|
||||||
import com.raytheon.uf.common.dataplugin.grib.GribModel;
|
import com.raytheon.uf.common.dataplugin.grib.GribModel;
|
||||||
import com.raytheon.uf.common.dataplugin.grib.GribRecord;
|
import com.raytheon.uf.common.dataplugin.grib.GribRecord;
|
||||||
|
@ -215,11 +216,18 @@ public class GridUpdater implements IAlertObserver {
|
||||||
}
|
}
|
||||||
GribMapKey updateKey = new GribMapKey(alert.decodedAlert);
|
GribMapKey updateKey = new GribMapKey(alert.decodedAlert);
|
||||||
GribTimeCache.getInstance().clearTimes(updateKey);
|
GribTimeCache.getInstance().clearTimes(updateKey);
|
||||||
|
LevelNode lNode = null;
|
||||||
|
try {
|
||||||
Level level = LevelFactory.getInstance().getLevel(
|
Level level = LevelFactory.getInstance().getLevel(
|
||||||
updateKey.masterLevel, updateKey.levelone,
|
updateKey.masterLevel, updateKey.levelone,
|
||||||
updateKey.leveltwo);
|
updateKey.leveltwo);
|
||||||
LevelNode lNode = inventory.getNode(updateKey.modelName,
|
lNode = inventory.getNode(updateKey.modelName,
|
||||||
updateKey.parameter, level);
|
updateKey.parameter, level);
|
||||||
|
} catch (CommunicationException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||||
|
e);
|
||||||
|
}
|
||||||
|
|
||||||
if (lNode == null) {
|
if (lNode == null) {
|
||||||
inventory.reinitTree();
|
inventory.reinitTree();
|
||||||
// System.out.println(alert.dataURI);
|
// System.out.println(alert.dataURI);
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.comm.CommunicationException;
|
||||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
import com.raytheon.uf.common.dataplugin.PluginException;
|
||||||
import com.raytheon.uf.common.dataplugin.grib.GribModel;
|
import com.raytheon.uf.common.dataplugin.grib.GribModel;
|
||||||
import com.raytheon.uf.common.dataplugin.grib.GribRecord;
|
import com.raytheon.uf.common.dataplugin.grib.GribRecord;
|
||||||
|
@ -157,8 +158,14 @@ public class RadarUpdater implements IAlertObserver {
|
||||||
}
|
}
|
||||||
Double elevationAngle = (Double) obj;
|
Double elevationAngle = (Double) obj;
|
||||||
cache.remove(new CacheKey(productCode, elevationAngle));
|
cache.remove(new CacheKey(productCode, elevationAngle));
|
||||||
Level level = LevelFactory.getInstance().getLevel(
|
Level level = null;
|
||||||
|
try {
|
||||||
|
level = LevelFactory.getInstance().getLevel(
|
||||||
RadarAdapter.CUBE_MASTER_LEVEL_NAME, elevationAngle);
|
RadarAdapter.CUBE_MASTER_LEVEL_NAME, elevationAngle);
|
||||||
|
} catch (CommunicationException e1) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
e1.getLocalizedMessage(), e1);
|
||||||
|
}
|
||||||
GribRecord fakeRec = new GribRecord();
|
GribRecord fakeRec = new GribRecord();
|
||||||
fakeRec.setPluginName("grib");
|
fakeRec.setPluginName("grib");
|
||||||
fakeRec.setDataTime(time);
|
fakeRec.setDataTime(time);
|
||||||
|
|
|
@ -22,6 +22,7 @@ package com.raytheon.viz.grid.rsc;
|
||||||
import com.raytheon.uf.common.dataplugin.grib.GribModel;
|
import com.raytheon.uf.common.dataplugin.grib.GribModel;
|
||||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||||
import com.raytheon.uf.common.time.DataTime;
|
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.LevelMapping;
|
||||||
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
||||||
import com.raytheon.uf.viz.core.rsc.AbstractNameGenerator;
|
import com.raytheon.uf.viz.core.rsc.AbstractNameGenerator;
|
||||||
|
@ -118,12 +119,17 @@ public class GridNameGenerator extends AbstractNameGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String lookupPlane(Level level) {
|
private String lookupPlane(Level level) {
|
||||||
|
try {
|
||||||
LevelMapping mapping = LevelMappingFactory.getInstance()
|
LevelMapping mapping = LevelMappingFactory.getInstance()
|
||||||
.getLevelMappingForLevel(level);
|
.getLevelMappingForLevel(level);
|
||||||
if (mapping == null) {
|
if (mapping == null) {
|
||||||
return level.getMasterLevel().getName();
|
return level.getMasterLevel().getName();
|
||||||
}
|
}
|
||||||
return mapping.getDisplayName();
|
return mapping.getDisplayName();
|
||||||
|
} catch (VizCommunicationException e) {
|
||||||
|
return level.getMasterLevel().getName();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPlaneLabelString(String planeLabelString) {
|
public void setPlaneLabelString(String planeLabelString) {
|
||||||
|
|
|
@ -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.ISpatialEnabled;
|
||||||
import com.raytheon.uf.common.geospatial.ISpatialObject;
|
import com.raytheon.uf.common.geospatial.ISpatialObject;
|
||||||
import com.raytheon.uf.common.pointdata.PointDataContainer;
|
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.common.time.DataTime;
|
||||||
import com.raytheon.uf.viz.core.HDF5Util;
|
import com.raytheon.uf.viz.core.HDF5Util;
|
||||||
import com.raytheon.uf.viz.core.catalog.LayerProperty;
|
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.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||||
import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
|
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.library.DerivedParameterGenerator;
|
||||||
import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableLevelNode;
|
import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableLevelNode;
|
||||||
import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableLevelNode.Dependency;
|
import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableLevelNode.Dependency;
|
||||||
|
@ -89,13 +91,13 @@ import com.raytheon.viz.grid.record.RequestableDataRecord;
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
public class GribDataCubeAdapter implements IDataCubeAdapter {
|
public class GribDataCubeAdapter implements IDataCubeAdapter {
|
||||||
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(GribDataCubeAdapter.class);
|
||||||
|
|
||||||
private static final String DERIVED = "DERIVED";
|
private static final String DERIVED = "DERIVED";
|
||||||
|
|
||||||
private GridInventory gridInventory;
|
private GridInventory gridInventory;
|
||||||
|
|
||||||
private Map<String, DerivParamDesc> derParLibrary;
|
|
||||||
|
|
||||||
protected void getTimeQuery(
|
protected void getTimeQuery(
|
||||||
AbstractRequestableLevelNode req,
|
AbstractRequestableLevelNode req,
|
||||||
boolean latestOnly,
|
boolean latestOnly,
|
||||||
|
@ -293,17 +295,33 @@ public class GribDataCubeAdapter implements IDataCubeAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initInventory() {
|
public void initInventory() {
|
||||||
derParLibrary = DerivedParameterGenerator.getDerParLibrary();
|
|
||||||
if (gridInventory == null) {
|
if (gridInventory == null) {
|
||||||
GridInventory gridInventory = new GridInventory();
|
GridInventory gridInventory = new GridInventory();
|
||||||
gridInventory.initTree(derParLibrary);
|
try {
|
||||||
|
gridInventory.initTree(DerivedParameterGenerator
|
||||||
|
.getDerParLibrary());
|
||||||
this.gridInventory = gridInventory;
|
this.gridInventory = gridInventory;
|
||||||
|
} catch (VizException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||||
|
e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getInventory() {
|
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;
|
return gridInventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.opengis.geometry.DirectPosition;
|
||||||
import org.opengis.referencing.crs.ProjectedCRS;
|
import org.opengis.referencing.crs.ProjectedCRS;
|
||||||
import org.opengis.referencing.operation.MathTransform;
|
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.Level;
|
||||||
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
||||||
import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
|
import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
|
||||||
|
@ -309,7 +310,12 @@ public class RadarAdapter {
|
||||||
* @param level
|
* @param level
|
||||||
*/
|
*/
|
||||||
private void initTopoParam(SourceNode modelNameNode) {
|
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();
|
DerivParamDesc topo = new DerivParamDesc();
|
||||||
topo.setAbbreviation("Topo");
|
topo.setAbbreviation("Topo");
|
||||||
topo.setName("Topography");
|
topo.setName("Topography");
|
||||||
|
|
|
@ -26,6 +26,7 @@ Export-Package: com.raytheon.viz.pointdata,
|
||||||
com.raytheon.viz.pointdata.rsc.retrieve,
|
com.raytheon.viz.pointdata.rsc.retrieve,
|
||||||
com.raytheon.viz.pointdata.util
|
com.raytheon.viz.pointdata.util
|
||||||
Import-Package: com.raytheon.edex.meteoLib,
|
Import-Package: com.raytheon.edex.meteoLib,
|
||||||
|
com.raytheon.uf.common.comm,
|
||||||
com.raytheon.uf.common.dataplugin.level,
|
com.raytheon.uf.common.dataplugin.level,
|
||||||
com.raytheon.uf.common.derivparam.tree,
|
com.raytheon.uf.common.derivparam.tree,
|
||||||
com.raytheon.uf.common.message.response,
|
com.raytheon.uf.common.message.response,
|
||||||
|
|
|
@ -15,6 +15,7 @@ import java.util.Set;
|
||||||
import java.util.concurrent.BlockingQueue;
|
import java.util.concurrent.BlockingQueue;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
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.Level;
|
||||||
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
||||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
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.LocalizationLevel;
|
||||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
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.common.time.BinOffset;
|
||||||
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
|
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.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
||||||
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
||||||
|
@ -39,6 +44,8 @@ import com.raytheon.viz.pointdata.util.PointDataInventory;
|
||||||
|
|
||||||
public class PlotModelDataDefinition extends
|
public class PlotModelDataDefinition extends
|
||||||
AbstractRequestableProductBrowserDataDefinition<PlotResourceData> {
|
AbstractRequestableProductBrowserDataDefinition<PlotResourceData> {
|
||||||
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(PlotModelDataDefinition.class);
|
||||||
|
|
||||||
private static final String PLOTLOCATION = "plotModels";
|
private static final String PLOTLOCATION = "plotModels";
|
||||||
|
|
||||||
|
@ -271,10 +278,18 @@ public class PlotModelDataDefinition extends
|
||||||
}
|
}
|
||||||
List<String> validLevels = new ArrayList<String>();
|
List<String> validLevels = new ArrayList<String>();
|
||||||
for (String levelid : possibleLevels) {
|
for (String levelid : possibleLevels) {
|
||||||
|
try {
|
||||||
Level level = LevelFactory.getInstance().getLevel(
|
Level level = LevelFactory.getInstance().getLevel(
|
||||||
Long.parseLong(levelid));
|
Long.parseLong(levelid));
|
||||||
validLevels.add(LevelMappingFactory.getInstance()
|
validLevels.add(LevelMappingFactory.getInstance()
|
||||||
.getLevelMappingForLevel(level).getDisplayName());
|
.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]);
|
return validLevels.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.uf.common.time.DataTime;
|
import com.raytheon.uf.common.time.DataTime;
|
||||||
import com.raytheon.uf.viz.core.RecordFactory;
|
import com.raytheon.uf.viz.core.RecordFactory;
|
||||||
import com.raytheon.uf.viz.core.catalog.CatalogQuery;
|
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.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
||||||
import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
|
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
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
.getHandler(AbstractPointDataInventory.class);
|
.getHandler(AbstractPointDataInventory.class);
|
||||||
|
|
||||||
public static final Level STATION = LevelMappingFactory.getInstance()
|
|
||||||
.getLevelMappingForKey("Station").getLevels().get(0);
|
|
||||||
|
|
||||||
public static String PLUGIN_NAME = "pluginName";
|
public static String PLUGIN_NAME = "pluginName";
|
||||||
|
|
||||||
protected List<String> plugins;
|
protected List<String> plugins;
|
||||||
|
@ -135,7 +133,7 @@ public abstract class AbstractPointDataInventory extends AbstractInventory {
|
||||||
|
|
||||||
protected DataTree getInitialTree() {
|
protected DataTree getInitialTree() {
|
||||||
DataTree tree = new DataTree();
|
DataTree tree = new DataTree();
|
||||||
String stationId = Long.toString(STATION.getId());
|
String stationId = Long.toString(getStationLevel().getId());
|
||||||
for (String pluginName : plugins) {
|
for (String pluginName : plugins) {
|
||||||
try {
|
try {
|
||||||
String[] types = getAvailableTypes(pluginName);
|
String[] types = getAvailableTypes(pluginName);
|
||||||
|
@ -276,4 +274,14 @@ public abstract class AbstractPointDataInventory extends AbstractInventory {
|
||||||
return plugins;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class PointAccumLevelNode extends AbstractDerivedLevelNode {
|
||||||
public PointAccumLevelNode(DerivParamDesc desc, DerivParamMethod method,
|
public PointAccumLevelNode(DerivParamDesc desc, DerivParamMethod method,
|
||||||
List<AbstractRequestableLevelNode> idNodes,
|
List<AbstractRequestableLevelNode> idNodes,
|
||||||
AbstractRequestableLevelNode timeNode) {
|
AbstractRequestableLevelNode timeNode) {
|
||||||
super(PointDataInventory.STATION, desc, method, null);
|
super(PointDataInventory.getStationLevel(), desc, method, null);
|
||||||
this.idNodes = idNodes;
|
this.idNodes = idNodes;
|
||||||
this.timeNode = timeNode;
|
this.timeNode = timeNode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.FloatDataRecord;
|
||||||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||||
import com.raytheon.uf.common.pointdata.PointDataContainer;
|
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.common.time.DataTime;
|
||||||
import com.raytheon.uf.viz.core.RecordFactory;
|
import com.raytheon.uf.viz.core.RecordFactory;
|
||||||
import com.raytheon.uf.viz.core.catalog.LayerProperty;
|
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.level.LevelMappingFactory;
|
||||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||||
import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
|
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.library.DerivedParameterGenerator;
|
||||||
import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableLevelNode;
|
import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableLevelNode;
|
||||||
import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableLevelNode.Dependency;
|
import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableLevelNode.Dependency;
|
||||||
|
@ -76,6 +78,8 @@ import com.raytheon.viz.pointdata.PointDataRequest;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class PointDataCubeAdapter implements IDataCubeAdapter {
|
public class PointDataCubeAdapter implements IDataCubeAdapter {
|
||||||
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(PointDataCubeAdapter.class);
|
||||||
|
|
||||||
public static String PLUGIN_NAME = PointDataInventory.PLUGIN_NAME;
|
public static String PLUGIN_NAME = PointDataInventory.PLUGIN_NAME;
|
||||||
|
|
||||||
|
@ -88,8 +92,6 @@ public class PointDataCubeAdapter implements IDataCubeAdapter {
|
||||||
|
|
||||||
protected AbstractPointDataInventory inventory;
|
protected AbstractPointDataInventory inventory;
|
||||||
|
|
||||||
protected Map<String, DerivParamDesc> derParLibrary;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
@ -112,6 +114,9 @@ public class PointDataCubeAdapter implements IDataCubeAdapter {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Object getInventory() {
|
public Object getInventory() {
|
||||||
|
if (inventory == null) {
|
||||||
|
initInventory();
|
||||||
|
}
|
||||||
return this.inventory;
|
return this.inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,12 +306,17 @@ public class PointDataCubeAdapter implements IDataCubeAdapter {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void initInventory() {
|
public void initInventory() {
|
||||||
derParLibrary = DerivedParameterGenerator.getDerParLibrary();
|
|
||||||
if (inventory == null) {
|
if (inventory == null) {
|
||||||
PointDataInventory pointInventory = new PointDataInventory(
|
PointDataInventory pointInventory = new PointDataInventory(
|
||||||
Arrays.asList(supportedPlugins));
|
Arrays.asList(supportedPlugins));
|
||||||
pointInventory.initTree(derParLibrary);
|
try {
|
||||||
|
pointInventory.initTree(DerivedParameterGenerator
|
||||||
|
.getDerParLibrary());
|
||||||
this.inventory = pointInventory;
|
this.inventory = pointInventory;
|
||||||
|
} catch (VizException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||||
|
e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,12 @@ public class PointDataInventory extends AbstractPointDataInventory implements
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getAllSources() != null && !getAllSources().contains(source)) {
|
if (getAllSources() != null && !getAllSources().contains(source)) {
|
||||||
|
try {
|
||||||
initTree(derParLibrary);
|
initTree(derParLibrary);
|
||||||
|
} catch (VizException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
e.getLocalizedMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class PointRequestableData extends AbstractRequestableData {
|
||||||
public PointRequestableData(IDataRecord rec, Unit<?> unit) {
|
public PointRequestableData(IDataRecord rec, Unit<?> unit) {
|
||||||
this.unit = unit;
|
this.unit = unit;
|
||||||
this.rec = rec;
|
this.rec = rec;
|
||||||
this.level = PointDataInventory.STATION;
|
this.level = PointDataInventory.getStationLevel();
|
||||||
this.parameter = rec.getName();
|
this.parameter = rec.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.DbQueryResponse;
|
||||||
import com.raytheon.uf.common.dataquery.responses.DbQueryResponseSet;
|
import com.raytheon.uf.common.dataquery.responses.DbQueryResponseSet;
|
||||||
import com.raytheon.uf.common.pointdata.PointDataContainer;
|
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.BinOffset;
|
||||||
import com.raytheon.uf.common.time.DataTime;
|
import com.raytheon.uf.common.time.DataTime;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
|
@ -61,6 +64,9 @@ import com.raytheon.viz.pointdata.util.PointDataCubeAdapter;
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
public class RadarDataCubeAdapter extends PointDataCubeAdapter {
|
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 DATA_TIME_FIELD = "dataTime";
|
||||||
|
|
||||||
private static final String LATEST_DATA_TIME_FIELD = "dataTime.refTime";
|
private static final String LATEST_DATA_TIME_FIELD = "dataTime.refTime";
|
||||||
|
@ -74,11 +80,16 @@ public class RadarDataCubeAdapter extends PointDataCubeAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initInventory() {
|
public void initInventory() {
|
||||||
derParLibrary = DerivedParameterGenerator.getDerParLibrary();
|
|
||||||
if (inventory == null) {
|
if (inventory == null) {
|
||||||
AbstractPointDataInventory pointInventory = new VwpInventory();
|
AbstractPointDataInventory pointInventory = new VwpInventory();
|
||||||
pointInventory.initTree(derParLibrary);
|
try {
|
||||||
|
pointInventory.initTree(DerivedParameterGenerator
|
||||||
|
.getDerParLibrary());
|
||||||
this.inventory = pointInventory;
|
this.inventory = pointInventory;
|
||||||
|
} catch (VizException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||||
|
e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,8 @@ Export-Package: com.raytheon.viz.volumebrowser,
|
||||||
com.raytheon.viz.volumebrowser.datacatalog,
|
com.raytheon.viz.volumebrowser.datacatalog,
|
||||||
com.raytheon.viz.volumebrowser.vbui,
|
com.raytheon.viz.volumebrowser.vbui,
|
||||||
com.raytheon.viz.volumebrowser.xml
|
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.spatial.projections,
|
||||||
com.raytheon.uf.common.dataplugin.grib.util,
|
com.raytheon.uf.common.dataplugin.grib.util,
|
||||||
com.raytheon.uf.common.dataplugin.level,
|
com.raytheon.uf.common.dataplugin.level,
|
||||||
|
|
|
@ -40,6 +40,7 @@ import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.widgets.Button;
|
import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Label;
|
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.GribModelLookup;
|
||||||
import com.raytheon.uf.common.dataplugin.grib.util.GridModel;
|
import com.raytheon.uf.common.dataplugin.grib.util.GridModel;
|
||||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||||
|
@ -267,10 +268,14 @@ public class GridDataCatalog implements IDataCatalog {
|
||||||
LevelFactory lf = LevelFactory.getInstance();
|
LevelFactory lf = LevelFactory.getInstance();
|
||||||
|
|
||||||
for (int i = 0; i < levelIds.length; i++) {
|
for (int i = 0; i < levelIds.length; i++) {
|
||||||
|
try {
|
||||||
Level level = lf.getLevel(levelIds[i]);
|
Level level = lf.getLevel(levelIds[i]);
|
||||||
levelNames[i] = level.getMasterLevel().getName()
|
levelNames[i] = level.getMasterLevel().getName()
|
||||||
+ level.getLevelInfo();
|
+ level.getLevelInfo();
|
||||||
this.levelList.put(levelNames[i], level);
|
this.levelList.put(levelNames[i], level);
|
||||||
|
} catch (CommunicationException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Arrays.sort(levelNames);
|
Arrays.sort(levelNames);
|
||||||
|
|
|
@ -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;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
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.LevelMapping;
|
||||||
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
||||||
import com.raytheon.uf.viz.core.level.LevelUtilities;
|
import com.raytheon.uf.viz.core.level.LevelUtilities;
|
||||||
|
@ -344,16 +345,26 @@ public abstract class AbstractDataCatalog implements IDataCatalog {
|
||||||
|
|
||||||
String planesKey = catalogEntry.getSelectedData().getPlanesKey();
|
String planesKey = catalogEntry.getSelectedData().getPlanesKey();
|
||||||
|
|
||||||
LevelMappingFactory lmf = LevelMappingFactory.getInstance();
|
|
||||||
Collection<Level> levels = Collections.emptyList();
|
Collection<Level> levels = Collections.emptyList();
|
||||||
if (planesKey.startsWith("spatial-")) {
|
if (planesKey.startsWith("spatial-")) {
|
||||||
|
try {
|
||||||
levels = LevelUtilities.getOrderedSetOfStandardLevels(planesKey
|
levels = LevelUtilities.getOrderedSetOfStandardLevels(planesKey
|
||||||
.replace("spatial-", ""));
|
.replace("spatial-", ""));
|
||||||
|
} catch (VizCommunicationException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||||
|
e);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
try {
|
||||||
|
LevelMappingFactory lmf = LevelMappingFactory.getInstance();
|
||||||
LevelMapping lm = lmf.getLevelMappingForKey(planesKey);
|
LevelMapping lm = lmf.getLevelMappingForKey(planesKey);
|
||||||
if (lm != null) {
|
if (lm != null) {
|
||||||
levels = lm.getLevels();
|
levels = lm.getLevels();
|
||||||
}
|
}
|
||||||
|
} catch (VizCommunicationException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||||
|
e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ParamLevelMatchCriteria match = new ParamLevelMatchCriteria();
|
ParamLevelMatchCriteria match = new ParamLevelMatchCriteria();
|
||||||
if (levels.size() > 0) {
|
if (levels.size() > 0) {
|
||||||
|
|
|
@ -35,12 +35,14 @@ import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
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.Level;
|
||||||
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
|
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.LevelMapping;
|
||||||
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
||||||
import com.raytheon.uf.viz.core.level.LevelUtilities;
|
import com.raytheon.uf.viz.core.level.LevelUtilities;
|
||||||
|
@ -172,6 +174,7 @@ public abstract class AbstractInventoryDataCatalog extends AbstractDataCatalog {
|
||||||
String levelStr = levelQueue.poll();
|
String levelStr = levelQueue.poll();
|
||||||
while (levelStr != null) {
|
while (levelStr != null) {
|
||||||
// Convert levels into planes.
|
// Convert levels into planes.
|
||||||
|
try {
|
||||||
Level level = LevelFactory.getInstance().getLevel(levelStr);
|
Level level = LevelFactory.getInstance().getLevel(levelStr);
|
||||||
|
|
||||||
if (levels3D.contains(level)) {
|
if (levels3D.contains(level)) {
|
||||||
|
@ -181,13 +184,21 @@ public abstract class AbstractInventoryDataCatalog extends AbstractDataCatalog {
|
||||||
}
|
}
|
||||||
request.addAvailablePlane("spatial-"
|
request.addAvailablePlane("spatial-"
|
||||||
+ level.getMasterLevel().getName());
|
+ level.getMasterLevel().getName());
|
||||||
|
try {
|
||||||
LevelMapping lm = LevelMappingFactory.getInstance()
|
LevelMapping lm = LevelMappingFactory.getInstance()
|
||||||
.getLevelMappingForLevel(level);
|
.getLevelMappingForLevel(level);
|
||||||
|
|
||||||
if (lm != null) {
|
if (lm != null) {
|
||||||
request.addAvailablePlane(lm.getKey());
|
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();
|
levelStr = levelQueue.poll();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -273,13 +284,23 @@ public abstract class AbstractInventoryDataCatalog extends AbstractDataCatalog {
|
||||||
for (String plane : selectedPlanes) {
|
for (String plane : selectedPlanes) {
|
||||||
Collection<Level> levels = Collections.emptyList();
|
Collection<Level> levels = Collections.emptyList();
|
||||||
if (plane.startsWith("spatial-")) {
|
if (plane.startsWith("spatial-")) {
|
||||||
levels = LevelUtilities.getOrderedSetOfStandardLevels(plane
|
try {
|
||||||
.replace("spatial-", ""));
|
levels = LevelUtilities
|
||||||
|
.getOrderedSetOfStandardLevels(plane.replace(
|
||||||
|
"spatial-", ""));
|
||||||
|
} catch (VizCommunicationException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
e.getLocalizedMessage(), e);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
LevelMapping lm = lmf.getLevelMappingForKey(plane);
|
LevelMapping lm = lmf.getLevelMappingForKey(plane);
|
||||||
if (lm != null) {
|
if (lm != null) {
|
||||||
|
try {
|
||||||
levels = lm.getLevels();
|
levels = lm.getLevels();
|
||||||
|
} catch (VizCommunicationException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
e.getLocalizedMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Level l : levels) {
|
for (Level l : levels) {
|
||||||
|
|
|
@ -21,6 +21,7 @@ package com.raytheon.viz.volumebrowser.datacatalog;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
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;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
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.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
||||||
import com.raytheon.uf.viz.core.level.LevelUtilities;
|
import com.raytheon.uf.viz.core.level.LevelUtilities;
|
||||||
|
@ -177,11 +179,16 @@ public class GribDataCatalog extends AbstractInventoryDataCatalog {
|
||||||
.getInvalidLevelValueAsString()));
|
.getInvalidLevelValueAsString()));
|
||||||
} else {
|
} else {
|
||||||
// Get all possible levels for the selected levels
|
// Get all possible levels for the selected levels
|
||||||
|
List<Level> selectedLevels = Collections.emptyList();
|
||||||
|
try {
|
||||||
LevelMappingFactory lmf = LevelMappingFactory.getInstance();
|
LevelMappingFactory lmf = LevelMappingFactory.getInstance();
|
||||||
List<Level> selectedLevels = new ArrayList<Level>(lmf
|
selectedLevels = new ArrayList<Level>(lmf
|
||||||
.getLevelMappingForKey(catalogEntry.selectedPlanesKey)
|
.getLevelMappingForKey(
|
||||||
.getLevels());
|
catalogEntry.selectedPlanesKey).getLevels());
|
||||||
|
} catch (VizCommunicationException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
e.getLocalizedMessage(), e);
|
||||||
|
}
|
||||||
RequestConstraint masterRC = new RequestConstraint(null,
|
RequestConstraint masterRC = new RequestConstraint(null,
|
||||||
ConstraintType.IN);
|
ConstraintType.IN);
|
||||||
RequestConstraint oneRC = new RequestConstraint(null,
|
RequestConstraint oneRC = new RequestConstraint(null,
|
||||||
|
@ -355,21 +362,34 @@ public class GribDataCatalog extends AbstractInventoryDataCatalog {
|
||||||
@Override
|
@Override
|
||||||
protected Collection<? extends Level> get3DLevels() {
|
protected Collection<? extends Level> get3DLevels() {
|
||||||
ArrayList<Level> all = new ArrayList<Level>();
|
ArrayList<Level> all = new ArrayList<Level>();
|
||||||
|
try {
|
||||||
NavigableSet<Level> tilts = LevelUtilities
|
NavigableSet<Level> tilts = LevelUtilities
|
||||||
.getOrderedSetOfStandardLevels("TILT");
|
.getOrderedSetOfStandardLevels("TILT");
|
||||||
if (tilts != null) {
|
if (tilts != null) {
|
||||||
all.addAll(tilts);
|
all.addAll(tilts);
|
||||||
}
|
}
|
||||||
|
} catch (VizCommunicationException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||||
|
}
|
||||||
|
try {
|
||||||
NavigableSet<Level> pres = LevelUtilities
|
NavigableSet<Level> pres = LevelUtilities
|
||||||
.getOrderedSetOfStandardLevels("MB");
|
.getOrderedSetOfStandardLevels("MB");
|
||||||
if (pres != null) {
|
if (pres != null) {
|
||||||
all.addAll(pres);
|
all.addAll(pres);
|
||||||
}
|
}
|
||||||
|
} catch (VizCommunicationException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||||
|
}
|
||||||
|
try {
|
||||||
NavigableSet<Level> theta = LevelUtilities
|
NavigableSet<Level> theta = LevelUtilities
|
||||||
.getOrderedSetOfStandardLevels("K");
|
.getOrderedSetOfStandardLevels("K");
|
||||||
if (theta != null) {
|
if (theta != null) {
|
||||||
all.addAll(theta);
|
all.addAll(theta);
|
||||||
}
|
}
|
||||||
|
} catch (VizCommunicationException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||||
|
}
|
||||||
|
|
||||||
return all;
|
return all;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.uf.common.time.BinOffset;
|
import com.raytheon.uf.common.time.BinOffset;
|
||||||
import com.raytheon.uf.viz.core.catalog.DbQuery;
|
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.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
||||||
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
|
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
|
||||||
|
@ -386,8 +387,13 @@ public class PointDataCatalog extends AbstractInventoryDataCatalog {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Collection<? extends Level> get3DLevels() {
|
protected Collection<? extends Level> get3DLevels() {
|
||||||
|
try {
|
||||||
return LevelMappingFactory.getInstance()
|
return LevelMappingFactory.getInstance()
|
||||||
.getLevelMappingForKey("Station").getLevels();
|
.getLevelMappingForKey("Station").getLevels();
|
||||||
|
} catch (VizCommunicationException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -58,6 +58,7 @@ Import-Package: com.raytheon.edex.db.dao,
|
||||||
com.raytheon.edex.util,
|
com.raytheon.edex.util,
|
||||||
com.raytheon.edex.util.grib,
|
com.raytheon.edex.util.grib,
|
||||||
com.raytheon.uf.common.activetable,
|
com.raytheon.uf.common.activetable,
|
||||||
|
com.raytheon.uf.common.comm,
|
||||||
com.raytheon.uf.common.dataplugin,
|
com.raytheon.uf.common.dataplugin,
|
||||||
com.raytheon.uf.common.dataplugin.annotations,
|
com.raytheon.uf.common.dataplugin.annotations,
|
||||||
com.raytheon.uf.common.dataplugin.grib,
|
com.raytheon.uf.common.dataplugin.grib,
|
||||||
|
|
|
@ -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.server.database.GridDatabase;
|
||||||
import com.raytheon.edex.plugin.gfe.util.GridTranslator;
|
import com.raytheon.edex.plugin.gfe.util.GridTranslator;
|
||||||
import com.raytheon.edex.plugin.gfe.util.SendNotifications;
|
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.PluginDataObject;
|
||||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
import com.raytheon.uf.common.dataplugin.PluginException;
|
||||||
import com.raytheon.uf.common.dataplugin.gfe.GridDataHistory;
|
import com.raytheon.uf.common.dataplugin.gfe.GridDataHistory;
|
||||||
|
@ -651,6 +652,7 @@ public class GFEDao extends DefaultPluginDao {
|
||||||
Level level = null;
|
Level level = null;
|
||||||
|
|
||||||
// to have a level 2, must have a level one
|
// to have a level 2, must have a level one
|
||||||
|
try {
|
||||||
if (levelOnePresent && levelTwoPresent) {
|
if (levelOnePresent && levelTwoPresent) {
|
||||||
level = LevelFactory.getInstance().getLevel(levelName,
|
level = LevelFactory.getInstance().getLevel(levelName,
|
||||||
levelValues[0], levelValues[1]);
|
levelValues[0], levelValues[1]);
|
||||||
|
@ -660,7 +662,9 @@ public class GFEDao extends DefaultPluginDao {
|
||||||
} else {
|
} else {
|
||||||
level = LevelFactory.getInstance().getLevel(levelName, 0.0);
|
level = LevelFactory.getInstance().getLevel(levelName, 0.0);
|
||||||
}
|
}
|
||||||
|
} catch (CommunicationException e) {
|
||||||
|
logger.error(e.getLocalizedMessage(), e);
|
||||||
|
}
|
||||||
if (level == null) {
|
if (level == null) {
|
||||||
logger.warn("Unable to query D2D parms, ParmID " + id
|
logger.warn("Unable to query D2D parms, ParmID " + id
|
||||||
+ " does not map to a level");
|
+ " does not map to a level");
|
||||||
|
|
|
@ -24,6 +24,7 @@ Require-Bundle: javax.measure,
|
||||||
com.raytheon.uf.common.awipstools;bundle-version="1.12.1174",
|
com.raytheon.uf.common.awipstools;bundle-version="1.12.1174",
|
||||||
ucar.nc2;bundle-version="1.0.0"
|
ucar.nc2;bundle-version="1.0.0"
|
||||||
Import-Package: com.raytheon.edex.exception,
|
Import-Package: com.raytheon.edex.exception,
|
||||||
|
com.raytheon.uf.common.comm,
|
||||||
com.raytheon.uf.common.dataplugin.grib,
|
com.raytheon.uf.common.dataplugin.grib,
|
||||||
com.raytheon.uf.common.dataplugin.grib.exception,
|
com.raytheon.uf.common.dataplugin.grib.exception,
|
||||||
com.raytheon.uf.common.dataplugin.grib.request,
|
com.raytheon.uf.common.dataplugin.grib.request,
|
||||||
|
|
|
@ -53,6 +53,7 @@ import com.raytheon.edex.util.Util;
|
||||||
import com.raytheon.edex.util.grib.Grib1TableMap;
|
import com.raytheon.edex.util.grib.Grib1TableMap;
|
||||||
import com.raytheon.edex.util.grib.GribParamTranslator;
|
import com.raytheon.edex.util.grib.GribParamTranslator;
|
||||||
import com.raytheon.edex.util.grib.GribTableLookup;
|
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.PluginException;
|
||||||
import com.raytheon.uf.common.dataplugin.grib.GribModel;
|
import com.raytheon.uf.common.dataplugin.grib.GribModel;
|
||||||
import com.raytheon.uf.common.dataplugin.grib.GribRecord;
|
import com.raytheon.uf.common.dataplugin.grib.GribRecord;
|
||||||
|
@ -1225,10 +1226,12 @@ public class Grib1Decoder extends AbstractDecoder {
|
||||||
* The level two scale factor
|
* The level two scale factor
|
||||||
* @param value2
|
* @param value2
|
||||||
* The level two value
|
* The level two value
|
||||||
|
* @throws GribException
|
||||||
*/
|
*/
|
||||||
private void getLevelInfo(GribModel model, int centerID, int subcenterID,
|
private void getLevelInfo(GribModel model, int centerID, int subcenterID,
|
||||||
float levelOneNumber, float scaleFactor1, float value1,
|
float levelOneNumber, float scaleFactor1, float value1,
|
||||||
float levelTwoNumber, float scaleFactor2, float value2) {
|
float levelTwoNumber, float scaleFactor2, float value2)
|
||||||
|
throws GribException {
|
||||||
String levelName = null;
|
String levelName = null;
|
||||||
String levelUnit = null;
|
String levelUnit = null;
|
||||||
double levelOneValue = Level.getInvalidLevelValue();
|
double levelOneValue = Level.getInvalidLevelValue();
|
||||||
|
@ -1281,9 +1284,13 @@ public class Grib1Decoder extends AbstractDecoder {
|
||||||
levelOneValue = 0.0;
|
levelOneValue = 0.0;
|
||||||
levelTwoValue = Level.getInvalidLevelValue();
|
levelTwoValue = Level.getInvalidLevelValue();
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
Level level = LevelFactory.getInstance().getLevel(levelName,
|
Level level = LevelFactory.getInstance().getLevel(levelName,
|
||||||
levelOneValue, levelTwoValue, levelUnit);
|
levelOneValue, levelTwoValue, levelUnit);
|
||||||
model.setLevel(level);
|
model.setLevel(level);
|
||||||
|
} catch (CommunicationException e) {
|
||||||
|
throw new GribException("Error requesting levels", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
package com.raytheon.edex.plugin.grib.decoderpostprocessors;
|
package com.raytheon.edex.plugin.grib.decoderpostprocessors;
|
||||||
|
|
||||||
import com.raytheon.edex.plugin.grib.util.GribModelCache;
|
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.GribModel;
|
||||||
import com.raytheon.uf.common.dataplugin.grib.GribRecord;
|
import com.raytheon.uf.common.dataplugin.grib.GribRecord;
|
||||||
import com.raytheon.uf.common.dataplugin.grib.exception.GribException;
|
import com.raytheon.uf.common.dataplugin.grib.exception.GribException;
|
||||||
|
@ -62,9 +63,13 @@ public class LapsPostProcessor implements IDecoderPostProcessor {
|
||||||
GribModel gribModel = record.getModelInfo();
|
GribModel gribModel = record.getModelInfo();
|
||||||
boolean modelInfoModified = false;
|
boolean modelInfoModified = false;
|
||||||
if (levelName.equals(FHAG)) {
|
if (levelName.equals(FHAG)) {
|
||||||
|
try {
|
||||||
Level sfcLevel = LevelFactory.getInstance().getLevel(SFC, 0);
|
Level sfcLevel = LevelFactory.getInstance().getLevel(SFC, 0);
|
||||||
gribModel.setLevel(sfcLevel);
|
gribModel.setLevel(sfcLevel);
|
||||||
modelInfoModified = true;
|
modelInfoModified = true;
|
||||||
|
} catch (CommunicationException e) {
|
||||||
|
throw new GribException("Error modifying LAPS records.", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gribModel.getParameterAbbreviation().equals(PMSL)) {
|
if (gribModel.getParameterAbbreviation().equals(PMSL)) {
|
||||||
|
|
|
@ -21,7 +21,8 @@ Export-Package: com.raytheon.edex.plugin.radar,
|
||||||
com.raytheon.edex.plugin.radar.level2,
|
com.raytheon.edex.plugin.radar.level2,
|
||||||
com.raytheon.edex.uengine.tasks.radar
|
com.raytheon.edex.uengine.tasks.radar
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
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.menus.xml,
|
||||||
com.raytheon.uf.common.site.ingest,
|
com.raytheon.uf.common.site.ingest,
|
||||||
org.apache.commons.logging,
|
org.apache.commons.logging,
|
||||||
|
|
|
@ -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.request,
|
||||||
com.raytheon.uf.common.dataplugin.level.xml
|
com.raytheon.uf.common.dataplugin.level.xml
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||||
Import-Package: org.hibernate.annotations
|
Import-Package: com.raytheon.uf.common.comm,
|
||||||
|
org.hibernate.annotations
|
||||||
|
|
|
@ -38,8 +38,8 @@ import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import javax.xml.bind.annotation.XmlType;
|
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.annotations.DataURI;
|
||||||
import com.raytheon.uf.common.dataplugin.level.util.Constants;
|
|
||||||
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
|
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
|
||||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||||
|
@ -71,7 +71,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
@XmlType(namespace = "dataplugin-level")
|
@XmlType(namespace = "dataplugin-level")
|
||||||
public class Level extends PersistableDataObject implements ISerializableObject {
|
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;
|
public static final double INVALID_VALUE = -999999;
|
||||||
|
|
||||||
|
@ -216,7 +217,7 @@ public class Level extends PersistableDataObject implements ISerializableObject
|
||||||
dirtyFlag = false;
|
dirtyFlag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Level getUpperLevel() {
|
public Level getUpperLevel() throws CommunicationException {
|
||||||
Level rval = null;
|
Level rval = null;
|
||||||
|
|
||||||
if (isRangeLevel()) {
|
if (isRangeLevel()) {
|
||||||
|
@ -278,7 +279,7 @@ public class Level extends PersistableDataObject implements ISerializableObject
|
||||||
return bestLevel;
|
return bestLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Level getLowerLevel() {
|
public Level getLowerLevel() throws CommunicationException {
|
||||||
Level rval = null;
|
Level rval = null;
|
||||||
|
|
||||||
if (isRangeLevel()) {
|
if (isRangeLevel()) {
|
||||||
|
|
|
@ -37,6 +37,7 @@ import javax.xml.bind.JAXB;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
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.GetLevelByIdRequest;
|
||||||
import com.raytheon.uf.common.dataplugin.level.request.GetLevelRequest;
|
import com.raytheon.uf.common.dataplugin.level.request.GetLevelRequest;
|
||||||
import com.raytheon.uf.common.dataplugin.level.request.GetMasterLevelRequest;
|
import com.raytheon.uf.common.dataplugin.level.request.GetMasterLevelRequest;
|
||||||
|
@ -98,6 +99,10 @@ public class LevelFactory {
|
||||||
|
|
||||||
private ILevelRetrievalAdapter retrievalAdapter = null;
|
private ILevelRetrievalAdapter retrievalAdapter = null;
|
||||||
|
|
||||||
|
private boolean hasRequestedAllLevels = false;
|
||||||
|
|
||||||
|
private boolean hasRequestedAllMasterLevels = false;
|
||||||
|
|
||||||
private static final double INVALID_LEVEL = Level.getInvalidLevelValue();
|
private static final double INVALID_LEVEL = Level.getInvalidLevelValue();
|
||||||
|
|
||||||
public static LevelFactory getInstance() {
|
public static LevelFactory getInstance() {
|
||||||
|
@ -119,43 +124,58 @@ public class LevelFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
loadLevelAliases();
|
loadLevelAliases();
|
||||||
LoadAllMasterLevels();
|
try {
|
||||||
loadMasterLevelFiles();
|
loadAllMasterLevels();
|
||||||
|
} catch (CommunicationException e) {
|
||||||
|
; // This is non-fatal, master levels should still be retrieved
|
||||||
|
// individually
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||||
|
}
|
||||||
|
try {
|
||||||
loadAllLevels();
|
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);
|
loadMasterLevel(level, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MasterLevel getMasterLevel(String name) {
|
public MasterLevel getMasterLevel(String name)
|
||||||
|
throws CommunicationException {
|
||||||
MasterLevel request = new MasterLevel(name);
|
MasterLevel request = new MasterLevel(name);
|
||||||
return loadMasterLevel(request, false);
|
return loadMasterLevel(request, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Level getLevel(long id) {
|
public Level getLevel(long id) throws CommunicationException {
|
||||||
return loadLevel(id);
|
return loadLevel(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Level getLevel(String name) {
|
public Level getLevel(String name) throws CommunicationException {
|
||||||
return loadLevel(name);
|
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);
|
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);
|
return getLevel(name, levelOneValue, INVALID_LEVEL, unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Level getLevel(String name, double levelOneValue,
|
public Level getLevel(String name, double levelOneValue,
|
||||||
double levelTwoValue) {
|
double levelTwoValue) throws CommunicationException {
|
||||||
return getLevel(name, levelOneValue, levelTwoValue, null);
|
return getLevel(name, levelOneValue, levelTwoValue, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Level getLevel(String name, double levelOneValue,
|
public Level getLevel(String name, double levelOneValue,
|
||||||
double levelTwoValue, String unit) {
|
double levelTwoValue, String unit) throws CommunicationException {
|
||||||
Level rval = null;
|
Level rval = null;
|
||||||
|
|
||||||
// lookup master level
|
// lookup master level
|
||||||
|
@ -204,7 +224,8 @@ public class LevelFactory {
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MasterLevel loadMasterLevel(MasterLevel level, boolean createFlag) {
|
private MasterLevel loadMasterLevel(MasterLevel level, boolean createFlag)
|
||||||
|
throws CommunicationException {
|
||||||
MasterLevel rval = null;
|
MasterLevel rval = null;
|
||||||
String levelName = level.getName();
|
String levelName = level.getName();
|
||||||
|
|
||||||
|
@ -213,6 +234,9 @@ public class LevelFactory {
|
||||||
levelName = levelAliasMap.get(levelName);
|
levelName = levelAliasMap.get(levelName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!hasRequestedAllMasterLevels) {
|
||||||
|
loadAllMasterLevels();
|
||||||
|
}
|
||||||
if (masterLevelCache.containsKey(levelName)) {
|
if (masterLevelCache.containsKey(levelName)) {
|
||||||
rval = masterLevelCache.get(levelName);
|
rval = masterLevelCache.get(levelName);
|
||||||
} else if (retrievalAdapter != null) {
|
} else if (retrievalAdapter != null) {
|
||||||
|
@ -243,7 +267,7 @@ public class LevelFactory {
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Level loadLevel(Level level) {
|
private Level loadLevel(Level level) throws CommunicationException {
|
||||||
// limit precision to 3 places past the decimal
|
// limit precision to 3 places past the decimal
|
||||||
double levelone = ((int) (level.getLevelonevalue() * 1000)) / 1000.0;
|
double levelone = ((int) (level.getLevelonevalue() * 1000)) / 1000.0;
|
||||||
double leveltwo = ((int) (level.getLeveltwovalue() * 1000)) / 1000.0;
|
double leveltwo = ((int) (level.getLeveltwovalue() * 1000)) / 1000.0;
|
||||||
|
@ -259,6 +283,9 @@ public class LevelFactory {
|
||||||
}
|
}
|
||||||
level.setLevelonevalue(levelone);
|
level.setLevelonevalue(levelone);
|
||||||
level.setLeveltwovalue(leveltwo);
|
level.setLeveltwovalue(leveltwo);
|
||||||
|
if (!hasRequestedAllLevels) {
|
||||||
|
loadAllLevels();
|
||||||
|
}
|
||||||
// check if we have already loaded level
|
// check if we have already loaded level
|
||||||
Level rval = levelCache.get(level);
|
Level rval = levelCache.get(level);
|
||||||
|
|
||||||
|
@ -280,7 +307,10 @@ public class LevelFactory {
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Level loadLevel(long id) {
|
private Level loadLevel(long id) throws CommunicationException {
|
||||||
|
if (!hasRequestedAllLevels) {
|
||||||
|
loadAllLevels();
|
||||||
|
}
|
||||||
// check if we have already loaded level
|
// check if we have already loaded level
|
||||||
Level rval = levelCacheById.get(id);
|
Level rval = levelCacheById.get(id);
|
||||||
|
|
||||||
|
@ -298,7 +328,10 @@ public class LevelFactory {
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Level loadLevel(String id) {
|
private Level loadLevel(String id) throws CommunicationException {
|
||||||
|
if (!hasRequestedAllLevels) {
|
||||||
|
loadAllLevels();
|
||||||
|
}
|
||||||
// check if we have already loaded level
|
// check if we have already loaded level
|
||||||
Level rval = levelCacheByIdAsString.get(id);
|
Level rval = levelCacheByIdAsString.get(id);
|
||||||
|
|
||||||
|
@ -386,7 +419,7 @@ public class LevelFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadAllLevels() {
|
private void loadAllLevels() throws CommunicationException {
|
||||||
if (retrievalAdapter != null) {
|
if (retrievalAdapter != null) {
|
||||||
LevelContainer container = retrievalAdapter.getAllLevels();
|
LevelContainer container = retrievalAdapter.getAllLevels();
|
||||||
if (container != null) {
|
if (container != null) {
|
||||||
|
@ -408,10 +441,11 @@ public class LevelFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
hasRequestedAllLevels = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadAllMasterLevels() {
|
private void loadAllMasterLevels() throws CommunicationException {
|
||||||
if (retrievalAdapter != null) {
|
if (retrievalAdapter != null) {
|
||||||
MasterLevelContainer container = retrievalAdapter
|
MasterLevelContainer container = retrievalAdapter
|
||||||
.getAllMasterLevels();
|
.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()) {
|
if (file == null || !file.exists()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,15 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
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.annotations.DataURI;
|
||||||
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
|
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
|
||||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
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.
|
* MasterLevel - once a field is set it cannot be changed.
|
||||||
|
@ -61,6 +65,9 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
public class MasterLevel extends PersistableDataObject implements
|
public class MasterLevel extends PersistableDataObject implements
|
||||||
ISerializableObject {
|
ISerializableObject {
|
||||||
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(MasterLevel.class);
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
@ -151,7 +158,12 @@ public class MasterLevel extends PersistableDataObject implements
|
||||||
|
|
||||||
public Progression getProgression() {
|
public Progression getProgression() {
|
||||||
if (processType) {
|
if (processType) {
|
||||||
|
try {
|
||||||
processTypeField();
|
processTypeField();
|
||||||
|
} catch (CommunicationException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||||
|
e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return progression;
|
return progression;
|
||||||
|
@ -216,7 +228,7 @@ public class MasterLevel extends PersistableDataObject implements
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processTypeField() {
|
private void processTypeField() throws CommunicationException {
|
||||||
if (type != null && type.trim().length() > 0) {
|
if (type != null && type.trim().length() > 0) {
|
||||||
try {
|
try {
|
||||||
setProgression(Progression.valueOf(type));
|
setProgression(Progression.valueOf(type));
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.common.dataplugin.level.request;
|
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.Level;
|
||||||
import com.raytheon.uf.common.dataplugin.level.LevelContainer;
|
import com.raytheon.uf.common.dataplugin.level.LevelContainer;
|
||||||
import com.raytheon.uf.common.dataplugin.level.MasterLevel;
|
import com.raytheon.uf.common.dataplugin.level.MasterLevel;
|
||||||
|
@ -39,16 +40,21 @@ import com.raytheon.uf.common.dataplugin.level.MasterLevelContainer;
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
public interface ILevelRetrievalAdapter {
|
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(
|
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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ Bundle-ActivationPolicy: lazy
|
||||||
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
|
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
|
||||||
Eclipse-BuddyPolicy: registered, ext, global
|
Eclipse-BuddyPolicy: registered, ext, global
|
||||||
Import-Package: com.raytheon.edex.scriptfactory,
|
Import-Package: com.raytheon.edex.scriptfactory,
|
||||||
|
com.raytheon.uf.common.comm,
|
||||||
com.raytheon.uf.common.dataplugin.level,
|
com.raytheon.uf.common.dataplugin.level,
|
||||||
com.raytheon.uf.common.serialization,
|
com.raytheon.uf.common.serialization,
|
||||||
com.raytheon.uf.common.serialization.annotations,
|
com.raytheon.uf.common.serialization.annotations,
|
||||||
|
|
|
@ -21,6 +21,7 @@ package com.raytheon.uf.common.derivparam.tree;
|
||||||
|
|
||||||
import javax.persistence.Transient;
|
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.Level;
|
||||||
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||||
|
@ -67,7 +68,11 @@ public class LevelNode extends AbstractNode<LevelNode> {
|
||||||
*/
|
*/
|
||||||
public Level getLevel() {
|
public Level getLevel() {
|
||||||
if (value != null && level == null) {
|
if (value != null && level == null) {
|
||||||
|
try {
|
||||||
level = LevelFactory.getInstance().getLevel(value);
|
level = LevelFactory.getInstance().getLevel(value);
|
||||||
|
} catch (CommunicationException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ Require-Bundle: com.raytheon.uf.common.dataplugin,
|
||||||
com.raytheon.uf.common.dataplugin.level,
|
com.raytheon.uf.common.dataplugin.level,
|
||||||
com.raytheon.uf.edex.plugin.level
|
com.raytheon.uf.edex.plugin.level
|
||||||
Import-Package: com.raytheon.edex.db.dao,
|
Import-Package: com.raytheon.edex.db.dao,
|
||||||
|
com.raytheon.uf.common.comm,
|
||||||
com.raytheon.uf.common.serialization.comm,
|
com.raytheon.uf.common.serialization.comm,
|
||||||
com.raytheon.uf.edex.database.plugin,
|
com.raytheon.uf.edex.database.plugin,
|
||||||
org.apache.commons.logging,
|
org.apache.commons.logging,
|
||||||
|
|
|
@ -18,3 +18,4 @@ Require-Bundle: com.raytheon.edex.common,
|
||||||
Export-Package: com.raytheon.uf.edex.plugin.level.adapter,
|
Export-Package: com.raytheon.uf.edex.plugin.level.adapter,
|
||||||
com.raytheon.uf.edex.plugin.level.dao
|
com.raytheon.uf.edex.plugin.level.dao
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||||
|
Import-Package: com.raytheon.uf.common.comm
|
||||||
|
|
|
@ -10,6 +10,7 @@ Import-Package: com.raytheon.edex.db.dao,
|
||||||
com.raytheon.edex.exception,
|
com.raytheon.edex.exception,
|
||||||
com.raytheon.edex.plugin,
|
com.raytheon.edex.plugin,
|
||||||
com.raytheon.edex.uengine.tasks.query,
|
com.raytheon.edex.uengine.tasks.query,
|
||||||
|
com.raytheon.uf.common.comm,
|
||||||
com.raytheon.uf.common.dataplugin,
|
com.raytheon.uf.common.dataplugin,
|
||||||
com.raytheon.uf.common.dataplugin.level,
|
com.raytheon.uf.common.dataplugin.level,
|
||||||
com.raytheon.uf.common.dataplugin.persist,
|
com.raytheon.uf.common.dataplugin.persist,
|
||||||
|
|
|
@ -26,7 +26,6 @@ import java.util.Map.Entry;
|
||||||
|
|
||||||
import com.raytheon.edex.uengine.tasks.query.CatalogQuery;
|
import com.raytheon.edex.uengine.tasks.query.CatalogQuery;
|
||||||
import com.raytheon.edex.uengine.tasks.query.MetadataCatalogQuery;
|
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.dataplugin.level.LevelFactory;
|
||||||
import com.raytheon.uf.common.derivparam.tree.DataTree;
|
import com.raytheon.uf.common.derivparam.tree.DataTree;
|
||||||
import com.raytheon.uf.common.pointdata.GetPointDataTreeRequest;
|
import com.raytheon.uf.common.pointdata.GetPointDataTreeRequest;
|
||||||
|
@ -52,16 +51,14 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
|
||||||
public class GetPointDataTreeHandler implements
|
public class GetPointDataTreeHandler implements
|
||||||
IRequestHandler<GetPointDataTreeRequest> {
|
IRequestHandler<GetPointDataTreeRequest> {
|
||||||
|
|
||||||
public static final Level STATION = LevelFactory.getInstance().getLevel(
|
|
||||||
LevelFactory.UNKNOWN_LEVEL, 0.0);
|
|
||||||
|
|
||||||
public static final String PLUGIN_NAME = "pluginName";
|
public static final String PLUGIN_NAME = "pluginName";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataTree handleRequest(GetPointDataTreeRequest request)
|
public DataTree handleRequest(GetPointDataTreeRequest request)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
DataTree tree = new DataTree();
|
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<String, String> entry : request.getPluginTypeKeyMap()
|
for (Entry<String, String> entry : request.getPluginTypeKeyMap()
|
||||||
.entrySet()) {
|
.entrySet()) {
|
||||||
String[] types = getAvailableTypes(entry.getKey(), entry.getValue());
|
String[] types = getAvailableTypes(entry.getKey(), entry.getValue());
|
||||||
|
|
|
@ -19,8 +19,9 @@ Require-Bundle: javax.measure,
|
||||||
com.raytheon.uf.common.serialization.comm,
|
com.raytheon.uf.common.serialization.comm,
|
||||||
com.raytheon.uf.edex.python.decoder;bundle-version="1.11.26",
|
com.raytheon.uf.edex.python.decoder;bundle-version="1.11.26",
|
||||||
gov.noaa.nws.ncep.common.dataplugin.ncgrib;bundle-version="1.0.0",
|
gov.noaa.nws.ncep.common.dataplugin.ncgrib;bundle-version="1.0.0",
|
||||||
ucar.nc2;bundle-version="1.0.0"
|
ucar.nc2
|
||||||
Import-Package: com.raytheon.uf.common.dataplugin.level,
|
Import-Package: com.raytheon.uf.common.comm,
|
||||||
|
com.raytheon.uf.common.dataplugin.level,
|
||||||
com.raytheon.uf.common.derivparam.tree,
|
com.raytheon.uf.common.derivparam.tree,
|
||||||
com.raytheon.uf.common.status,
|
com.raytheon.uf.common.status,
|
||||||
gov.noaa.nws.ncep.common.dataplugin.ncgrib,
|
gov.noaa.nws.ncep.common.dataplugin.ncgrib,
|
||||||
|
|
|
@ -20,6 +20,29 @@
|
||||||
|
|
||||||
package gov.noaa.nws.ncep.edex.plugin.ncgrib;
|
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.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -27,6 +50,7 @@ import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import ucar.grib.GribNumbers;
|
import ucar.grib.GribNumbers;
|
||||||
|
@ -42,35 +66,20 @@ import ucar.grib.grib1.GribPDSParamTable;
|
||||||
import ucar.grid.GridParameter;
|
import ucar.grid.GridParameter;
|
||||||
import ucar.unidata.io.RandomAccessFile;
|
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.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.Level;
|
||||||
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
||||||
import com.raytheon.uf.common.dataquery.db.QueryResult;
|
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.DataTime;
|
||||||
import com.raytheon.uf.common.time.TimeRange;
|
import com.raytheon.uf.common.time.TimeRange;
|
||||||
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
||||||
|
@ -86,6 +95,8 @@ import com.raytheon.uf.edex.database.plugin.PluginFactory;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* 3/11/10 4758 bphillip Initial Creation
|
* 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()
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -93,6 +104,8 @@ import com.raytheon.uf.edex.database.plugin.PluginFactory;
|
||||||
* @version 1
|
* @version 1
|
||||||
*/
|
*/
|
||||||
public class Ncgrib1Decoder extends AbstractDecoder {
|
public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(Ncgrib1Decoder.class);
|
||||||
|
|
||||||
/** Missing value string */
|
/** Missing value string */
|
||||||
private static final String MISSING = "Missing";
|
private static final String MISSING = "Missing";
|
||||||
|
@ -101,15 +114,41 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
private static final Set<Integer> AVG_ACCUM_LIST = new HashSet<Integer>();
|
private static final Set<Integer> AVG_ACCUM_LIST = new HashSet<Integer>();
|
||||||
|
|
||||||
private String traceId = "";
|
private String traceId = "";
|
||||||
|
|
||||||
private NcgribDao dao;
|
private NcgribDao dao;
|
||||||
|
|
||||||
private String fileName="";
|
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 {
|
static {
|
||||||
AVG_ACCUM_LIST.add(3);
|
AVG_ACCUM_LIST.add(3);
|
||||||
AVG_ACCUM_LIST.add(4);
|
AVG_ACCUM_LIST.add(4);
|
||||||
AVG_ACCUM_LIST.add(6);
|
AVG_ACCUM_LIST.add(6);
|
||||||
AVG_ACCUM_LIST.add(7);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -141,7 +180,7 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
fileName = gribFileName;
|
fileName = gribFileName;
|
||||||
RandomAccessFile raf = null;
|
RandomAccessFile raf = null;
|
||||||
|
|
||||||
//System.out.println (" grib file name =" + gribFileName);
|
// System.out.println (" grib file name =" + gribFileName);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
|
@ -160,11 +199,16 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
+ gribFile + "]");
|
+ gribFile + "]");
|
||||||
}
|
}
|
||||||
ArrayList<Grib1Record> records = g1i.getRecords();
|
ArrayList<Grib1Record> records = g1i.getRecords();
|
||||||
NcgribRecord[] gribRecords = new NcgribRecord[records.size()];
|
// NcgribRecord[] gribRecords = new NcgribRecord[records.size()];
|
||||||
|
List<NcgribRecord> gribRecords = new ArrayList<NcgribRecord>();
|
||||||
for (int i = 0; i < records.size(); i++) {
|
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 {
|
} finally {
|
||||||
if (raf != null) {
|
if (raf != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -192,7 +236,7 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
private NcgribRecord decodeRecord(Grib1Record rec, RandomAccessFile raf)
|
private NcgribRecord decodeRecord(Grib1Record rec, RandomAccessFile raf)
|
||||||
throws GribException {
|
throws GribException {
|
||||||
|
|
||||||
int discipline=255,category=255,pid=255;
|
int discipline = 255, category = 255, pid = 255;
|
||||||
NcgribRecord retVal = new NcgribRecord();
|
NcgribRecord retVal = new NcgribRecord();
|
||||||
|
|
||||||
// Extract the sections from the grib record
|
// Extract the sections from the grib record
|
||||||
|
@ -210,8 +254,11 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
|
|
||||||
// Some centers use other center's parameter tables so we need to check
|
// Some centers use other center's parameter tables so we need to check
|
||||||
// for that
|
// for that
|
||||||
int[] tableValue = Ncgrib1TableMap.getInstance().getTableAlias(centerid,
|
// System.out.println ("==centerid:" + centerid + " subcenterid:" +
|
||||||
subcenterid, pdsVars.getParameterTableVersion());
|
// subcenterid + " pdsVars.getTableVersion():" +
|
||||||
|
// pdsVars.getTableVersion());
|
||||||
|
int[] tableValue = Ncgrib1TableMap.getInstance().getTableAlias(
|
||||||
|
centerid, subcenterid, pdsVars.getParameterTableVersion());
|
||||||
int centerAlias = tableValue[0];
|
int centerAlias = tableValue[0];
|
||||||
int subcenterAlias = tableValue[1];
|
int subcenterAlias = tableValue[1];
|
||||||
int tableAlias = tableValue[2];
|
int tableAlias = tableValue[2];
|
||||||
|
@ -219,11 +266,11 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Decodes the parameter information from the record. An attempt is
|
* 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;
|
* first made to map the gribimport
|
||||||
1 parameter to the equivalent grib 2
|
* gov.noaa.nws.ncep.common.dataplugin.ncgrib.subgrid.SubNcgrid; 1
|
||||||
* parameter. If this cannot be successfully executed, the grib 1
|
* parameter to the equivalent grib 2 parameter. If this cannot be
|
||||||
* parameter will be used from the parameter tables contained in the
|
* successfully executed, the grib 1 parameter will be used from the
|
||||||
* unidata decoder.
|
* parameter tables contained in the unidata decoder.
|
||||||
*/
|
*/
|
||||||
NcgribParameter parameter = NcgribTableLookup.getInstance()
|
NcgribParameter parameter = NcgribTableLookup.getInstance()
|
||||||
.getNcgrib2Parameter(centerAlias, subcenterAlias, tableAlias,
|
.getNcgrib2Parameter(centerAlias, subcenterAlias, tableAlias,
|
||||||
|
@ -231,8 +278,7 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
|
|
||||||
if (parameter == null || parameter.getName().equals(MISSING)) {
|
if (parameter == null || parameter.getName().equals(MISSING)) {
|
||||||
try {
|
try {
|
||||||
logger
|
logger.warn("Unable to map Grib 1 parameter to equivalent Grib 2 parameter for center ["
|
||||||
.warn("Unable to map Grib 1 parameter to equivalent Grib 2 parameter for center ["
|
|
||||||
+ centerid
|
+ centerid
|
||||||
+ "] subcenter ["
|
+ "] subcenter ["
|
||||||
+ subcenterid
|
+ subcenterid
|
||||||
|
@ -242,8 +288,9 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
+ pdsVars.getParameterNumber()
|
+ pdsVars.getParameterNumber()
|
||||||
+ "] Using grib 1 parameter mapping");
|
+ "] Using grib 1 parameter mapping");
|
||||||
GridParameter param = GribPDSParamTable.getParameterTable(
|
GridParameter param = GribPDSParamTable.getParameterTable(
|
||||||
centerid, subcenterid, pdsVars.getParameterTableVersion())
|
centerid, subcenterid,
|
||||||
.getParameter(pdsVars.getParameterNumber());
|
pdsVars.getParameterTableVersion()).getParameter(
|
||||||
|
pdsVars.getParameterNumber());
|
||||||
parameterName = param.getDescription();
|
parameterName = param.getDescription();
|
||||||
parameterAbbreviation = param.getName();
|
parameterAbbreviation = param.getName();
|
||||||
parameterUnit = param.getUnit();
|
parameterUnit = param.getUnit();
|
||||||
|
@ -277,10 +324,24 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
model.setParameterName(parameterName);
|
model.setParameterName(parameterName);
|
||||||
model.setParameterAbbreviation(parameterAbbreviation);
|
model.setParameterAbbreviation(parameterAbbreviation);
|
||||||
model.setParameterUnit(parameterUnit);
|
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.setNumForecasts(pdsVars.getNumberForecasts());
|
||||||
model.setTypeEnsemble(pdsVars.getType());
|
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 {
|
} else {
|
||||||
model.setNumForecasts(null);
|
model.setNumForecasts(null);
|
||||||
model.setTypeEnsemble(null);
|
model.setTypeEnsemble(null);
|
||||||
|
@ -291,11 +352,9 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
createModelName(model);
|
createModelName(model);
|
||||||
|
|
||||||
// Get the level information
|
// Get the level information
|
||||||
float[] levelMetadata = this.convertGrib1LevelInfo(pdsVars
|
float[] levelMetadata = this.convertGrib1LevelInfo(
|
||||||
.getLevelType1(), (float) pdsVars
|
pdsVars.getLevelType1(), (float) pdsVars.getLevelValue1(),
|
||||||
.getLevelValue1(), pdsVars
|
pdsVars.getLevelType2(), (float) pdsVars.getLevelValue2());
|
||||||
.getLevelType2(), (float) pdsVars
|
|
||||||
.getLevelValue2());
|
|
||||||
getLevelInfo(model, centerid, subcenterid, levelMetadata[0],
|
getLevelInfo(model, centerid, subcenterid, levelMetadata[0],
|
||||||
levelMetadata[1], levelMetadata[2], levelMetadata[3],
|
levelMetadata[1], levelMetadata[2], levelMetadata[3],
|
||||||
levelMetadata[4], levelMetadata[5]);
|
levelMetadata[4], levelMetadata[5]);
|
||||||
|
@ -303,11 +362,13 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
// Construct the DataTime
|
// Construct the DataTime
|
||||||
GregorianCalendar refTime = new GregorianCalendar();
|
GregorianCalendar refTime = new GregorianCalendar();
|
||||||
refTime.setTimeInMillis(pdsVars.getReferenceTime());
|
refTime.setTimeInMillis(pdsVars.getReferenceTime());
|
||||||
int forecastTime = convertToSeconds(pdsVars.getForecastTime(), pdsVars
|
int forecastTime = convertToSeconds(pdsVars.getForecastTime(),
|
||||||
.getTimeUnit());
|
pdsVars.getTimeUnit());
|
||||||
DataTime dataTime = constructDataTime(refTime, forecastTime,
|
DataTime dataTime = constructDataTime(
|
||||||
getTimeInformation(refTime, pdsVars.getTimeRangeIndicator(), pdsVars
|
refTime,
|
||||||
.getP1(), pdsVars.getP2()), model);
|
forecastTime,
|
||||||
|
getTimeInformation(refTime, pdsVars.getTimeRangeIndicator(),
|
||||||
|
pdsVars.getP1(), pdsVars.getP2()), model);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Extract the data values from the file. The AVG_ACCUM_LIST is checked
|
* 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);
|
Grib1Data gd = new Grib1Data(raf);
|
||||||
float[] data = null;
|
float[] data = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
boolean bmsPresent = pdsVars.bmsExists();
|
boolean bmsPresent = pdsVars.bmsExists();
|
||||||
int scanMode = gdsVars.getScanMode();
|
int scanMode = gdsVars.getScanMode();
|
||||||
|
@ -327,11 +389,16 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
data = new float[gdsVars.getNx() * gdsVars.getNy()];
|
data = new float[gdsVars.getNx() * gdsVars.getNy()];
|
||||||
} else {
|
} else {
|
||||||
data = gd.getData(rec.getDataOffset() - gdsVars.getLength(),
|
data = gd.getData(rec.getDataOffset() - gdsVars.getLength(),
|
||||||
rec.getDataOffset(), pdsVars.getDecimalScale(), pdsVars
|
rec.getDataOffset(), pdsVars.getDecimalScale(),
|
||||||
.bmsExists());
|
pdsVars.bmsExists());
|
||||||
}
|
}
|
||||||
correctForScanMode(data, gdsVars.getNx(), gdsVars.getNy(),
|
correctForScanMode(data, gdsVars.getNx(), gdsVars.getNy(),
|
||||||
bmsPresent, scanMode);
|
bmsPresent, scanMode);
|
||||||
|
if (getAddCol()) {
|
||||||
|
float[] dataArry = this.addOneColumnDataTo1D(data,
|
||||||
|
gdsVars.getNx(), gdsVars.getNy());
|
||||||
|
retVal.setMessageData(dataArry);
|
||||||
|
} else
|
||||||
retVal.setMessageData(data);
|
retVal.setMessageData(data);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new GribException("Error getting data from grib file", e);
|
throw new GribException("Error getting data from grib file", e);
|
||||||
|
@ -345,19 +412,29 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
if (subCoverage != null) {
|
if (subCoverage != null) {
|
||||||
SubNcgrid subGrid = NcgribSpatialCache.getInstance().getSubGrid(
|
SubNcgrid subGrid = NcgribSpatialCache.getInstance().getSubGrid(
|
||||||
modelName);
|
modelName);
|
||||||
|
int nx = gridCoverage.getNx();
|
||||||
|
if (getAddCol()) {
|
||||||
|
nx = nx - 1;
|
||||||
|
}
|
||||||
// resize the data array
|
// resize the data array
|
||||||
float[][] dataArray = this.resizeDataTo2D(data, gridCoverage
|
float[][] dataArray = this.resizeDataTo2D(data, nx,
|
||||||
.getNx(), gridCoverage.getNy());
|
gridCoverage.getNy());
|
||||||
dataArray = this.subGrid(dataArray, subGrid.getStartX(), subGrid
|
dataArray = this.subGrid(dataArray, subGrid.getStartX(),
|
||||||
.getStartY(), subGrid.getNX(), subGrid.getNY());
|
subGrid.getStartY(), subGrid.getNX(), subGrid.getNY());
|
||||||
data = this.resizeDataTo1D(dataArray, subGrid.getNY(), subGrid
|
data = this.resizeDataTo1D(dataArray, subGrid.getNY(),
|
||||||
.getNX());
|
subGrid.getNX());
|
||||||
|
if (getAddCol()) {
|
||||||
|
float[] dataArray1 = this.addOneColumnDataTo1D(data,
|
||||||
|
subGrid.getNX(), subGrid.getNY());
|
||||||
|
retVal.setMessageData(dataArray1);
|
||||||
|
} else
|
||||||
retVal.setMessageData(data);
|
retVal.setMessageData(data);
|
||||||
model.setLocation(subCoverage);
|
model.setLocation(subCoverage);
|
||||||
}
|
}
|
||||||
|
setAddCol(false);
|
||||||
|
|
||||||
String newAbbr = NcgribParamTranslator.getInstance().translateParameter(
|
String newAbbr = NcgribParamTranslator.getInstance()
|
||||||
1, model, dataTime);
|
.translateParameter(1, model, dataTime);
|
||||||
|
|
||||||
if (newAbbr == null) {
|
if (newAbbr == null) {
|
||||||
if (!model.getParameterName().equals(MISSING)
|
if (!model.getParameterName().equals(MISSING)
|
||||||
|
@ -371,6 +448,9 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!model.getParameterName().equals(MISSING)) {
|
if (!model.getParameterName().equals(MISSING)) {
|
||||||
|
if (modelName.toUpperCase().equals("GFS")) {
|
||||||
|
model.generateId(fileName);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
model = NcgribModelCache.getInstance().getModel(model);
|
model = NcgribModelCache.getInstance().getModel(model);
|
||||||
} catch (DataAccessLayerException e) {
|
} catch (DataAccessLayerException e) {
|
||||||
|
@ -385,16 +465,16 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
retVal.setDataTime(dataTime);
|
retVal.setDataTime(dataTime);
|
||||||
retVal.setResCompFlags(gdsVars.getResolution());
|
retVal.setResCompFlags(gdsVars.getResolution());
|
||||||
retVal.setModelName(model.getModelName());
|
retVal.setModelName(model.getModelName());
|
||||||
String []fileTokens = fileName.split("/");
|
String[] fileTokens = fileName.split("/");
|
||||||
String flName="";
|
String flName = "";
|
||||||
if ( fileTokens.length > 0 ) {
|
if (fileTokens.length > 0) {
|
||||||
flName = fileTokens[fileTokens.length-1];
|
flName = fileTokens[fileTokens.length - 1];
|
||||||
}
|
}
|
||||||
retVal.setFileName(flName);
|
retVal.setFileName(flName);
|
||||||
String eventName=flName;
|
String eventName = flName;
|
||||||
int index = flName.indexOf(".");
|
int index = flName.indexOf(".");
|
||||||
|
|
||||||
if ( index > 0) {
|
if (index > 0) {
|
||||||
eventName = flName.substring(0, index);
|
eventName = flName.substring(0, index);
|
||||||
}
|
}
|
||||||
retVal.setEventName(eventName);
|
retVal.setEventName(eventName);
|
||||||
|
@ -402,22 +482,24 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
retVal.setCategory(category);
|
retVal.setCategory(category);
|
||||||
retVal.setParameterId(pid);
|
retVal.setParameterId(pid);
|
||||||
retVal.setProcessedDataType(pdsVars.getGenProcessId());
|
retVal.setProcessedDataType(pdsVars.getGenProcessId());
|
||||||
retVal.setGlevel1((int)model.getLevel().getLevelonevalue());
|
retVal.setGlevel1((int) model.getLevel().getLevelonevalue());
|
||||||
retVal.setGlevel2((int)model.getLevel().getLeveltwovalue());
|
retVal.setGlevel2((int) model.getLevel().getLeveltwovalue());
|
||||||
retVal.setVcrdId1(vcrdid);
|
retVal.setVcrdId1(vcrdid);
|
||||||
retVal.setVcrdId2(vcrdid);
|
retVal.setVcrdId2(vcrdid);
|
||||||
retVal.setGridVersion(1);
|
retVal.setGridVersion(1);
|
||||||
|
|
||||||
String vcord = "NONE";
|
String vcord = "NONE";
|
||||||
String scale = "";
|
String scale = "";
|
||||||
Grib2Vcrd grib2Vcrd = Grib2VcrdTableLookup.getGrib2VcrdByGrib1VcrdId (vcrdid);
|
Grib2Vcrd grib2Vcrd = Grib2VcrdTableLookup
|
||||||
if ( grib2Vcrd != null ) {
|
.getGrib2VcrdByGrib1VcrdId(vcrdid);
|
||||||
|
if (grib2Vcrd != null) {
|
||||||
vcord = grib2Vcrd.getGnam();
|
vcord = grib2Vcrd.getGnam();
|
||||||
scale = grib2Vcrd.getScale();
|
scale = grib2Vcrd.getScale();
|
||||||
}
|
}
|
||||||
retVal.setVcord(vcord);
|
retVal.setVcord(vcord);
|
||||||
retVal.setScale(scale);
|
retVal.setScale(scale);
|
||||||
String parm = Grib2VarsTableLookup.getVarGnam4Grib1 (discipline,category,pid);
|
String parm = Grib2VarsTableLookup.getVarGnam4Grib1(discipline,
|
||||||
|
category, pid);
|
||||||
retVal.setParm(parm);
|
retVal.setParm(parm);
|
||||||
|
|
||||||
// Special case handling for ffg grids
|
// Special case handling for ffg grids
|
||||||
|
@ -474,6 +556,32 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
return newGrid;
|
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
|
* Resizes a 2-D array of data to a 1-D array
|
||||||
*
|
*
|
||||||
|
@ -620,15 +728,26 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
NcgridCoverage coverage = null;
|
NcgridCoverage coverage = null;
|
||||||
|
|
||||||
int gridType = gdsVars.getGdtn();
|
int gridType = gdsVars.getGdtn();
|
||||||
|
int nx;
|
||||||
|
float Lon1, Lon2, lo2;
|
||||||
switch (gridType) {
|
switch (gridType) {
|
||||||
case 0:
|
case 0:
|
||||||
LatLonNcgridCoverage latLonCoverage = new LatLonNcgridCoverage();
|
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.setNy(gdsVars.getNy());
|
||||||
latLonCoverage.setLa1(gdsVars.getLa1());
|
latLonCoverage.setLa1(gdsVars.getLa1());
|
||||||
latLonCoverage.setLo1(gdsVars.getLo1());
|
latLonCoverage.setLo1(gdsVars.getLo1());
|
||||||
latLonCoverage.setLa2(gdsVars.getLa2());
|
latLonCoverage.setLa2(gdsVars.getLa2());
|
||||||
latLonCoverage.setLo2(gdsVars.getLo2());
|
latLonCoverage.setLo2(lo2);
|
||||||
if (gdsVars.getGridUnits().equals("degrees")) {
|
if (gdsVars.getGridUnits().equals("degrees")) {
|
||||||
latLonCoverage.setSpacingUnit("degree");
|
latLonCoverage.setSpacingUnit("degree");
|
||||||
latLonCoverage.setDx(gdsVars.getDx());
|
latLonCoverage.setDx(gdsVars.getDx());
|
||||||
|
@ -648,12 +767,23 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
MercatorNcgridCoverage mercator = new MercatorNcgridCoverage();
|
MercatorNcgridCoverage mercator = new MercatorNcgridCoverage();
|
||||||
mercator.setMajorAxis(gdsVars.getMajorAxis() * 1000);
|
mercator.setMajorAxis(gdsVars.getMajorAxis() * 1000);
|
||||||
mercator.setMinorAxis(gdsVars.getMinorAxis() * 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.setNy(gdsVars.getNy());
|
||||||
mercator.setLa1(correctLat(gdsVars.getLa1()));
|
mercator.setLa1(correctLat(gdsVars.getLa1()));
|
||||||
mercator.setLo1(correctLon(gdsVars.getLo1()));
|
mercator.setLo1(correctLon(gdsVars.getLo1()));
|
||||||
mercator.setLa2(correctLat(gdsVars.getLa2()));
|
mercator.setLa2(correctLat(gdsVars.getLa2()));
|
||||||
mercator.setLo2(correctLon(gdsVars.getLo2()));
|
mercator.setLo2(lo2);
|
||||||
mercator.setLatin(correctLat(gdsVars.getLatin1()));
|
mercator.setLatin(correctLat(gdsVars.getLatin1()));
|
||||||
if (gdsVars.getGridUnits().equals("degrees")) {
|
if (gdsVars.getGridUnits().equals("degrees")) {
|
||||||
mercator.setSpacingUnit("degree");
|
mercator.setSpacingUnit("degree");
|
||||||
|
@ -732,7 +862,8 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
private NcgridCoverage getGridFromCache(NcgridCoverage coverage)
|
private NcgridCoverage getGridFromCache(NcgridCoverage coverage)
|
||||||
throws GribException {
|
throws GribException {
|
||||||
|
|
||||||
NcgridCoverage grid = NcgribSpatialCache.getInstance().getGrid(coverage);
|
NcgridCoverage grid = NcgribSpatialCache.getInstance()
|
||||||
|
.getGrid(coverage);
|
||||||
|
|
||||||
if (grid == null) {
|
if (grid == null) {
|
||||||
NcgribSpatialCache.getInstance().putGrid(coverage, true);
|
NcgribSpatialCache.getInstance().putGrid(coverage, true);
|
||||||
|
@ -753,8 +884,8 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
|
|
||||||
String gridid = model.getGridid();
|
String gridid = model.getGridid();
|
||||||
int process = model.getGenprocess();
|
int process = model.getGenprocess();
|
||||||
NcgridModel gridModel = NcgribModelLookup.getInstance().getModel(center,
|
NcgridModel gridModel = NcgribModelLookup.getInstance().getModel(
|
||||||
subcenter, gridid, process);
|
center, subcenter, gridid, process);
|
||||||
String name = null;
|
String name = null;
|
||||||
if (gridModel == null) {
|
if (gridModel == null) {
|
||||||
name = "UnknownModel:" + String.valueOf(center) + ":"
|
name = "UnknownModel:" + String.valueOf(center) + ":"
|
||||||
|
@ -789,7 +920,8 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
if (endTime == null) {
|
if (endTime == null) {
|
||||||
dataTime = new DataTime(refTime, forecastTime);
|
dataTime = new DataTime(refTime, forecastTime);
|
||||||
} else {
|
} else {
|
||||||
TimeRange timeRange = new TimeRange(startTime.getTimeInMillis(),endTime.getTimeInMillis());
|
TimeRange timeRange = new TimeRange(startTime.getTimeInMillis(),
|
||||||
|
endTime.getTimeInMillis());
|
||||||
dataTime = new DataTime(refTime, forecastTime, timeRange);
|
dataTime = new DataTime(refTime, forecastTime, timeRange);
|
||||||
}
|
}
|
||||||
return dataTime;
|
return dataTime;
|
||||||
|
@ -1093,8 +1225,16 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
* -1));
|
* -1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Level level = LevelFactory.getInstance().getLevel(levelName,
|
Level level = null;
|
||||||
|
try {
|
||||||
|
level = LevelFactory.getInstance().getLevel(levelName,
|
||||||
levelOneValue, levelTwoValue, levelUnit);
|
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);
|
model.setLevel(level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1145,4 +1285,11 @@ public class Ncgrib1Decoder extends AbstractDecoder {
|
||||||
return lat;
|
return lat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setAddCol(boolean addCol) {
|
||||||
|
this.addCol = addCol;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean getAddCol() {
|
||||||
|
return this.addCol;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue