13.4.1-3 baseline

Former-commit-id: 03ff5cd82c [formerly 3486902772] [formerly 54afedf617] [formerly 03ff5cd82c [formerly 3486902772] [formerly 54afedf617] [formerly 86e96f378c [formerly 54afedf617 [formerly 02412063da81fbfd3f1bbdd48700e1b1ccdeb4fd]]]]
Former-commit-id: 86e96f378c
Former-commit-id: 63a820bca5 [formerly 9fb6f3835c] [formerly 9ed4bd11d8f4f59100814b197a573e16fc302211 [formerly 8a41dd2048]]
Former-commit-id: efce989e4749e088495f2c8e2c2e6ff2660cbac9 [formerly 7e923539d5]
Former-commit-id: d8da1e82f5
This commit is contained in:
Steve Harris 2013-04-29 12:25:07 -05:00
parent dc6ffe2ccf
commit 7193eee657
78 changed files with 2156 additions and 3284 deletions

View file

@ -2,6 +2,6 @@
<?eclipse-pydev version="1.0"?> <?eclipse-pydev version="1.0"?>
<pydev_project> <pydev_project>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.5</pydev_property> <pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property> <pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
</pydev_project> </pydev_project>

View file

@ -2,19 +2,19 @@
## ##
# This software was developed and / or modified by Raytheon Company, # This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government. # pursuant to Contract DG133W-05-CQ-1067 with the US Government.
# #
# U.S. EXPORT CONTROLLED TECHNICAL DATA # U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose # This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination # export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires # to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization. # an export license or other authorization.
# #
# Contractor Name: Raytheon Company # Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340 # Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8 # Mail Stop B8
# Omaha, NE 68106 # Omaha, NE 68106
# 402.291.0100 # 402.291.0100
# #
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for # See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information. # further licensing information.
## ##
@ -119,7 +119,7 @@ nnn = r'(?:[A-Z]{2}[ZC])?\d{3}'
purge = r'(?P<purgeT>\d{6})-' purge = r'(?P<purgeT>\d{6})-'
ugc = r'\n(?P<uhdr>' + r'[A-Z]{2}[Z|C](?:(?:\d{3})|(?:ALL))' + r'(?:[->]\n?' + nnn + \ ugc = r'\n(?P<uhdr>' + r'[A-Z]{2}[Z|C](?:(?:\d{3})|(?:ALL))' + r'(?:[->]\n?' + nnn + \
r')*-\n?' + purge + el + r')' r')*-\n?' + purge + el + r')'
cityh = r'(?<=-\n(?!.*-\n))(?P<incc>(?:.*\n))' cityh = r'-\n(?P<incc>(?:\s*\n)*(?:INCLUDING THE (?:CITIES|CITY) OF...)?)'
body = r'(?P<body>(?:^.*\n)*?)' body = r'(?P<body>(?:^.*\n)*?)'
#body = r'.*' #body = r'.*'
@ -192,20 +192,20 @@ class ProductParser:
#l = headline_re.finditer(str) #l = headline_re.finditer(str)
l = single_head_re.finditer(str) l = single_head_re.finditer(str)
for m in l: for m in l:
if m is not None: if m is not None:
#print 'phl m = ', m #print 'phl m = ', m
newstart = start + m.start() newstart = start + m.start()
m = headline_re.match(m.group(0)) m = headline_re.match(m.group(0))
if m is not None: if m is not None:
hdlns.append(self.dumpMatch(m, newstart)) hdlns.append(self.dumpMatch(m, newstart))
#print 'hdlns = ', hdlns #print 'hdlns = ', hdlns
rval['headInfo'] = hdlns rval['headInfo'] = hdlns
def dumpMatch(self, m, offset=0, rval=None): def dumpMatch(self, m, offset=0, rval=None):
if rval is None: if rval is None:
rval = {} rval = {}
#print 'dumpmatch m = ', m.groupdict() #print 'dumpmatch m = ', m.groupdict()
for k in m.groupdict().keys(): for k in m.groupdict().keys():
if m.start(k) != -1 and m.start(k) != m.end(k): if m.start(k) != -1 and m.start(k) != m.end(k):
@ -234,7 +234,7 @@ class ProductParser:
segs = [] segs = []
l = ugch_re.finditer(self._str) l = ugch_re.finditer(self._str)
for m in l: for m in l:
if m is not None: if m is not None:
m1 = cityh_re.search(self._str, m.end()) m1 = cityh_re.search(self._str, m.end())
@ -250,7 +250,7 @@ class ProductParser:
else: else:
continue continue
m4 = head_re.search(self._str, m.end(), m3.end()) m4 = head_re.search(self._str, m.end(), m3.end())
d = self.dumpMatch(m) d = self.dumpMatch(m)
d = self.dumpMatch(m2, rval=d) d = self.dumpMatch(m2, rval=d)
d = self.dumpMatch(m3, rval=d) d = self.dumpMatch(m3, rval=d)
@ -266,7 +266,7 @@ class ProductParser:
else: else:
d['city'] = (self.tkc(m2.start()), d['city'] = (self.tkc(m2.start()),
self.tkc(m2.start())) self.tkc(m2.start()))
if m4 is not None: if m4 is not None:
#print 'm4 = ', m4.group() #print 'm4 = ', m4.group()
d = self.dumpMatch(m4, rval=d) d = self.dumpMatch(m4, rval=d)
@ -284,7 +284,7 @@ class ProductParser:
rval['frames'] = frames rval['frames'] = frames
return rval return rval
def parseFromJava(self, text): def parseFromJava(self, text):
self._str = text self._str = text
self._ci = None self._ci = None
@ -295,13 +295,13 @@ class ProductParser:
lc.append(count) lc.append(count)
count += l count += l
self._totals = lc self._totals = lc
#print 'text START ----------------------' #print 'text START ----------------------'
#print text #print text
#print 'text END ------------------------' #print 'text END ------------------------'
result = self.parse() result = self.parse()
#print 'result = ', result #print 'result = ', result
return JUtil.pyDictToJavaMap(result) return JUtil.pyDictToJavaMap(result)

View file

@ -24,6 +24,7 @@ import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.NavigableSet; import java.util.NavigableSet;
import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
import javax.measure.unit.Unit; import javax.measure.unit.Unit;
@ -34,6 +35,7 @@ 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.common.dataplugin.level.mapping.LevelMappingFactory;
import com.raytheon.uf.viz.core.exception.VizCommunicationException; import com.raytheon.uf.viz.core.exception.VizCommunicationException;
/** /**
@ -57,8 +59,8 @@ public class LevelUtilities {
static { static {
try { try {
hPa = (Unit<?>) UnitFormat.getUCUMInstance().parseProductUnit( hPa = UnitFormat.getUCUMInstance().parseProductUnit("hPa",
"hPa", new ParsePosition(0)); new ParsePosition(0));
} catch (Exception e) { } catch (Exception e) {
// this is bad // this is bad
} }
@ -122,7 +124,15 @@ public class LevelUtilities {
}; };
Map<String, NavigableSet<Level>> masterLevelToOrderedSet = new HashMap<String, NavigableSet<Level>>(); Map<String, NavigableSet<Level>> masterLevelToOrderedSet = new HashMap<String, NavigableSet<Level>>();
for (Level level : LevelMappingFactory.getInstance().getAllLevels()) { Set<Level> allLevels;
try {
allLevels = LevelMappingFactory.getInstance(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getAllLevels();
} catch (CommunicationException e) {
throw new VizCommunicationException(e);
}
for (Level level : allLevels) {
NavigableSet<Level> levels = masterLevelToOrderedSet.get(level NavigableSet<Level> levels = masterLevelToOrderedSet.get(level
.getMasterLevel().getName()); .getMasterLevel().getName());
if (levels == null) { if (levels == null) {

View file

@ -15,11 +15,12 @@ Require-Bundle: org.eclipse.core.runtime,
com.raytheon.viz.core;bundle-version="1.12.1174", com.raytheon.viz.core;bundle-version="1.12.1174",
com.raytheon.viz.core.graphing;bundle-version="1.12.1174", com.raytheon.viz.core.graphing;bundle-version="1.12.1174",
com.raytheon.uf.viz.xy.timeseries;bundle-version="1.12.1174", com.raytheon.uf.viz.xy.timeseries;bundle-version="1.12.1174",
javax.measure;bundle-version="1.0.0" javax.measure;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174",
com.raytheon.uf.common.comm;bundle-version="1.12.1174"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.raytheon.uf.common.dataplugin, Import-Package: com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.dataplugin.grid, com.raytheon.uf.common.dataplugin.grid,
com.raytheon.uf.common.dataplugin.level,
com.raytheon.uf.common.dataplugin.radar, com.raytheon.uf.common.dataplugin.radar,
com.raytheon.uf.common.dataplugin.radar.util, com.raytheon.uf.common.dataplugin.radar.util,
com.raytheon.uf.common.dataquery.requests, com.raytheon.uf.common.dataquery.requests,

View file

@ -35,6 +35,8 @@ import org.opengis.referencing.crs.CoordinateReferenceSystem;
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.mapping.LevelMapping;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
import com.raytheon.uf.common.geospatial.MapUtil; import com.raytheon.uf.common.geospatial.MapUtil;
@ -44,8 +46,6 @@ 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.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.level.LevelMapping;
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
import com.raytheon.uf.viz.core.level.LevelUtilities; import com.raytheon.uf.viz.core.level.LevelUtilities;
import com.raytheon.uf.viz.core.rsc.DisplayType; import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.style.level.SingleLevel; import com.raytheon.uf.viz.core.style.level.SingleLevel;
@ -238,6 +238,7 @@ public class PointDataTimeSeriesAdapter extends
return loadDataOAInternal(recordsToLoad); return loadDataOAInternal(recordsToLoad);
} }
@Override
public SingleLevel getLevel() { public SingleLevel getLevel() {
SingleLevel level = new SingleLevel("SURFACE"); SingleLevel level = new SingleLevel("SURFACE");
level.setValue(0.0); level.setValue(0.0);
@ -246,7 +247,8 @@ public class PointDataTimeSeriesAdapter extends
return level; return level;
} }
try { try {
LevelMapping mapping = LevelMappingFactory.getInstance() LevelMapping mapping = LevelMappingFactory.getInstance(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getLevelMappingForKey(resourceData.getLevelKey()); .getLevelMappingForKey(resourceData.getLevelKey());
for (Level l : mapping.getLevels()) { for (Level l : mapping.getLevels()) {
if (LevelUtilities.isPressureLevel(l)) { if (LevelUtilities.isPressureLevel(l)) {
@ -260,7 +262,7 @@ public class PointDataTimeSeriesAdapter extends
} }
} }
} }
} catch (VizException e) { } catch (Exception e) {
// return the default // return the default
} }
return level; return level;

View file

@ -35,6 +35,7 @@ import java.util.concurrent.BlockingQueue;
import com.raytheon.uf.common.comm.CommunicationException; 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.mapping.LevelMappingFactory;
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;
import com.raytheon.uf.common.derivparam.tree.DataTree; import com.raytheon.uf.common.derivparam.tree.DataTree;
@ -47,7 +48,6 @@ 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.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.LevelUtilities; import com.raytheon.uf.viz.core.level.LevelUtilities;
import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData; import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
import com.raytheon.uf.viz.derivparam.data.FloatRequestableData; import com.raytheon.uf.viz.derivparam.data.FloatRequestableData;
@ -137,27 +137,36 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
*/ */
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) if (this == obj) {
return true; return true;
if (obj == null) }
if (obj == null) {
return false; return false;
if (getClass() != obj.getClass()) }
if (getClass() != obj.getClass()) {
return false; return false;
}
StackEntry other = (StackEntry) obj; StackEntry other = (StackEntry) obj;
if (!getOuterType().equals(other.getOuterType())) if (!getOuterType().equals(other.getOuterType())) {
return false; return false;
if (level != other.level) }
if (level != other.level) {
return false; return false;
}
if (source == null) { if (source == null) {
if (other.source != null) if (other.source != null) {
return false; return false;
} else if (!source.equals(other.source)) }
} else if (!source.equals(other.source)) {
return false; return false;
}
if (parameter == null) { if (parameter == null) {
if (other.parameter != null) if (other.parameter != null) {
return false; return false;
} else if (!parameter.equals(other.parameter)) }
} else if (!parameter.equals(other.parameter)) {
return false; return false;
}
return true; return true;
} }
@ -474,8 +483,10 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
protected Collection<Level> getAllLevels() { protected Collection<Level> getAllLevels() {
if (allLevels == null) { if (allLevels == null) {
try { try {
return LevelMappingFactory.getInstance().getAllLevels(); return LevelMappingFactory.getInstance(
} catch (VizCommunicationException e) { LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getAllLevels();
} catch (CommunicationException e) {
// TODO recover from this. // TODO recover from this.
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e); e);
@ -1094,7 +1105,13 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
// because it is valid for all requests // because it is valid for all requests
} else if (type == LevelType.LevelMapping) { } else if (type == LevelType.LevelMapping) {
LevelNode target = null; LevelNode target = null;
for (Level fieldLevel : field.getLevelMapping().getLevels()) { List<Level> levels;
try {
levels = field.getLevelMapping().getLevels();
} catch (CommunicationException e) {
throw new VizCommunicationException(e);
}
for (Level fieldLevel : levels) {
target = resolveNode(fieldSourceNode, fieldParamAbbrev, target = resolveNode(fieldSourceNode, fieldParamAbbrev,
fieldLevel, stack, nodata); fieldLevel, stack, nodata);
if (target != null) { if (target != null) {

View file

@ -27,11 +27,11 @@ import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMapping;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory;
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.exception.VizCommunicationException;
import com.raytheon.uf.viz.core.level.LevelMapping;
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
/** /**
* Metadata about a derived parameter field. * Metadata about a derived parameter field.
@ -131,7 +131,8 @@ public class DerivParamField implements ISerializableObject, IDerivParamField {
public boolean setLevel(String level) throws VizCommunicationException { 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(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getLevelMappingForKey(level); .getLevelMappingForKey(level);
if (levelMapping == null) { if (levelMapping == null) {
levelType = null; levelType = null;

View file

@ -34,11 +34,11 @@ 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.dataplugin.level.mapping.LevelMapper; import com.raytheon.uf.common.dataplugin.level.mapping.LevelMapper;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMapping;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory;
import com.raytheon.uf.common.util.mapping.Mapper; import com.raytheon.uf.common.util.mapping.Mapper;
import com.raytheon.uf.common.util.mapping.MultipleMappingException; import com.raytheon.uf.common.util.mapping.MultipleMappingException;
import com.raytheon.uf.viz.core.exception.VizCommunicationException; import com.raytheon.uf.viz.core.exception.VizCommunicationException;
import com.raytheon.uf.viz.core.level.LevelMapping;
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
/** /**
* Generates the valid levels for a derived parameter script based on it * Generates the valid levels for a derived parameter script based on it
@ -74,7 +74,8 @@ public class ValidLevelGenerator {
private Set<MasterLevel> masterLevelsHandled; private Set<MasterLevel> masterLevelsHandled;
public ValidLevelGenerator() { public ValidLevelGenerator() {
lmf = LevelMappingFactory.getInstance(); lmf = LevelMappingFactory
.getInstance(LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE);
lf = LevelFactory.getInstance(); lf = LevelFactory.getInstance();
lm = LevelMapper.getInstance(); lm = LevelMapper.getInstance();
} }
@ -84,61 +85,65 @@ public class ValidLevelGenerator {
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>();
if (validLevelsString != null && validLevelsString.length() > 0) { try {
String[] levelTokenArray = validLevelsString.split(","); if (validLevelsString != null && validLevelsString.length() > 0) {
List<String> tokensToProcess = new ArrayList<String>( String[] levelTokenArray = validLevelsString.split(",");
levelTokenArray.length); List<String> tokensToProcess = new ArrayList<String>(
levelTokenArray.length);
for (String token : levelTokenArray) { for (String token : levelTokenArray) {
tokensToProcess.add(token); tokensToProcess.add(token);
}
// generate initial list
Iterator<String> iter = tokensToProcess.iterator();
while (iter.hasNext()) {
String token = iter.next();
if (token.charAt(0) == '!') {
token = token.substring(1);
} }
// See if this is a group.
Map<MasterLevel, Set<Level>> tmp = lmf
.getLevelMapForGroup(token);
if (tmp != null) { // generate initial list
masterLevels = tmp; Iterator<String> iter = tokensToProcess.iterator();
iter.remove();
break;
}
}
if (masterLevels.size() == 0 && tokensToProcess.size() > 0) { while (iter.hasNext()) {
for (Level l : lmf.getAllLevels()) { String token = iter.next();
MasterLevel ml = l.getMasterLevel();
Set<Level> levels = masterLevels.get(ml); if (token.charAt(0) == '!') {
if (levels == null) { token = token.substring(1);
levels = new HashSet<Level>();
masterLevels.put(ml, levels);
} }
// See if this is a group.
Map<MasterLevel, Set<Level>> tmp = lmf
.getLevelMapForGroup(token);
levels.add(l); if (tmp != null) {
} masterLevels = tmp;
} iter.remove();
break;
if (tokensToProcess.size() > 0) {
for (String token : tokensToProcess) {
try {
processLevelToken(token);
} catch (CommunicationException e) {
throw new VizCommunicationException(e);
} }
} }
} else {
for (Set<Level> levels : masterLevels.values()) { if (masterLevels.size() == 0 && tokensToProcess.size() > 0) {
validLevels.addAll(levels); for (Level l : lmf.getAllLevels()) {
MasterLevel ml = l.getMasterLevel();
Set<Level> levels = masterLevels.get(ml);
if (levels == null) {
levels = new HashSet<Level>();
masterLevels.put(ml, levels);
}
levels.add(l);
}
}
if (tokensToProcess.size() > 0) {
for (String token : tokensToProcess) {
try {
processLevelToken(token);
} catch (CommunicationException e) {
throw new VizCommunicationException(e);
}
}
} else {
for (Set<Level> levels : masterLevels.values()) {
validLevels.addAll(levels);
}
} }
} }
} catch (CommunicationException e) {
throw new VizCommunicationException(e);
} }
return validLevels; return validLevels;

View file

@ -93,6 +93,7 @@ import com.raytheon.uf.viz.monitor.listeners.IMonitorListener;
* 02/19/13 1639 njensen Replaced ConcurrentHashMaps with data structures * 02/19/13 1639 njensen Replaced ConcurrentHashMaps with data structures
* 02/20/13 1635 D. Hladky Fixed multi guidance sources * 02/20/13 1635 D. Hladky Fixed multi guidance sources
* Mar 6, 2013 1769 dhladky Changed threading to use count down latch. * Mar 6, 2013 1769 dhladky Changed threading to use count down latch.
* Apr 9, 2013 1890 dhladky Fixed the broken cache file load
* *
* </pre> * </pre>
* *
@ -386,19 +387,40 @@ public class FFMPMonitor extends ResourceMonitor {
* @param dataKey * @param dataKey
* @param source * @param source
*/ */
public void insertFFMPData(FFMPAggregateRecord data, String siteKey, public void insertFFMPData(FFMPAggregateRecord data,
String source) { NavigableMap<Date, List<String>> uris, String siteKey, String source) {
// TODO do we need this method if we're no longer supporting cache
// records? // get record from cache
if (siteDataMap.containsSite(siteKey)) { FFMPSourceData sourceData = siteDataMap.get(siteKey).getSourceData(source);
if (siteDataMap.get(siteKey).containsSource(source)) { FFMPRecord curRecord = sourceData.getRecord();
for (Entry<String, FFMPBasinData> entry : data.getBasinsMap()
.entrySet()) { if (curRecord == null) {
FFMPBasinData basinData = entry.getValue(); // add each huc requested
basinData.populate(data.getTimes()); for (String huc : data.getBasinsMap().keySet()) {
// add all of the uris
for (Entry<Date, List<String>> duris : uris.entrySet()) {
for (String uri : duris.getValue()) {
if (curRecord == null) {
curRecord = new FFMPRecord(uri);
sourceData.setRecord(curRecord);
}
sourceData.addLoadedUri(huc, uri);
}
} }
} }
} }
if (curRecord != null) {
for (Entry<String, FFMPBasinData> entry : data.getBasinsMap()
.entrySet()) {
FFMPBasinData basinData = entry.getValue();
basinData.populate(data.getTimes());
curRecord.populate(basinData, entry.getKey());
}
}
} }
/** /**

View file

@ -89,6 +89,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Changes for non-blocking HelpDlg. * Changes for non-blocking HelpDlg.
* Changes for non-blocking RetrieveMergeDlg. * Changes for non-blocking RetrieveMergeDlg.
* Changes for non-blocking LoadSaveDeleteSelectDlg. * Changes for non-blocking LoadSaveDeleteSelectDlg.
* Apr, 15, 2013 #1911 dhladky dialog wouldn't open every time to retrieve file.
* *
* </pre> * </pre>
* *
@ -1607,8 +1608,8 @@ public class FFFGDlg extends CaveSWTDialog implements ISourceCompAction,
} }
if (isDialogClear() && (fileNameLbl.getText().trim().length() == 0)) { if (isDialogClear() && (fileNameLbl.getText().trim().length() == 0)) {
return; getRetrieveFilename(RetrieveMergeAction.RETRIEVE);
} else { } else {
if (retMergeDlg == null) { if (retMergeDlg == null) {
retMergeDlg = new RetrieveMergeDlg(shell); retMergeDlg = new RetrieveMergeDlg(shell);
retMergeDlg.setCloseCallback(new ICloseCallback() { retMergeDlg.setCloseCallback(new ICloseCallback() {

View file

@ -55,6 +55,7 @@ import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPTableColumnXML;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 01, 2012 14168 mpduff Add convenience methods for * Aug 01, 2012 14168 mpduff Add convenience methods for
* getting ColorCell and ReverseFilter * getting ColorCell and ReverseFilter
* Apr 15. 2013 1890 dhladky Added Mikes fix for singleton.
* *
* </pre> * </pre>
* *
@ -123,27 +124,9 @@ public class FFMPConfig {
} }
public static synchronized FFMPConfig getInstance() { public static synchronized FFMPConfig getInstance() {
if (classInstance == null) {
classInstance = new FFMPConfig();
}
return classInstance; return classInstance;
} }
public void disposeResources() {
upperColor.dispose();
midColor.dispose();
lowerColor.dispose();
belowLowerColor.dispose();
defaultColor.dispose();
forcedFFGColor.dispose();
vgbColor.dispose();
}
public static void unloadConfig() {
classInstance = null;
}
private void init() { private void init() {
threshMgrMap = new HashMap<ThreshColNames, ThresholdManager>(); threshMgrMap = new HashMap<ThreshColNames, ThresholdManager>();

View file

@ -319,8 +319,8 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
dataLoadFont.dispose(); dataLoadFont.dispose();
timeDurFont.dispose(); timeDurFont.dispose();
FFMPConfig.getInstance().disposeResources(); //FFMPConfig.getInstance().disposeResources();
FFMPConfig.unloadConfig(); //FFMPConfig.unloadConfig();
if (refreshColor != null) { if (refreshColor != null) {
refreshColor.dispose(); refreshColor.dispose();
@ -1311,15 +1311,20 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
if (attributeDlg == null || attributeDlg.isDisposed()) { if (attributeDlg == null || attributeDlg.isDisposed()) {
attrData = ffmpTable.getVisibleColumns(); attrData = ffmpTable.getVisibleColumns();
attributeDlg = new AttributesDlg(shell, resource, attrData, this); attributeDlg = new AttributesDlg(shell, resource, attrData, this);
attributeDlg.open();
} else {
attributeDlg.bringToTop();
} }
attributeDlg.open();
} }
private void displayThresholdsDialog(ThreshColNames colName) { private void displayThresholdsDialog(ThreshColNames colName) {
if (attrThreshDlg == null) { if (attrThreshDlg == null) {
attrThreshDlg = new AttributeThresholdDlg(shell, colName, this); attrThreshDlg = new AttributeThresholdDlg(shell, colName, this);
attrThreshDlg.open();
} else {
attrThreshDlg.bringToTop();
} }
attrThreshDlg.open();
attrThreshDlg.newThreshold(colName); attrThreshDlg.newThreshold(colName);
} }
@ -2105,13 +2110,17 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
shell.pack(); shell.pack();
} }
String prefix = null; String prefix = null;
if (status.getLoaderType() == LOADER_TYPE.SECONDARY) { if (status.getLoaderType() == LOADER_TYPE.SECONDARY) {
prefix = " Secondary Data Load: "; prefix = " Secondary Data Load: ";
} else { } else if (status.getLoaderType() == LOADER_TYPE.TERTIARY) {
prefix = " Tertiary Data Load: "; prefix = " Tertiary Data Load: ";
} } else if (status.getLoaderType() == LOADER_TYPE.GENERAL) {
prefix = " General Data Load: ";
} else {
prefix = " Tertiary Data Load: ";
}
if (status.isDone() == false) { if (status.isDone() == false) {
dataLoadingLbl.setText(prefix + status.getMessage()); dataLoadingLbl.setText(prefix + status.getMessage());

View file

@ -24,6 +24,7 @@ import java.util.List;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin; import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceInterpolation; import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceInterpolation;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPTemplates; import com.raytheon.uf.common.dataplugin.ffmp.FFMPTemplates;
import com.raytheon.uf.common.monitor.config.FFFGDataMgr; import com.raytheon.uf.common.monitor.config.FFFGDataMgr;
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager; import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager;
@ -41,6 +42,7 @@ import com.raytheon.uf.common.monitor.xml.SourceXML;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jul 20, 2011 mpduff Initial creation * Jul 20, 2011 mpduff Initial creation
* 01/14/13 1569 dhladky changed arraylist to list * 01/14/13 1569 dhladky changed arraylist to list
* 04/15/13 1890 dhladky Changed COUNTY to use constant
* *
* </pre> * </pre>
* *
@ -132,7 +134,7 @@ public class FFFGForceUtil {
pfafList = ft.getAggregatePfafs(cBasin.getPfaf(), pfafList = ft.getAggregatePfafs(cBasin.getPfaf(),
resource.getSiteKey(), resource.getHuc()); resource.getSiteKey(), resource.getHuc());
} else if (!domain.equals("NA")) { } else if (!domain.equals("NA")) {
if (!resource.getHuc().equals("ALL")) { if (!resource.getHuc().equals(FFMPRecord.ALL)) {
pfafList = ft.getAggregatePfafsByDomain(cBasin.getPfaf(), pfafList = ft.getAggregatePfafsByDomain(cBasin.getPfaf(),
resource.getSiteKey(), domain, resource.getHuc()); resource.getSiteKey(), domain, resource.getHuc());
} }

View file

@ -71,6 +71,8 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfigData;
* Feb 19, 2013 1639 njensen Replaced FFMPCacheRecord with FFMPRecord * Feb 19, 2013 1639 njensen Replaced FFMPCacheRecord with FFMPRecord
* feb 20, 2013 1635 dhladky Fixed multi guidance displays * feb 20, 2013 1635 dhladky Fixed multi guidance displays
* Feb 28, 2013 1729 dhladky General enhancements for speed. * Feb 28, 2013 1729 dhladky General enhancements for speed.
* Apr 15, 2013 1890 dhladky Added another constant fix.
* Apr 15, 2013 1911 dhladky Fixed forced FFG for centered aggregates.
* </pre> * </pre>
* @author dhladky * @author dhladky
* @version 1.0 * @version 1.0
@ -497,7 +499,7 @@ public class FFMPDataGenerator {
forced = forceUtil.isForced(); forced = forceUtil.isForced();
} }
if ((!forcedPfafs.isEmpty()) && forced) { if ((!forcedPfafs.isEmpty()) && forced && centeredAggregationKey == null) {
// Recalculate the guidance using the forced // Recalculate the guidance using the forced
// value(s) // value(s)
guidance = guidRecords guidance = guidRecords
@ -510,7 +512,7 @@ public class FFMPDataGenerator {
guidance, guidance,
forcedPfafs, forcedPfafs,
resource.getGuidSourceExpiration(guidType)); resource.getGuidSourceExpiration(guidType));
} else if (!forcedPfafs.isEmpty()) { } else if (!forcedPfafs.isEmpty() && centeredAggregationKey == null) {
guidance = guidRecords guidance = guidRecords
.get(guidType) .get(guidType)
.getBasinData(ALL) .getBasinData(ALL)
@ -522,7 +524,7 @@ public class FFMPDataGenerator {
forcedPfafs, forcedPfafs,
resource.getGuidSourceExpiration(guidType)); resource.getGuidSourceExpiration(guidType));
forced = true; forced = true;
} else if (!pfafList.isEmpty()) { } else if (!pfafList.isEmpty() && centeredAggregationKey == null) {
guidance = guidRecords guidance = guidRecords
.get(guidType) .get(guidType)
.getBasinData(ALL) .getBasinData(ALL)
@ -674,7 +676,7 @@ public class FFMPDataGenerator {
forced = forceUtil.isForced(); forced = forceUtil.isForced();
} }
if ((!forcedPfafs.isEmpty()) && forced) { if ((!forcedPfafs.isEmpty()) && forced && centeredAggregationKey == null) {
// Recalculate the guidance using the forced // Recalculate the guidance using the forced
// value(s) // value(s)
guidance = guidRecords guidance = guidRecords
@ -687,7 +689,7 @@ public class FFMPDataGenerator {
guidance, guidance,
forcedPfafs, forcedPfafs,
resource.getGuidSourceExpiration(guidType)); resource.getGuidSourceExpiration(guidType));
} else if (!forcedPfafs.isEmpty()) { } else if (!forcedPfafs.isEmpty() && centeredAggregationKey == null) {
guidance = guidRecords guidance = guidRecords
.get(guidType) .get(guidType)
.getBasinData(ALL) .getBasinData(ALL)
@ -699,7 +701,7 @@ public class FFMPDataGenerator {
forcedPfafs, forcedPfafs,
resource.getGuidSourceExpiration(guidType)); resource.getGuidSourceExpiration(guidType));
forced = true; forced = true;
} else if (!pfafList.isEmpty()) { } else if (!pfafList.isEmpty() && centeredAggregationKey == null) {
guidance = guidRecords guidance = guidRecords
.get(guidType) .get(guidType)
.getBasinData(ALL) .getBasinData(ALL)
@ -843,7 +845,7 @@ public class FFMPDataGenerator {
ArrayList<Long> pfafs = ft.getAggregatePfafs(basin.getPfaf(), ArrayList<Long> pfafs = ft.getAggregatePfafs(basin.getPfaf(),
siteKey, huc); siteKey, huc);
if (!pfafs.isEmpty()) { if (!pfafs.isEmpty()) {
if (huc.equals("COUNTY")) { if (huc.equals(FFMPRecord.COUNTY)) {
name = ft.getCountyStateName(siteKey, basin.getPfaf()); name = ft.getCountyStateName(siteKey, basin.getPfaf());
} else { } else {
for (int i = 0; i < pfafs.size(); i++) { for (int i = 0; i < pfafs.size(); i++) {

View file

@ -20,7 +20,6 @@
package com.raytheon.uf.viz.monitor.ffmp.ui.rsc; package com.raytheon.uf.viz.monitor.ffmp.ui.rsc;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
@ -67,6 +66,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.listeners.FFMPLoaderEvent;
* 02/01/13 1569 D. Hladky Changed to reading aggregate records from pypies * 02/01/13 1569 D. Hladky Changed to reading aggregate records from pypies
* Feb 28, 2013 1729 dhladky Changed the way status messages are sent to the FFMP Dialog. * Feb 28, 2013 1729 dhladky Changed the way status messages are sent to the FFMP Dialog.
* Mar 6, 2013 1769 dhladky Changed threading to use count down latch. * Mar 6, 2013 1769 dhladky Changed threading to use count down latch.
* Apr 9, 2013 1890 dhladky removed loading of phantom Virtual template and cache file processing.
* </pre> * </pre>
* *
* @author dhladky * @author dhladky
@ -74,7 +74,8 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.listeners.FFMPLoaderEvent;
*/ */
public class FFMPDataLoader extends Thread { public class FFMPDataLoader extends Thread {
private static final IUFStatusHandler statusHandler = UFStatus.getHandler(FFMPDataLoader.class); private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(FFMPDataLoader.class);
private ProductXML product = null; private ProductXML product = null;
@ -156,13 +157,14 @@ public class FFMPDataLoader extends Thread {
@Override @Override
public void run() { public void run() {
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
try { try {
resourceData.setLoader(loadType); resourceData.setLoader(loadType);
FFMPMonitor monitor = getMonitor(); FFMPMonitor monitor = getMonitor();
FFMPSourceConfigurationManager sourceConfig = monitor.getSourceConfig(); FFMPSourceConfigurationManager sourceConfig = monitor
.getSourceConfig();
ProductRunXML productRun = runner.getProduct(siteKey); ProductRunXML productRun = runner.getProduct(siteKey);
ArrayList<String> qpfSources = new ArrayList<String>(); ArrayList<String> qpfSources = new ArrayList<String>();
@ -235,6 +237,10 @@ public class FFMPDataLoader extends Thread {
if (loadType == LOADER_TYPE.TERTIARY) { if (loadType == LOADER_TYPE.TERTIARY) {
hucsToLoad.clear(); hucsToLoad.clear();
hucsToLoad.add(FFMPRecord.ALL); hucsToLoad.add(FFMPRecord.ALL);
} else {
// Only used as place holder name, No data is linked to it, uses
// ALL
hucsToLoad.remove(FFMPRecord.VIRTUAL);
} }
if (isDone()) { if (isDone()) {
@ -253,29 +259,28 @@ public class FFMPDataLoader extends Thread {
} }
// qpes // qpes
fireLoaderEvent(loadType, "Processing " + product.getQpe(), isDone()); fireLoaderEvent(loadType, "Processing " + product.getQpe(),
isDone());
FFMPAggregateRecord qpeCache = null; FFMPAggregateRecord qpeCache = null;
if (loadType == LOADER_TYPE.INITIAL) { if (loadType == LOADER_TYPE.INITIAL) {
SourceXML source = sourceConfig.getSource( SourceXML source = sourceConfig.getSource(product.getQpe());
product.getQpe());
qpeCache = readAggregateRecord(source, dataKey, wfo); qpeCache = readAggregateRecord(source, dataKey, wfo);
if (qpeCache != null) { if (qpeCache != null) {
monitor.insertFFMPData(qpeCache, siteKey, monitor.insertFFMPData(qpeCache, qpeURIs, siteKey, product.getQpe());
product.getQpe());
} }
} }
// Use this method of QPE data retrieval if you don't have cache files // Use this method of QPE data retrieval if you don't have cache
// files
if (!qpeURIs.isEmpty() && qpeCache == null) { if (!qpeURIs.isEmpty() && qpeCache == null) {
for (String phuc : hucsToLoad) { for (String phuc : hucsToLoad) {
if (phuc.equals(layer) if (phuc.equals(layer) || phuc.equals(FFMPRecord.ALL)) {
|| phuc.equals(FFMPRecord.ALL)) { monitor.processUris(qpeURIs, isProductLoad, siteKey,
monitor.processUris(qpeURIs, isProductLoad, product.getQpe(), timeBack, phuc);
siteKey, product.getQpe(), timeBack, phuc);
} }
} }
} }
@ -291,7 +296,6 @@ public class FFMPDataLoader extends Thread {
if (loadType == LOADER_TYPE.INITIAL) { if (loadType == LOADER_TYPE.INITIAL) {
SourceXML source = sourceConfig SourceXML source = sourceConfig
.getSource(qpfSources.get(i)); .getSource(qpfSources.get(i));
@ -300,36 +304,36 @@ public class FFMPDataLoader extends Thread {
if (qpfCache != null) { if (qpfCache != null) {
for (String phuc : hucsToLoad) { for (String phuc : hucsToLoad) {
if ((phuc.equals(layer) || phuc.equals(FFMPRecord.ALL)) if ((phuc.equals(layer) || phuc
.equals(FFMPRecord.ALL))
&& loadType == LOADER_TYPE.INITIAL && loadType == LOADER_TYPE.INITIAL
&& source.getSourceName().equals( && source.getSourceName().equals(
config.getFFMPConfigData() config.getFFMPConfigData()
.getIncludedQPF())) { .getIncludedQPF())) {
if (!qpfURIs.isEmpty()) { if (!qpfURIs.isEmpty()) {
monitor.processUris(qpfURIs, monitor.processUris(qpfURIs, isProductLoad,
isProductLoad, siteKey, siteKey, source.getSourceName(),
source.getSourceName(), timeBack, timeBack, phuc);
phuc);
} }
} }
} }
monitor.insertFFMPData(qpfCache, siteKey, monitor.insertFFMPData(qpfCache, qpfURIs, siteKey,
source.getSourceName()); source.getSourceName());
} }
} }
// if (isUrisProcessNeeded(qpfData,qpfURIs)) // if (isUrisProcessNeeded(qpfData,qpfURIs))
// {/*DR13839*/ // {/*DR13839*/
// Use this method of QPF data retrieval if you don't have cache files // Use this method of QPF data retrieval if you don't have cache
// files
if ((qpfCache == null) && !qpfURIs.isEmpty()) { if ((qpfCache == null) && !qpfURIs.isEmpty()) {
for (String phuc : hucsToLoad) { for (String phuc : hucsToLoad) {
if (phuc.equals(layer) if (phuc.equals(layer) || phuc.equals(FFMPRecord.ALL)) { // old
|| phuc.equals(FFMPRecord.ALL)) { // old // code:
// code: // keep
// keep // for
// for // reference*/
// reference*/
// if (isHucProcessNeeded(phuc)) {/*DR13839*/ // if (isHucProcessNeeded(phuc)) {/*DR13839*/
monitor.processUris(qpfURIs, isProductLoad, monitor.processUris(qpfURIs, isProductLoad,
siteKey, product.getQpf(i), timeBack, phuc); siteKey, product.getQpf(i), timeBack, phuc);
@ -344,24 +348,8 @@ public class FFMPDataLoader extends Thread {
fireLoaderEvent(loadType, "Processing " + product.getVirtual(), fireLoaderEvent(loadType, "Processing " + product.getVirtual(),
isDone()); isDone());
FFMPAggregateRecord vgbCache = null; // process virtual all for all only, never uses cache files
if (!virtualURIs.isEmpty()) {
if (loadType == LOADER_TYPE.INITIAL) {
SourceXML source = sourceConfig.getSource(
product.getVirtual());
vgbCache = readAggregateRecord(source, dataKey, wfo);
if (vgbCache != null) {
monitor.insertFFMPData(vgbCache, siteKey,
product.getVirtual());
}
}
// Use this method of Virtual data retrieval if you don't have cache files
if ((vgbCache == null) && !virtualURIs.isEmpty()) {
monitor.processUris(virtualURIs, isProductLoad, siteKey, monitor.processUris(virtualURIs, isProductLoad, siteKey,
product.getVirtual(), timeBack, FFMPRecord.ALL); product.getVirtual(), timeBack, FFMPRecord.ALL);
} }
@ -379,10 +367,12 @@ public class FFMPDataLoader extends Thread {
.get(guidSource.getSourceName()); .get(guidSource.getSourceName());
fireLoaderEvent(loadType, fireLoaderEvent(loadType,
"Processing " + guidSource.getSourceName(), isDone()); "Processing " + guidSource.getSourceName(),
isDone());
monitor.processUris(iguidURIs, isProductLoad, siteKey, monitor.processUris(iguidURIs, isProductLoad, siteKey,
guidSource.getSourceName(), timeBack, FFMPRecord.ALL); guidSource.getSourceName(), timeBack,
FFMPRecord.ALL);
fireLoaderEvent(loadType, guidSource.getSourceName(), fireLoaderEvent(loadType, guidSource.getSourceName(),
isDone()); isDone());
@ -390,10 +380,11 @@ public class FFMPDataLoader extends Thread {
} }
} }
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,"General Problem in Loading FFMP Data", e); statusHandler.handle(Priority.PROBLEM,
"General Problem in Loading FFMP Data", e);
} finally { } finally {
latch.countDown(); latch.countDown();
synchronized(this) { synchronized (this) {
this.notifyAll(); this.notifyAll();
} }
} }
@ -406,7 +397,8 @@ public class FFMPDataLoader extends Thread {
} }
long endTime = (System.currentTimeMillis()) - time; long endTime = (System.currentTimeMillis()) - time;
System.out.println(loadType.loaderType + " Loader took: " + endTime / 1000 + " seconds"); System.out.println(loadType.loaderType + " Loader took: " + endTime
/ 1000 + " seconds");
fireLoaderEvent(loadType, message, isDone()); fireLoaderEvent(loadType, message, isDone());
} }
@ -503,7 +495,8 @@ public class FFMPDataLoader extends Thread {
try { try {
// we are just checking if it exists or not // we are just checking if it exists or not
String pdataKey = product.getProductKey(); String pdataKey = product.getProductKey();
String sourceSiteDataKey = getSourceSiteDataKey(source, pdataKey); String sourceSiteDataKey = getSourceSiteDataKey(source,
pdataKey);
File hdf5File = FFMPUtils.getHdf5File(wfo, sourceSiteDataKey); File hdf5File = FFMPUtils.getHdf5File(wfo, sourceSiteDataKey);
DataStoreFactory.getDataStore(hdf5File); DataStoreFactory.getDataStore(hdf5File);
@ -516,16 +509,16 @@ public class FFMPDataLoader extends Thread {
return siteKey; return siteKey;
} }
/** /**
* Get the sourceSiteDataKey for this piece of data * Get the sourceSiteDataKey for this piece of data
*
* @param source * @param source
* @param pdataKey * @param pdataKey
* @return * @return
*/ */
private String getSourceSiteDataKey(SourceXML source, String pdataKey) { private String getSourceSiteDataKey(SourceXML source, String pdataKey) {
return source.getSourceName() + "-" + siteKey + "-" return source.getSourceName() + "-" + siteKey + "-" + pdataKey;
+ pdataKey;
} }
public boolean isDone() { public boolean isDone() {

View file

@ -163,6 +163,7 @@ import com.vividsolutions.jts.geom.Point;
* Feb 20, 2013 1635 dhladky Fixed multiple guidance display * Feb 20, 2013 1635 dhladky Fixed multiple guidance display
* Feb 28, 2013 1729 dhladky Changed the way the loaders are managed via the status updates. * Feb 28, 2013 1729 dhladky Changed the way the loaders are managed via the status updates.
* Mar 6, 2013 1769 dhladky Changed threading to use count down latch. * Mar 6, 2013 1769 dhladky Changed threading to use count down latch.
* Apr 9, 2013 1890 dhladky General cleanup.
* Apr 10, 2013 1896 bsteffen Make FFMPResource work better with D2D * Apr 10, 2013 1896 bsteffen Make FFMPResource work better with D2D
* time matcher. * time matcher.
* </pre> * </pre>
@ -1219,7 +1220,7 @@ public class FFMPResource extends
paintProps.setAlpha(getCapability(ImagingCapability.class) paintProps.setAlpha(getCapability(ImagingCapability.class)
.getAlpha()); .getAlpha());
boolean isShaded = isPolygonal(); boolean isShaded = true;
FFMPDrawable drawable = null; FFMPDrawable drawable = null;
if (paintTime != null) { if (paintTime != null) {
@ -1571,14 +1572,6 @@ public class FFMPResource extends
return geometryType; return geometryType;
} }
protected boolean isLineal() {
return getGeometryType().endsWith("LINESTRING");
}
protected boolean isPolygonal() {
return getGeometryType().endsWith("POLYGON");
}
/** /**
* Get color wrapper class * Get color wrapper class
* *

View file

@ -23,12 +23,12 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.viz.grid;bundle-version="1.11.17", com.raytheon.viz.grid;bundle-version="1.11.17",
com.raytheon.viz.core.contours;bundle-version="1.11.17", com.raytheon.viz.core.contours;bundle-version="1.11.17",
com.raytheon.uf.viz.sounding;bundle-version="1.11.17", com.raytheon.uf.viz.sounding;bundle-version="1.11.17",
com.raytheon.uf.common.dataplugin.bufrua;bundle-version="1.11.17" com.raytheon.uf.common.dataplugin.bufrua;bundle-version="1.11.17",
com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174"
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.comm, Import-Package: com.raytheon.uf.common.comm,
com.raytheon.uf.common.dataplugin.level,
com.raytheon.uf.common.dataplugin.radar, com.raytheon.uf.common.dataplugin.radar,
com.raytheon.uf.common.gridcoverage, com.raytheon.uf.common.gridcoverage,
com.raytheon.uf.viz.derivparam.library, com.raytheon.uf.viz.derivparam.library,

View file

@ -32,10 +32,10 @@ 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.dataplugin.level.mapping.LevelMappingFactory;
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.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.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;
@ -196,29 +196,30 @@ 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;
try {
ml = factory.getMasterLevel("TILT");
} catch (CommunicationException e) {
throw new VizCommunicationException(e);
}
Set<Level> allLevels = LevelMappingFactory.getInstance()
.getAllLevels();
List<Level> levels = new ArrayList<Level>();
for (Level l : allLevels) {
if (l.getMasterLevel().equals(ml)) {
levels.add(l);
}
}
List<DataTime> timesWithLevels = new ArrayList<DataTime>(); List<DataTime> timesWithLevels = new ArrayList<DataTime>();
for (int i = 0; i < times.length; ++i) { try {
for (int j = 0; j < levels.size(); ++j) { MasterLevel ml = factory.getMasterLevel("TILT");
DataTime time = times[i].clone(); Set<Level> allLevels = LevelMappingFactory.getInstance(
time.setLevelValue(levels.get(j).getLevelonevalue()); LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
if (time.isSpatial()) { .getAllLevels();
timesWithLevels.add(time); List<Level> levels = new ArrayList<Level>();
for (Level l : allLevels) {
if (l.getMasterLevel().equals(ml)) {
levels.add(l);
} }
} }
for (int i = 0; i < times.length; ++i) {
for (int j = 0; j < levels.size(); ++j) {
DataTime time = times[i].clone();
time.setLevelValue(levels.get(j).getLevelonevalue());
if (time.isSpatial()) {
timesWithLevels.add(time);
}
}
}
} catch (CommunicationException e) {
throw new VizCommunicationException(e);
} }
return timesWithLevels return timesWithLevels
.toArray(new DataTime[timesWithLevels.size()]); .toArray(new DataTime[timesWithLevels.size()]);

View file

@ -67,6 +67,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* 03/13/2008 879 rbell Legacy conversion. * 03/13/2008 879 rbell Legacy conversion.
* 06/10/2009 2159 rjpeter Updated isValid to call gridSlice.isValid * 06/10/2009 2159 rjpeter Updated isValid to call gridSlice.isValid
* 02/19/2013 1637 randerso Added throws declarations to translateDataFrom * 02/19/2013 1637 randerso Added throws declarations to translateDataFrom
* 04/15/2013 1892 randerso Adding logging to help determine what is different in the gridInfos
* Changed how gridInfo is retrieved which seems to have fixed the problem
* </pre> * </pre>
* *
* @author chammack * @author chammack
@ -1026,16 +1028,20 @@ public abstract class AbstractGridData implements IGridData {
return false; return false;
} }
if (!((AbstractGridData) source).gridSlice.getGridInfo().equals( if (!source.getParm().getGridInfo()
this.gridSlice.getGridInfo())) { .equals(this.getParm().getGridInfo())) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Differing gridInfos for source/dest for replace()"); "Differing gridInfos for source/dest for replace()."
+ "\nSource: " + source.getParm().getGridInfo()
+ "\nDest: " + this.getParm().getGridInfo());
return false; return false;
} }
if (!source.getGridTime().equals(getGridTime())) { if (!source.getGridTime().equals(getGridTime())) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Differing gridTimes for source/dest for replace()"); "Differing gridTimes for source/dest for replace()"
+ "\nSource: " + source.getGridTime() + "\nDest: "
+ this.getGridTime());
return false; return false;
} }

View file

@ -25,7 +25,8 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.viz.points;bundle-version="1.0.0", com.raytheon.uf.viz.points;bundle-version="1.0.0",
com.raytheon.uf.common.gridcoverage, com.raytheon.uf.common.gridcoverage,
org.apache.commons.beanutils;bundle-version="1.8.3", org.apache.commons.beanutils;bundle-version="1.8.3",
com.raytheon.uf.common.dataplugin.grid;bundle-version="1.0.0" com.raytheon.uf.common.dataplugin.grid;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174"
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.viz.grid, Export-Package: com.raytheon.viz.grid,
com.raytheon.viz.grid.inv, com.raytheon.viz.grid.inv,
@ -36,7 +37,6 @@ Export-Package: com.raytheon.viz.grid,
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.comm,
com.raytheon.uf.common.dataplugin.level,
com.raytheon.uf.common.derivparam.tree, com.raytheon.uf.common.derivparam.tree,
com.raytheon.uf.common.localization, com.raytheon.uf.common.localization,
com.raytheon.uf.common.message, com.raytheon.uf.common.message,

View file

@ -42,15 +42,14 @@ import com.raytheon.uf.common.dataplugin.grid.dataset.DatasetInfoLookup;
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.dataplugin.level.mapping.LevelMappingFactory;
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.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.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.rsc.DisplayType; import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.ResourceProperties; import com.raytheon.uf.viz.core.rsc.ResourceProperties;
import com.raytheon.uf.viz.core.rsc.ResourceType; import com.raytheon.uf.viz.core.rsc.ResourceType;
@ -195,8 +194,11 @@ public class GridProductBrowserDataDefinition extends
params = Arrays.asList(value); params = Arrays.asList(value);
} else if (key.equals(GridInventory.MASTER_LEVEL_QUERY)) { } else if (key.equals(GridInventory.MASTER_LEVEL_QUERY)) {
if (levels == null) { if (levels == null) {
levels = new ArrayList<Level>(LevelMappingFactory levels = new ArrayList<Level>(
.getInstance().getAllLevels()); LevelMappingFactory
.getInstance(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getAllLevels());
} }
Iterator<Level> iter = levels.iterator(); Iterator<Level> iter = levels.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
@ -209,8 +211,11 @@ public class GridProductBrowserDataDefinition extends
} else if (key.equals(GridInventory.LEVEL_ONE_QUERY)) { } else if (key.equals(GridInventory.LEVEL_ONE_QUERY)) {
double doubleValue = Double.parseDouble(value); double doubleValue = Double.parseDouble(value);
if (levels == null) { if (levels == null) {
levels = new ArrayList<Level>(LevelMappingFactory levels = new ArrayList<Level>(
.getInstance().getAllLevels()); LevelMappingFactory
.getInstance(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getAllLevels());
} }
Iterator<Level> iter = levels.iterator(); Iterator<Level> iter = levels.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
@ -221,8 +226,11 @@ public class GridProductBrowserDataDefinition extends
} else if (key.equals(GridInventory.LEVEL_TWO_QUERY)) { } else if (key.equals(GridInventory.LEVEL_TWO_QUERY)) {
double doubleValue = Double.parseDouble(value); double doubleValue = Double.parseDouble(value);
if (levels == null) { if (levels == null) {
levels = new ArrayList<Level>(LevelMappingFactory levels = new ArrayList<Level>(
.getInstance().getAllLevels()); LevelMappingFactory
.getInstance(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getAllLevels());
} }
Iterator<Level> iter = levels.iterator(); Iterator<Level> iter = levels.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
@ -280,9 +288,6 @@ public class GridProductBrowserDataDefinition extends
return returnQueue.toArray(new String[0]); return returnQueue.toArray(new String[0]);
} }
} }
} catch (VizCommunicationException e) {
statusHandler.handle(Priority.ERROR, "Unable to query data for "
+ productName, e);
} catch (CommunicationException e) { } catch (CommunicationException e) {
statusHandler.handle(Priority.ERROR, "Unable to query data for " statusHandler.handle(Priority.ERROR, "Unable to query data for "
+ productName, e); + productName, e);

View file

@ -19,11 +19,11 @@
**/ **/
package com.raytheon.viz.grid.rsc; package com.raytheon.viz.grid.rsc;
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.mapping.LevelMapping;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory;
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.LevelMappingFactory;
import com.raytheon.uf.viz.core.rsc.AbstractNameGenerator; import com.raytheon.uf.viz.core.rsc.AbstractNameGenerator;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
@ -144,13 +144,14 @@ public class GridNameGenerator extends AbstractNameGenerator {
private String lookupPlane(Level level) { private String lookupPlane(Level level) {
try { try {
LevelMapping mapping = LevelMappingFactory.getInstance() LevelMapping mapping = LevelMappingFactory.getInstance(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.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) { } catch (CommunicationException e) {
return level.getMasterLevel().getName(); return level.getMasterLevel().getName();
} }

View file

@ -1,4 +1,5 @@
com.raytheon.viz.mpe.ui.rsc.MPERadarRingOverlayResourceData com.raytheon.viz.mpe.ui.rsc.MPERadarRingOverlayResourceData
com.raytheon.viz.mpe.ui.displays.MPEMapRenderableDisplay com.raytheon.viz.mpe.ui.displays.MPEMapRenderableDisplay
com.raytheon.viz.mpe.ui.displays.MPETimeMatcher com.raytheon.viz.mpe.ui.displays.MPETimeMatcher
com.raytheon.viz.mpe.ui.rsc.RadarGageOverlayRscData com.raytheon.viz.mpe.ui.rsc.RadarGageOverlayRscData
com.raytheon.viz.mpe.ui.rsc.MPEFieldResourceData

View file

@ -99,6 +99,7 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 18, 2012 mschenke Initial creation * Dec 18, 2012 mschenke Initial creation
* Mar 14, 2013 1457 mpduff Reset the gages on the resource. * Mar 14, 2013 1457 mpduff Reset the gages on the resource.
* Apr 18, 2013 1920 mpduff Added updateGages method to reload the gage data.
* *
* </pre> * </pre>
* *
@ -401,6 +402,10 @@ public class MPEDisplayManager {
private DisplayFieldData displayedField; private DisplayFieldData displayedField;
private int displayedAccumHrs;
private ArealDisplay displayedArealDisplay;
private final MPEFieldResourceData fieldResourceData = new MPEFieldResourceData(); private final MPEFieldResourceData fieldResourceData = new MPEFieldResourceData();
private MPEFieldResource displayedFieldResource; private MPEFieldResource displayedFieldResource;
@ -698,9 +703,14 @@ public class MPEDisplayManager {
*/ */
public void displayFieldData(DisplayFieldData fieldToDisplay, public void displayFieldData(DisplayFieldData fieldToDisplay,
int accumulationHrs, ArealDisplay arealDisplay) { int accumulationHrs, ArealDisplay arealDisplay) {
if (displayedField != fieldToDisplay || displayedFieldResource == null) { if (displayedField != fieldToDisplay || displayedFieldResource == null
|| accumulationHrs != displayedAccumHrs
|| arealDisplay != displayedArealDisplay) {
DisplayFieldData oldField = displayedField; DisplayFieldData oldField = displayedField;
displayedField = fieldToDisplay; displayedField = fieldToDisplay;
displayedAccumHrs = accumulationHrs;
displayedArealDisplay = arealDisplay;
ResourceList list = display.getDescriptor().getResourceList(); ResourceList list = display.getDescriptor().getResourceList();
if (displayedFieldResource != null) { if (displayedFieldResource != null) {
@ -725,14 +735,6 @@ public class MPEDisplayManager {
listener.displayFieldChanged(oldField, fieldToDisplay); listener.displayFieldChanged(oldField, fieldToDisplay);
} }
} }
// reset gages
List<MPEGageResource> rscs = display.getDescriptor()
.getResourceList()
.getResourcesByTypeAsType(MPEGageResource.class);
for (MPEGageResource rsc : rscs) {
rsc.reloadGages();
}
} }
displayedFieldResource.issueRefresh(); displayedFieldResource.issueRefresh();
@ -1118,4 +1120,15 @@ public class MPEDisplayManager {
+ " - OK to Proceed?"); + " - OK to Proceed?");
} }
/**
* Update the Gage resource.
*/
public void updateGages() {
// reset gages
List<MPEGageResource> rscs = display.getDescriptor().getResourceList()
.getResourcesByTypeAsType(MPEGageResource.class);
for (MPEGageResource rsc : rscs) {
rsc.reloadGages();
}
}
} }

View file

@ -26,10 +26,13 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI; import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability;
import com.raytheon.viz.hydrocommon.colorscalemgr.ColorScaleMgrDlg; import com.raytheon.viz.hydrocommon.colorscalemgr.ColorScaleMgrDlg;
import com.raytheon.viz.mpe.ui.DisplayFieldData; import com.raytheon.viz.mpe.ui.DisplayFieldData;
import com.raytheon.viz.mpe.ui.MPEDisplayManager; import com.raytheon.viz.mpe.ui.MPEDisplayManager;
import com.raytheon.viz.mpe.ui.colors.MPEColorManager; import com.raytheon.viz.mpe.ui.colors.MPEColorManager;
import com.raytheon.viz.mpe.ui.rsc.MPEFieldResource;
import com.raytheon.viz.mpe.ui.rsc.MPEFieldResourceData;
/** /**
* TODO Add Description * TODO Add Description
@ -39,6 +42,7 @@ import com.raytheon.viz.mpe.ui.colors.MPEColorManager;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 5, 2008 mschenke Initial creation * Dec 5, 2008 mschenke Initial creation
* Apr 18, 2013 1920 mpduff Set new ColorMap.
* </pre> * </pre>
* *
* @author mschenke * @author mschenke
@ -69,9 +73,24 @@ public class MPEColorScaleMgrAction extends AbstractHandler {
colorScaleDlg.open(); colorScaleDlg.open();
} }
DisplayFieldData dt = MPEDisplayManager.getCurrent() MPEFieldResource displayedFieldResource = MPEDisplayManager
.getDisplayFieldType(); .getCurrent().getDisplayedFieldResource();
MPEDisplayManager.getCurrent().displayFieldData(dt);
if (displayedFieldResource != null) {
MPEFieldResourceData resourceData = displayedFieldResource
.getResourceData();
displayedFieldResource.getCapability(ColorMapCapability.class)
.setColorMapParameters(
MPEDisplayManager.createColorMap(
resourceData.getCvUseString(),
resourceData.getDurationInHours(),
resourceData.getDataUnits(),
resourceData.getDisplayUnits()));
DisplayFieldData dt = MPEDisplayManager.getCurrent()
.getDisplayFieldType();
MPEDisplayManager.getCurrent().displayFieldData(dt);
}
return null; return null;
} }

View file

@ -41,7 +41,7 @@ import com.raytheon.viz.mpe.ui.rsc.MPEFieldResource;
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
/** /**
* TODO Add Description * The Run FieldGen dialog.
* *
* <pre> * <pre>
* SOFTWARE HISTORY * SOFTWARE HISTORY
@ -49,6 +49,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Oct 27, 2008 snaples Initial creation * Oct 27, 2008 snaples Initial creation
* Nov 10, 2008 1649 snaples Added handlers for Yes button * Nov 10, 2008 1649 snaples Added handlers for Yes button
* Apr 18, 2013 1920 mpduff Call back to MPEDisplayManager to reload the gages.
* </pre> * </pre>
* *
* @author snaples * @author snaples
@ -109,6 +110,8 @@ public class DisplayFieldGenDialog extends CaveJFACEDialog {
if (rsc != null) { if (rsc != null) {
rsc.getResourceData().update(dt); rsc.getResourceData().update(dt);
} }
instance.updateGages();
} catch (VizException ex) { } catch (VizException ex) {
Activator.statusHandler.handle(Priority.PROBLEM, Activator.statusHandler.handle(Priority.PROBLEM,
"Error regenerating hourly fields", ex); "Error regenerating hourly fields", ex);

View file

@ -192,8 +192,7 @@ public class MPEGageResource extends AbstractMPEInputResource implements
displayMgr.registerDisplayFieldChangedListener(this); displayMgr.registerDisplayFieldChangedListener(this);
fontFactory = new MPEFontFactory(target, this); fontFactory = new MPEFontFactory(target, this);
loadColors(); loadColors();
lastDate = displayMgr.getCurrentEditDate(); reloadGages();
addPoints(MPEDataManager.getInstance().readGageData(lastDate, lastDate));
} }
@Override @Override
@ -651,7 +650,7 @@ public class MPEGageResource extends AbstractMPEInputResource implements
public void displayFieldChanged(DisplayFieldData oldFieldData, public void displayFieldChanged(DisplayFieldData oldFieldData,
DisplayFieldData newFieldData) { DisplayFieldData newFieldData) {
loadColors(); loadColors();
reloadGages();
issueRefresh(); issueRefresh();
} }
} }

View file

@ -18,7 +18,8 @@ Require-Bundle: org.apache.batik,
com.raytheon.uf.viz.localization;bundle-version="1.12.1174", com.raytheon.uf.viz.localization;bundle-version="1.12.1174",
org.jep;bundle-version="1.0.0", org.jep;bundle-version="1.0.0",
com.raytheon.uf.common.python;bundle-version="1.12.1161", com.raytheon.uf.common.python;bundle-version="1.12.1161",
com.raytheon.uf.common.pointdata;bundle-version="1.12.1174" com.raytheon.uf.common.pointdata;bundle-version="1.12.1174",
com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174"
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.viz.pointdata, Export-Package: com.raytheon.viz.pointdata,
com.raytheon.viz.pointdata.drawables, com.raytheon.viz.pointdata.drawables,
@ -28,7 +29,6 @@ Export-Package: com.raytheon.viz.pointdata,
Import-Package: com.raytheon.edex.meteoLib, Import-Package: com.raytheon.edex.meteoLib,
com.raytheon.uf.common.comm, com.raytheon.uf.common.comm,
com.raytheon.uf.common.dataplugin.grid, com.raytheon.uf.common.dataplugin.grid,
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,
com.raytheon.uf.common.pointdata, com.raytheon.uf.common.pointdata,

View file

@ -18,6 +18,7 @@ import java.util.concurrent.LinkedBlockingQueue;
import com.raytheon.uf.common.comm.CommunicationException; 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.level.mapping.LevelMappingFactory;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext; import com.raytheon.uf.common.localization.LocalizationContext;
@ -29,9 +30,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.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.map.MapDescriptor; import com.raytheon.uf.viz.core.map.MapDescriptor;
import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.ResourceType; import com.raytheon.uf.viz.core.rsc.ResourceType;
@ -281,14 +280,15 @@ public class PlotModelDataDefinition extends
try { try {
Level level = LevelFactory.getInstance().getLevel( Level level = LevelFactory.getInstance().getLevel(
Long.parseLong(levelid)); Long.parseLong(levelid));
validLevels.add(LevelMappingFactory.getInstance() validLevels
.getLevelMappingForLevel(level).getDisplayName()); .add(LevelMappingFactory
.getInstance(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getLevelMappingForLevel(level)
.getDisplayName());
} catch (CommunicationException e) { } catch (CommunicationException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e); e);
} catch (VizCommunicationException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
} }
} }
return validLevels.toArray(new String[0]); return validLevels.toArray(new String[0]);

View file

@ -28,7 +28,9 @@ 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.Level; import com.raytheon.uf.common.dataplugin.level.Level;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.derivparam.tree.DataTree; import com.raytheon.uf.common.derivparam.tree.DataTree;
import com.raytheon.uf.common.derivparam.tree.LevelNode; import com.raytheon.uf.common.derivparam.tree.LevelNode;
@ -40,9 +42,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.derivparam.data.AbstractRequestableData; import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
import com.raytheon.uf.viz.derivparam.inv.AbstractInventory; import com.raytheon.uf.viz.derivparam.inv.AbstractInventory;
import com.raytheon.uf.viz.derivparam.library.DerivParamDesc; import com.raytheon.uf.viz.derivparam.library.DerivParamDesc;
@ -278,9 +278,11 @@ public abstract class AbstractPointDataInventory extends AbstractInventory {
public static Level getStationLevel() { public static Level getStationLevel() {
try { try {
return LevelMappingFactory.getInstance() return LevelMappingFactory
.getInstance(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getLevelMappingForKey("Station").getLevels().get(0); .getLevelMappingForKey("Station").getLevels().get(0);
} catch (VizCommunicationException e) { } catch (CommunicationException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
return null; return null;
} }

View file

@ -25,8 +25,10 @@ import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
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.mapping.LevelMappingFactory;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest; import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequestSet; import com.raytheon.uf.common.dataquery.requests.TimeQueryRequestSet;
@ -45,8 +47,8 @@ import com.raytheon.uf.viz.core.comm.Loader;
import com.raytheon.uf.viz.core.datastructure.CubeUtil; import com.raytheon.uf.viz.core.datastructure.CubeUtil;
import com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter; import com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter;
import com.raytheon.uf.viz.core.datastructure.VizDataCubeException; import com.raytheon.uf.viz.core.datastructure.VizDataCubeException;
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.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.inv.AvailabilityContainer; import com.raytheon.uf.viz.derivparam.inv.AvailabilityContainer;
@ -143,8 +145,15 @@ public class PointDataCubeAdapter implements IDataCubeAdapter {
source += type; source += type;
} }
List<Level> levels = LevelMappingFactory.getInstance() List<Level> levels;
.getLevelMappingForKey(levelKey).getLevels(); try {
levels = LevelMappingFactory
.getInstance(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getLevelMappingForKey(levelKey).getLevels();
} catch (CommunicationException e) {
throw new VizCommunicationException(e);
}
List<AbstractRequestableNode> nodes = inventory.getNodes(source, List<AbstractRequestableNode> nodes = inventory.getNodes(source,
Arrays.asList(parameters), levels); Arrays.asList(parameters), levels);
PointMetadataContainer pmc = new PointMetadataContainer(queryParams, PointMetadataContainer pmc = new PointMetadataContainer(queryParams,

View file

@ -31,7 +31,9 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.viz.d2d.nsharp;bundle-version="1.0.0", com.raytheon.uf.viz.d2d.nsharp;bundle-version="1.0.0",
gov.noaa.nws.ncep.ui.nsharp;bundle-version="1.0.0", gov.noaa.nws.ncep.ui.nsharp;bundle-version="1.0.0",
com.raytheon.uf.common.message;bundle-version="1.12.1174", com.raytheon.uf.common.message;bundle-version="1.12.1174",
com.raytheon.viz.core.graphing;bundle-version="1.12.1174" com.raytheon.viz.core.graphing;bundle-version="1.12.1174",
com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174",
com.raytheon.uf.common.comm;bundle-version="1.12.1174"
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.viz.volumebrowser, Export-Package: com.raytheon.viz.volumebrowser,
com.raytheon.viz.volumebrowser.catalog, com.raytheon.viz.volumebrowser.catalog,
@ -41,7 +43,6 @@ Export-Package: com.raytheon.viz.volumebrowser,
Import-Package: com.raytheon.uf.common.comm, Import-Package: com.raytheon.uf.common.comm,
com.raytheon.uf.common.dataplugin.grid, com.raytheon.uf.common.dataplugin.grid,
com.raytheon.uf.common.dataplugin.grid.dataset, com.raytheon.uf.common.dataplugin.grid.dataset,
com.raytheon.uf.common.dataplugin.level,
com.raytheon.uf.common.gridcoverage, com.raytheon.uf.common.gridcoverage,
com.raytheon.uf.common.menus.xml, com.raytheon.uf.common.menus.xml,
com.raytheon.uf.viz.core.maps.display, com.raytheon.uf.viz.core.maps.display,

View file

@ -29,15 +29,16 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.regex.Pattern; import java.util.regex.Pattern;
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.mapping.LevelMapping;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory;
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.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.VizCommunicationException;
import com.raytheon.uf.viz.core.level.LevelMapping;
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
import com.raytheon.uf.viz.core.level.LevelUtilities; import com.raytheon.uf.viz.core.level.LevelUtilities;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.DisplayType; import com.raytheon.uf.viz.core.rsc.DisplayType;
@ -373,12 +374,13 @@ public abstract class AbstractDataCatalog implements IDataCatalog {
} }
} else { } else {
try { try {
LevelMappingFactory lmf = LevelMappingFactory.getInstance(); LevelMappingFactory lmf = LevelMappingFactory
.getInstance(LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE);
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) { } catch (CommunicationException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e); e);
} }

View file

@ -38,13 +38,13 @@ import org.eclipse.core.runtime.jobs.Job;
import com.raytheon.uf.common.comm.CommunicationException; 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.level.mapping.LevelMapping;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory;
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.exception.VizCommunicationException;
import com.raytheon.uf.viz.core.level.LevelMapping;
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
import com.raytheon.uf.viz.core.level.LevelUtilities; import com.raytheon.uf.viz.core.level.LevelUtilities;
import com.raytheon.uf.viz.derivparam.inv.AbstractInventory; import com.raytheon.uf.viz.derivparam.inv.AbstractInventory;
import com.raytheon.viz.volumebrowser.vbui.DataListsProdTableComp.DataSelection; import com.raytheon.viz.volumebrowser.vbui.DataListsProdTableComp.DataSelection;
@ -184,16 +184,13 @@ public abstract class AbstractInventoryDataCatalog extends AbstractDataCatalog {
} }
request.addAvailablePlane("spatial-" request.addAvailablePlane("spatial-"
+ level.getMasterLevel().getName()); + level.getMasterLevel().getName());
try { LevelMapping lm = LevelMappingFactory
LevelMapping lm = LevelMappingFactory.getInstance() .getInstance(
.getLevelMappingForLevel(level); LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.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) { } catch (CommunicationException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
@ -255,6 +252,7 @@ public abstract class AbstractInventoryDataCatalog extends AbstractDataCatalog {
return result; return result;
} }
@Override
public List<String> getSupportedSources() { public List<String> getSupportedSources() {
return getSupportedSourcesInternal(); return getSupportedSourcesInternal();
} }
@ -280,7 +278,8 @@ public abstract class AbstractInventoryDataCatalog extends AbstractDataCatalog {
if (selectedPlanes == null || selectedPlanes.length == 0) { if (selectedPlanes == null || selectedPlanes.length == 0) {
return null; return null;
} }
LevelMappingFactory lmf = LevelMappingFactory.getInstance(); LevelMappingFactory lmf = LevelMappingFactory
.getInstance(LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE);
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-")) {
@ -297,7 +296,7 @@ public abstract class AbstractInventoryDataCatalog extends AbstractDataCatalog {
if (lm != null) { if (lm != null) {
try { try {
levels = lm.getLevels(); levels = lm.getLevels();
} catch (VizCommunicationException e) { } catch (CommunicationException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e); e.getLocalizedMessage(), e);
} }

View file

@ -35,8 +35,10 @@ import org.geotools.geometry.Envelope2D;
import org.geotools.geometry.jts.ReferencedEnvelope; import org.geotools.geometry.jts.ReferencedEnvelope;
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.grid.GridConstants; import com.raytheon.uf.common.dataplugin.grid.GridConstants;
import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.level.Level;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
import com.raytheon.uf.common.geospatial.MapUtil; import com.raytheon.uf.common.geospatial.MapUtil;
@ -47,7 +49,6 @@ 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.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.LevelUtilities; import com.raytheon.uf.viz.core.level.LevelUtilities;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.DisplayType; import com.raytheon.uf.viz.core.rsc.DisplayType;
@ -182,11 +183,12 @@ public class GridDataCatalog extends AbstractInventoryDataCatalog {
// Get all possible levels for the selected levels // Get all possible levels for the selected levels
List<Level> selectedLevels = Collections.emptyList(); List<Level> selectedLevels = Collections.emptyList();
try { try {
LevelMappingFactory lmf = LevelMappingFactory.getInstance(); LevelMappingFactory lmf = LevelMappingFactory
.getInstance(LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE);
selectedLevels = new ArrayList<Level>(lmf selectedLevels = new ArrayList<Level>(lmf
.getLevelMappingForKey( .getLevelMappingForKey(
catalogEntry.selectedPlanesKey).getLevels()); catalogEntry.selectedPlanesKey).getLevels());
} catch (VizCommunicationException e) { } catch (CommunicationException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e); e.getLocalizedMessage(), e);
} }
@ -422,8 +424,8 @@ public class GridDataCatalog extends AbstractInventoryDataCatalog {
.getCoordinateReferenceSystem()); .getCoordinateReferenceSystem());
Envelope2D env = gridGeom.getEnvelope2D(); Envelope2D env = gridGeom.getEnvelope2D();
for (String letter : pointLetters) { for (String letter : pointLetters) {
Coordinate c = PointsDataManager.getInstance() Coordinate c = PointsDataManager.getInstance()
.getCoordinate(letter); .getCoordinate(letter);
DirectPosition2D dp = new DirectPosition2D(c.x, c.y); DirectPosition2D dp = new DirectPosition2D(c.x, c.y);
llToCRS.transform(dp, dp); llToCRS.transform(dp, dp);
if (env.contains(dp.x, dp.y)) { if (env.contains(dp.x, dp.y)) {
@ -508,8 +510,8 @@ public class GridDataCatalog extends AbstractInventoryDataCatalog {
.getTransformFromLatLon(gridGeom .getTransformFromLatLon(gridGeom
.getCoordinateReferenceSystem()); .getCoordinateReferenceSystem());
Envelope2D env = gridGeom.getEnvelope2D(); Envelope2D env = gridGeom.getEnvelope2D();
for (String letter : pdm.getPointNames()) { for (String letter : pdm.getPointNames()) {
Coordinate c = pdm.getCoordinate(letter); Coordinate c = pdm.getCoordinate(letter);
DirectPosition2D dp = new DirectPosition2D(c.x, c.y); DirectPosition2D dp = new DirectPosition2D(c.x, c.y);
llToCRS.transform(dp, dp); llToCRS.transform(dp, dp);
if (env.contains(dp.x, dp.y)) { if (env.contains(dp.x, dp.y)) {

View file

@ -32,7 +32,9 @@ import java.util.Set;
import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ArrayBlockingQueue;
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.dataplugin.level.mapping.LevelMappingFactory;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation; import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation;
@ -41,9 +43,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.rsc.AbstractRequestableResourceData; import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.ResourceType; import com.raytheon.uf.viz.core.rsc.ResourceType;
import com.raytheon.uf.viz.d2d.nsharp.rsc.BufruaNSharpResourceData; import com.raytheon.uf.viz.d2d.nsharp.rsc.BufruaNSharpResourceData;
@ -390,9 +390,11 @@ public class PointDataCatalog extends AbstractInventoryDataCatalog {
@Override @Override
protected Collection<? extends Level> get3DLevels() { protected Collection<? extends Level> get3DLevels() {
try { try {
return LevelMappingFactory.getInstance() return LevelMappingFactory
.getInstance(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getLevelMappingForKey("Station").getLevels(); .getLevelMappingForKey("Station").getLevels();
} catch (VizCommunicationException e) { } catch (CommunicationException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
return Collections.emptyList(); return Collections.emptyList();
} }

View file

@ -28,8 +28,8 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swt.widgets.MenuItem;
import com.raytheon.uf.viz.core.level.LevelMapping; import com.raytheon.uf.common.dataplugin.level.mapping.LevelMapping;
import com.raytheon.uf.viz.core.level.LevelMappingFactory; import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory;
import com.raytheon.viz.volumebrowser.vbui.MenuItemManager; import com.raytheon.viz.volumebrowser.vbui.MenuItemManager;
import com.raytheon.viz.volumebrowser.xml.MenuContribution; import com.raytheon.viz.volumebrowser.xml.MenuContribution;
@ -93,7 +93,8 @@ public class MenuContributionItem extends ContributionItem {
item.setData(this); item.setData(this);
if (menuContribution.xml.textLookup.equals("LevelMapping")) { if (menuContribution.xml.textLookup.equals("LevelMapping")) {
LevelMapping mapping = LevelMappingFactory.getInstance() LevelMapping mapping = LevelMappingFactory.getInstance(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getLevelMappingForKey(menuContribution.xml.key); .getLevelMappingForKey(menuContribution.xml.key);
if (mapping != null) { if (mapping != null) {
menuContribution.xml.menuText = mapping.getDisplayName(); menuContribution.xml.menuText = mapping.getDisplayName();

View file

@ -21,7 +21,10 @@ package com.raytheon.viz.warngen.gis;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import org.geotools.coverage.grid.GeneralGridEnvelope; import org.geotools.coverage.grid.GeneralGridEnvelope;
import org.geotools.coverage.grid.GridGeometry2D; import org.geotools.coverage.grid.GridGeometry2D;
@ -57,6 +60,8 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 1, 2010 mschenke Initial creation * Dec 1, 2010 mschenke Initial creation
* 12/06/2012 DR 15559 Qinglu Lin Added round() methods. * 12/06/2012 DR 15559 Qinglu Lin Added round() methods.
* 04/16/2013 DR 16045 Qinglu Lin Relocated removeDuplicateCoordinate(), computeSlope(),
* computeCoordinate(), and adjustPolygon from WarngenUIState.
* *
* </pre> * </pre>
* *
@ -982,4 +987,178 @@ public class PolygonUtil {
coordinate.x = x / Math.pow(10, decimalPlaces); coordinate.x = x / Math.pow(10, decimalPlaces);
coordinate.y = y / Math.pow(10, decimalPlaces); coordinate.y = y / Math.pow(10, decimalPlaces);
} }
/**
* removeDuplicateCoordinate remove duplicate intermediate coordinates in
* warningPolygon. History 10-26-2012 Qinglu Lin DR15479 Created.
*/
public static Polygon removeDuplicateCoordinate(Polygon polygon) {
if (polygon == null) {
return null;
}
Coordinate[] verts = polygon.getCoordinates();
Set<Coordinate> coords = new LinkedHashSet<Coordinate>();
for (Coordinate c : verts)
coords.add(c);
if ((verts.length - coords.size()) < 2)
return polygon;
Coordinate[] vertices = new Coordinate[coords.size() + 1];
Iterator<Coordinate> iter = coords.iterator();
int i = 0;
while (iter.hasNext()) {
vertices[i] = new Coordinate(iter.next());
i += 1;
}
vertices[i] = new Coordinate(vertices[0]);
GeometryFactory gf = new GeometryFactory();
return gf.createPolygon(gf.createLinearRing(vertices), null);
}
/**
* computeSlope compute the slope of a line.
*
* History 12/06/2012 DR 15559 Qinglu Lin Created.
*/
private static double computeSlope(Coordinate[] coords, int i) {
double min = 1.0E-08;
double dx = coords[i].x - coords[i + 1].x;
double slope = 0.0;
if (Math.abs(dx) > min) {
slope = (coords[i].y - coords[i + 1].y) / dx;
}
return slope;
}
/**
* computeCoordinate Compute the x component of a coordinate after its y
* component is adjusted.
*
* History 12/06/2012 DR 15559 Qinglu Lin Created.
*/
private static void computeCoordinate(Coordinate[] c, int i, int j) {
double slope;
slope = computeSlope(c, i);
int iPlus1 = i + 1;
if (c[j].x >= c[i].x && c[j].x <= c[iPlus1].x || c[j].x >= c[iPlus1].x
&& c[j].x <= c[i].x) {
double x, y;
double min1 = 0.005d;
y = slope * (c[j].x - c[i].x) + c[i].y;
double d = Math.abs(y - c[j].y);
if (d > min1)
return;
double min2 = 1.0E-8d;
double delta = 0.005d; // empirical value
double dyMin = 0.01d;
int jMinus1 = j - 1;
if (jMinus1 < 0)
jMinus1 = c.length - 2;
int jPlus1 = j + 1;
if (Math.abs(y - c[j].y) < min1) {
double dy1, dy2;
dy1 = Math.abs(c[jMinus1].y - y);
dy2 = Math.abs(c[jPlus1].y - y);
if (dy1 >= dy2
&& (Math.abs(dy1) > dyMin || Math.abs(dy2) > dyMin)) {
// attempt to use l2 for computation
if (c[j].y == c[jMinus1].y
&& Math.abs(c[j].x - c[jMinus1].x) > min2) {
// l2 is a horizontal line, use l3 for computation
if (c[jPlus1].y < c[j].y)
delta = -delta;
slope = computeSlope(c, j);
if (Math.abs(slope) > min2) {
y = c[j].y + delta;
x = (y - c[jPlus1].y) / slope + c[jPlus1].x;
} else {
// l3 is a vertical line
y = c[j].y + delta;
x = c[j].x;
}
} else {
// use l2 for computation
if (c[jMinus1].y < c[j].y)
delta = -delta;
slope = computeSlope(c, jMinus1);
if (Math.abs(slope) > min2) {
y = c[j].y + delta;
x = (y - c[jMinus1].y) / slope + c[jMinus1].x;
} else {
// l2 is a vertical line
y = c[j].y + delta;
x = c[j].x;
}
}
} else {
if (Math.abs(dy1) > dyMin || Math.abs(dy2) > dyMin) {
// attempt to use l3 for computation
if (c[j].y == c[jPlus1].y
&& Math.abs(c[j].x - c[jPlus1].x) > min2) {
// l3 is a horizontal line, use l2 for computation
if (c[jMinus1].y < c[j].y)
delta = -delta;
slope = computeSlope(c, jMinus1);
if (Math.abs(slope) > min2) {
y = c[j].y + delta;
x = (y - c[jMinus1].y) / slope + c[jMinus1].x;
} else {
// l2 is a vertical line
y = c[j].y + delta;
x = c[j].x;
}
} else {
// use l3 for computation
if (c[jPlus1].y < c[j].y)
delta = -delta;
slope = computeSlope(c, j);
if (Math.abs(slope) > min2) {
y = c[j].y + delta;
x = (y - c[jPlus1].y) / slope + c[jPlus1].x;
} else {
// l3 is a vertical line
y = c[j].y + delta;
x = c[j].x;
}
}
} else {
x = c[j].x;
y = c[j].y;
}
}
c[j].x = x;
c[j].y = y;
if (j == 0)
c[c.length - 1] = c[j];
}
}
}
/**
* adjustPolygon When a point is very close to a line in the initial warning
* polygon, the resulting coordinates cause the failure of polygon drawing
* in follow-up. The method move that kind of points away from the line, and
* return a Polygon.
*
* History 12/06/2012 DR 15559 Qinglu Lin Created.
*/
public static void adjustPolygon(Coordinate[] coords) {
int n = coords.length;
for (int i = 0; i < n - 1; ++i) {
int j;
for (j = i + 2; j <= n - 2; j++) {
computeCoordinate(coords, i, j);
}
if (i <= n - 3)
for (j = 0; j < i; j++) {
computeCoordinate(coords, i, j);
}
else
for (j = 1; j < i; j++) {
computeCoordinate(coords, i, j);
}
}
}
} }

View file

@ -135,7 +135,7 @@ import com.vividsolutions.jts.geom.Polygon;
* and removed it from updateListSelected(). * and removed it from updateListSelected().
* Feb 18, 2013 #1633 rferrel Changed checkFollowupSelection to use SimulatedTime. * Feb 18, 2013 #1633 rferrel Changed checkFollowupSelection to use SimulatedTime.
* Mar 28, 2013 DR 15974 D. Friedman Do not track removed GIDs. * Mar 28, 2013 DR 15974 D. Friedman Do not track removed GIDs.
* * Apr 11, 2013 1894 jsanchez Removed the ability to load/unload maps via bullet selection. This will be resolved in a follow on ticket.
* </pre> * </pre>
* *
* @author chammack * @author chammack
@ -1426,7 +1426,6 @@ public class WarngenDialog extends CaveSWTDialog implements
.getBullets(), warngenLayer.getConfiguration() .getBullets(), warngenLayer.getConfiguration()
.getDamInfoBullets()); .getDamInfoBullets());
refreshBulletList(); refreshBulletList();
updateMaps(bulletListManager.getMapsToLoad());
// duration // duration
boolean enableDuration = warngenLayer.getConfiguration() boolean enableDuration = warngenLayer.getConfiguration()
@ -1626,7 +1625,10 @@ public class WarngenDialog extends CaveSWTDialog implements
bulletListManager.recreateBullets(warngenLayer bulletListManager.recreateBullets(warngenLayer
.getConfiguration().getBullets(), warngenLayer .getConfiguration().getBullets(), warngenLayer
.getConfiguration().getDamInfoBullets()); .getConfiguration().getDamInfoBullets());
updateMaps(bulletListManager.getMapsToLoad()); // TODO Repair load/unload maps via bullet selection
// A follow on ticket will be written to fix the existing broken
// functionality of loading/unloading maps
// updateMaps(bulletListManager.getMapsToLoad());
} else { } else {
bulletListManager.recreateBulletsFromFollowup( bulletListManager.recreateBulletsFromFollowup(
warngenLayer.getConfiguration(), action, oldWarning); warngenLayer.getConfiguration(), action, oldWarning);
@ -1729,7 +1731,10 @@ public class WarngenDialog extends CaveSWTDialog implements
bulletList.deselectAll(); bulletList.deselectAll();
bulletList.setItems(bulletListManager.getAllBulletTexts()); bulletList.setItems(bulletListManager.getAllBulletTexts());
bulletList.select(bulletListManager.getSelectedIndices()); bulletList.select(bulletListManager.getSelectedIndices());
updateMaps(bulletListManager.getMapsToLoad()); // TODO Repair load/unload maps via bullet selection
// A follow on ticket will be written to fix the existing broken
// functionality of loading/unloading maps
// updateMaps(bulletListManager.getMapsToLoad());
} }
private void updateMaps(ArrayList<String> mapsToLoad) { private void updateMaps(ArrayList<String> mapsToLoad) {

View file

@ -165,9 +165,11 @@ import com.vividsolutions.jts.io.WKTReader;
* 03/28/2013 DR 15974 D. Friedman Preserve the set of selected counties when recreating the polygon from the * 03/28/2013 DR 15974 D. Friedman Preserve the set of selected counties when recreating the polygon from the
* hatched area and remember marked counties outside the polygon on followup. * hatched area and remember marked counties outside the polygon on followup.
* 04/03/2013 1858 jsanchez Handled creating follow up warnings when created before 0z but issued after 0z. * 04/03/2013 1858 jsanchez Handled creating follow up warnings when created before 0z but issued after 0z.
* 03/13/2013 DR 15942 Qinglu Lin Added code to prevent small area from being toggled on that * 04/03/2013 DR 15942 Qinglu Lin Added code to prevent small area from being toggled on that
* does not meet inclusionPercent/inclusionArea criteria. * does not meet inclusionPercent/inclusionArea criteria.
* 04/10/2013 DR 16044 D. Friedman Fix NPE in getAllFipsInArea. * 04/10/2013 DR 16044 D. Friedman Fix NPE in getAllFipsInArea.
* 04/11/2013 1894 jsanchez Kept tracked of the currently loaded custom maps.
* 04/12/1013 DR 16045 Qinglu Lin Updated AreaHatcher's run() by calling removeDuplicateCoordinate().
* </pre> * </pre>
* *
* @author mschenke * @author mschenke
@ -197,7 +199,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
private class CustomMaps extends Job { private class CustomMaps extends Job {
private final Set<String> customMaps = new HashSet<String>(); private Set<String> customMaps = new HashSet<String>();
private Set<String> mapsToLoad; private Set<String> mapsToLoad;
@ -228,7 +230,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
for (String load : toLoad) { for (String load : toLoad) {
manager.loadMapByName(load); manager.loadMapByName(load);
} }
customMaps = toLoad;
issueRefresh(); issueRefresh();
} }
@ -241,6 +243,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
synchronized (this) { synchronized (this) {
mapsToLoad = new HashSet<String>(maps); mapsToLoad = new HashSet<String>(maps);
} }
schedule(); schedule();
} }
@ -285,6 +288,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
} }
try { try {
warningPolygon = PolygonUtil.removeDuplicateCoordinate(warningPolygon);
Polygon hatched = polygonUtil.hatchWarningArea( Polygon hatched = polygonUtil.hatchWarningArea(
warningPolygon, warningPolygon,
removeCounties(warningArea, removeCounties(warningArea,
@ -293,7 +297,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
// DR 15559 // DR 15559
Coordinate[] coords = hatched.getCoordinates(); Coordinate[] coords = hatched.getCoordinates();
PolygonUtil.round(coords, 2); PolygonUtil.round(coords, 2);
WarngenUIState.adjustPolygon(coords); PolygonUtil.adjustPolygon(coords);
GeometryFactory gf = new GeometryFactory(); GeometryFactory gf = new GeometryFactory();
LinearRing lr = gf.createLinearRing(coords); LinearRing lr = gf.createLinearRing(coords);
hatchedArea = gf.createPolygon(lr, null); hatchedArea = gf.createPolygon(lr, null);

View file

@ -45,6 +45,11 @@ import com.vividsolutions.jts.geom.Polygon;
* and adjustPolygon(). * and adjustPolygon().
* Feb 15, 2013 1624 jsanchez Fix NullPointerException in removeDuplicateCoordinate. * Feb 15, 2013 1624 jsanchez Fix NullPointerException in removeDuplicateCoordinate.
* 03/28/2013 DR 15974 D. Friedman Track marked areas outside polygon. * 03/28/2013 DR 15974 D. Friedman Track marked areas outside polygon.
* 04/12/2013 DR 16045 Qinglu Lin Updated setWarningPolygon() by removing the call to
* removeDuplicateCoordinate() and updated removeDuplicateCoordinate()
* by changing access control level from private to public.
* Moved removeDuplicateCoordinate(), computeSlope(),computeCoordinate(),
* and adjustPolygon to PolygonUtil.
* *
* </pre> * </pre>
* *
@ -126,180 +131,6 @@ public class WarngenUIState {
return oldWarningArea; return oldWarningArea;
} }
/**
* removeDuplicateCoordinate remove duplicate intermediate coordinates in
* warningPolygon. History 10-26-2012 Qinglu Lin DR15479 Created.
*/
private static Polygon removeDuplicateCoordinate(Polygon polygon) {
if (polygon == null) {
return null;
}
Coordinate[] verts = polygon.getCoordinates();
Set<Coordinate> coords = new LinkedHashSet<Coordinate>();
for (Coordinate c : verts)
coords.add(c);
if ((verts.length - coords.size()) < 2)
return polygon;
Coordinate[] vertices = new Coordinate[coords.size() + 1];
Iterator<Coordinate> iter = coords.iterator();
int i = 0;
while (iter.hasNext()) {
vertices[i] = new Coordinate(iter.next());
i += 1;
}
vertices[i] = new Coordinate(vertices[0]);
GeometryFactory gf = new GeometryFactory();
return gf.createPolygon(gf.createLinearRing(vertices), null);
}
/**
* computeSlope compute the slope of a line.
*
* History 12/06/2012 DR 15559 Qinglu Lin Created.
*/
private static double computeSlope(Coordinate[] coords, int i) {
double min = 1.0E-08;
double dx = coords[i].x - coords[i + 1].x;
double slope = 0.0;
if (Math.abs(dx) > min) {
slope = (coords[i].y - coords[i + 1].y) / dx;
}
return slope;
}
/**
* computeCoordinate Compute the x component of a coordinate after its y
* component is adjusted.
*
* History 12/06/2012 DR 15559 Qinglu Lin Created.
*/
private static void computeCoordinate(Coordinate[] c, int i, int j) {
double slope;
slope = computeSlope(c, i);
int iPlus1 = i + 1;
if (c[j].x >= c[i].x && c[j].x <= c[iPlus1].x || c[j].x >= c[iPlus1].x
&& c[j].x <= c[i].x) {
double x, y;
double min1 = 0.005d;
y = slope * (c[j].x - c[i].x) + c[i].y;
double d = Math.abs(y - c[j].y);
if (d > min1)
return;
double min2 = 1.0E-8d;
double delta = 0.005d; // empirical value
double dyMin = 0.01d;
int jMinus1 = j - 1;
if (jMinus1 < 0)
jMinus1 = c.length - 2;
int jPlus1 = j + 1;
if (Math.abs(y - c[j].y) < min1) {
double dy1, dy2;
dy1 = Math.abs(c[jMinus1].y - y);
dy2 = Math.abs(c[jPlus1].y - y);
if (dy1 >= dy2
&& (Math.abs(dy1) > dyMin || Math.abs(dy2) > dyMin)) {
// attempt to use l2 for computation
if (c[j].y == c[jMinus1].y
&& Math.abs(c[j].x - c[jMinus1].x) > min2) {
// l2 is a horizontal line, use l3 for computation
if (c[jPlus1].y < c[j].y)
delta = -delta;
slope = computeSlope(c, j);
if (Math.abs(slope) > min2) {
y = c[j].y + delta;
x = (y - c[jPlus1].y) / slope + c[jPlus1].x;
} else {
// l3 is a vertical line
y = c[j].y + delta;
x = c[j].x;
}
} else {
// use l2 for computation
if (c[jMinus1].y < c[j].y)
delta = -delta;
slope = computeSlope(c, jMinus1);
if (Math.abs(slope) > min2) {
y = c[j].y + delta;
x = (y - c[jMinus1].y) / slope + c[jMinus1].x;
} else {
// l2 is a vertical line
y = c[j].y + delta;
x = c[j].x;
}
}
} else {
if (Math.abs(dy1) > dyMin || Math.abs(dy2) > dyMin) {
// attempt to use l3 for computation
if (c[j].y == c[jPlus1].y
&& Math.abs(c[j].x - c[jPlus1].x) > min2) {
// l3 is a horizontal line, use l2 for computation
if (c[jMinus1].y < c[j].y)
delta = -delta;
slope = computeSlope(c, jMinus1);
if (Math.abs(slope) > min2) {
y = c[j].y + delta;
x = (y - c[jMinus1].y) / slope + c[jMinus1].x;
} else {
// l2 is a vertical line
y = c[j].y + delta;
x = c[j].x;
}
} else {
// use l3 for computation
if (c[jPlus1].y < c[j].y)
delta = -delta;
slope = computeSlope(c, j);
if (Math.abs(slope) > min2) {
y = c[j].y + delta;
x = (y - c[jPlus1].y) / slope + c[jPlus1].x;
} else {
// l3 is a vertical line
y = c[j].y + delta;
x = c[j].x;
}
}
} else {
x = c[j].x;
y = c[j].y;
}
}
c[j].x = x;
c[j].y = y;
if (j == 0)
c[c.length - 1] = c[j];
}
}
}
/**
* adjustPolygon When a point is very close to a line in the initial warning
* polygon, the resulting coordinates cause the failure of polygon drawing
* in follow-up. The method move that kind of points away from the line, and
* return a Polygon.
*
* History 12/06/2012 DR 15559 Qinglu Lin Created.
*/
public static void adjustPolygon(Coordinate[] coords) {
int n = coords.length;
for (int i = 0; i < n - 1; ++i) {
int j;
for (j = i + 2; j <= n - 2; j++) {
computeCoordinate(coords, i, j);
}
if (i <= n - 3)
for (j = 0; j < i; j++) {
computeCoordinate(coords, i, j);
}
else
for (j = 1; j < i; j++) {
computeCoordinate(coords, i, j);
}
}
}
/** /**
* Set the old warning area in lat/lon projection. Will be converted to * Set the old warning area in lat/lon projection. Will be converted to
* local * local
@ -326,7 +157,7 @@ public class WarngenUIState {
* the warningPolygon to set * the warningPolygon to set
*/ */
public void setWarningPolygon(Polygon warningPolygon) { public void setWarningPolygon(Polygon warningPolygon) {
this.warningPolygon = removeDuplicateCoordinate(warningPolygon); this.warningPolygon = warningPolygon;
} }
public Set<String> getFipsOutsidePolygon() { public Set<String> getFipsOutsidePolygon() {

View file

@ -33,6 +33,7 @@ import java.util.regex.Pattern;
* Sep 24, 2012 15332 jsanchez Initial creation * Sep 24, 2012 15332 jsanchez Initial creation
* Oct 18, 2012 15332 jsanchez Replaced listOfAreaNamesPtrn with String pattern. * Oct 18, 2012 15332 jsanchez Replaced listOfAreaNamesPtrn with String pattern.
* Mar 13, 2013 DR 15892 D. Friedman Allow some punctuation in area names. * Mar 13, 2013 DR 15892 D. Friedman Allow some punctuation in area names.
* Apr 18, 2013 DR 16055 D. Friedman Allow more than one contiguous space in areas.
* *
* </pre> * </pre>
* *
@ -56,7 +57,7 @@ public interface ICommonPatterns {
// LOCK_END can be added at the start of the line if a previous line has // LOCK_END can be added at the start of the line if a previous line has
// been locked. // been locked.
public static final String listOfAreaName = "^((" + LOCK_END public static final String listOfAreaName = "^((" + LOCK_END
+ "){0,1}((([\\?\\(\\)\\w\\.,/'-]+\\s{1})+\\w{2}-)*(([\\?\\(\\)\\w\\.,/'-]+\\s{1})+\\w{2}-)))"; + "){0,1}((([\\?\\(\\)\\w\\.,/'-]+\\s{1,})+\\w{2}-)*(([\\?\\(\\)\\w\\.,/'-]+\\s{1,})+\\w{2}-)))";
// LOCK_END should not be found at the beginning of a first bullet since the // LOCK_END should not be found at the beginning of a first bullet since the
// previous line should be blank. // previous line should be blank.

View file

@ -33,6 +33,7 @@ import java.util.regex.Pattern;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Sep 24, 2012 15322 jsanchez Initial creation * Sep 24, 2012 15322 jsanchez Initial creation
* Oct 19, 2012 15332 jsanchez Created a local pattern listOfAreaNamesPtrn. * Oct 19, 2012 15332 jsanchez Created a local pattern listOfAreaNamesPtrn.
* Apr 18, 2013 DR 16055 D. Friedman Fix word wrapping of long area names.
* *
* </pre> * </pre>
* *
@ -48,24 +49,13 @@ public class WrapUtil implements ICommonPatterns {
private static final String BULLET_START = "* "; private static final String BULLET_START = "* ";
private static final Pattern wrapUgcPtrn = Pattern.compile("(\\S{1," // Guess at the amount of extra characters added by wrapping
+ (MAX_WIDTH - 1) + "}-)"); private static final int WRAP_COUNT_GUESS = 16 * 3; // *3 for bullet indent + \n
private static final Pattern wrapListOfNamesPtrn = Pattern.compile("(.{1," private static final String DELIM_GROUP = "\0";
+ (MAX_WIDTH - 4) + "} \\w{2}-)"); private static final String[] NORMAL_DELIMS = { " ", "...", DELIM_GROUP, "-" };
private static final String[] AREA_DELIMS = { "-", "...", DELIM_GROUP, " " };
// Locations in 4th bullet or locations paragraph of followup private static final String[] UGC_DELIMS = AREA_DELIMS;
// ex: ellipsis, spaces, period
private static final Pattern wrapDefaultPtrn = Pattern
.compile("(\\w{1,}\\.\\.\\.)|(AND \\w+\\.\\.\\.)|(\\w+\\.\\.\\.\\s{1,2})|"
+ "("
+ LOCK_START
+ "\\w+"
+ LOCK_END
+ "\\.\\.\\.)|\\S+\\.\\.\\."
+ LOCK_END
+ "|\\S+\\.\\.\\.|"
+ "(\\s*\\S+\\s+)|(.+\\.)|(\\S+$)");
// ugc pattern // ugc pattern
private static final Pattern ugcPtrn = Pattern.compile(ugc); private static final Pattern ugcPtrn = Pattern.compile(ugc);
@ -93,19 +83,24 @@ public class WrapUtil implements ICommonPatterns {
if (unlocked.trim().length() == 0) { // BLANK LINE if (unlocked.trim().length() == 0) { // BLANK LINE
inBullet = false; inBullet = false;
addLine = line; addLine = line;
} else if (unlocked.length() <= MAX_WIDTH) { // LESS THAN MAX } else {
// Add indenting if the template didn't account for it yet. boolean wasInBullet = inBullet;
if (inBullet && !unlocked.startsWith(INDENT)) {
sb.append(INDENT);
}
if (unlocked.startsWith(BULLET_START)) { if (unlocked.startsWith(BULLET_START)) {
inBullet = true; inBullet = true;
} }
addLine = line; // Add indenting if the template didn't account for it yet.
} else { // NEEDS TO BE WRAPPED int add = wasInBullet && !unlocked.startsWith(INDENT) ? INDENT
addLine = wrapLongLines(line, inBullet); .length() : 0;
if (unlocked.length() <= MAX_WIDTH - add) { // LESS THAN MAX
if (add > 0) {
sb.append(INDENT);
}
addLine = line;
} else { // NEEDS TO BE WRAPPED
addLine = wrapLongLines(line, inBullet);
}
} }
sb.append(addLine); sb.append(addLine);
@ -125,34 +120,122 @@ public class WrapUtil implements ICommonPatterns {
* @return * @return
*/ */
private static String wrapLongLines(String line, boolean inBullet) { private static String wrapLongLines(String line, boolean inBullet) {
StringBuffer sb = new StringBuffer(line.length()); String[] delims = getDelimiters(line);
String unlockedLine = line.replaceAll(LOCK_START + "|" + LOCK_END, ""); return wrapLongLine(line, inBullet, delims, MAX_WIDTH);
}
if (unlockedLine.startsWith(BULLET_START)) { /**
inBullet = true; * Wraps a line of text to the given maximum width, if possible, by breaking
} * at the given delimiters.
*
* @param line
* @param inBullet
* @param delims
* a list of delimiters divided into groups by the object
* instance DELIM_GROUP. A delimiter in an earlier group will be
* used before using any delimiter from a later group. Within a
* group, the delimiter closest to the margin is used.
* @param maxLength
* @return
*/
public static String wrapLongLine(String line, boolean inBullet, String[] delims, int maxLength) {
StringBuilder sb = new StringBuilder(line.length() + WRAP_COUNT_GUESS);
int start = 0;
int allowLength = maxLength;
boolean failed = false;
Pattern p = getPattern(line); /*
Matcher m = p.matcher(line.trim()); * Skip over initial bullet point and/or indent OR add indentation if
String tmp = inBullet && !unlockedLine.startsWith(BULLET_START) ? INDENT * missing.
: ""; */
if (inBullet) {
while (m.find()) { char[] cb = new char[2];
String group = m.group(); int i = indexIgnoringLockMarkers(line, start, 0);
String unlocked = group.replaceAll(LOCK_START + "|" + LOCK_END, ""); int o = 0;
while (i < line.length() && o < 2) {
int len = tmp.replaceAll(LOCK_START + "|" + LOCK_END, "").length(); cb[o++] = line.charAt(i);
if (len + unlocked.length() > MAX_WIDTH && tmp.trim().length() > 0) { i = indexIgnoringLockMarkers(line, i, 1);
sb.append(tmp + "\n"); }
tmp = inBullet ? INDENT : ""; if (o == 2) {
tmp += group; String lead = new String(cb, 0, o);
} else { if (INDENT.equals(lead) || BULLET_START.equals(lead)) {
tmp += group; allowLength -= lead.length();
start = i;
sb.append(line, 0, i);
} else {
allowLength -= INDENT.length();
sb.append(INDENT);
}
} }
} }
if (tmp.trim().length() > 0) { while (start < line.length()) {
sb.append(tmp); int limit = indexIgnoringLockMarkers(line, start, allowLength);
if (limit >= line.length()) {
appendRTrim(line, start, line.length(), sb);
break;
}
/*
* Find delimiter in a group of delimiters that is closest to the
* wrap margin. If not found, try again with the next group.
*
* Searches before the limit (or at the limit if the delimiter is a
* space). If the whole process has failed once, searches after the
* limit.
*/
String bestDelim = null;
int bestP = -1;
for (String delim : delims) {
if (delim == DELIM_GROUP) {
if (bestDelim != null)
break;
continue;
}
int backup = " ".equals(delim) ? 0 : delim.length();
int p = !failed ? line.lastIndexOf(delim, limit - backup)
: line.indexOf(delim, limit - backup);
if (p >= start && (bestDelim == null
|| !failed ? p > bestP : p < bestP)) {
bestDelim = delim;
bestP = p;
}
}
if (bestDelim != null) {
failed = false;
int next = indexIgnoringLockMarkers(line,
bestP + bestDelim.length(), 0);
int segmentEnd = " ".equals(bestDelim) ? bestP : next;
appendRTrim(line, start, segmentEnd, sb);
// Remove any leading space at the start of the next line.
while (next < line.length() && line.charAt(next) == ' ')
next = indexIgnoringLockMarkers(line, next, 1);
if (next < line.length()) {
sb.append('\n');
if (inBullet) {
sb.append(INDENT);
allowLength = maxLength - INDENT.length();
}
}
start = next;
} else if (! failed) {
/*
* Failed to wrap before the margin. Try again, wrapping the
* line after the margin, but still as close to it as possible.
*/
failed = true;
continue;
} else {
/*
* Failed to find any kind of break. Just dump the rest of the
* text.
*/
appendRTrim(line, start, line.length(), sb);
break;
}
} }
return sb.toString(); return sb.toString();
@ -164,21 +247,73 @@ public class WrapUtil implements ICommonPatterns {
* @param line * @param line
* @return * @return
*/ */
private static Pattern getPattern(String line) { private static String[] getDelimiters(String line) {
Matcher m = ugcPtrn.matcher(line); Matcher m = ugcPtrn.matcher(line);
// UGC line or FIPS line // UGC line or FIPS line
if (m.find()) { if (m.find()) {
return wrapUgcPtrn; return UGC_DELIMS;
} }
m = listOfAreaNamePtrn.matcher(line); m = listOfAreaNamePtrn.matcher(line);
// List of area names. // List of area names.
if (m.find() && !line.startsWith(BULLET_START)) { if (m.find() && !line.startsWith(BULLET_START)) {
return wrapListOfNamesPtrn; return AREA_DELIMS;
} }
return wrapDefaultPtrn; return NORMAL_DELIMS;
} }
/**
* Returns the index in {@code text} that is {@code count} characters after
* {@code start}, skipping past any lock markers. This includes any lock
* markers at the desired index. This greediness prevents wrapping to a new
* line that would only contain lock markers.
*
* @param text
* @param start
* 0 <= start < text.length()
* @param count
* Number of characters to skip. May be greater than the number
* of characters in text past start.
* @return
*/
private static int indexIgnoringLockMarkers(String text, int start, int count) {
int i = start;
do {
if (text.startsWith(LOCK_START, i))
i += LOCK_START.length();
else if (text.startsWith(LOCK_END, i))
i += LOCK_END.length();
else if (count > 0) {
if (i >= text.length())
break;
++i;
--count;
} else
break;
} while (true);
return i;
}
/**
* Append text.substring(start, end) to sb, removing any trailing
* whitespace. The trailing whitespace may have have embedded lock marks.
*/
private static void appendRTrim(String text, int start, int end, StringBuilder sb) {
int sbStart = sb.length();
sb.append(text, start, end);
int i = sb.length();
while (i > sbStart) {
if (Character.isWhitespace(sb.charAt(i - 1))) {
sb.deleteCharAt(--i);
} else if (i - sbStart >= LOCK_START.length() &&
LOCK_START.equals(sb.substring(i - LOCK_START.length(), i))) {
i -= LOCK_START.length();
} else if (i - sbStart >= LOCK_END.length() &&
LOCK_END.equals(sb.substring(i - LOCK_END.length(), i))) {
i -= LOCK_END.length();
} else
break;
}
}
} }

View file

@ -3,6 +3,7 @@ package com.raytheon.viz.warnings.rsc;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -74,6 +75,8 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
* String array returned from getText method * String array returned from getText method
* Jun 04, 2012 DR14992 mgamazaychikov Reversed the previous changes * Jun 04, 2012 DR14992 mgamazaychikov Reversed the previous changes
* Sep 26, 2012 jsanchez Refactored AbstractWarningResource and AbstractWatchesResource into this class. * Sep 26, 2012 jsanchez Refactored AbstractWarningResource and AbstractWatchesResource into this class.
* Apr 11, 2013 1877 jsanchez Updated conditions for matching a frame.
* Apr 18, 2013 1877 jsanchez Had the child classes set the comparator. Fixed a null pointer.
* *
* </pre> * </pre>
* *
@ -152,7 +155,7 @@ public abstract class AbstractWWAResource extends
protected List<AbstractWarningRecord> recordsToLoad; protected List<AbstractWarningRecord> recordsToLoad;
protected WarningRecordComparator comparator = new WarningRecordComparator(); protected Comparator<AbstractWarningRecord> comparator;
protected abstract void updateDisplay(IGraphicsTarget target) protected abstract void updateDisplay(IGraphicsTarget target)
throws VizException; throws VizException;
@ -284,18 +287,24 @@ public abstract class AbstractWWAResource extends
PaintProperties paintProps) throws VizException { PaintProperties paintProps) throws VizException {
FramesInfo info = paintProps.getFramesInfo(); FramesInfo info = paintProps.getFramesInfo();
DataTime[] frames = info.getFrameTimes(); DataTime[] frames = info.getFrameTimes();
int frameToRequestedCompare = frames[0].compareTo(earliestRequested); if (earliestRequested == null) {
if (frameToRequestedCompare < 0) {
// we haven't requested data this far back
this.requestData(frames[0]); this.requestData(frames[0]);
} else if (frameToRequestedCompare > 0) { } else {
// the previous earliest frame was removed as updates came in, so int frameToRequestedCompare = frames[0]
// the warnings need to be disposed and we need to update the .compareTo(earliestRequested);
// earliestRequested so if they ever went back in time to that if (frameToRequestedCompare < 0) {
// again, it would be re-requested // we haven't requested data this far back
earliestRequested = frames[0]; this.requestData(frames[0]);
if (paintProps.getDataTime() != null) { } else if (frameToRequestedCompare > 0) {
cleanupData(paintProps.getDataTime(), frames); // the previous earliest frame was removed as updates came in,
// so
// the warnings need to be disposed and we need to update the
// earliestRequested so if they ever went back in time to that
// again, it would be re-requested
earliestRequested = frames[0];
if (paintProps.getDataTime() != null) {
cleanupData(paintProps.getDataTime(), frames);
}
} }
} }
int index = info.getFrameIndex(); int index = info.getFrameIndex();
@ -436,16 +445,13 @@ public abstract class AbstractWWAResource extends
if (action == WarningAction.CAN && refTime.equals(paintTime)) { if (action == WarningAction.CAN && refTime.equals(paintTime)) {
return false; return false;
// If this entry has been altered/updated, display its pre-altered // If this entry has been altered/updated, display its pre-altered
// version // version only in the frames prior to the time it was altered
// only in the frames prior to the time it was altered
} else if (entry.altered) { } else if (entry.altered) {
if (frameStart.getTime() >= refTime.getTime() if (frameStart.getTime() >= refTime.getTime()
&& frameStart.getTime() < (entry.timeAltered.getTime()) && frameStart.getTime() <= (entry.timeAltered.getTime())
&& frameStart.getTime() < entry.frameAltered.getTime()) && frameStart.getTime() < entry.frameAltered.getTime()) {
return true; return true;
if (frameStart.getTime() >= (entry.timeAltered.getTime())) }
return false;
} else if (refTime.equals(paintTime) } else if (refTime.equals(paintTime)
|| recordPeriod.contains(frameTime) || recordPeriod.contains(frameTime)
|| (framePeriod.contains(centerTime) && (!lastFrame || !entry.altered))) { || (framePeriod.contains(centerTime) && (!lastFrame || !entry.altered))) {
@ -518,8 +524,9 @@ public abstract class AbstractWWAResource extends
} }
} }
/* Sorts by phensig, etn, starttime (descending), act */ if (comparator != null) {
Collections.sort(sortedWarnings, comparator); Collections.sort(sortedWarnings, comparator);
}
return sortedWarnings.toArray(new AbstractWarningRecord[sortedWarnings return sortedWarnings.toArray(new AbstractWarningRecord[sortedWarnings
.size()]); .size()]);
} }

View file

@ -18,6 +18,7 @@ import com.raytheon.uf.common.dataplugin.warning.WarningRecord.WarningAction;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* May 12, 2011 jsanchez Initial creation * May 12, 2011 jsanchez Initial creation
* Sep 27, 2012 1149 jsanchez Updated order of actions. Put CON before CAN,EXP * Sep 27, 2012 1149 jsanchez Updated order of actions. Put CON before CAN,EXP
* Apr 18, 2013 1877 jsanchez Ordered by starttime before action to handle updates and initial load of the resource.
* </pre> * </pre>
* *
* @author jsanchez * @author jsanchez
@ -27,8 +28,8 @@ public class WarningRecordComparator implements
Comparator<AbstractWarningRecord> { Comparator<AbstractWarningRecord> {
/** /**
* Compares the WarningRecords by phenSig, ETN, action, then starttime * Compares the WarningRecords by phenSig, ETN, starttime (ascending order),
* (descending order) * then action
*/ */
@Override @Override
public int compare(AbstractWarningRecord wr1, AbstractWarningRecord wr2) { public int compare(AbstractWarningRecord wr1, AbstractWarningRecord wr2) {
@ -43,6 +44,11 @@ public class WarningRecordComparator implements
rval = Double.compare(Double.parseDouble(wr1.getEtn()), rval = Double.compare(Double.parseDouble(wr1.getEtn()),
Double.parseDouble(wr2.getEtn())); Double.parseDouble(wr2.getEtn()));
} }
if (rval == 0) {
rval = wr1.getStartTime().compareTo(wr2.getStartTime());
}
if (rval == 0) { if (rval == 0) {
if (wr1.getAct() != null && wr2.getAct() != null) { if (wr1.getAct() != null && wr2.getAct() != null) {
WarningAction act1 = WarningAction.valueOf(wr1.getAct()); WarningAction act1 = WarningAction.valueOf(wr1.getAct());
@ -55,24 +61,15 @@ public class WarningRecordComparator implements
rval = 1; rval = 1;
} else if (act1 == WarningAction.CON } else if (act1 == WarningAction.CON
&& (act2 == WarningAction.CAN || act2 == WarningAction.EXP)) { && (act2 == WarningAction.CAN || act2 == WarningAction.EXP)) {
return -1; return 1;
} else if (act2 == WarningAction.CON } else if (act2 == WarningAction.CON
&& (act1 == WarningAction.CAN || act1 == WarningAction.EXP)) { && (act1 == WarningAction.CAN || act1 == WarningAction.EXP)) {
return 1; return -1;
} else { } else {
rval = wr1.getAct().compareTo(wr2.getAct()); rval = wr1.getAct().compareTo(wr2.getAct());
} }
} }
if (rval == 0) {
rval = wr1.getStartTime().compareTo(wr2.getStartTime());
// sort warnings in descending order
if (wr1.getSig() != null) {
if (!wr1.getSig().equals("A")) {
rval *= -1;
}
}
}
} }
} }
return rval; return rval;

View file

@ -58,6 +58,7 @@ import com.vividsolutions.jts.geom.Geometry;
* Jun 04, 2012 DR14992 mgamazaychikov Fix the problem with plotting expiration time for * Jun 04, 2012 DR14992 mgamazaychikov Fix the problem with plotting expiration time for
* NEW warning when CAN warning is issued * NEW warning when CAN warning is issued
* Sep 27, 2012 1149 jsanchez Refactored methods from AbstractWarningsResource into this class. * Sep 27, 2012 1149 jsanchez Refactored methods from AbstractWarningsResource into this class.
* Arp 18, 2013 1877 jsanchez Ordered the records the same for update and initial load.
* </pre> * </pre>
* *
* @author jsanchez * @author jsanchez
@ -104,6 +105,7 @@ public class WarningsResource extends AbstractWWAResource {
*/ */
public WarningsResource(WWAResourceData data, LoadProperties props) { public WarningsResource(WWAResourceData data, LoadProperties props) {
super(data, props); super(data, props);
comparator = new WarningRecordComparator();
resourceName = "Warnings"; resourceName = "Warnings";
} }
@ -148,7 +150,7 @@ public class WarningsResource extends AbstractWWAResource {
synchronized (WarningsResource.this) { synchronized (WarningsResource.this) {
{ {
try { try {
addRecord(pdo); addRecord(sort(pdo));
} catch (VizException e) { } catch (VizException e) {
statusHandler.handle(Priority.SIGNIFICANT, statusHandler.handle(Priority.SIGNIFICANT,
e.getLocalizedMessage(), e); e.getLocalizedMessage(), e);

View file

@ -0,0 +1,93 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.warnings.rsc;
import java.util.Comparator;
import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord;
import com.raytheon.uf.common.dataplugin.warning.WarningRecord.WarningAction;
/**
* Comparator class for SPC watches. The logic for the compare method differs
* from the WarningRecordComparator.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 18, 2013 jsanchez Initial creation
*
* </pre>
*
* @author jsanchez
* @version 1.0
*/
public class WatchesComparator implements Comparator<AbstractWarningRecord> {
/**
* Compares the WarningRecords by phenSig, ETN, action, then starttime
* (ascending order)
*/
@Override
public int compare(AbstractWarningRecord wr1, AbstractWarningRecord wr2) {
int rval = 0;
if (wr1.getPhensig() != null && wr2.getPhensig() != null) {
rval = wr1.getPhensig().compareTo(wr2.getPhensig());
}
if (rval == 0) {
if (wr1.getEtn() != null && wr2.getEtn() != null) {
rval = Double.compare(Double.parseDouble(wr1.getEtn()),
Double.parseDouble(wr2.getEtn()));
}
if (rval == 0) {
if (wr1.getAct() != null && wr2.getAct() != null) {
WarningAction act1 = WarningAction.valueOf(wr1.getAct());
WarningAction act2 = WarningAction.valueOf(wr2.getAct());
if (act1 == act2) {
rval = 0;
} else if (act1 == WarningAction.NEW) {
rval = -1;
} else if (act2 == WarningAction.NEW) {
rval = 1;
} else if (act1 == WarningAction.CON
&& (act2 == WarningAction.CAN || act2 == WarningAction.EXP)) {
return -1;
} else if (act2 == WarningAction.CON
&& (act1 == WarningAction.CAN || act1 == WarningAction.EXP)) {
return 1;
} else {
rval = wr1.getAct().compareTo(wr2.getAct());
}
}
}
if (rval == 0) {
rval = wr1.getStartTime().compareTo(wr2.getStartTime());
}
}
return rval;
}
}

View file

@ -94,6 +94,7 @@ public class WatchesResource extends AbstractWWAResource {
public WatchesResource(WWAResourceData data, LoadProperties props) { public WatchesResource(WWAResourceData data, LoadProperties props) {
super(data, props); super(data, props);
comparator = new WatchesComparator();
timer = new Timer(); timer = new Timer();
expTaskSet = new HashSet<Long>(); expTaskSet = new HashSet<Long>();
resourceName = "Watches"; resourceName = "Watches";

View file

@ -32,8 +32,9 @@ import JUtil
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# 04/10/08 chammack Initial Creation. # 04/10/08 chammack Initial Creation.
# 09/30/08 1566 wdougher Quit returning TimeRange from overlaps(), etc. # 09/30/08 1566 wdougher Quit returning TimeRange from overlaps(), etc.
# 09/16/09 2899 njensen Huge performance boost by caching # 09/16/09 2899 njensen Huge performance boost by caching
# # 04/04/2013 #1787 randerso Removed isValid check to allow 0 duration
# time ranges to be used in python
# #
# #
@ -159,8 +160,6 @@ def javaTimeRangeListToPyList(timeRanges):
return pylist return pylist
def encodeJavaTimeRange(javaTimeRange): def encodeJavaTimeRange(javaTimeRange):
if not javaTimeRange.isValid():
return None
time = TimeRange(javaTimeRange) time = TimeRange(javaTimeRange)
start = time.startTime() start = time.startTime()
end = time.endTime() end = time.endTime()

View file

@ -24,7 +24,10 @@
# 02/16/12 14439 jdynina modified haines thresholds # 02/16/12 14439 jdynina modified haines thresholds
# 02/16/12 13917 jdynina merged in changes from TRAC ticket 11391 # 02/16/12 13917 jdynina merged in changes from TRAC ticket 11391
# 07/25/12 #957 dgilling implement edit areas as args to calc methods. # 07/25/12 #957 dgilling implement edit areas as args to calc methods.
# 10/5/12 15158 ryu add Forecaster.getDb() # 10/05/12 15158 ryu add Forecaster.getDb()
# 04/04/13 #1787 randerso fix validTime check to work with accumulative parms
# fix logging so you can actually determine why
# a smartInit is not calculating a parameter
# #
## ##
import string, sys, re, time, types, getopt, fnmatch, LogStream, DatabaseID, JUtil, AbsTime, TimeRange import string, sys, re, time, types, getopt, fnmatch, LogStream, DatabaseID, JUtil, AbsTime, TimeRange
@ -836,8 +839,8 @@ class Forecaster(GridUtilities):
def __sortTimes(self, methods, validTime): def __sortTimes(self, methods, validTime):
rval = [] rval = []
calced = [] calced = []
haveNoData = {}
for we, mthd, args in methods: for we, mthd, args in methods:
# LogStream.logEvent("Evaluating times for calc"+we)
calced.append(we) calced.append(we)
args = filter(lambda x, ma=self.magicArgs().keys() + [we]: args = filter(lambda x, ma=self.magicArgs().keys() + [we]:
x not in ma, args) x not in ma, args)
@ -865,27 +868,36 @@ class Forecaster(GridUtilities):
if validTime is None: if validTime is None:
valid = True valid = True
elif jtr.contains(validTime): else:
valid = True # need check to be inclusive on both ends for methods that
# need both accumulative and non-accumulative parms
valid = validTime.getTime() >= jtr.getStart().getTime() and \
validTime.getTime() <= jtr.getEnd().getTime()
if valid: if valid:
timelist = TimeRange.encodeJavaTimeRange(jtr) timelist = TimeRange.encodeJavaTimeRange(jtr)
pylist.append(timelist) pylist.append(timelist)
ttimes.append(pylist) ttimes.append(pylist)
timeList = ttimes[len(ttimes)-1]
result = 0 # msg = "Times available for " + p + " " + str(validTime) + ":\n"
for xtime in timeList: # timeList = ttimes[len(ttimes)-1]
result += xtime[1] - xtime[0] # for xtime in timeList:
# msg += '('
if result == 0: # stime = time.gmtime(xtime[0])
if not haveNoData.has_key(we): # etime = time.gmtime(xtime[1])
haveNoData[we] = [p] # stime = time.strftime('%Y%m%d_%H%M', stime)
else: # etime = time.strftime('%Y%m%d_%H%M', etime)
haveNoData[we].append(p) # msg += stime + ", " + etime
# msg += ')\n'
# LogStream.logEvent(msg)
# compare the times of each parm and find where they match up # compare the times of each parm and find where they match up
times = self.__compTimes(None, ttimes) times = self.__compTimes(None, ttimes)
# LogStream.logEvent("nargs:",nargs)
# LogStream.logEvent("ttimes:",ttimes)
# LogStream.logEvent("times:",times)
hadDataButSkipped = {} hadDataButSkipped = {}
for i in range(len(ttimes)): for i in range(len(ttimes)):
timeList = ttimes[i] timeList = ttimes[i]
@ -896,7 +908,16 @@ class Forecaster(GridUtilities):
hadDataButSkipped[xtime].append(parmName) hadDataButSkipped[xtime].append(parmName)
else: else:
hadDataButSkipped[xtime] = [parmName] hadDataButSkipped[xtime] = [parmName]
# LogStream.logEvent("hadDataButSkipped:",hadDataButSkipped)
hadNoData = []
for i in range(len(nargs)):
timeList = ttimes[i]
parmName = nargs[i]
if len(timeList) == 0:
hadNoData.append(parmName)
# LogStream.logEvent("hadNoData:",hadNoData)
missing = {} missing = {}
for xtime in hadDataButSkipped: for xtime in hadDataButSkipped:
stime = time.gmtime(xtime[0]) stime = time.gmtime(xtime[0])
@ -908,16 +929,17 @@ class Forecaster(GridUtilities):
for parmName in nargs: for parmName in nargs:
if not hadDataButSkipped[xtime].__contains__(parmName): if not hadDataButSkipped[xtime].__contains__(parmName):
if parmName in calced: missing[msg].append(parmName)
if haveNoData.has_key(parmName):
missing[msg].append(parmName) if len(missing) == 0 and len(hadNoData) > 0:
else: msg = ''
if parmName in haveNoData.values(): if (validTime is not None):
missing[msg].append(parmName) vtime = validTime.getTime()/1000
vtime = time.gmtime(vtime)
if not len(missing[msg]): msg = time.strftime('%Y%m%d_%H%M', vtime)
del missing[msg] missing[msg] = hadNoData
# LogStream.logEvent("missing:",missing)
if len(missing): if len(missing):
LogStream.logEvent("Skipping calc" + we + " for some times due to the following " + LogStream.logEvent("Skipping calc" + we + " for some times due to the following " +
"missing data:", missing) "missing data:", missing)
@ -1130,7 +1152,7 @@ class Forecaster(GridUtilities):
parm = self.__getNewWE(m[0]) parm = self.__getNewWE(m[0])
tr = parm.getTimeRange(t[0]) tr = parm.getTimeRange(t[0])
# A vaild time range was not found so the parameter # A valid time range was not found so the parameter
# cannot be calculated, so continue # cannot be calculated, so continue
if not tr.isValid(): if not tr.isValid():
continue continue

View file

@ -29,6 +29,7 @@ Require-Bundle: com.raytheon.uf.common.dataplugin.gfe;bundle-version="1.12.1174"
com.google.guava;bundle-version="1.0.0", com.google.guava;bundle-version="1.0.0",
com.raytheon.uf.common.util;bundle-version="1.12.1174", com.raytheon.uf.common.util;bundle-version="1.12.1174",
org.apache.commons.lang;bundle-version="2.3.0", org.apache.commons.lang;bundle-version="2.3.0",
com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174",
com.raytheon.uf.common.python.concurrent;bundle-version="1.0.0" com.raytheon.uf.common.python.concurrent;bundle-version="1.0.0"
Export-Package: com.raytheon.edex.plugin.gfe, Export-Package: com.raytheon.edex.plugin.gfe,
com.raytheon.edex.plugin.gfe.config, com.raytheon.edex.plugin.gfe.config,
@ -53,7 +54,6 @@ Import-Package: com.raytheon.edex.db.dao,
com.raytheon.uf.common.activetable, com.raytheon.uf.common.activetable,
com.raytheon.uf.common.comm, 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.persist, com.raytheon.uf.common.dataplugin.persist,
com.raytheon.uf.common.dataplugin.warning, com.raytheon.uf.common.dataplugin.warning,
com.raytheon.uf.common.datastorage, com.raytheon.uf.common.datastorage,

View file

@ -22,35 +22,20 @@ package com.raytheon.edex.plugin.gfe.db.dao;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.SortedMap; import java.util.SortedMap;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.hibernate.Query;
import org.hibernate.SQLQuery;
import org.hibernate.Session; import org.hibernate.Session;
import com.raytheon.edex.plugin.gfe.config.IFPServerConfig;
import com.raytheon.edex.plugin.gfe.config.IFPServerConfigManager;
import com.raytheon.edex.plugin.gfe.exception.GfeConfigurationException;
import com.raytheon.edex.plugin.gfe.util.GridTranslator;
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.gfe.db.objects.DatabaseID;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridParmInfo; import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridParmInfo;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
import com.raytheon.uf.common.dataplugin.grid.GridConstants; import com.raytheon.uf.common.dataplugin.grid.GridConstants;
import com.raytheon.uf.common.dataplugin.grid.GridInfoConstants;
import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.dataplugin.grid.GridRecord;
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.dataquery.db.QueryParam.QueryOperand;
import com.raytheon.uf.common.parameter.mapping.ParameterMapper;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.util.mapping.MultipleMappingException;
import com.raytheon.uf.edex.database.DataAccessLayerException; import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.database.query.DatabaseQuery; import com.raytheon.uf.edex.database.query.DatabaseQuery;
import com.raytheon.uf.edex.plugin.grid.dao.GridDao; import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
@ -63,6 +48,9 @@ import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 03/20/13 #1774 randerso Refactored out of GFEDao * 03/20/13 #1774 randerso Refactored out of GFEDao
* 04/04/13 #1787 randerso Fixed to support changes to D2D grid location
* Additional cleanup to move the D2D to GFE translation
* logic into D2DGridDatabase.
* *
* </pre> * </pre>
* *
@ -81,27 +69,6 @@ public class GFED2DDao extends GridDao {
private static final String REF_TIME = "dataTime.refTime"; private static final String REF_TIME = "dataTime.refTime";
// hibernate query to find grid info record for the given datasetId and
// parameter
private static final String SQL_D2D_GRID_PARM_QUERY = "select parameter_abbreviation, id "
+ "FROM grid_info WHERE "
+ GridInfoConstants.DATASET_ID
+ " = :"
+ GridInfoConstants.DATASET_ID
+ " AND "
+ "level_id = :level_id AND "
+ "(lower(parameter_abbreviation) = :abbrev OR lower(parameter_abbreviation) like :hourAbbrev)";
// hibernate query to find the times for the GridRecord for the given
// info.id, id returned to allow easy lookup of the record associated with
// the time
private static final String HQL_D2D_GRID_TIME_QUERY = "select dataTime.fcstTime, id from GridRecord "
+ "where "
+ GridConstants.INFO_ID
+ " = :info_id AND dataTime.refTime = :refTime order by dataTime.fcstTime";
private static final Pattern WIND_PATTERN = Pattern.compile("wind");
public GFED2DDao() throws PluginException { public GFED2DDao() throws PluginException {
super(); super();
} }
@ -116,20 +83,12 @@ public class GFED2DDao extends GridDao {
* @throws DataAccessLayerException * @throws DataAccessLayerException
* If errors occur while querying the metadata database * If errors occur while querying the metadata database
*/ */
public List<Integer> getD2DForecastTimes(DatabaseID dbId) public List<Integer> getForecastTimes(String d2dModelName, Date refTime)
throws DataAccessLayerException { throws DataAccessLayerException {
DatabaseQuery query = new DatabaseQuery(GridRecord.class.getName()); DatabaseQuery query = new DatabaseQuery(GridRecord.class.getName());
query.addDistinctParameter(FCST_TIME); query.addDistinctParameter(FCST_TIME);
try { query.addQueryParam(GridConstants.DATASET_ID, d2dModelName);
IFPServerConfig config = IFPServerConfigManager query.addQueryParam(REF_TIME, refTime);
.getServerConfig(dbId.getSiteId());
query.addQueryParam(GridConstants.DATASET_ID,
config.d2dModelNameMapping(dbId.getModelName()));
} catch (GfeConfigurationException e) {
throw new DataAccessLayerException(
"Error occurred looking up model name mapping", e);
}
query.addQueryParam(REF_TIME, dbId.getModelTimeAsDate());
query.addOrder(FCST_TIME, true); query.addOrder(FCST_TIME, true);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -152,14 +111,16 @@ public class GFED2DDao extends GridDao {
* @throws DataAccessLayerException * @throws DataAccessLayerException
* If errors occur while querying the metadata database * If errors occur while querying the metadata database
*/ */
public GridRecord getD2DGrid(ParmID id, Integer forecastTime, public GridRecord getGrid(String d2dModelName, Date refTime,
String d2dParmName, Level d2dLevel, Integer forecastTime,
GridParmInfo info) throws DataAccessLayerException { GridParmInfo info) throws DataAccessLayerException {
Session s = null; Session s = null;
try { try {
s = getHibernateTemplate().getSessionFactory().openSession(); s = getHibernateTemplate().getSessionFactory().openSession();
// TODO: clean up so we only make one db query // TODO: clean up so we only make one db query
SortedMap<Integer, Integer> rawTimes = queryByD2DParmId(id, s); SortedMap<Integer, Integer> rawTimes = queryByParmId(d2dModelName,
refTime, d2dParmName, d2dLevel, s);
// if forecastTime is null just pick one, // if forecastTime is null just pick one,
// this is for static data since all times are the same // this is for static data since all times are the same
@ -198,108 +159,75 @@ public class GFED2DDao extends GridDao {
* @throws DataAccessLayerException * @throws DataAccessLayerException
* If errors occur while querying the metadata database * If errors occur while querying the metadata database
*/ */
public SortedMap<Integer, Integer> queryByD2DParmId(ParmID id, Session s) public SortedMap<Integer, Integer> queryByParmId(String d2dModelName,
Date refTime, String d2dParmName, Level d2dLevel, Session s)
throws DataAccessLayerException { throws DataAccessLayerException {
String levelName = GridTranslator.getLevelName(id.getParmLevel());
double[] levelValues = GridTranslator.getLevelValue(id.getParmLevel()); DatabaseQuery query = new DatabaseQuery(GridRecord.class.getName());
boolean levelOnePresent = (levelValues[0] != Level query.addReturnedField(FCST_TIME);
.getInvalidLevelValue()); query.addReturnedField("id");
boolean levelTwoPresent = (levelValues[1] != Level query.addQueryParam(GridConstants.DATASET_ID, d2dModelName);
.getInvalidLevelValue()); query.addQueryParam(REF_TIME, refTime);
Level level = null; query.addQueryParam(GridConstants.PARAMETER_ABBREVIATION, d2dParmName);
query.addQueryParam(GridConstants.LEVEL_ID, d2dLevel.getId());
// to have a level 2, must have a level one query.addOrder(FCST_TIME, true);
try {
if (levelOnePresent && levelTwoPresent) {
level = LevelFactory.getInstance().getLevel(levelName,
levelValues[0], levelValues[1]);
} else if (levelOnePresent) {
level = LevelFactory.getInstance().getLevel(levelName,
levelValues[0]);
} else {
level = LevelFactory.getInstance().getLevel(levelName, 0.0);
}
} catch (CommunicationException e) {
logger.error(e.getLocalizedMessage(), e);
}
if (level == null) {
logger.warn("Unable to query D2D parms, ParmID " + id
+ " does not map to a level");
return new TreeMap<Integer, Integer>();
}
SQLQuery modelQuery = s.createSQLQuery(SQL_D2D_GRID_PARM_QUERY);
modelQuery.setLong("level_id", level.getId());
DatabaseID dbId = id.getDbId();
try {
IFPServerConfig config = IFPServerConfigManager
.getServerConfig(dbId.getSiteId());
modelQuery.setString(GridInfoConstants.DATASET_ID,
config.d2dModelNameMapping(dbId.getModelName()));
} catch (GfeConfigurationException e) {
throw new DataAccessLayerException(
"Error occurred looking up model name mapping", e);
}
String abbreviation = null;
try {
abbreviation = ParameterMapper.getInstance().lookupBaseName(
id.getParmName(), "gfeParamName");
} catch (MultipleMappingException e) {
statusHandler.handle(Priority.WARN, e.getLocalizedMessage(), e);
abbreviation = e.getArbitraryMapping();
}
abbreviation = abbreviation.toLowerCase();
modelQuery.setString("abbrev", abbreviation);
modelQuery.setString("hourAbbrev", abbreviation + "%hr");
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
List<Object[]> results = modelQuery.list(); List<Object[]> firstTry = (List<Object[]>) this.queryByCriteria(query);
Integer modelId = null;
if (results.size() == 0) {
return new TreeMap<Integer, Integer>();
} else if (results.size() > 1) {
// hours matched, take hour with least number that matches exact
// param
Pattern p = Pattern.compile("^" + abbreviation + "(\\d+)hr$");
int lowestHr = -1;
for (Object[] rows : results) {
String param = ((String) rows[0]).toLowerCase();
if (param.equals(abbreviation) && (lowestHr < 0)) {
modelId = (Integer) rows[1];
} else {
Matcher matcher = p.matcher(param);
if (matcher.matches()) {
int hr = Integer.parseInt(matcher.group(1));
if ((lowestHr < 0) || (hr < lowestHr)) {
modelId = (Integer) rows[1];
lowestHr = hr;
}
}
}
}
} else {
modelId = (Integer) (results.get(0))[1];
}
Query timeQuery = s.createQuery(HQL_D2D_GRID_TIME_QUERY);
timeQuery.setInteger("info_id", modelId);
timeQuery.setParameter("refTime", dbId.getModelTimeAsDate());
@SuppressWarnings("unchecked")
List<Object[]> timeResults = timeQuery.list();
if (timeResults.isEmpty()) {
return new TreeMap<Integer, Integer>();
}
SortedMap<Integer, Integer> dataTimes = new TreeMap<Integer, Integer>(); SortedMap<Integer, Integer> dataTimes = new TreeMap<Integer, Integer>();
for (Object[] rows : timeResults) { if (firstTry.isEmpty()) {
dataTimes.put((Integer) rows[0], (Integer) rows[1]); query = new DatabaseQuery(GridRecord.class.getName());
query.addReturnedField(FCST_TIME);
query.addReturnedField("id");
query.addReturnedField(GridConstants.PARAMETER_ABBREVIATION);
query.addQueryParam(GridConstants.DATASET_ID, d2dModelName);
query.addQueryParam(REF_TIME, refTime);
query.addQueryParam(GridConstants.PARAMETER_ABBREVIATION,
d2dParmName + "%hr", QueryOperand.LIKE);
query.addQueryParam(GridConstants.LEVEL_ID, d2dLevel.getId());
query.addOrder(FCST_TIME, true);
query.addOrder(GridConstants.PARAMETER_ABBREVIATION, true);
@SuppressWarnings("unchecked")
List<Object[]> secondTry = (List<Object[]>) this
.queryByCriteria(query);
Pattern p = Pattern.compile("^" + d2dParmName + "(\\d+)hr$");
int i = 0;
while (i < secondTry.size()) {
Object[] row = secondTry.get(i++);
Integer fcstHr = (Integer) row[0];
Integer id = (Integer) row[1];
Matcher matcher = p.matcher((String) row[2]);
int dur = Integer.MAX_VALUE;
if (matcher.matches()) {
dur = Integer.parseInt(matcher.group(1));
}
for (int j = i; j < secondTry.size(); j++) {
Object[] nextRow = secondTry.get(j);
if (fcstHr.equals(nextRow[0])) {
i = j;
String nextParam = (String) nextRow[2];
Matcher nextMatcher = p.matcher(nextParam);
int nextDur = Integer.MAX_VALUE;
if (nextMatcher.matches()) {
nextDur = Integer.parseInt(nextMatcher.group(1));
}
if (nextDur < dur) {
id = (Integer) nextRow[1];
}
} else {
break;
}
}
dataTimes.put(fcstHr, id);
}
} else {
for (Object[] row : firstTry) {
dataTimes.put((Integer) row[0], (Integer) row[1]);
}
} }
return dataTimes; return dataTimes;
} }
@ -311,66 +239,18 @@ public class GFED2DDao extends GridDao {
* @return the list of forecast hours * @return the list of forecast hours
* @throws DataAccessLayerException * @throws DataAccessLayerException
*/ */
public List<Integer> queryFcstHourByD2DParmId(ParmID id) public List<Integer> queryFcstHourByParmId(String d2dModelName,
Date refTime, String d2dParmName, Level d2dLevel)
throws DataAccessLayerException { throws DataAccessLayerException {
List<Integer> timeList = new ArrayList<Integer>(); List<Integer> timeList = new ArrayList<Integer>();
Session s = null; Session s = null;
try { try {
s = getHibernateTemplate().getSessionFactory().openSession(); s = getHibernateTemplate().getSessionFactory().openSession();
if (id.getParmName().equalsIgnoreCase("wind")) { SortedMap<Integer, Integer> results = queryByParmId(d2dModelName,
String idString = id.toString(); refTime, d2dParmName, d2dLevel, s);
Matcher idWindMatcher = WIND_PATTERN.matcher(idString); for (Integer o : results.keySet()) {
timeList.add(o);
ParmID uWindId = new ParmID(idWindMatcher.replaceAll("uW"));
SortedMap<Integer, Integer> results = queryByD2DParmId(uWindId,
s);
List<Integer> uTimeList = new ArrayList<Integer>(results.size());
for (Integer o : results.keySet()) {
uTimeList.add(o);
}
ParmID vWindId = new ParmID(idWindMatcher.replaceAll("vW"));
results = queryByD2DParmId(vWindId, s);
Set<Integer> vTimeList = new HashSet<Integer>(results.size(), 1);
for (Integer o : results.keySet()) {
vTimeList.add(o);
}
for (Integer tr : uTimeList) {
if (vTimeList.contains(tr)) {
timeList.add(tr);
}
}
if (!timeList.isEmpty()) {
return timeList;
}
ParmID sWindId = new ParmID(idWindMatcher.replaceAll("ws"));
results = queryByD2DParmId(sWindId, s);
List<Integer> sTimeList = new ArrayList<Integer>(results.size());
for (Integer o : results.keySet()) {
sTimeList.add(o);
}
ParmID dWindId = new ParmID(idWindMatcher.replaceAll("wd"));
results = queryByD2DParmId(dWindId, s);
Set<Integer> dTimeList = new HashSet<Integer>(results.size(), 1);
for (Integer o : results.keySet()) {
dTimeList.add(o);
}
for (Integer tr : sTimeList) {
if (dTimeList.contains(tr)) {
timeList.add(tr);
}
}
} else {
SortedMap<Integer, Integer> results = queryByD2DParmId(id, s);
for (Integer o : results.keySet()) {
timeList.add(o);
}
} }
} finally { } finally {
if (s != null) { if (s != null) {
@ -395,7 +275,7 @@ public class GFED2DDao extends GridDao {
* @return * @return
* @throws DataAccessLayerException * @throws DataAccessLayerException
*/ */
public List<Date> getD2DModelRunTimes(String d2dModelName, int maxRecords) public List<Date> getModelRunTimes(String d2dModelName, int maxRecords)
throws DataAccessLayerException { throws DataAccessLayerException {
DatabaseQuery query = new DatabaseQuery(GridRecord.class.getName()); DatabaseQuery query = new DatabaseQuery(GridRecord.class.getName());
query.addDistinctParameter(REF_TIME); query.addDistinctParameter(REF_TIME);

View file

@ -23,7 +23,6 @@ package com.raytheon.edex.plugin.gfe.server.database;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.nio.FloatBuffer; import java.nio.FloatBuffer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
@ -45,7 +44,7 @@ import com.raytheon.edex.plugin.gfe.paraminfo.GridParamInfo;
import com.raytheon.edex.plugin.gfe.paraminfo.GridParamInfoLookup; import com.raytheon.edex.plugin.gfe.paraminfo.GridParamInfoLookup;
import com.raytheon.edex.plugin.gfe.paraminfo.ParameterInfo; import com.raytheon.edex.plugin.gfe.paraminfo.ParameterInfo;
import com.raytheon.edex.plugin.gfe.server.GridParmManager; import com.raytheon.edex.plugin.gfe.server.GridParmManager;
import com.raytheon.edex.plugin.gfe.util.GridTranslator; 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.gfe.GridDataHistory; import com.raytheon.uf.common.dataplugin.gfe.GridDataHistory;
import com.raytheon.uf.common.dataplugin.gfe.RemapGrid; import com.raytheon.uf.common.dataplugin.gfe.RemapGrid;
@ -65,6 +64,8 @@ import com.raytheon.uf.common.dataplugin.gfe.slice.VectorGridSlice;
import com.raytheon.uf.common.dataplugin.grid.GridPathProvider; import com.raytheon.uf.common.dataplugin.grid.GridPathProvider;
import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.dataplugin.grid.GridRecord;
import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.level.Level;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMapping;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory;
import com.raytheon.uf.common.datastorage.DataStoreFactory; import com.raytheon.uf.common.datastorage.DataStoreFactory;
import com.raytheon.uf.common.datastorage.IDataStore; import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.datastorage.Request; import com.raytheon.uf.common.datastorage.Request;
@ -101,7 +102,9 @@ import com.raytheon.uf.edex.database.DataAccessLayerException;
* data instead of full grid. Added logging to support * data instead of full grid. Added logging to support
* GFE performance testing * GFE performance testing
* 03/19/2013 #1774 randerso Fix accumulative grid time ranges * 03/19/2013 #1774 randerso Fix accumulative grid time ranges
* Apr 01, 2013 #1774 randerso Moved wind component checking to GfeIngestNotificaionFilter * 04/04/2013 #1774 randerso Moved wind component checking to GfeIngestNotificaionFilter
* 04/04/2013 #1787 randerso Move the D2D to GFE translation logic out of GFED2DDao
* 04/17/2013 #1913 randerso Added GFE level mapping to replace GridTranslator
* *
* </pre> * </pre>
* *
@ -167,8 +170,7 @@ public class D2DGridDatabase extends VGridDatabase {
try { try {
GFED2DDao dao = new GFED2DDao(); GFED2DDao dao = new GFED2DDao();
List<Date> result = dao.getD2DModelRunTimes(d2dModelName, List<Date> result = dao.getModelRunTimes(d2dModelName, maxRecords);
maxRecords);
List<DatabaseID> dbInventory = new ArrayList<DatabaseID>(); List<DatabaseID> dbInventory = new ArrayList<DatabaseID>();
for (Date date : result) { for (Date date : result) {
@ -195,6 +197,8 @@ public class D2DGridDatabase extends VGridDatabase {
private static final Pattern parmHrPattern = Pattern private static final Pattern parmHrPattern = Pattern
.compile("(\\D+)\\d+hr"); .compile("(\\D+)\\d+hr");
private static final String GFE_LEVEL_MAPPING_FILE = "grid/gfeLevelMappingFile.xml";
private final IPerformanceStatusHandler perfLog = PerformanceStatus private final IPerformanceStatusHandler perfLog = PerformanceStatus
.getHandler("GFE:"); .getHandler("GFE:");
@ -209,6 +213,8 @@ public class D2DGridDatabase extends VGridDatabase {
private String[] components; private String[] components;
private Level level;
public D2DParm(ParmID parmId, GridParmInfo gpi, public D2DParm(ParmID parmId, GridParmInfo gpi,
Map<Integer, TimeRange> fcstHrToTimeRange, String... components) { Map<Integer, TimeRange> fcstHrToTimeRange, String... components) {
this.parmId = parmId; this.parmId = parmId;
@ -222,6 +228,8 @@ public class D2DGridDatabase extends VGridDatabase {
for (Entry<Integer, TimeRange> entry : fcstHrToTimeRange.entrySet()) { for (Entry<Integer, TimeRange> entry : fcstHrToTimeRange.entrySet()) {
this.timeRangeToFcstHr.put(entry.getValue(), entry.getKey()); this.timeRangeToFcstHr.put(entry.getValue(), entry.getKey());
} }
this.level = getD2DLevel(parmId.getParmLevel());
} }
public ParmID getParmId() { public ParmID getParmId() {
@ -244,6 +252,10 @@ public class D2DGridDatabase extends VGridDatabase {
return components; return components;
} }
public Level getLevel() {
return level;
}
@Override @Override
public String toString() { public String toString() {
return this.parmId.toString(); return this.parmId.toString();
@ -252,7 +264,7 @@ public class D2DGridDatabase extends VGridDatabase {
private String d2dModelName; private String d2dModelName;
private Date modelTime; private Date refTime;
private GridParamInfo modelInfo; private GridParamInfo modelInfo;
@ -275,20 +287,20 @@ public class D2DGridDatabase extends VGridDatabase {
* The database ID of this database * The database ID of this database
*/ */
public D2DGridDatabase(IFPServerConfig config, String d2dModelName, public D2DGridDatabase(IFPServerConfig config, String d2dModelName,
Date modelTime) throws GfeException { Date refTime) throws GfeException {
super(config); super(config);
this.d2dModelName = d2dModelName; this.d2dModelName = d2dModelName;
this.modelTime = modelTime; this.refTime = refTime;
this.modelInfo = GridParamInfoLookup.getInstance().getGridParamInfo( this.modelInfo = GridParamInfoLookup.getInstance().getGridParamInfo(
d2dModelName); d2dModelName);
if (modelInfo == null) { if (modelInfo == null) {
throw new GfeException("No model info for: " + d2dModelName); throw new GfeException("No model info for: " + d2dModelName);
} }
this.availableTimes = modelInfo.getAvailableTimes(modelTime); this.availableTimes = modelInfo.getAvailableTimes(refTime);
// Get the database id for this database. // Get the database id for this database.
this.dbId = getDbId(this.d2dModelName, this.modelTime, this.config); this.dbId = getDbId(this.d2dModelName, this.refTime, this.config);
this.valid = this.dbId.isValid(); this.valid = this.dbId.isValid();
// get the output gloc' // get the output gloc'
@ -409,8 +421,10 @@ public class D2DGridDatabase extends VGridDatabase {
} }
} }
String d2dParmName = getD2DParmName(atts.getShort_name());
D2DParm d2dParm = new D2DParm(pid, gpi, possibleInventorySlots, D2DParm d2dParm = new D2DParm(pid, gpi, possibleInventorySlots,
atts.getShort_name()); d2dParmName);
this.gfeParms.put(pid, d2dParm); this.gfeParms.put(pid, d2dParm);
this.d2dParms.put(compositeName(atts.getShort_name(), level), d2dParm); this.d2dParms.put(compositeName(atts.getShort_name(), level), d2dParm);
} }
@ -450,8 +464,11 @@ public class D2DGridDatabase extends VGridDatabase {
availableTimes.get(i)); availableTimes.get(i));
} }
String uD2dParmName = getD2DParmName(uatts.getShort_name());
String vD2dParmName = getD2DParmName(vatts.getShort_name());
D2DParm d2dParm = new D2DParm(pid, gpi, possibleInventorySlots, D2DParm d2dParm = new D2DParm(pid, gpi, possibleInventorySlots,
uatts.getShort_name(), vatts.getShort_name()); uD2dParmName, vD2dParmName);
this.gfeParms.put(pid, d2dParm); this.gfeParms.put(pid, d2dParm);
this.d2dParms.put(compositeName(uatts.getShort_name(), level), d2dParm); this.d2dParms.put(compositeName(uatts.getShort_name(), level), d2dParm);
this.d2dParms.put(compositeName(vatts.getShort_name(), level), d2dParm); this.d2dParms.put(compositeName(vatts.getShort_name(), level), d2dParm);
@ -514,10 +531,8 @@ public class D2DGridDatabase extends VGridDatabase {
// get database inventory where all components are available // get database inventory where all components are available
for (String component : parm.getComponents()) { for (String component : parm.getComponents()) {
ParmID compPid = new ParmID(component, dbId, List<Integer> compInv = dao.queryFcstHourByParmId(
id.getParmLevel()); d2dModelName, refTime, component, parm.getLevel());
List<Integer> compInv = dao
.queryFcstHourByD2DParmId(compPid);
if (dbInv == null) { if (dbInv == null) {
dbInv = compInv; dbInv = compInv;
@ -828,17 +843,18 @@ public class D2DGridDatabase extends VGridDatabase {
try { try {
// Gets the metadata from the grib metadata database // Gets the metadata from the grib metadata database
D2DParm parm = this.gfeParms.get(parmId);
Integer fcstHr = null; Integer fcstHr = null;
if (!GridPathProvider.STATIC_PARAMETERS.contains(parmId if (!GridPathProvider.STATIC_PARAMETERS.contains(parmId
.getParmName())) { .getParmName())) {
D2DParm parm = this.gfeParms.get(parmId);
fcstHr = parm.getTimeRangeToFcstHr().get(timeRange); fcstHr = parm.getTimeRangeToFcstHr().get(timeRange);
if (fcstHr == null) { if (fcstHr == null) {
throw new GfeException("Invalid time range " + timeRange throw new GfeException("Invalid time range " + timeRange
+ " for " + parmId); + " for " + parmId);
} }
} }
d2dRecord = dao.getD2DGrid(parmId, fcstHr, gpi); d2dRecord = dao.getGrid(d2dModelName, refTime,
parm.getComponents()[0], parm.getLevel(), fcstHr, gpi);
} catch (DataAccessLayerException e) { } catch (DataAccessLayerException e) {
throw new GfeException( throw new GfeException(
"Error retrieving D2D Grid record from database", e); "Error retrieving D2D Grid record from database", e);
@ -955,21 +971,18 @@ public class D2DGridDatabase extends VGridDatabase {
+ parmId); + parmId);
} }
String mappedModel = config.d2dModelNameMapping(dbId.getModelName()); // TODO clean up the hard coded d2d parm names
if (windParm.getComponents()[0].equals("uW")) {
if (windParm.getComponents()[0].equals("uw")) {
try { try {
GridRecord uRecord = null; GridRecord uRecord = null;
GridRecord vRecord = null; GridRecord vRecord = null;
// Get the metadata from the grib metadata database // Get the metadata from the grib metadata database
uRecord = dao.getD2DGrid( uRecord = dao.getGrid(d2dModelName, refTime, "uW",
new ParmID("uw", this.dbId, parmId.getParmLevel()), windParm.getLevel(), fcstHr, gpi);
fcstHr, gpi); vRecord = dao.getGrid(d2dModelName, refTime, "vW",
vRecord = dao.getD2DGrid( windParm.getLevel(), fcstHr, gpi);
new ParmID("vw", this.dbId, parmId.getParmLevel()),
fcstHr, gpi);
// Gets the raw grid data from the D2D grib HDF5 files // Gets the raw grid data from the D2D grib HDF5 files
Grid2DFloat uData = getRawGridData(uRecord); Grid2DFloat uData = getRawGridData(uRecord);
@ -977,8 +990,7 @@ public class D2DGridDatabase extends VGridDatabase {
// Resample the data to fit the desired region // Resample the data to fit the desired region
float fillV = Float.MAX_VALUE; float fillV = Float.MAX_VALUE;
ParameterInfo pa = GridParamInfoLookup.getInstance() ParameterInfo pa = modelInfo.getParameterInfo("uw");
.getParameterInfo(mappedModel, "uw");
if (pa != null) { if (pa != null) {
fillV = pa.getFillValue(); fillV = pa.getFillValue();
} }
@ -1003,12 +1015,10 @@ public class D2DGridDatabase extends VGridDatabase {
GridRecord dRecord = null; GridRecord dRecord = null;
// Get the metadata from the grib metadata database // Get the metadata from the grib metadata database
sRecord = dao.getD2DGrid( sRecord = dao.getGrid(d2dModelName, refTime, "WS",
new ParmID("ws", this.dbId, parmId.getParmLevel()), windParm.getLevel(), fcstHr, gpi);
fcstHr, gpi); dRecord = dao.getGrid(d2dModelName, refTime, "WD",
dRecord = dao.getD2DGrid( windParm.getLevel(), fcstHr, gpi);
new ParmID("wd", this.dbId, parmId.getParmLevel()),
fcstHr, gpi);
// Gets the raw grid data from the D2D grib HDF5 files // Gets the raw grid data from the D2D grib HDF5 files
Grid2DFloat sData = getRawGridData(sRecord); Grid2DFloat sData = getRawGridData(sRecord);
@ -1016,8 +1026,7 @@ public class D2DGridDatabase extends VGridDatabase {
// Resample the data to fit the desired region // Resample the data to fit the desired region
float fillV = Float.MAX_VALUE; float fillV = Float.MAX_VALUE;
ParameterInfo pa = GridParamInfoLookup.getInstance() ParameterInfo pa = modelInfo.getParameterInfo("ws");
.getParameterInfo(mappedModel, "ws");
if (pa != null) { if (pa != null) {
fillV = pa.getFillValue(); fillV = pa.getFillValue();
} }
@ -1153,14 +1162,11 @@ public class D2DGridDatabase extends VGridDatabase {
throw new GfeException("Unable to get GFE dao!!", e); throw new GfeException("Unable to get GFE dao!!", e);
} }
List<Integer> fcstTimes = dao.getD2DForecastTimes(dbId); List<Integer> fcstTimes = dao.getForecastTimes(d2dModelName, refTime);
SortedSet<Date> validTimes = new TreeSet<Date>(); SortedSet<Date> validTimes = new TreeSet<Date>();
Calendar validTimeCalc = Calendar.getInstance();
Date refTime = dbId.getModelTimeAsDate();
for (Integer fcstTime : fcstTimes) { for (Integer fcstTime : fcstTimes) {
validTimeCalc.setTime(refTime); validTimes.add(new Date(refTime.getTime() + fcstTime
validTimeCalc.add(Calendar.SECOND, fcstTime.intValue()); * TimeUtil.MILLIS_PER_SECOND));
validTimes.add(validTimeCalc.getTime());
} }
return validTimes; return validTimes;
} }
@ -1175,27 +1181,33 @@ public class D2DGridDatabase extends VGridDatabase {
// no-op // no-op
} }
public D2DParm getD2DParm(String d2dParmName, Level level) { public D2DParm getD2DParm(String d2dParmName, Level d2dLevel) {
String gfeParmName = getGfeParmName(d2dParmName); String gfeParmName = getGfeParmName(d2dParmName);
String levelName = GridTranslator.getShortLevelName(level String gfeLevel = getGFELevel(d2dLevel);
.getMasterLevel().getName(), level.getLevelonevalue(), level if (gfeLevel == null) {
.getLeveltwovalue()); statusHandler.warn("No GFE level found for D2D model: "
+ d2dModelName + " D2D parm: " + d2dParmName
+ " D2D level:" + d2dLevel + " GFE model: "
+ dbId.getModelName() + " GFE parm: " + gfeParmName
+ ". Check gfeLevelMapping and parameterInfo files.");
return null;
}
D2DParm parm = d2dParms.get(compositeName(gfeParmName, levelName)); D2DParm parm = d2dParms.get(compositeName(gfeParmName, gfeLevel));
if (parm == null) { if (parm == null) {
// try to find one with duration (XXXnnhr) // try to find one with duration (XXXnnhr)
Matcher matcher = parmHrPattern.matcher(d2dParmName); Matcher matcher = parmHrPattern.matcher(d2dParmName);
if (matcher.find()) { if (matcher.find()) {
String abbrev = matcher.group(1); String abbrev = matcher.group(1);
gfeParmName = getGfeParmName(abbrev); gfeParmName = getGfeParmName(abbrev);
parm = d2dParms.get(compositeName(gfeParmName, levelName)); parm = d2dParms.get(compositeName(gfeParmName, gfeLevel));
} }
} }
if (parm == null) { if (parm == null) {
statusHandler.warn("No gridParameterInfo found for " statusHandler.warn("No gridParameterInfo found for "
+ compositeName(gfeParmName, levelName) + ":" + compositeName(gfeParmName, gfeLevel) + ":"
+ dbId.getModelId() + ". Check parameterInfo file."); + dbId.getModelId() + ". Check parameterInfo file.");
} }
@ -1214,6 +1226,18 @@ public class D2DGridDatabase extends VGridDatabase {
return gfeParmName; return gfeParmName;
} }
public String getD2DParmName(String gfeParmName) {
String d2dParmName = null;
try {
d2dParmName = ParameterMapper.getInstance().lookupBaseName(
gfeParmName, "gfeParamName");
} catch (MultipleMappingException e) {
statusHandler.handle(Priority.WARN, e.getLocalizedMessage(), e);
d2dParmName = e.getArbitraryMapping();
}
return d2dParmName;
}
public TimeRange getTimeRange(ParmID parmID, Integer fcstHour) { public TimeRange getTimeRange(ParmID parmID, Integer fcstHour) {
D2DParm parm = this.gfeParms.get(parmID); D2DParm parm = this.gfeParms.get(parmID);
if (parm == null) { if (parm == null) {
@ -1227,4 +1251,38 @@ public class D2DGridDatabase extends VGridDatabase {
private String compositeName(String parmName, String level) { private String compositeName(String parmName, String level) {
return parmName + "_" + level; return parmName + "_" + level;
} }
private static Level getD2DLevel(String gfeLevel) {
List<Level> levels;
try {
levels = LevelMappingFactory.getInstance(GFE_LEVEL_MAPPING_FILE)
.getLevelMappingForKey(gfeLevel).getLevels();
} catch (CommunicationException e) {
levels = Collections.emptyList();
}
Level level = null;
if (levels.isEmpty()) {
statusHandler.warn("No D2D level found for: " + gfeLevel);
} else {
level = levels.get(0);
}
return level;
}
private static String getGFELevel(Level d2dLevel) {
LevelMapping levelMapping;
try {
levelMapping = LevelMappingFactory.getInstance(
GFE_LEVEL_MAPPING_FILE).getLevelMappingForLevel(d2dLevel);
} catch (CommunicationException e) {
levelMapping = null;
}
String gfeLevel = null;
if (levelMapping != null) {
gfeLevel = levelMapping.getKey();
}
return gfeLevel;
}
} }

View file

@ -78,6 +78,8 @@ import com.raytheon.uf.edex.core.EDEXUtil;
* SectorId and PhysicalElement. * SectorId and PhysicalElement.
* Mar 20, 2013 #1774 randerso Refactor to use grid durations from D2DGridDatabase * Mar 20, 2013 #1774 randerso Refactor to use grid durations from D2DGridDatabase
* Apr 01, 2013 #1774 randerso Moved wind component checking to GfeIngestNotificaionFilter * Apr 01, 2013 #1774 randerso Moved wind component checking to GfeIngestNotificaionFilter
* Apr 04, 2013 #1787 randerso Added null check to prevent log spamming for parameters
* not included in the parameter info file
* *
* </pre> * </pre>
* *

View file

@ -1,251 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.gfe.util;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Pattern;
import com.raytheon.uf.common.dataplugin.level.Level;
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
/**
* Singleton that assists with grid data
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 5, 2008 njensen Initial creation
* Aug 22, 2008 1502 dglazesk Changed to JAXB unmarshalling
* Dec 06, 2012 1394 rjpeter Attend static compiled patterns.
* </pre>
*
* @author njensen
* @version 1.0
*/
public class GridTranslator {
private static final List<String> NEEDS_ZERO = Arrays.asList("BLD", "WBZ");
private static final Pattern ANY_NUMBER = Pattern.compile("[0-9]");
private static final Pattern NOT_NUMBER = Pattern.compile("[^0-9]");
private GridTranslator() {
}
public static String getLevelName(String shorthand) {
return ANY_NUMBER.matcher(shorthand).replaceAll("");
}
public static double[] getLevelValue(String shorthand) {
String levelString = NOT_NUMBER.matcher(shorthand).replaceAll("");
int length = levelString.length();
double[] retVal = new double[2];
retVal[0] = Level.getInvalidLevelValue();
retVal[1] = Level.getInvalidLevelValue();
switch (length) {
case 0:
retVal[0] = 0.0;
break;
case 1:
case 2:
retVal[0] = Double.parseDouble(levelString);
break;
case 3:
if (levelString.charAt(0) != '0') {
retVal[0] = Double.parseDouble(levelString);
} else {
retVal[1] = Double.parseDouble(levelString);
if (levelString.charAt(0) == '0') {
retVal[0] = 0.0;
}
}
break;
case 4:
if (levelString.charAt(0) == '0') {
retVal[0] = 0.0;
retVal[1] = Double.parseDouble(levelString);
} else if (levelString.charAt(0) == '1') {
retVal[0] = Double.parseDouble(levelString);
} else {
retVal[0] = Double.parseDouble(levelString.substring(0, 2));
retVal[1] = Double.parseDouble(levelString.substring(2, 4));
}
break;
case 5:
retVal[0] = Double.parseDouble(levelString.substring(0, 2));
retVal[1] = Double.parseDouble(levelString.substring(2, 5));
break;
case 6:
retVal[0] = Double.parseDouble(levelString.substring(0, 3));
retVal[1] = Double.parseDouble(levelString.substring(3, 6));
break;
case 7:
retVal[0] = Double.parseDouble(levelString.substring(0, 4));
retVal[1] = Double.parseDouble(levelString.substring(4, 7));
break;
case 8:
retVal[0] = Double.parseDouble(levelString.substring(0, 4));
retVal[1] = Double.parseDouble(levelString.substring(4, 8));
break;
default:
break;
}
return retVal;
}
/**
* Formats short level name in GFE format
*
* @param name
* @param levelOne
* @param levelTwo
* @return short level name
*/
public static String getShortLevelName(String name, double levelOne,
double levelTwo) {
StringBuilder tmp = new StringBuilder();
if (name == null) {
tmp.append(LevelFactory.UNKNOWN_LEVEL);
} else {
tmp.append(name);
if ((levelOne != Level.getInvalidLevelValue())
&& ((levelOne != 0)
|| (levelTwo != Level.getInvalidLevelValue()) || NEEDS_ZERO
.contains(name))) {
tmp.append(String.valueOf(Math.round(levelOne)));
}
if (levelTwo != Level.getInvalidLevelValue()) {
tmp.append(String.valueOf(Math.round(levelTwo)));
}
}
return tmp.toString();
}
public static void main(String[] args) {
double[] testLevelsBL = { 0, 30, 60, 90, 120, 150, 180, -999999 };
double[] testLevelsMB = { 1100, 1050, 1000, 950, 900, 850, 800, 750,
700, 650, 600, 550, 500, 450, 400, 350, 300, 250, 200, 150,
100, -999999 };
String levelName;
String level;
double[] levels;
double l1, l2;
levelName = "BL";
for (int i = 0; i < testLevelsBL.length; i++) {
l1 = testLevelsBL[i];
for (int j = i + 1; j < testLevelsBL.length; j++) {
l2 = testLevelsBL[j];
level = GridTranslator.getShortLevelName(levelName, l1, l2);
levels = GridTranslator.getLevelValue(level);
System.out.println(levelName
+ " "
+ l1
+ " "
+ l2
+ ": "
+ level
+ " "
+ Arrays.toString(levels)
+ ((l1 == levels[0]) && (l2 == levels[1]) ? " passed"
: " failed"));
}
}
levelName = "MB";
for (int i = 0; i < testLevelsMB.length; i++) {
l1 = testLevelsMB[i];
for (int j = i + 1; j < testLevelsMB.length; j++) {
l2 = testLevelsMB[j];
level = GridTranslator.getShortLevelName(levelName, l1, l2);
levels = GridTranslator.getLevelValue(level);
System.out.println(levelName
+ " "
+ l1
+ " "
+ l2
+ ": "
+ level
+ " "
+ Arrays.toString(levels)
+ ((l1 == levels[0]) && (l2 == levels[1]) ? " passed"
: " failed"));
}
}
levelName = "SFC";
l1 = 0;
l2 = -999999;
level = GridTranslator.getShortLevelName(levelName, l1, l2);
levels = GridTranslator.getLevelValue(level);
System.out.println(levelName
+ " "
+ l1
+ " "
+ l2
+ ": "
+ level
+ " "
+ Arrays.toString(levels)
+ ((l1 == levels[0]) && (l2 == levels[1]) ? " passed"
: " failed"));
levelName = "BLD";
l1 = 0;
l2 = -999999;
level = GridTranslator.getShortLevelName(levelName, l1, l2);
levels = GridTranslator.getLevelValue(level);
System.out.println(levelName
+ " "
+ l1
+ " "
+ l2
+ ": "
+ level
+ " "
+ Arrays.toString(levels)
+ ((l1 == levels[0]) && (l2 == levels[1]) ? " passed"
: " failed"));
levelName = "WBZ";
l1 = 0;
l2 = -999999;
level = GridTranslator.getShortLevelName(levelName, l1, l2);
levels = GridTranslator.getLevelValue(level);
System.out.println(levelName
+ " "
+ l1
+ " "
+ l2
+ ": "
+ level
+ " "
+ Arrays.toString(levels)
+ ((l1 == levels[0]) && (l2 == levels[1]) ? " passed"
: " failed"));
}
}

View file

@ -0,0 +1,462 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<LevelMappings>
<Level key="BL030">
<DatabaseLevel levelName="BL" levelOneValue="0.0" levelTwoValue="30.0" unit="hPa"/>
</Level>
<Level key="BL0180">
<DatabaseLevel levelName="BL" levelOneValue="0.0" levelTwoValue="180.0" unit="hPa"/>
</Level>
<Level key="BL0255">
<DatabaseLevel levelName="BL" levelOneValue="0.0" levelTwoValue="255.0" unit="hPa"/>
</Level>
<Level key="BL3060">
<DatabaseLevel levelName="BL" levelOneValue="30.0" levelTwoValue="60.0" unit="hPa"/>
</Level>
<Level key="BL6090">
<DatabaseLevel levelName="BL" levelOneValue="60.0" levelTwoValue="90.0" unit="hPa"/>
</Level>
<Level key="BL90120">
<DatabaseLevel levelName="BL" levelOneValue="90.0" levelTwoValue="120.0" unit="hPa"/>
</Level>
<Level key="BL120150">
<DatabaseLevel levelName="BL" levelOneValue="120.0" levelTwoValue="150.0" unit="hPa"/>
</Level>
<Level key="BL150180">
<DatabaseLevel levelName="BL" levelOneValue="150.0" levelTwoValue="180.0" unit="hPa"/>
</Level>
<Level key="BLD0">
<DatabaseLevel levelName="BLD" levelOneValue="0.0"/>
</Level>
<Level key="BLS">
<DatabaseLevel levelName="BLS" levelOneValue="0.0" unit="m"/>
</Level>
<Level key="BLS1">
<DatabaseLevel levelName="BLS" levelOneValue="1.0" unit="m"/>
</Level>
<Level key="BLS2">
<DatabaseLevel levelName="BLS" levelOneValue="2.0" unit="m"/>
</Level>
<Level key="BLS3">
<DatabaseLevel levelName="BLS" levelOneValue="3.0" unit="m"/>
</Level>
<Level key="CBL">
<DatabaseLevel levelName="CBL" levelOneValue="0.0"/>
</Level>
<Level key="CCTL">
<DatabaseLevel levelName="CCTL" levelOneValue="0.0"/>
</Level>
<Level key="CLG">
<DatabaseLevel levelName="CLG" levelOneValue="0.0"/>
</Level>
<Level key="CTL">
<DatabaseLevel levelName="CTL" levelOneValue="0.0"/>
</Level>
<Level key="Dflt">
<DatabaseLevel levelName="Dflt" levelOneValue="0.0"/>
</Level>
<Level key="EA">
<DatabaseLevel levelName="EA" levelOneValue="0.0"/>
</Level>
<Level key="EL">
<DatabaseLevel levelName="EL" levelOneValue="0.0"/>
</Level>
<Level key="FH10">
<DatabaseLevel levelName="FH" levelOneValue="10.0" unit="m"/>
</Level>
<Level key="FH304">
<DatabaseLevel levelName="FH" levelOneValue="304.0" unit="m"/>
</Level>
<Level key="FH305">
<DatabaseLevel levelName="FH" levelOneValue="305.0" unit="m"/>
</Level>
<Level key="FH609">
<DatabaseLevel levelName="FH" levelOneValue="609.0" unit="m"/>
</Level>
<Level key="FH610">
<DatabaseLevel levelName="FH" levelOneValue="610.0" unit="m"/>
</Level>
<Level key="FH914">
<DatabaseLevel levelName="FH" levelOneValue="914.0" unit="m"/>
</Level>
<Level key="FH1219">
<DatabaseLevel levelName="FH" levelOneValue="1219.0" unit="m"/>
</Level>
<Level key="FH1500">
<DatabaseLevel levelName="FH" levelOneValue="1500.0" unit="m"/>
</Level>
<Level key="FH1524">
<DatabaseLevel levelName="FH" levelOneValue="1524.0" unit="m"/>
</Level>
<Level key="FH1828">
<DatabaseLevel levelName="FH" levelOneValue="1828.0" unit="m"/>
</Level>
<Level key="FH1829">
<DatabaseLevel levelName="FH" levelOneValue="1829.0" unit="m"/>
</Level>
<Level key="FH2133">
<DatabaseLevel levelName="FH" levelOneValue="2133.0" unit="m"/>
</Level>
<Level key="FH2134">
<DatabaseLevel levelName="FH" levelOneValue="2134.0" unit="m"/>
</Level>
<Level key="FH2438">
<DatabaseLevel levelName="FH" levelOneValue="2438.0" unit="m"/>
</Level>
<Level key="FH2743">
<DatabaseLevel levelName="FH" levelOneValue="2743.0" unit="m"/>
</Level>
<Level key="FH3048">
<DatabaseLevel levelName="FH" levelOneValue="3048.0" unit="m"/>
</Level>
<Level key="FH3352">
<DatabaseLevel levelName="FH" levelOneValue="3352.0" unit="m"/>
</Level>
<Level key="FH3353">
<DatabaseLevel levelName="FH" levelOneValue="3353.0" unit="m"/>
</Level>
<Level key="FH3657">
<DatabaseLevel levelName="FH" levelOneValue="3657.0" unit="m"/>
</Level>
<Level key="FH3658">
<DatabaseLevel levelName="FH" levelOneValue="3658.0" unit="m"/>
</Level>
<Level key="FH3962">
<DatabaseLevel levelName="FH" levelOneValue="3962.0" unit="m"/>
</Level>
<Level key="FH4267">
<DatabaseLevel levelName="FH" levelOneValue="4267.0" unit="m"/>
</Level>
<Level key="FH4572">
<DatabaseLevel levelName="FH" levelOneValue="4572.0" unit="m"/>
</Level>
<Level key="FH4876">
<DatabaseLevel levelName="FH" levelOneValue="4876.0" unit="m"/>
</Level>
<Level key="FH4877">
<DatabaseLevel levelName="FH" levelOneValue="4877.0" unit="m"/>
</Level>
<Level key="FH5181">
<DatabaseLevel levelName="FH" levelOneValue="5181.0" unit="m"/>
</Level>
<Level key="FH5182">
<DatabaseLevel levelName="FH" levelOneValue="5182.0" unit="m"/>
</Level>
<Level key="FH5486">
<DatabaseLevel levelName="FH" levelOneValue="5486.0" unit="m"/>
</Level>
<Level key="FH5791">
<DatabaseLevel levelName="FH" levelOneValue="5791.0" unit="m"/>
</Level>
<Level key="FH6400">
<DatabaseLevel levelName="FH" levelOneValue="6400.0" unit="m"/>
</Level>
<Level key="FH6096">
<DatabaseLevel levelName="FH" levelOneValue="6096.0" unit="m"/>
</Level>
<Level key="FH6401">
<DatabaseLevel levelName="FH" levelOneValue="6401.0" unit="m"/>
</Level>
<Level key="FH6705">
<DatabaseLevel levelName="FH" levelOneValue="6705.0" unit="m"/>
</Level>
<Level key="FH6706">
<DatabaseLevel levelName="FH" levelOneValue="6706.0" unit="m"/>
</Level>
<Level key="FH7010">
<DatabaseLevel levelName="FH" levelOneValue="7010.0" unit="m"/>
</Level>
<Level key="FH7315">
<DatabaseLevel levelName="FH" levelOneValue="7315.0" unit="m"/>
</Level>
<Level key="FH7620">
<DatabaseLevel levelName="FH" levelOneValue="7620.0" unit="m"/>
</Level>
<Level key="FH7924">
<DatabaseLevel levelName="FH" levelOneValue="7924.0" unit="m"/>
</Level>
<Level key="FH7925">
<DatabaseLevel levelName="FH" levelOneValue="7925.0" unit="m"/>
</Level>
<Level key="FH8229">
<DatabaseLevel levelName="FH" levelOneValue="8229.0" unit="m"/>
</Level>
<Level key="FH8230">
<DatabaseLevel levelName="FH" levelOneValue="8230.0" unit="m"/>
</Level>
<Level key="FH8534">
<DatabaseLevel levelName="FH" levelOneValue="8534.0" unit="m"/>
</Level>
<Level key="FH8839">
<DatabaseLevel levelName="FH" levelOneValue="8839.0" unit="m"/>
</Level>
<Level key="FH9144">
<DatabaseLevel levelName="FH" levelOneValue="9144.0" unit="m"/>
</Level>
<Level key="FH9448">
<DatabaseLevel levelName="FH" levelOneValue="9448.0" unit="m"/>
</Level>
<Level key="FH9753">
<DatabaseLevel levelName="FH" levelOneValue="9753.0" unit="m"/>
</Level>
<Level key="FH10058">
<DatabaseLevel levelName="FH" levelOneValue="10058.0" unit="m"/>
</Level>
<Level key="FH10363">
<DatabaseLevel levelName="FH" levelOneValue="10363.0" unit="m"/>
</Level>
<Level key="FH10668">
<DatabaseLevel levelName="FH" levelOneValue="10668.0" unit="m"/>
</Level>
<Level key="FH10972">
<DatabaseLevel levelName="FH" levelOneValue="10972.0" unit="m"/>
</Level>
<Level key="FH11277">
<DatabaseLevel levelName="FH" levelOneValue="11227.0" unit="m"/>
</Level>
<Level key="FH11582">
<DatabaseLevel levelName="FH" levelOneValue="11582.0" unit="m"/>
</Level>
<Level key="FH11887">
<DatabaseLevel levelName="FH" levelOneValue="11887.0" unit="m"/>
</Level>
<Level key="FH12192">
<DatabaseLevel levelName="FH" levelOneValue="12192.0" unit="m"/>
</Level>
<Level key="FH12496">
<DatabaseLevel levelName="FH" levelOneValue="12496.0" unit="m"/>
</Level>
<Level key="FH12801">
<DatabaseLevel levelName="FH" levelOneValue="12801.0" unit="m"/>
</Level>
<Level key="FH13106">
<DatabaseLevel levelName="FH" levelOneValue="13106.0" unit="m"/>
</Level>
<Level key="FH13411">
<DatabaseLevel levelName="FH" levelOneValue="13411.0" unit="m"/>
</Level>
<Level key="FH13716">
<DatabaseLevel levelName="FH" levelOneValue="13716.0" unit="m"/>
</Level>
<Level key="FHAG2">
<DatabaseLevel levelName="FHAG" levelOneValue="2.0" unit="m"/>
</Level>
<Level key="FHAG10">
<DatabaseLevel levelName="FHAG" levelOneValue="10.0" unit="m"/>
</Level>
<Level key="FHAG1000">
<DatabaseLevel levelName="FHAG" levelOneValue="1000.0" unit="m"/>
</Level>
<Level key="FHAG4000">
<DatabaseLevel levelName="FHAG" levelOneValue="4000.0" unit="m"/>
</Level>
<Level key="FHAG030">
<DatabaseLevel levelName="FHAG" levelOneValue="0.0" levelTwoValue="30.0" unit="m"/>
</Level>
<Level key="FHAG3000">
<DatabaseLevel levelName="FHAG" levelOneValue="0.0" levelTwoValue="3000.0" unit="m"/>
</Level>
<Level key="FHAG6000">
<DatabaseLevel levelName="FHAG" levelOneValue="0.0" levelTwoValue="6000.0" unit="m"/>
</Level>
<Level key="FRZ">
<DatabaseLevel levelName="FRZ" levelOneValue="0.0"/>
</Level>
<Level key="HCBL">
<DatabaseLevel levelName="HCBL" levelOneValue="0.0"/>
</Level>
<Level key="HYB1">
<DatabaseLevel levelName="HYB" levelOneValue="1.0"/>
</Level>
<Level key="LCBL">
<DatabaseLevel levelName="LCBL" levelOneValue="0.0"/>
</Level>
<Level key="LCL">
<DatabaseLevel levelName="LCL" levelOneValue="0.0"/>
</Level>
<Level key="MAXW">
<DatabaseLevel levelName="MAXW" levelOneValue="0.0"/>
</Level>
<Level key="MB50">
<DatabaseLevel levelName="MB" levelOneValue="50.0" unit="hPa"/>
</Level>
<Level key="MB100">
<DatabaseLevel levelName="MB" levelOneValue="100.0" unit="hPa"/>
</Level>
<Level key="MB125">
<DatabaseLevel levelName="MB" levelOneValue="125.0" unit="hPa"/>
</Level>
<Level key="MB150">
<DatabaseLevel levelName="MB" levelOneValue="150.0" unit="hPa"/>
</Level>
<Level key="MB175">
<DatabaseLevel levelName="MB" levelOneValue="175.0" unit="hPa"/>
</Level>
<Level key="MB200">
<DatabaseLevel levelName="MB" levelOneValue="200.0" unit="hPa"/>
</Level>
<Level key="MB225">
<DatabaseLevel levelName="MB" levelOneValue="225.0" unit="hPa"/>
</Level>
<Level key="MB250">
<DatabaseLevel levelName="MB" levelOneValue="250.0" unit="hPa"/>
</Level>
<Level key="MB275">
<DatabaseLevel levelName="MB" levelOneValue="275.0" unit="hPa"/>
</Level>
<Level key="MB300">
<DatabaseLevel levelName="MB" levelOneValue="300.0" unit="hPa"/>
</Level>
<Level key="MB325">
<DatabaseLevel levelName="MB" levelOneValue="325.0" unit="hPa"/>
</Level>
<Level key="MB350">
<DatabaseLevel levelName="MB" levelOneValue="350.0" unit="hPa"/>
</Level>
<Level key="MB375">
<DatabaseLevel levelName="MB" levelOneValue="375.0" unit="hPa"/>
</Level>
<Level key="MB400">
<DatabaseLevel levelName="MB" levelOneValue="400.0" unit="hPa"/>
</Level>
<Level key="MB425">
<DatabaseLevel levelName="MB" levelOneValue="425.0" unit="hPa"/>
</Level>
<Level key="MB450">
<DatabaseLevel levelName="MB" levelOneValue="450.0" unit="hPa"/>
</Level>
<Level key="MB475">
<DatabaseLevel levelName="MB" levelOneValue="475.0" unit="hPa"/>
</Level>
<Level key="MB500">
<DatabaseLevel levelName="MB" levelOneValue="500.0" unit="hPa"/>
</Level>
<Level key="MB525">
<DatabaseLevel levelName="MB" levelOneValue="525.0" unit="hPa"/>
</Level>
<Level key="MB550">
<DatabaseLevel levelName="MB" levelOneValue="550.0" unit="hPa"/>
</Level>
<Level key="MB575">
<DatabaseLevel levelName="MB" levelOneValue="575.0" unit="hPa"/>
</Level>
<Level key="MB600">
<DatabaseLevel levelName="MB" levelOneValue="600.0" unit="hPa"/>
</Level>
<Level key="MB625">
<DatabaseLevel levelName="MB" levelOneValue="625.0" unit="hPa"/>
</Level>
<Level key="MB650">
<DatabaseLevel levelName="MB" levelOneValue="650.0" unit="hPa"/>
</Level>
<Level key="MB675">
<DatabaseLevel levelName="MB" levelOneValue="675.0" unit="hPa"/>
</Level>
<Level key="MB700">
<DatabaseLevel levelName="MB" levelOneValue="700.0" unit="hPa"/>
</Level>
<Level key="MB725">
<DatabaseLevel levelName="MB" levelOneValue="725.0" unit="hPa"/>
</Level>
<Level key="MB750">
<DatabaseLevel levelName="MB" levelOneValue="750.0" unit="hPa"/>
</Level>
<Level key="MB775">
<DatabaseLevel levelName="MB" levelOneValue="775.0" unit="hPa"/>
</Level>
<Level key="MB800">
<DatabaseLevel levelName="MB" levelOneValue="800.0" unit="hPa"/>
</Level>
<Level key="MB825">
<DatabaseLevel levelName="MB" levelOneValue="825.0" unit="hPa"/>
</Level>
<Level key="MB850">
<DatabaseLevel levelName="MB" levelOneValue="850.0" unit="hPa"/>
</Level>
<Level key="MB875">
<DatabaseLevel levelName="MB" levelOneValue="875.0" unit="hPa"/>
</Level>
<Level key="MB900">
<DatabaseLevel levelName="MB" levelOneValue="900.0" unit="hPa"/>
</Level>
<Level key="MB925">
<DatabaseLevel levelName="MB" levelOneValue="925.0" unit="hPa"/>
</Level>
<Level key="MB950">
<DatabaseLevel levelName="MB" levelOneValue="950.0" unit="hPa"/>
</Level>
<Level key="MB975">
<DatabaseLevel levelName="MB" levelOneValue="975.0" unit="hPa"/>
</Level>
<Level key="MB1000">
<DatabaseLevel levelName="MB" levelOneValue="1000.0" unit="hPa"/>
</Level>
<Level key="MB1025">
<DatabaseLevel levelName="MB" levelOneValue="1025.0" unit="hPa"/>
</Level>
<Level key="MB1050">
<DatabaseLevel levelName="MB" levelOneValue="1050.0" unit="hPa"/>
</Level>
<Level key="MB1100">
<DatabaseLevel levelName="MB" levelOneValue="1100.0" unit="hPa"/>
</Level>
<Level key="MB50100">
<DatabaseLevel levelName="MB" levelOneValue="1000.0" levelTwoValue="500.0" unit="hPa"/>
</Level>
<Level key="MB0500">
<DatabaseLevel levelName="MB" levelOneValue="1000.0" levelTwoValue="500.0" unit="hPa"/>
</Level>
<Level key="MCBL">
<DatabaseLevel levelName="MCBL" levelOneValue="0.0"/>
</Level>
<Level key="MSL">
<DatabaseLevel levelName="MSL" levelOneValue="0.0"/>
</Level>
<Level key="OSEQD1">
<DatabaseLevel levelName="OSEQD" levelOneValue="1.0"/>
</Level>
<Level key="OSEQD2">
<DatabaseLevel levelName="OSEQD" levelOneValue="2.0"/>
</Level>
<Level key="PV5">
<DatabaseLevel levelName="PV" levelOneValue="0.5" unit="K * m^2/kg*s * 1000000"/>
</Level>
<Level key="PV10">
<DatabaseLevel levelName="PV" levelOneValue="1.0" unit="K * m^2/kg*s * 1000000"/>
</Level>
<Level key="PV15">
<DatabaseLevel levelName="PV" levelOneValue="1.5" unit="K * m^2/kg*s * 1000000"/>
</Level>
<Level key="PV20">
<DatabaseLevel levelName="PV" levelOneValue="2.0" unit="K * m^2/kg*s * 1000000"/>
</Level>
<Level key="SFC">
<DatabaseLevel levelName="SFC" levelOneValue="0.0"/>
</Level>
<Level key="SIG0100">
<DatabaseLevel levelName="SIG" levelOneValue="0.0" levelTwoValue="1.0"/>
</Level>
<Level key="SIG9823">
<DatabaseLevel levelName="SIG" levelOneValue="0.23" levelTwoValue="0.98"/>
</Level>
<Level key="SIG33100">
<DatabaseLevel levelName="SIG" levelOneValue="0.33" levelTwoValue="1.0"/>
</Level>
<Level key="SIG44100">
<DatabaseLevel levelName="SIG" levelOneValue="0.44" levelTwoValue="1.0"/>
</Level>
<Level key="SIG47100">
<DatabaseLevel levelName="SIG" levelOneValue="0.47" levelTwoValue="1.0"/>
</Level>
<Level key="SIG8498">
<DatabaseLevel levelName="SIG" levelOneValue="0.84" levelTwoValue="0.98"/>
</Level>
<Level key="TROP">
<DatabaseLevel levelName="TROP" levelOneValue="0.0"/>
</Level>
<Level key="TW0">
<DatabaseLevel levelName="TW0" levelOneValue="0.0"/>
</Level>
<Level key="WBZ0">
<DatabaseLevel levelName="WBZ" levelOneValue="0.0"/>
</Level>
</LevelMappings>

View file

@ -1,4 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!--
REVISION HISTORY
Date Ticket# Engineer Description
04/17/2013 #1913 randerso Corrected level for SLI
-->
<gridParamInfo xmlns:ns2="group"> <gridParamInfo xmlns:ns2="group">
<valtimeMINUSreftime> <valtimeMINUSreftime>
<fcst>0</fcst> <fcst>0</fcst>
@ -445,9 +451,9 @@
<valid_range>20.0</valid_range> <valid_range>20.0</valid_range>
<fillValue>-99999.0</fillValue> <fillValue>-99999.0</fillValue>
<n3D>0</n3D> <n3D>0</n3D>
<levelsDesc>MB 0&gt;500</levelsDesc> <levelsDesc>SFC</levelsDesc>
<levels> <levels>
<level>MB0500</level> <level>SFC</level>
</levels> </levels>
</gridParameterInfo> </gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo"> <gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">

View file

@ -1,4 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!--
REVISION HISTORY
Date Ticket# Engineer Description
04/17/2013 #1913 randerso Corrected level for SLI
-->
<gridParamInfo xmlns:ns2="group"> <gridParamInfo xmlns:ns2="group">
<valtimeMINUSreftime> <valtimeMINUSreftime>
<fcst>0</fcst> <fcst>0</fcst>
@ -445,9 +451,9 @@
<valid_range>20.0</valid_range> <valid_range>20.0</valid_range>
<fillValue>-99999.0</fillValue> <fillValue>-99999.0</fillValue>
<n3D>0</n3D> <n3D>0</n3D>
<levelsDesc>MB 0&gt;500</levelsDesc> <levelsDesc>SFC</levelsDesc>
<levels> <levels>
<level>MB0500</level> <level>SFC</level>
</levels> </levels>
</gridParameterInfo> </gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo"> <gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">

View file

@ -1,4 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!--
REVISION HISTORY
Date Ticket# Engineer Description
04/17/2013 #1913 randerso Corrected level for SLI
-->
<gridParamInfo xmlns:ns2="group"> <gridParamInfo xmlns:ns2="group">
<valtimeMINUSreftime> <valtimeMINUSreftime>
<fcst>0</fcst> <fcst>0</fcst>
@ -275,9 +281,9 @@
<valid_range>20.0</valid_range> <valid_range>20.0</valid_range>
<fillValue>-99999.0</fillValue> <fillValue>-99999.0</fillValue>
<n3D>0</n3D> <n3D>0</n3D>
<levelsDesc>MB 0&gt;500</levelsDesc> <levelsDesc>SFC</levelsDesc>
<levels> <levels>
<level>MB0500</level> <level>SFC</level>
</levels> </levels>
</gridParameterInfo> </gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo"> <gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">

View file

@ -1,4 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!--
REVISION HISTORY
Date Ticket# Engineer Description
04/17/2013 #1913 randerso Corrected level for SLI
-->
<gridParamInfo xmlns:ns2="group"> <gridParamInfo xmlns:ns2="group">
<valtimeMINUSreftime> <valtimeMINUSreftime>
<fcst>0</fcst> <fcst>0</fcst>
@ -445,9 +451,9 @@
<valid_range>20.0</valid_range> <valid_range>20.0</valid_range>
<fillValue>-99999.0</fillValue> <fillValue>-99999.0</fillValue>
<n3D>0</n3D> <n3D>0</n3D>
<levelsDesc>MB 0&gt;500</levelsDesc> <levelsDesc>SFC</levelsDesc>
<levels> <levels>
<level>MB0500</level> <level>SFC</level>
</levels> </levels>
</gridParameterInfo> </gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo"> <gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">

View file

@ -1,6 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Mar 20, 2013 #1774 randerso Fixed wx definition REVISION HISTORY
Date Ticket# Engineer Description
03/20/2013 #1774 randerso Fixed wx definition
04/17/2013 #1913 randerso Corrected wx units
--> -->
<gridParamInfo xmlns:ns2="group"> <gridParamInfo xmlns:ns2="group">
<valtimeMINUSreftime> <valtimeMINUSreftime>
@ -129,7 +133,7 @@
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo"> <gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>wx</short_name> <short_name>wx</short_name>
<long_name>Weather</long_name> <long_name>Weather</long_name>
<units/> <units>wx</units>
<udunits/> <udunits/>
<uiname>Weather</uiname> <uiname>Weather</uiname>
<valid_range>0.0</valid_range> <valid_range>0.0</valid_range>

View file

@ -1,358 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<gridParamInfo xmlns:ns2="group">
<valtimeMINUSreftime>
<fcst>0</fcst>
<fcst>21600</fcst>
<fcst>43200</fcst>
<fcst>64800</fcst>
<fcst>86400</fcst>
<fcst>108000</fcst>
<fcst>129600</fcst>
<fcst>151200</fcst>
<fcst>172800</fcst>
</valtimeMINUSreftime>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>vw</short_name>
<long_name>v wind component</long_name>
<units>m/s</units>
<udunits>meter/sec</udunits>
<uiname>vWind</uiname>
<valid_range>-150.0</valid_range>
<valid_range>150.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>21</n3D>
<levelsDesc>SIG 9823 MB 1000-50 by 50 FH 1829 2743 3658 TROP</levelsDesc>
<levels>
<level>SIG9823</level>
<level>MB1000</level>
<level>MB950</level>
<level>MB900</level>
<level>MB850</level>
<level>MB800</level>
<level>MB750</level>
<level>MB700</level>
<level>MB650</level>
<level>MB600</level>
<level>MB550</level>
<level>MB500</level>
<level>MB450</level>
<level>MB400</level>
<level>MB350</level>
<level>MB300</level>
<level>MB250</level>
<level>MB200</level>
<level>MB150</level>
<level>MB100</level>
<level>MB50</level>
<level>FH1829</level>
<level>FH2743</level>
<level>FH3658</level>
<level>TROP</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>staticSpacing</short_name>
<long_name>Grid spacing</long_name>
<units>meters</units>
<fillValue>-99999.0</fillValue>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>tp</short_name>
<long_name>total precipitation</long_name>
<units>mm</units>
<udunits>millimeter</udunits>
<uiname>totPrecip</uiname>
<valid_range>0.0</valid_range>
<valid_range>1000.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>SFC</levelsDesc>
<levels>
<level>SFC</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>av</short_name>
<long_name>absolute vorticity</long_name>
<units>/s</units>
<udunits>1/second</udunits>
<uiname>absVort</uiname>
<valid_range>-0.00999999977648</valid_range>
<valid_range>0.00999999977648</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>4</n3D>
<levelsDesc>MB 850 700 500 250</levelsDesc>
<levels>
<level>MB850</level>
<level>MB700</level>
<level>MB500</level>
<level>MB250</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>gh</short_name>
<long_name>Geopotential height</long_name>
<units>m</units>
<udunits>meters</udunits>
<uiname>geoPotHt</uiname>
<valid_range>-2000.0</valid_range>
<valid_range>20000.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>20</n3D>
<levelsDesc>MB 1000-50 by 50</levelsDesc>
<levels>
<level>MB1000</level>
<level>MB950</level>
<level>MB900</level>
<level>MB850</level>
<level>MB800</level>
<level>MB750</level>
<level>MB700</level>
<level>MB650</level>
<level>MB600</level>
<level>MB550</level>
<level>MB500</level>
<level>MB450</level>
<level>MB400</level>
<level>MB350</level>
<level>MB300</level>
<level>MB250</level>
<level>MB200</level>
<level>MB150</level>
<level>MB100</level>
<level>MB50</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>pw</short_name>
<long_name>precipitable water</long_name>
<units>mm</units>
<udunits>millimeter</udunits>
<uiname>precipH2O</uiname>
<valid_range>0.0</valid_range>
<valid_range>300.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>SIG 0&gt;100</levelsDesc>
<levels>
<level>SIG0100</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>bli</short_name>
<long_name>Best lifted index</long_name>
<units>K</units>
<udunits>degree_Kelvin</udunits>
<uiname>bestLftInd</uiname>
<valid_range>-20.0</valid_range>
<valid_range>50.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>SIG 84&gt;98</levelsDesc>
<levels>
<level>SIG8498</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>staticCoriolis</short_name>
<long_name>Coriolis parameter</long_name>
<units>/s</units>
<fillValue>-99999.0</fillValue>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>rh</short_name>
<long_name>Relative Humidity</long_name>
<units>%</units>
<udunits>percent</udunits>
<uiname>rh</uiname>
<valid_range>0.0</valid_range>
<valid_range>100.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>21</n3D>
<levelsDesc>SIG 9823 MB 1000-50 by 50 SIG 47&gt;100</levelsDesc>
<levels>
<level>SIG9823</level>
<level>MB1000</level>
<level>MB950</level>
<level>MB900</level>
<level>MB850</level>
<level>MB800</level>
<level>MB750</level>
<level>MB700</level>
<level>MB650</level>
<level>MB600</level>
<level>MB550</level>
<level>MB500</level>
<level>MB450</level>
<level>MB400</level>
<level>MB350</level>
<level>MB300</level>
<level>MB250</level>
<level>MB200</level>
<level>MB150</level>
<level>MB100</level>
<level>MB50</level>
<level>SIG47100</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>sli</short_name>
<long_name>Surface lifted index</long_name>
<units>K</units>
<udunits>degree_Kelvin</udunits>
<uiname>LftInd</uiname>
<valid_range>-20.0</valid_range>
<valid_range>20.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>MB 50&gt;100</levelsDesc>
<levels>
<level>MB50100</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>snd</short_name>
<long_name>snow depth</long_name>
<units>m</units>
<udunits>meters</udunits>
<uiname>snowDepth</uiname>
<valid_range>0.0</valid_range>
<valid_range>100.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>SFC</levelsDesc>
<levels>
<level>SFC</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>staticTopo</short_name>
<long_name>Topography</long_name>
<units>meters</units>
<fillValue>-99999.0</fillValue>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>pmsl</short_name>
<long_name>pressure at mean sea level</long_name>
<units>Pa</units>
<udunits>pascal</udunits>
<uiname>PMSL</uiname>
<valid_range>80000.0</valid_range>
<valid_range>110000.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>MSL</levelsDesc>
<levels>
<level>MSL</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>uw</short_name>
<long_name>u wind component</long_name>
<units>m/s</units>
<udunits>meter/sec</udunits>
<uiname>uWind</uiname>
<valid_range>-150.0</valid_range>
<valid_range>150.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>21</n3D>
<levelsDesc>SIG 9823 MB 1000-50 by 50 FH 1829 2743 3658 TROP</levelsDesc>
<levels>
<level>SIG9823</level>
<level>MB1000</level>
<level>MB950</level>
<level>MB900</level>
<level>MB850</level>
<level>MB800</level>
<level>MB750</level>
<level>MB700</level>
<level>MB650</level>
<level>MB600</level>
<level>MB550</level>
<level>MB500</level>
<level>MB450</level>
<level>MB400</level>
<level>MB350</level>
<level>MB300</level>
<level>MB250</level>
<level>MB200</level>
<level>MB150</level>
<level>MB100</level>
<level>MB50</level>
<level>FH1829</level>
<level>FH2743</level>
<level>FH3658</level>
<level>TROP</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>st</short_name>
<long_name>soil temperature</long_name>
<units>K</units>
<udunits>degree_Kelvin</udunits>
<uiname>soilT</uiname>
<valid_range>0.0</valid_range>
<valid_range>1000.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>BLS</levelsDesc>
<levels>
<level>BLS</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>p</short_name>
<long_name>pressure</long_name>
<units>Pa</units>
<udunits>pascal</udunits>
<uiname>atmP</uiname>
<valid_range>0.0</valid_range>
<valid_range>110000.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>1</n3D>
<levelsDesc>SFC TROP</levelsDesc>
<levels>
<level>SFC</level>
<level>TROP</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>t</short_name>
<long_name>Temperature</long_name>
<units>K</units>
<udunits>degree_Kelvin</udunits>
<uiname>T</uiname>
<valid_range>180.0</valid_range>
<valid_range>330.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>21</n3D>
<levelsDesc>SIG 9823 MB 1000-50 by 50 FH 1829 2743 3658 TROP</levelsDesc>
<levels>
<level>SIG9823</level>
<level>MB1000</level>
<level>MB950</level>
<level>MB900</level>
<level>MB850</level>
<level>MB800</level>
<level>MB750</level>
<level>MB700</level>
<level>MB650</level>
<level>MB600</level>
<level>MB550</level>
<level>MB500</level>
<level>MB450</level>
<level>MB400</level>
<level>MB350</level>
<level>MB300</level>
<level>MB250</level>
<level>MB200</level>
<level>MB150</level>
<level>MB100</level>
<level>MB50</level>
<level>FH1829</level>
<level>FH2743</level>
<level>FH3658</level>
<level>TROP</level>
</levels>
</gridParameterInfo>
</gridParamInfo>

View file

@ -1,396 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<gridParamInfo xmlns:ns2="group">
<valtimeMINUSreftime>
<fcst>0</fcst>
<fcst>21600</fcst>
<fcst>43200</fcst>
<fcst>64800</fcst>
<fcst>86400</fcst>
<fcst>108000</fcst>
<fcst>129600</fcst>
<fcst>151200</fcst>
<fcst>172800</fcst>
</valtimeMINUSreftime>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>pvv</short_name>
<long_name>Pressure vertical velocity</long_name>
<units>Pa/s</units>
<udunits>pascal/second</udunits>
<uiname>Pvv</uiname>
<valid_range>-2.5</valid_range>
<valid_range>2.5</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>9</n3D>
<levelsDesc>MB 850 700 500 400 300 250 200 150 100</levelsDesc>
<levels>
<level>MB850</level>
<level>MB700</level>
<level>MB500</level>
<level>MB400</level>
<level>MB300</level>
<level>MB250</level>
<level>MB200</level>
<level>MB150</level>
<level>MB100</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>vw</short_name>
<long_name>v wind component</long_name>
<units>m/s</units>
<udunits>meter/sec</udunits>
<uiname>vWind</uiname>
<valid_range>-150.0</valid_range>
<valid_range>150.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>21</n3D>
<levelsDesc>SIG 9823 MB 1000-50 by 50 FH 1829 2743 3658 TROP</levelsDesc>
<levels>
<level>SIG9823</level>
<level>MB1000</level>
<level>MB950</level>
<level>MB900</level>
<level>MB850</level>
<level>MB800</level>
<level>MB750</level>
<level>MB700</level>
<level>MB650</level>
<level>MB600</level>
<level>MB550</level>
<level>MB500</level>
<level>MB450</level>
<level>MB400</level>
<level>MB350</level>
<level>MB300</level>
<level>MB250</level>
<level>MB200</level>
<level>MB150</level>
<level>MB100</level>
<level>MB50</level>
<level>FH1829</level>
<level>FH2743</level>
<level>FH3658</level>
<level>TROP</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>staticSpacing</short_name>
<long_name>Grid spacing</long_name>
<units>meters</units>
<fillValue>-99999.0</fillValue>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>tp</short_name>
<long_name>total precipitation</long_name>
<units>mm</units>
<udunits>millimeter</udunits>
<uiname>totPrecip</uiname>
<valid_range>0.0</valid_range>
<valid_range>1000.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>SFC</levelsDesc>
<levels>
<level>SFC</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>av</short_name>
<long_name>absolute vorticity</long_name>
<units>/s</units>
<udunits>1/second</udunits>
<uiname>absVort</uiname>
<valid_range>-0.00999999977648</valid_range>
<valid_range>0.00999999977648</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>4</n3D>
<levelsDesc>MB 850 700 500 250</levelsDesc>
<levels>
<level>MB850</level>
<level>MB700</level>
<level>MB500</level>
<level>MB250</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>cp</short_name>
<long_name>convective precipitation</long_name>
<units>mm</units>
<udunits>millimeter</udunits>
<uiname>convPrecip</uiname>
<valid_range>0.0</valid_range>
<valid_range>1000.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>SFC</levelsDesc>
<levels>
<level>SFC</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>gh</short_name>
<long_name>Geopotential height</long_name>
<units>m</units>
<udunits>meters</udunits>
<uiname>geoPotHt</uiname>
<valid_range>-2000.0</valid_range>
<valid_range>20000.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>20</n3D>
<levelsDesc>MB 1000-50 by 50</levelsDesc>
<levels>
<level>MB1000</level>
<level>MB950</level>
<level>MB900</level>
<level>MB850</level>
<level>MB800</level>
<level>MB750</level>
<level>MB700</level>
<level>MB650</level>
<level>MB600</level>
<level>MB550</level>
<level>MB500</level>
<level>MB450</level>
<level>MB400</level>
<level>MB350</level>
<level>MB300</level>
<level>MB250</level>
<level>MB200</level>
<level>MB150</level>
<level>MB100</level>
<level>MB50</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>pw</short_name>
<long_name>precipitable water</long_name>
<units>mm</units>
<udunits>millimeter</udunits>
<uiname>precipH2O</uiname>
<valid_range>0.0</valid_range>
<valid_range>300.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>SIG 0&gt;100</levelsDesc>
<levels>
<level>SIG0100</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>bli</short_name>
<long_name>Best lifted index</long_name>
<units>K</units>
<udunits>degree_Kelvin</udunits>
<uiname>bestLftInd</uiname>
<valid_range>-20.0</valid_range>
<valid_range>50.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>SIG 84&gt;98</levelsDesc>
<levels>
<level>SIG8498</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>staticCoriolis</short_name>
<long_name>Coriolis parameter</long_name>
<units>/s</units>
<fillValue>-99999.0</fillValue>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>rh</short_name>
<long_name>Relative Humidity</long_name>
<units>%</units>
<udunits>percent</udunits>
<uiname>rh</uiname>
<valid_range>0.0</valid_range>
<valid_range>100.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>21</n3D>
<levelsDesc>SIG 9823 MB 1000-50 by 50 SIG 47&gt;100</levelsDesc>
<levels>
<level>SIG9823</level>
<level>MB1000</level>
<level>MB950</level>
<level>MB900</level>
<level>MB850</level>
<level>MB800</level>
<level>MB750</level>
<level>MB700</level>
<level>MB650</level>
<level>MB600</level>
<level>MB550</level>
<level>MB500</level>
<level>MB450</level>
<level>MB400</level>
<level>MB350</level>
<level>MB300</level>
<level>MB250</level>
<level>MB200</level>
<level>MB150</level>
<level>MB100</level>
<level>MB50</level>
<level>SIG47100</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>sli</short_name>
<long_name>Surface lifted index</long_name>
<units>K</units>
<udunits>degree_Kelvin</udunits>
<uiname>LftInd</uiname>
<valid_range>-20.0</valid_range>
<valid_range>20.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>MB 50&gt;100</levelsDesc>
<levels>
<level>MB50100</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>snd</short_name>
<long_name>snow depth</long_name>
<units>m</units>
<udunits>meters</udunits>
<uiname>snowDepth</uiname>
<valid_range>0.0</valid_range>
<valid_range>100.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>SFC</levelsDesc>
<levels>
<level>SFC</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>staticTopo</short_name>
<long_name>Topography</long_name>
<units>meters</units>
<fillValue>-99999.0</fillValue>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>pmsl</short_name>
<long_name>pressure at mean sea level</long_name>
<units>Pa</units>
<udunits>pascal</udunits>
<uiname>PMSL</uiname>
<valid_range>80000.0</valid_range>
<valid_range>110000.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>MSL</levelsDesc>
<levels>
<level>MSL</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>uw</short_name>
<long_name>u wind component</long_name>
<units>m/s</units>
<udunits>meter/sec</udunits>
<uiname>uWind</uiname>
<valid_range>-150.0</valid_range>
<valid_range>150.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>21</n3D>
<levelsDesc>SIG 9823 MB 1000-50 by 50 FH 1829 2743 3658 TROP</levelsDesc>
<levels>
<level>SIG9823</level>
<level>MB1000</level>
<level>MB950</level>
<level>MB900</level>
<level>MB850</level>
<level>MB800</level>
<level>MB750</level>
<level>MB700</level>
<level>MB650</level>
<level>MB600</level>
<level>MB550</level>
<level>MB500</level>
<level>MB450</level>
<level>MB400</level>
<level>MB350</level>
<level>MB300</level>
<level>MB250</level>
<level>MB200</level>
<level>MB150</level>
<level>MB100</level>
<level>MB50</level>
<level>FH1829</level>
<level>FH2743</level>
<level>FH3658</level>
<level>TROP</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>st</short_name>
<long_name>soil temperature</long_name>
<units>K</units>
<udunits>degree_Kelvin</udunits>
<uiname>soilT</uiname>
<valid_range>0.0</valid_range>
<valid_range>1000.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>BLS</levelsDesc>
<levels>
<level>BLS</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>p</short_name>
<long_name>pressure</long_name>
<units>Pa</units>
<udunits>pascal</udunits>
<uiname>atmP</uiname>
<valid_range>0.0</valid_range>
<valid_range>110000.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>1</n3D>
<levelsDesc>SFC TROP</levelsDesc>
<levels>
<level>SFC</level>
<level>TROP</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>t</short_name>
<long_name>Temperature</long_name>
<units>K</units>
<udunits>degree_Kelvin</udunits>
<uiname>T</uiname>
<valid_range>180.0</valid_range>
<valid_range>330.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>21</n3D>
<levelsDesc>SIG 9823 MB 1000-50 by 50 FH 1829 2743 3658 TROP</levelsDesc>
<levels>
<level>SIG9823</level>
<level>MB1000</level>
<level>MB950</level>
<level>MB900</level>
<level>MB850</level>
<level>MB800</level>
<level>MB750</level>
<level>MB700</level>
<level>MB650</level>
<level>MB600</level>
<level>MB550</level>
<level>MB500</level>
<level>MB450</level>
<level>MB400</level>
<level>MB350</level>
<level>MB300</level>
<level>MB250</level>
<level>MB200</level>
<level>MB150</level>
<level>MB100</level>
<level>MB50</level>
<level>FH1829</level>
<level>FH2743</level>
<level>FH3658</level>
<level>TROP</level>
</levels>
</gridParameterInfo>
</gridParamInfo>

View file

@ -1,396 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<gridParamInfo xmlns:ns2="group">
<valtimeMINUSreftime>
<fcst>0</fcst>
<fcst>21600</fcst>
<fcst>43200</fcst>
<fcst>64800</fcst>
<fcst>86400</fcst>
<fcst>108000</fcst>
<fcst>129600</fcst>
<fcst>151200</fcst>
<fcst>172800</fcst>
</valtimeMINUSreftime>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>pvv</short_name>
<long_name>Pressure vertical velocity</long_name>
<units>Pa/s</units>
<udunits>pascal/second</udunits>
<uiname>Pvv</uiname>
<valid_range>-2.5</valid_range>
<valid_range>2.5</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>9</n3D>
<levelsDesc>MB 850 700 500 400 300 250 200 150 100</levelsDesc>
<levels>
<level>MB850</level>
<level>MB700</level>
<level>MB500</level>
<level>MB400</level>
<level>MB300</level>
<level>MB250</level>
<level>MB200</level>
<level>MB150</level>
<level>MB100</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>vw</short_name>
<long_name>v wind component</long_name>
<units>m/s</units>
<udunits>meter/sec</udunits>
<uiname>vWind</uiname>
<valid_range>-150.0</valid_range>
<valid_range>150.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>21</n3D>
<levelsDesc>SIG 9823 MB 1000-50 by 50 FH 1829 2743 3658 TROP</levelsDesc>
<levels>
<level>SIG9823</level>
<level>MB1000</level>
<level>MB950</level>
<level>MB900</level>
<level>MB850</level>
<level>MB800</level>
<level>MB750</level>
<level>MB700</level>
<level>MB650</level>
<level>MB600</level>
<level>MB550</level>
<level>MB500</level>
<level>MB450</level>
<level>MB400</level>
<level>MB350</level>
<level>MB300</level>
<level>MB250</level>
<level>MB200</level>
<level>MB150</level>
<level>MB100</level>
<level>MB50</level>
<level>FH1829</level>
<level>FH2743</level>
<level>FH3658</level>
<level>TROP</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>staticSpacing</short_name>
<long_name>Grid spacing</long_name>
<units>meters</units>
<fillValue>-99999.0</fillValue>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>tp</short_name>
<long_name>total precipitation</long_name>
<units>mm</units>
<udunits>millimeter</udunits>
<uiname>totPrecip</uiname>
<valid_range>0.0</valid_range>
<valid_range>1000.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>SFC</levelsDesc>
<levels>
<level>SFC</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>av</short_name>
<long_name>absolute vorticity</long_name>
<units>/s</units>
<udunits>1/second</udunits>
<uiname>absVort</uiname>
<valid_range>-0.00999999977648</valid_range>
<valid_range>0.00999999977648</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>4</n3D>
<levelsDesc>MB 850 700 500 250</levelsDesc>
<levels>
<level>MB850</level>
<level>MB700</level>
<level>MB500</level>
<level>MB250</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>cp</short_name>
<long_name>convective precipitation</long_name>
<units>mm</units>
<udunits>millimeter</udunits>
<uiname>convPrecip</uiname>
<valid_range>0.0</valid_range>
<valid_range>1000.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>SFC</levelsDesc>
<levels>
<level>SFC</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>gh</short_name>
<long_name>Geopotential height</long_name>
<units>m</units>
<udunits>meters</udunits>
<uiname>geoPotHt</uiname>
<valid_range>-2000.0</valid_range>
<valid_range>20000.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>20</n3D>
<levelsDesc>MB 1000-50 by 50</levelsDesc>
<levels>
<level>MB1000</level>
<level>MB950</level>
<level>MB900</level>
<level>MB850</level>
<level>MB800</level>
<level>MB750</level>
<level>MB700</level>
<level>MB650</level>
<level>MB600</level>
<level>MB550</level>
<level>MB500</level>
<level>MB450</level>
<level>MB400</level>
<level>MB350</level>
<level>MB300</level>
<level>MB250</level>
<level>MB200</level>
<level>MB150</level>
<level>MB100</level>
<level>MB50</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>pw</short_name>
<long_name>precipitable water</long_name>
<units>mm</units>
<udunits>millimeter</udunits>
<uiname>precipH2O</uiname>
<valid_range>0.0</valid_range>
<valid_range>300.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>SIG 0&gt;100</levelsDesc>
<levels>
<level>SIG0100</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>bli</short_name>
<long_name>Best lifted index</long_name>
<units>K</units>
<udunits>degree_Kelvin</udunits>
<uiname>bestLftInd</uiname>
<valid_range>-20.0</valid_range>
<valid_range>50.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>SIG 84&gt;98</levelsDesc>
<levels>
<level>SIG8498</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>staticCoriolis</short_name>
<long_name>Coriolis parameter</long_name>
<units>/s</units>
<fillValue>-99999.0</fillValue>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>rh</short_name>
<long_name>Relative Humidity</long_name>
<units>%</units>
<udunits>percent</udunits>
<uiname>rh</uiname>
<valid_range>0.0</valid_range>
<valid_range>100.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>21</n3D>
<levelsDesc>SIG 9823 MB 1000-50 by 50 SIG 47&gt;100</levelsDesc>
<levels>
<level>SIG9823</level>
<level>MB1000</level>
<level>MB950</level>
<level>MB900</level>
<level>MB850</level>
<level>MB800</level>
<level>MB750</level>
<level>MB700</level>
<level>MB650</level>
<level>MB600</level>
<level>MB550</level>
<level>MB500</level>
<level>MB450</level>
<level>MB400</level>
<level>MB350</level>
<level>MB300</level>
<level>MB250</level>
<level>MB200</level>
<level>MB150</level>
<level>MB100</level>
<level>MB50</level>
<level>SIG47100</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>sli</short_name>
<long_name>Surface lifted index</long_name>
<units>K</units>
<udunits>degree_Kelvin</udunits>
<uiname>LftInd</uiname>
<valid_range>-20.0</valid_range>
<valid_range>20.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>MB 50&gt;100</levelsDesc>
<levels>
<level>MB50100</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>snd</short_name>
<long_name>snow depth</long_name>
<units>m</units>
<udunits>meters</udunits>
<uiname>snowDepth</uiname>
<valid_range>0.0</valid_range>
<valid_range>100.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>SFC</levelsDesc>
<levels>
<level>SFC</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>staticTopo</short_name>
<long_name>Topography</long_name>
<units>meters</units>
<fillValue>-99999.0</fillValue>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>pmsl</short_name>
<long_name>pressure at mean sea level</long_name>
<units>Pa</units>
<udunits>pascal</udunits>
<uiname>PMSL</uiname>
<valid_range>80000.0</valid_range>
<valid_range>110000.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>MSL</levelsDesc>
<levels>
<level>MSL</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>uw</short_name>
<long_name>u wind component</long_name>
<units>m/s</units>
<udunits>meter/sec</udunits>
<uiname>uWind</uiname>
<valid_range>-150.0</valid_range>
<valid_range>150.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>21</n3D>
<levelsDesc>SIG 9823 MB 1000-50 by 50 FH 1829 2743 3658 TROP</levelsDesc>
<levels>
<level>SIG9823</level>
<level>MB1000</level>
<level>MB950</level>
<level>MB900</level>
<level>MB850</level>
<level>MB800</level>
<level>MB750</level>
<level>MB700</level>
<level>MB650</level>
<level>MB600</level>
<level>MB550</level>
<level>MB500</level>
<level>MB450</level>
<level>MB400</level>
<level>MB350</level>
<level>MB300</level>
<level>MB250</level>
<level>MB200</level>
<level>MB150</level>
<level>MB100</level>
<level>MB50</level>
<level>FH1829</level>
<level>FH2743</level>
<level>FH3658</level>
<level>TROP</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>st</short_name>
<long_name>soil temperature</long_name>
<units>K</units>
<udunits>degree_Kelvin</udunits>
<uiname>soilT</uiname>
<valid_range>0.0</valid_range>
<valid_range>1000.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>BLS</levelsDesc>
<levels>
<level>BLS</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>p</short_name>
<long_name>pressure</long_name>
<units>Pa</units>
<udunits>pascal</udunits>
<uiname>atmP</uiname>
<valid_range>0.0</valid_range>
<valid_range>110000.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>1</n3D>
<levelsDesc>SFC TROP</levelsDesc>
<levels>
<level>SFC</level>
<level>TROP</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>t</short_name>
<long_name>Temperature</long_name>
<units>K</units>
<udunits>degree_Kelvin</udunits>
<uiname>T</uiname>
<valid_range>180.0</valid_range>
<valid_range>330.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>21</n3D>
<levelsDesc>SIG 9823 MB 1000-50 by 50 FH 1829 2743 3658 TROP</levelsDesc>
<levels>
<level>SIG9823</level>
<level>MB1000</level>
<level>MB950</level>
<level>MB900</level>
<level>MB850</level>
<level>MB800</level>
<level>MB750</level>
<level>MB700</level>
<level>MB650</level>
<level>MB600</level>
<level>MB550</level>
<level>MB500</level>
<level>MB450</level>
<level>MB400</level>
<level>MB350</level>
<level>MB300</level>
<level>MB250</level>
<level>MB200</level>
<level>MB150</level>
<level>MB100</level>
<level>MB50</level>
<level>FH1829</level>
<level>FH2743</level>
<level>FH3658</level>
<level>TROP</level>
</levels>
</gridParameterInfo>
</gridParamInfo>

View file

@ -1,84 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<gridParamInfo xmlns:ns2="group">
<valtimeMINUSreftime>
<fcst>21600</fcst>
<fcst>43200</fcst>
<fcst>64800</fcst>
<fcst>86400</fcst>
<fcst>108000</fcst>
<fcst>129600</fcst>
<fcst>151200</fcst>
<fcst>172800</fcst>
</valtimeMINUSreftime>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>staticTopo</short_name>
<long_name>Topography</long_name>
<units>meters</units>
<fillValue>-99999.0</fillValue>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>pvv</short_name>
<long_name>Pressure vertical velocity</long_name>
<units>Pa/s</units>
<udunits>pascal/second</udunits>
<uiname>Pvv</uiname>
<valid_range>-2.5</valid_range>
<valid_range>2.5</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>9</n3D>
<levelsDesc>MB 850 700 500 400 300 250 200 150 100</levelsDesc>
<levels>
<level>MB850</level>
<level>MB700</level>
<level>MB500</level>
<level>MB400</level>
<level>MB300</level>
<level>MB250</level>
<level>MB200</level>
<level>MB150</level>
<level>MB100</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>tp</short_name>
<long_name>total precipitation</long_name>
<units>mm</units>
<udunits>millimeter</udunits>
<uiname>totPrecip</uiname>
<valid_range>0.0</valid_range>
<valid_range>1000.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>SFC</levelsDesc>
<levels>
<level>SFC</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>staticCoriolis</short_name>
<long_name>Coriolis parameter</long_name>
<units>/s</units>
<fillValue>-99999.0</fillValue>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>staticSpacing</short_name>
<long_name>Grid spacing</long_name>
<units>meters</units>
<fillValue>-99999.0</fillValue>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>cp</short_name>
<long_name>convective precipitation</long_name>
<units>mm</units>
<udunits>millimeter</udunits>
<uiname>convPrecip</uiname>
<valid_range>0.0</valid_range>
<valid_range>1000.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>SFC</levelsDesc>
<levels>
<level>SFC</level>
</levels>
</gridParameterInfo>
</gridParamInfo>

View file

@ -1,4 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!--
REVISION HISTORY
Date Ticket# Engineer Description
04/17/2013 #1913 randerso Corrected level for SLI
-->
<gridParamInfo xmlns:ns2="group"> <gridParamInfo xmlns:ns2="group">
<valtimeMINUSreftime> <valtimeMINUSreftime>
<fcst>0</fcst> <fcst>0</fcst>
@ -457,9 +463,9 @@
<valid_range>20.0</valid_range> <valid_range>20.0</valid_range>
<fillValue>-99999.0</fillValue> <fillValue>-99999.0</fillValue>
<n3D>0</n3D> <n3D>0</n3D>
<levelsDesc>SFC</levelsDesc> <levelsDesc>MB 0&gt;500</levelsDesc>
<levels> <levels>
<level>SFC</level> <level>MB0500</level>
</levels> </levels>
</gridParameterInfo> </gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo"> <gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">

View file

@ -37,11 +37,11 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
/** /**
* Implementation of a colormap * Implementation of a colormap
* *
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Feb 5, 2007 chammack Initial Creation. * Feb 5, 2007 chammack Initial Creation.
@ -50,9 +50,10 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
* Aug 20, 2008 dglazesk Added some interface pieces to make this more * Aug 20, 2008 dglazesk Added some interface pieces to make this more
* usable * usable
* Jan 10, 2013 15648 ryu Added removeDuplicates() method. * Jan 10, 2013 15648 ryu Added removeDuplicates() method.
* * Apr 18, 2013 1920 mpduff Default changed to true.
*
* </pre> * </pre>
* *
* @author chammack * @author chammack
* @version 1 * @version 1
*/ */
@ -67,7 +68,7 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
private Buffer glBuffer; private Buffer glBuffer;
private boolean changed = false; private boolean changed = true;
/** /**
* Constructor used by JiBX * Constructor used by JiBX
@ -97,7 +98,7 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
/** /**
* Creates a ColorMap using name and the list of colors in map. * Creates a ColorMap using name and the list of colors in map.
* *
* @param name * @param name
* Name for the new ColorMap * Name for the new ColorMap
* @param map * @param map
@ -107,12 +108,11 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
this.name = name; this.name = name;
colors = new ArrayList<Color>(); colors = new ArrayList<Color>();
colors.addAll(map.getColors()); colors.addAll(map.getColors());
this.changed = true;
} }
/** /**
* Do not instantiate directly, use GLTarget methods * Do not instantiate directly, use GLTarget methods
* *
* @param name * @param name
* @param red * @param red
* @param green * @param green
@ -139,9 +139,10 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see com.raytheon.uf.common.colormap.IColorMap#getBlue() * @see com.raytheon.uf.common.colormap.IColorMap#getBlue()
*/ */
@Override
public float[] getBlue() { public float[] getBlue() {
int colorNum = colors.size(); int colorNum = colors.size();
float[] blues = new float[colorNum]; float[] blues = new float[colorNum];
@ -153,9 +154,10 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see com.raytheon.uf.common.colormap.IColorMap#getGreen() * @see com.raytheon.uf.common.colormap.IColorMap#getGreen()
*/ */
@Override
public float[] getGreen() { public float[] getGreen() {
int colorNum = colors.size(); int colorNum = colors.size();
float[] greens = new float[colorNum]; float[] greens = new float[colorNum];
@ -167,9 +169,10 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see com.raytheon.uf.common.colormap.IColorMap#getRed() * @see com.raytheon.uf.common.colormap.IColorMap#getRed()
*/ */
@Override
public float[] getRed() { public float[] getRed() {
int colorNum = colors.size(); int colorNum = colors.size();
float[] reds = new float[colorNum]; float[] reds = new float[colorNum];
@ -181,18 +184,20 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see com.raytheon.uf.common.colormap.IColorMap#getSize() * @see com.raytheon.uf.common.colormap.IColorMap#getSize()
*/ */
@Override
public int getSize() { public int getSize() {
return colors.size(); return colors.size();
} }
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see com.raytheon.uf.common.colormap.IColorMap#getAlpha() * @see com.raytheon.uf.common.colormap.IColorMap#getAlpha()
*/ */
@Override
public float[] getAlpha() { public float[] getAlpha() {
int colorNum = colors.size(); int colorNum = colors.size();
float[] alphas = new float[colorNum]; float[] alphas = new float[colorNum];
@ -204,7 +209,7 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
/** /**
* Return the buffer representation of the colormap * Return the buffer representation of the colormap
* *
* @return the colorMap buffer * @return the colorMap buffer
*/ */
public synchronized Buffer getColorMap() { public synchronized Buffer getColorMap() {
@ -233,20 +238,22 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see com.raytheon.edex.colormap.IColorMap#getName() * @see com.raytheon.edex.colormap.IColorMap#getName()
*/ */
@Override
public String getName() { public String getName() {
return name; return name;
} }
@Override
public List<Color> getColors() { public List<Color> getColors() {
return colors; return colors;
} }
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see java.lang.Object#toString() * @see java.lang.Object#toString()
*/ */
@Override @Override
@ -254,10 +261,12 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
return "COLORMAP { " + getName() + " }"; return "COLORMAP { " + getName() + " }";
} }
@Override
public boolean isChanged() { public boolean isChanged() {
return changed; return changed;
} }
@Override
public void setAlpha(float[] anAlpha) { public void setAlpha(float[] anAlpha) {
int size = anAlpha.length; int size = anAlpha.length;
for (int i = 0; i < size; ++i) { for (int i = 0; i < size; ++i) {
@ -270,6 +279,7 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
changed = true; changed = true;
} }
@Override
public void setBlue(float[] aBlue) { public void setBlue(float[] aBlue) {
int size = aBlue.length; int size = aBlue.length;
for (int i = 0; i < size; ++i) { for (int i = 0; i < size; ++i) {
@ -282,6 +292,7 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
changed = true; changed = true;
} }
@Override
public void setGreen(float[] aGreen) { public void setGreen(float[] aGreen) {
int size = aGreen.length; int size = aGreen.length;
for (int i = 0; i < size; ++i) { for (int i = 0; i < size; ++i) {
@ -294,6 +305,7 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
changed = true; changed = true;
} }
@Override
public void setRed(float[] aRed) { public void setRed(float[] aRed) {
int size = aRed.length; int size = aRed.length;
for (int i = 0; i < size; ++i) { for (int i = 0; i < size; ++i) {
@ -310,10 +322,12 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
this.colors.set(index, color); this.colors.set(index, color);
} }
@Override
public void setChanged(boolean aChanged) { public void setChanged(boolean aChanged) {
changed = aChanged; changed = aChanged;
} }
@Override
public void setName(String aName) { public void setName(String aName) {
name = aName; name = aName;
changed = true; changed = true;
@ -329,7 +343,7 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
* wavelength to the maximum wavelength. If the reverse flag is set, then a * wavelength to the maximum wavelength. If the reverse flag is set, then a
* reverse spectrum is generated. The red, green, and blue indexes are * reverse spectrum is generated. The red, green, and blue indexes are
* returned through the calling arguments. * returned through the calling arguments.
* *
* @param numOfColors * @param numOfColors
* @param minWaveLength * @param minWaveLength
* @param maxWaveLength * @param maxWaveLength
@ -416,10 +430,10 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
public void removeDuplicates() { public void removeDuplicates() {
List<Color> colors = new ArrayList<Color>(); List<Color> colors = new ArrayList<Color>();
Color current = null; Color current = null;
for (Color color: this.colors) { for (Color color : this.colors) {
if (!color.equals(current)) { if (!color.equals(current)) {
colors.add(color); colors.add(color);
current = color; current = color;
} }
} }

View file

@ -31,6 +31,7 @@ import javax.persistence.Transient;
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.time.util.ImmutableDate;
/** /**
* FFMP basin/aggregated value holder * FFMP basin/aggregated value holder

View file

@ -1,572 +0,0 @@
package com.raytheon.uf.common.dataplugin.ffmp;
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
import java.awt.Point;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map.Entry;
import com.raytheon.uf.common.cache.CacheException;
import com.raytheon.uf.common.cache.CacheFactory;
import com.raytheon.uf.common.cache.ICache;
import com.raytheon.uf.common.cache.disk.DiskCache;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.datastorage.Request;
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager;
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager.SOURCE_TYPE;
import com.raytheon.uf.common.monitor.xml.DomainXML;
import com.raytheon.uf.common.monitor.xml.SourceXML;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
/**
* Cache coherent record
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 05/24/12 632 D. Hladky Initial release
*
* </pre>
*
* @author dhladky
* @version 1
*/
public class FFMPCacheRecord extends FFMPRecord {
private final String sourceCacheName;
private final String cacheName;
private final String cacheDir;
private ArrayList<String> hucs = new ArrayList<String>();
//private static final boolean useCache = !Boolean
// .getBoolean("com.raytheon.uf.common.ffmp.disableCache");
private static final boolean useCache = false;
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(FFMPCacheRecord.class);
/**
* Public constructor
* @param rec
* @param sourceCacheName
* @param cacheDir
*/
public FFMPCacheRecord(FFMPRecord rec, String sourceCacheName, String cacheDir) {
this.setSiteKey(rec.getSiteKey());
this.setWfo(rec.getWfo());
this.setDataKey(rec.getDataKey());
this.setSourceName(rec.getSourceName());
this.setPluginName(rec.getPluginName());
this.sourceCacheName = sourceCacheName;
this.cacheName = "FFMP-" + getWfo() + "-" + getSiteKey() + "-" +getDataKey()+ "-"
+ getSourceCacheName();
// set a default value
if (cacheDir == null) {
cacheDir = "/tmp";
}
this.cacheDir = cacheDir;
}
public String getSourceCacheName() {
return sourceCacheName;
}
/**
*
*/
private static final long serialVersionUID = 1L;
@SuppressWarnings({ "unchecked" })
private DiskCache<FFMPBasinData> getCache() {
DiskCache<FFMPBasinData> diskCache = null;
CacheFactory cf = CacheFactory.getInstance();
try {
diskCache = (DiskCache<FFMPBasinData>) cf.getCache(this.cacheName);
} catch (CacheException e) {
synchronized (this) {
// make sure not done on another thread
try {
diskCache = (DiskCache<FFMPBasinData>) cf
.getCache(this.cacheName);
} catch (CacheException e1) {
diskCache = createCache(this.cacheName);
CacheFactory.getInstance().addCache(this.cacheName,
diskCache);
}
}
}
return diskCache;
}
/**
* Get BasinData Map from cache
*
* @param siteKey
* @param sourceName
* @return
*/
@Override
public FFMPBasinData getBasinData(String hucName) {
return getBasinData(hucName, false);
}
/**
* Get BasinData Map from cache
*
* @param siteKey
* @param sourceName
* @return
*/
public FFMPBasinData getBasinData(String hucName, boolean lock) {
FFMPBasinData basins = null;
if (hucName != null) {
if (useCache) {
try {
DiskCache<FFMPBasinData> diskCache = getCache();
basins = (FFMPBasinData) diskCache.getFromCache(hucName, lock);
if (basins == null) {
basins = new FFMPBasinData(hucName);
if (!hucs.contains(hucName)) {
hucs.add(hucName);
}
}
} catch (Exception e) {
e.printStackTrace();
}
} else {
basins = super.getBasinData(hucName);
}
}
return basins;
}
/**
* Create cache objects if needed
*
* @param siteKey
* @return
*/
private DiskCache<FFMPBasinData> createCache(String name) {
ICache<FFMPBasinData> cache = new DiskCache<FFMPBasinData>();
DiskCache<FFMPBasinData> dc = (DiskCache<FFMPBasinData>) cache;
dc.setName(name);
dc.setBaseCacheDir(getCacheDir());
dc.setSizeMemCacheMap(2); // For FFMP hold two generally COUNTY and ALL
dc.activateCache();
return dc;
}
/**
* Set source record to cache
*
* @param siteKey
* @param sourceName
* @param record
*/
@Override
public void setBasinData(FFMPBasinData basins, String hucName) {
if (hucName != null) {
if (useCache) {
try {
synchronized (basins) {
DiskCache<FFMPBasinData> diskCache = getCache();
try {
diskCache.addToCache(hucName, basins);
} catch (IOException e) {
e.printStackTrace();
}
}
} catch (Exception e) {
e.printStackTrace();
}
} else {
super.setBasinData(basins, hucName);
}
}
}
/**
* Cache File reader
*
* @param basins
* @param hucName
*/
public void setCacheData(FFMPBasinData basins, String hucName) {
if (getBasinData(hucName) != null) {
basins = getBasinData(hucName, true);
//System.out.println("Adding Cache Data: "+hucName+" "+getSourceName());
synchronized (basins) {
for (Entry<Long, FFMPBasin> entry : basins.getBasins()
.entrySet()) {
FFMPBasin basin = basins.get(entry.getKey());
if (basin != null) {
if (basin instanceof FFMPGuidanceBasin) {
FFMPGuidanceBasin gbasin = (FFMPGuidanceBasin) basin;
gbasin.getGuidValues().putAll(
((FFMPGuidanceBasin) entry.getValue())
.getGuidValues());
} else {
basin.getValues().putAll(
entry.getValue().getValues());
}
} else {
basins.put(entry.getKey(), entry.getValue());
}
}
}
setBasinData(basins, hucName);
} else {
setBasinData(basins, hucName);
//System.out.println("Adding Whole Object Buddy Data: "+hucName+" "+getSourceName());
}
}
/**
* Gets the Hash out of the datastore by HUC
*
* @param dataStore
* @param huc
*/
public void retrieveMapFromDataStore(IDataStore dataStore, String uri,
FFMPTemplates template, String huc, Date date, String sourceName)
throws Exception {
FFMPBasinData fbd = null;
boolean aggregate = true;
if (huc.equals("ALL")) {
aggregate = false;
}
fbd = getBasinData(huc, true);
String key = getSiteKey();
synchronized (template) {
SourceXML source = FFMPSourceConfigurationManager.getInstance()
.getSource(sourceName);
for (DomainXML domain : template.getDomains()) {
LinkedHashMap<Long, ?> map = template.getMap(key,
domain.getCwa(), huc);
if (map != null && map.keySet().size() > 0) {
IDataRecord rec = null;
try {
rec = dataStore.retrieve(uri + "/" + domain.getCwa(),
huc, Request.ALL);
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
"FFMPRecord: no data record for: " + uri + "/"
+ domain.getCwa());
}
if (rec != null) {
float[] values = ((FloatDataRecord) rec).getFloatData();
int j = 0;
if (values != null) {
// System.err.println(sourceName);
if (source.getSourceType().equals(
SOURCE_TYPE.GUIDANCE.getSourceType())) {
for (Long pfaf : map.keySet()) {
try {
FFMPGuidanceBasin basin = (FFMPGuidanceBasin) fbd
.get(pfaf);
if (basin == null) {
basin = new FFMPGuidanceBasin(pfaf,
aggregate);
fbd.put(pfaf, basin);
}
if (basin.containsKey(date, sourceName)) {
if (basin
.getValue(date, sourceName) == FFMPUtils.MISSING
|| basin.getValue(date,
sourceName).isNaN()) {
float curval = basin.getValue(
date, sourceName);
if (curval >= 0.0f
&& values[j] >= 0.0f) {
basin.setValue(sourceName,
date, (curval + values[j])/ 2);
} else {
basin.setValue(sourceName,
date, values[j]);
}
}
} else {
basin.setValue(sourceName, date,
values[j]);
}
j++;
} catch (Exception e) {
break;
}
}
} else {
for (Long pfaf : map.keySet()) {
try {
FFMPBasin basin = fbd.get(pfaf);
if (basin == null) {
basin = new FFMPBasin(pfaf,
aggregate);
fbd.put(pfaf, basin);
}
if (basin.contains(date)) {
float curval = basin.getValue(date);
if (curval >= 0.0f
&& values[j] >= 0.0f) {
basin.setValue(date, (curval + values[j]) / 2);
} else {
basin.setValue(date, values[j]);
}
} else {
basin.setValue(date, values[j]);
}
j++;
} catch (Exception e) {
break;
}
}
}
}
}
}
}
}
setBasinData(fbd, huc);
}
/**
* Gets a single basin out of the dataStore
*
* @param dataStore
* @param huc
*/
public void retrieveBasinFromDataStore(IDataStore dataStore, String uri,
FFMPTemplates template, String huc, Date date, String sourceName,
FFMPBasin basin) {
FFMPBasinData fbd = null;
try {
SourceXML source = FFMPSourceConfigurationManager.getInstance()
.getSource(sourceName);
Long pfaf = basin.getPfaf();
fbd = getBasinData("ALL", true);
synchronized (template) {
for (DomainXML domain : template.getDomains()) {
LinkedHashMap<Long, ?> map = template.getMap(getSiteKey(),
domain.getCwa(), huc);
if (map != null && map.get(pfaf) != null) {
int index = 0;
for (Long pfafToCheck : map.keySet()) {
if (pfafToCheck.equals(pfaf)) {
break;
}
index++;
}
try {
IDataRecord rec = dataStore.retrieve(uri + "/"
+ domain.getCwa(), huc, Request
.buildPointRequest(new Point(index, 0)));
if (rec != null) {
float[] values = ((FloatDataRecord) rec)
.getFloatData();
boolean isFFG = false;
if (source.getSourceType().equals(
SOURCE_TYPE.GUIDANCE.getSourceType())) {
isFFG = true;
}
if (values != null) {
// System.err.println(sourceName);
if (isFFG) {
((FFMPGuidanceBasin) basin).setValue(
sourceName, date, values[0]);
} else {
basin.setValue(date, values[0]);
}
}
}
} catch (Throwable e) {
statusHandler.handle(Priority.PROBLEM,
"ERROR Retrieving Map for URI: " + uri
+ "..." + huc, e);
}
}
}
}
setBasinData(fbd, "ALL");
} catch (Exception e) {
statusHandler.handle(Priority.ERROR, "ERROR Retrieving HUC..."
+ huc);
}
}
/**
* Gets the Virtual Hash out of the datastore by HUC
*
* @param dataStore
* @param huc
*/
public void retrieveVirtualBasinFromDataStore(IDataStore dataStore,
String uri, FFMPTemplates template, Date date, FFMPBasin basin) {
FFMPBasinData fbd = null;
try {
boolean aggregate = false;
fbd = getBasinData("ALL", true);
String key = getDataKey();
for (DomainXML domain : template.getDomains()) {
LinkedHashMap<String, FFMPVirtualGageBasinMetaData> lids = template
.getVirtualGageBasins(key, domain.getCwa());
int size = lids.size();
if (size > 0) {
try {
IDataRecord rec = dataStore
.retrieve(uri + "/" + domain.getCwa(), "ALL",
Request.ALL);
if (rec != null) {
float[] values = ((FloatDataRecord) rec)
.getFloatData();
if (values != null) {
int j = 0;
for (Entry<String, FFMPVirtualGageBasinMetaData> entry : lids
.entrySet()) {
FFMPVirtualGageBasinMetaData fvgbmd = entry
.getValue();
FFMPVirtualGageBasin vgbasin = (FFMPVirtualGageBasin) fbd
.get(fvgbmd.getLookupId());
if (vgbasin == null) {
vgbasin = new FFMPVirtualGageBasin(
fvgbmd.getLid(),
fvgbmd.getLookupId(), aggregate);
fbd.put(fvgbmd.getLookupId(), vgbasin);
}
vgbasin.setValue(date, values[j]);
j++;
}
}
}
}
catch (Throwable e) {
statusHandler.handle(
Priority.PROBLEM,
"ERROR Retrieving Virtual ..."
+ domain.getCwa() + " : " + "ALL");
}
}
}
setBasinData(fbd, "ALL");
} catch (Throwable e) {
statusHandler.handle(Priority.ERROR, "ERROR Retrieving Virtual..."
+ "ALL");
}
}
/**
* Purges out old data
*
* @param date
*/
public void purgeData(Date date) {
for (String ihuc : hucs) {
FFMPBasinData basinData = getBasinData(ihuc, true);
basinData.purgeData(date);
setBasinData(basinData, ihuc);
}
}
/**
* Dump cache
*/
public void closeCache() {
getCache().closeCache();
}
public String getCacheDir() {
return cacheDir;
}
}

View file

@ -22,11 +22,14 @@ package com.raytheon.uf.common.dataplugin.ffmp;
import java.awt.Point; import java.awt.Point;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.lang.ref.WeakReference;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
@ -37,6 +40,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import org.hibernate.annotations.Index; import org.hibernate.annotations.Index;
import com.raytheon.uf.common.dataplugin.IDecoderGettable; import com.raytheon.uf.common.dataplugin.IDecoderGettable;
@ -57,6 +61,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
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.common.time.util.ImmutableDate;
/** /**
* Record implementation for FFMP plugin * Record implementation for FFMP plugin
@ -72,6 +77,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Feb 28, 2013 1729 dhladky Supressed un-necessary debug loggers * Feb 28, 2013 1729 dhladky Supressed un-necessary debug loggers
* Apr 4, 2013 1846 bkowal Added an index on refTime and forecastTime * Apr 4, 2013 1846 bkowal Added an index on refTime and forecastTime
* Apr 8, 2013 1293 bkowal Removed references to hdffileid. * Apr 8, 2013 1293 bkowal Removed references to hdffileid.
* April, 9 2013 1890 dhladky Moved dates to referenced map in record rather than multiple dates in FFMPBasin objs.
* *
* </pre> * </pre>
* *
@ -131,6 +137,8 @@ public class FFMPRecord extends PersistablePluginDataObject
@Transient @Transient
private boolean isRate = false; private boolean isRate = false;
protected static ConcurrentMap<Long, WeakReference<ImmutableDate>> cacheTimes = new ConcurrentHashMap<Long, WeakReference<ImmutableDate>>();
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(FFMPRecord.class); .getHandler(FFMPRecord.class);
@ -384,103 +392,96 @@ public class FFMPRecord extends PersistablePluginDataObject
} }
fbd = getBasinData(huc); fbd = getBasinData(huc);
ImmutableDate idate = getCacheDate(date);
synchronized (template) { SourceXML source = FFMPSourceConfigurationManager.getInstance()
.getSource(sourceName);
SourceXML source = FFMPSourceConfigurationManager.getInstance() for (DomainXML domain : template.getDomains()) {
.getSource(sourceName);
for (DomainXML domain : template.getDomains()) { LinkedHashMap<Long, ?> map = template.getMap(getSiteKey(), domain.getCwa(), huc);
LinkedHashMap<Long, ?> map = template.getMap(getSiteKey(),
domain.getCwa(), huc);
if (map != null && map.keySet().size() > 0) { if (map != null && !map.isEmpty()) {
IDataRecord rec = null; IDataRecord rec = null;
try { try {
rec = dataStore.retrieve(uri + "/" + domain.getCwa(), rec = dataStore.retrieve(uri + "/" + domain.getCwa(), huc,
huc, Request.ALL); Request.ALL);
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.DEBUG, statusHandler.handle(Priority.DEBUG,
"FFMPRecord: no data record for: " + uri + "/" "FFMPRecord: no data record for: " + uri + "/"
+ domain.getCwa()); + domain.getCwa());
} }
if (rec != null) { if (rec != null) {
float[] values = ((FloatDataRecord) rec).getFloatData(); float[] values = ((FloatDataRecord) rec).getFloatData();
int j = 0; int j = 0;
if (values != null) { if (values != null) {
// System.err.println(sourceName); // System.err.println(sourceName);
if (source.getSourceType().equals( if (source.getSourceType().equals(
SOURCE_TYPE.GUIDANCE.getSourceType())) { SOURCE_TYPE.GUIDANCE.getSourceType())) {
for (Long pfaf : map.keySet()) { for (Long pfaf : map.keySet()) {
try { try {
FFMPGuidanceBasin basin = (FFMPGuidanceBasin) fbd FFMPGuidanceBasin basin = (FFMPGuidanceBasin) fbd
.get(pfaf); .get(pfaf);
if (basin == null) { if (basin == null) {
basin = new FFMPGuidanceBasin(pfaf, basin = new FFMPGuidanceBasin(pfaf,
aggregate); aggregate);
fbd.put(pfaf, basin); fbd.put(pfaf, basin);
} }
if (basin.containsKey(date, sourceName)) { Float curval = basin.getValue(idate,
if (basin sourceName);
.getValue(date, sourceName) == FFMPUtils.MISSING
|| basin.getValue(date,
sourceName).isNaN()) {
float curval = basin.getValue( if (curval != FFMPUtils.MISSING
date, sourceName); || !curval.isNaN()) {
if (curval >= 0.0f if (curval >= 0.0f && values[j] >= 0.0f) {
&& values[j] >= 0.0f) { basin.setValue(sourceName, idate,
basin.setValue(sourceName, (curval + values[j]) / 2);
date, (curval + values[j])/ 2); } else if (values[j] >= 0.0f){
} else { basin.setValue(sourceName, idate,
basin.setValue(sourceName,
date, values[j]);
}
}
} else {
basin.setValue(sourceName, date,
values[j]); values[j]);
} }
// do not overwrite original value
j++; } else {
} catch (Exception e) { basin.setValue(sourceName, idate,
break; values[j]);
} }
j++;
} catch (Exception e) {
break;
} }
} else {
for (Long pfaf : map.keySet()) {
try {
FFMPBasin basin = fbd.get(pfaf);
if (basin == null) {
basin = new FFMPBasin(pfaf,
aggregate);
fbd.put(pfaf, basin);
}
if (basin.contains(date)) { }
float curval = basin.getValue(date); } else {
if (curval >= 0.0f for (Long pfaf : map.keySet()) {
&& values[j] >= 0.0f) { try {
basin.setValue(date, (curval + values[j])/ 2);; FFMPBasin basin = fbd.get(pfaf);
} else { if (basin == null) {
basin.setValue(date, values[j]); basin = new FFMPBasin(pfaf, aggregate);
} fbd.put(pfaf, basin);
} else {
basin.setValue(date, values[j]);
}
j++;
} catch (Exception e) {
break;
} }
if (basin.contains(idate)) {
float curval = basin.getValue(idate);
if (curval >= 0.0f && values[j] >= 0.0f) {
basin.setValue(idate,
(curval + values[j]) / 2);
} else if (values[j] >= 0.0f) {
basin.setValue(idate, values[j]);
} // do not overwrite original value
} else {
// no value at time exists, write regardless
basin.setValue(idate, values[j]);
}
j++;
} catch (Exception e) {
break;
} }
} }
} }
@ -488,6 +489,7 @@ public class FFMPRecord extends PersistablePluginDataObject
} }
} }
} }
} }
/** /**
@ -504,58 +506,57 @@ public class FFMPRecord extends PersistablePluginDataObject
SourceXML source = FFMPSourceConfigurationManager.getInstance() SourceXML source = FFMPSourceConfigurationManager.getInstance()
.getSource(sourceName); .getSource(sourceName);
Long pfaf = basin.getPfaf(); Long pfaf = basin.getPfaf();
ImmutableDate idate = getCacheDate(date);
synchronized (template) { for (DomainXML domain : template.getDomains()) {
for (DomainXML domain : template.getDomains()) { LinkedHashMap<Long, ?> map = template.getMap(getSiteKey(),
domain.getCwa(), huc);
LinkedHashMap<Long, ?> map = template.getMap(getSiteKey(), if (map != null && map.get(pfaf) != null) {
domain.getCwa(), huc);
if (map != null && map.get(pfaf) != null) { int index = 0;
for (Long pfafToCheck : map.keySet()) {
int index = 0; if (pfafToCheck.equals(pfaf)) {
for (Long pfafToCheck : map.keySet()) { break;
if (pfafToCheck.equals(pfaf)) {
break;
}
index++;
} }
index++;
}
try { try {
IDataRecord rec = dataStore.retrieve(uri + "/" IDataRecord rec = dataStore.retrieve(
+ domain.getCwa(), huc, Request uri + "/" + domain.getCwa(), huc,
.buildPointRequest(new Point(index, 0))); Request.buildPointRequest(new Point(index, 0)));
if (rec != null) { if (rec != null) {
float[] values = ((FloatDataRecord) rec) float[] values = ((FloatDataRecord) rec)
.getFloatData(); .getFloatData();
boolean isFFG = false; boolean isFFG = false;
if (source.getSourceType().equals( if (source.getSourceType().equals(
SOURCE_TYPE.GUIDANCE.getSourceType())) { SOURCE_TYPE.GUIDANCE.getSourceType())) {
isFFG = true; isFFG = true;
} }
if (values != null) { if (values != null) {
// System.err.println(sourceName); // System.err.println(sourceName);
if (isFFG) { if (isFFG) {
((FFMPGuidanceBasin) basin).setValue( ((FFMPGuidanceBasin) basin).setValue(
sourceName, date, values[0]); sourceName, idate, values[0]);
} else { } else {
basin.setValue(date, values[0]); basin.setValue(idate, values[0]);
}
} }
} }
} catch (Throwable e) {
statusHandler.handle(Priority.PROBLEM,
"ERROR Retrieving Map for URI: " + uri
+ "..." + huc);
} }
} catch (Throwable e) {
statusHandler.handle(Priority.PROBLEM,
"ERROR Retrieving Map for URI: " + uri + "..."
+ huc);
} }
} }
} }
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.ERROR, "ERROR Retrieving HUC..." statusHandler.handle(Priority.ERROR, "ERROR Retrieving HUC..."
+ huc); + huc);
@ -575,56 +576,54 @@ public class FFMPRecord extends PersistablePluginDataObject
boolean aggregate = false; boolean aggregate = false;
fbd = getBasinData(ALL); fbd = getBasinData(ALL);
String key = getDataKey(); String key = getDataKey();
ImmutableDate idate = getCacheDate(date);
synchronized (template) { for (DomainXML domain : template.getDomains()) {
for (DomainXML domain : template.getDomains()) { LinkedHashMap<String, FFMPVirtualGageBasinMetaData> lids = template
.getVirtualGageBasins(key, domain.getCwa());
LinkedHashMap<String, FFMPVirtualGageBasinMetaData> lids = template if (lids != null) {
.getVirtualGageBasins(key, domain.getCwa()); int size = lids.size();
if (lids != null) { if (size > 0) {
int size = lids.size();
if (size > 0) { IDataRecord rec = null;
IDataRecord rec = null; try {
rec = dataStore.retrieve(uri + "/" + domain.getCwa(),
try { ALL, Request.ALL);
rec = dataStore.retrieve( } catch (Exception e) {
uri + "/" + domain.getCwa(), ALL, // This is a routine error. Sometimes you can not have
Request.ALL); // data for a configured source
} catch (Exception e) { // This suppresses spurrious messages that would inflate
// This is a routine error. Sometimes you can not have data for a configured source // the loags needlessly.
// This suppresses spurrious messages that would inflate the loags needlessly. if (statusHandler.isPriorityEnabled(Priority.DEBUG)) {
if (statusHandler.isPriorityEnabled(Priority.DEBUG)) { statusHandler.handle(Priority.DEBUG,
statusHandler.handle(Priority.DEBUG, "FFMPRecord: no data for: " + uri + "/"
"FFMPRecord: no data for: " + uri + "/" + domain.getCwa());
+ domain.getCwa());
}
} }
}
if (rec != null) { if (rec != null) {
float[] values = ((FloatDataRecord) rec) float[] values = ((FloatDataRecord) rec).getFloatData();
.getFloatData(); if (values != null) {
if (values != null) { int j = 0;
int j = 0;
for (Entry<String, FFMPVirtualGageBasinMetaData> entry : lids for (Entry<String, FFMPVirtualGageBasinMetaData> entry : lids
.entrySet()) { .entrySet()) {
FFMPVirtualGageBasinMetaData fvgbmd = entry FFMPVirtualGageBasinMetaData fvgbmd = entry
.getValue(); .getValue();
FFMPVirtualGageBasin vgbasin = (FFMPVirtualGageBasin) fbd FFMPVirtualGageBasin vgbasin = (FFMPVirtualGageBasin) fbd
.get(fvgbmd.getLookupId()); .get(fvgbmd.getLookupId());
if (vgbasin == null) { if (vgbasin == null) {
vgbasin = new FFMPVirtualGageBasin( vgbasin = new FFMPVirtualGageBasin(
fvgbmd.getLid(), fvgbmd.getLid(),
fvgbmd.getLookupId(), aggregate); fvgbmd.getLookupId(), aggregate);
fbd.put(fvgbmd.getLookupId(), vgbasin); fbd.put(fvgbmd.getLookupId(), vgbasin);
}
vgbasin.setValue(date, values[j]);
j++;
} }
vgbasin.setValue(idate, values[j]);
j++;
} }
} }
} }
@ -646,11 +645,11 @@ public class FFMPRecord extends PersistablePluginDataObject
boolean aggregate = false; boolean aggregate = false;
fbd = getBasinData(ALL); fbd = getBasinData(ALL);
String key = getDataKey(); String key = getDataKey();
ImmutableDate idate = getCacheDate(date);
for (DomainXML domain : template.getDomains()) { for (DomainXML domain : template.getDomains()) {
LinkedHashMap<String, FFMPVirtualGageBasinMetaData> lids = template LinkedHashMap<String, FFMPVirtualGageBasinMetaData> lids = template.getVirtualGageBasins(key, domain.getCwa());
.getVirtualGageBasins(key, domain.getCwa());
int size = lids.size(); int size = lids.size();
if (size > 0) { if (size > 0) {
@ -677,7 +676,7 @@ public class FFMPRecord extends PersistablePluginDataObject
fvgbmd.getLookupId(), aggregate); fvgbmd.getLookupId(), aggregate);
fbd.put(fvgbmd.getLookupId(), vgbasin); fbd.put(fvgbmd.getLookupId(), vgbasin);
} }
vgbasin.setValue(date, values[j]); vgbasin.setValue(idate, values[j]);
j++; j++;
} }
} }
@ -814,5 +813,45 @@ public class FFMPRecord extends PersistablePluginDataObject
setBasinData(basinData, basinData.getHucLevel()); setBasinData(basinData, basinData.getHucLevel());
} }
} }
/**
* Gets and maintains the list of times. This will lesson memory consumption
* because it means all FFMPBasin TreeMap date keys reference back to this
* Hash. Seeing as there are 10000+ of those this will certainly help.
*
* @param date
* @return
*/
protected ImmutableDate getCacheDate(Date date) {
WeakReference<ImmutableDate> idate = cacheTimes.get(date.getTime());
ImmutableDate myDate = null;
if (idate != null) {
myDate = idate.get();
}
if (myDate == null) {
long time = date.getTime();
myDate = new ImmutableDate(time);
idate = new WeakReference<ImmutableDate>(myDate);
cacheTimes.putIfAbsent(time, idate);
}
return myDate;
}
/**
* Populate data from the cache files
* @param basins
* @param hucName
*/
public void populate(FFMPBasinData basins, String hucName) {
setBasinData(basins, hucName);
//System.out.println("Adding Whole Object Cache Data: "+hucName+" "+getSourceName());
}
} }

View file

@ -1274,7 +1274,7 @@ public class FFMPTemplates {
* @param huc * @param huc
* @return * @return
*/ */
public LinkedHashMap<Long, ?> getMap(String dataKey, String cwa, String huc) { public synchronized LinkedHashMap<Long, ?> getMap(String dataKey, String cwa, String huc) {
LinkedHashMap<Long, ?> map = null; LinkedHashMap<Long, ?> map = null;
HashMap<String, LinkedHashMap<Long, ?>> hucMap = null; HashMap<String, LinkedHashMap<Long, ?>> hucMap = null;
@ -1389,7 +1389,7 @@ public class FFMPTemplates {
* *
* @return * @return
*/ */
public LinkedHashMap<String, FFMPVirtualGageBasinMetaData> getVirtualGageBasins( public synchronized LinkedHashMap<String, FFMPVirtualGageBasinMetaData> getVirtualGageBasins(
String dataKey, String cwa) { String dataKey, String cwa) {
LinkedHashMap<String, FFMPVirtualGageBasinMetaData> map = null; LinkedHashMap<String, FFMPVirtualGageBasinMetaData> map = null;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.uf.viz.core.level; package com.raytheon.uf.common.dataplugin.level.mapping;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -33,7 +33,6 @@ 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.exception.VizCommunicationException;
/** /**
* Class defines a database level * Class defines a database level
@ -46,6 +45,8 @@ import com.raytheon.uf.viz.core.exception.VizCommunicationException;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 11/16/2008 #3576 rjpeter Initial version * 11/16/2008 #3576 rjpeter Initial version
* 04/17/2013 #1913 randerso Moved to common
*
* </pre> * </pre>
* *
* @author rjpeter * @author rjpeter
@ -59,16 +60,16 @@ public class DatabaseLevelMapping {
.getHandler(DatabaseLevelMapping.class); .getHandler(DatabaseLevelMapping.class);
@XmlAttribute @XmlAttribute
private String levelName = null; private String unit = null;
@XmlAttribute
private String levelOneValue = null;
@XmlAttribute @XmlAttribute
private String levelTwoValue = null; private String levelTwoValue = null;
@XmlAttribute @XmlAttribute
private String unit = null; private String levelOneValue = null;
@XmlAttribute
private String levelName = null;
public String getLevelName() { public String getLevelName() {
return levelName; return levelName;
@ -102,7 +103,7 @@ public class DatabaseLevelMapping {
this.unit = unit; this.unit = unit;
} }
public List<Level> getLevels() throws VizCommunicationException { public List<Level> getLevels() throws CommunicationException {
String[] levelOneValues = new String[0]; String[] levelOneValues = new String[0];
String[] levelTwoValues = new String[0]; String[] levelTwoValues = new String[0];
@ -145,16 +146,11 @@ public class DatabaseLevelMapping {
} }
// handle any aliasing etc // handle any aliasing etc
try { Level level = LevelFactory.getInstance().getLevel(levelName, lvl1,
Level level = LevelFactory.getInstance().getLevel(levelName, lvl2, unit);
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;

View file

@ -18,7 +18,7 @@
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.uf.viz.core.level; package com.raytheon.uf.common.dataplugin.level.mapping;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -29,9 +29,9 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
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.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.
@ -46,6 +46,7 @@ import com.raytheon.uf.viz.core.exception.VizCommunicationException;
* 11/01/2007 #518 S.Manoj Initial version * 11/01/2007 #518 S.Manoj Initial version
* 11/16/2009 #3120 rjpeter Modifed to better integrate with level framework. * 11/16/2009 #3120 rjpeter Modifed to better integrate with level framework.
* 11/21/2009 #3576 rjpeter Added group * 11/21/2009 #3576 rjpeter Added group
* 04/17/2013 #1913 randerso Moved to common
* *
* &#064;author smanoj * &#064;author smanoj
* @version 1.0 * @version 1.0
@ -119,7 +120,7 @@ public class LevelMapping implements ISerializableObject {
this.databaseLevels = databaseLevels; this.databaseLevels = databaseLevels;
} }
public List<Level> getLevels() throws VizCommunicationException { public List<Level> getLevels() throws CommunicationException {
if (levelList == null) { if (levelList == null) {
List<Level> levelList = new ArrayList<Level>(); List<Level> levelList = new ArrayList<Level>();
for (DatabaseLevelMapping mapping : databaseLevels) { for (DatabaseLevelMapping mapping : databaseLevels) {

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.uf.viz.core.level; package com.raytheon.uf.common.dataplugin.level.mapping;
import java.io.File; import java.io.File;
import java.util.Collection; import java.util.Collection;
@ -29,13 +29,13 @@ import java.util.Set;
import javax.xml.bind.JAXB; import javax.xml.bind.JAXB;
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.MasterLevel; import com.raytheon.uf.common.dataplugin.level.MasterLevel;
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.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
@ -49,15 +49,19 @@ import com.raytheon.uf.viz.core.exception.VizCommunicationException;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 11/16/2009 #3120 rjpeter Initial version * 11/16/2009 #3120 rjpeter Initial version
* 11/21/2009 #3576 rjpeter Added group capability * 11/21/2009 #3576 rjpeter Added group capability
* 04/17/2013 #1913 randerso Moved to common
* *
* &#064;author rjpeter * &#064;author rjpeter
* @version 1.0 * @version 1.0
*/ */
public class LevelMappingFactory { public class LevelMappingFactory {
// TODO: this should move somewhere else
public static final String VOLUMEBROWSER_LEVEL_MAPPING_FILE = "volumebrowser/LevelMappingFile.xml";
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(LevelMappingFactory.class); .getHandler(LevelMappingFactory.class);
private static LevelMappingFactory instance = null; private static Map<String, LevelMappingFactory> instanceMap = new HashMap<String, LevelMappingFactory>();
private Map<String, LevelMapping> keyToLevelMappings = new HashMap<String, LevelMapping>(); private Map<String, LevelMapping> keyToLevelMappings = new HashMap<String, LevelMapping>();
@ -69,16 +73,17 @@ public class LevelMappingFactory {
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 synchronized static LevelMappingFactory getInstance() { public synchronized static LevelMappingFactory getInstance(String filePath) {
LevelMappingFactory instance = instanceMap.get(filePath);
if (instance == null) { if (instance == null) {
instance = new LevelMappingFactory(); instance = new LevelMappingFactory(filePath);
instanceMap.put(filePath, instance);
} }
return instance; return instance;
} }
private LevelMappingFactory() { private LevelMappingFactory(String filePath) {
File path = PathManagerFactory.getPathManager().getStaticFile( File path = PathManagerFactory.getPathManager().getStaticFile(filePath);
"volumebrowser/LevelMappingFile.xml");
LevelMappingFile levelMapFile = null; LevelMappingFile levelMapFile = null;
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
try { try {
@ -115,7 +120,7 @@ public class LevelMappingFactory {
} }
public LevelMapping getLevelMappingForLevel(Level level) public LevelMapping getLevelMappingForLevel(Level level)
throws VizCommunicationException { throws CommunicationException {
if (!levelToLevelMappingsInitialized) { if (!levelToLevelMappingsInitialized) {
initializeLevelToLevelMappings(); initializeLevelToLevelMappings();
} }
@ -126,7 +131,7 @@ public class LevelMappingFactory {
return keyToLevelMappings.values(); return keyToLevelMappings.values();
} }
public Set<Level> getAllLevels() throws VizCommunicationException { public Set<Level> getAllLevels() throws CommunicationException {
if (!levelToLevelMappingsInitialized) { if (!levelToLevelMappingsInitialized) {
initializeLevelToLevelMappings(); initializeLevelToLevelMappings();
} }
@ -134,15 +139,14 @@ public class LevelMappingFactory {
} }
public Map<MasterLevel, Set<Level>> getLevelMapForGroup(String group) public Map<MasterLevel, Set<Level>> getLevelMapForGroup(String group)
throws VizCommunicationException { throws CommunicationException {
if (!groupToMasterLevelsInitialized) { if (!groupToMasterLevelsInitialized) {
initializeGroupToMasterLevels(); initializeGroupToMasterLevels();
} }
return groupToMasterLevels.get(group); return groupToMasterLevels.get(group);
} }
private void initializeLevelToLevelMappings() private void initializeLevelToLevelMappings() throws CommunicationException {
throws VizCommunicationException {
for (LevelMapping mapping : keyToLevelMappings.values()) { for (LevelMapping mapping : keyToLevelMappings.values()) {
String group = mapping.getGroup(); String group = mapping.getGroup();
@ -165,8 +169,7 @@ public class LevelMappingFactory {
levelToLevelMappingsInitialized = true; levelToLevelMappingsInitialized = true;
} }
private void initializeGroupToMasterLevels() private void initializeGroupToMasterLevels() throws CommunicationException {
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; Map<MasterLevel, Set<Level>> masterLevels = null;

View file

@ -18,7 +18,7 @@
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.uf.viz.core.level; package com.raytheon.uf.common.dataplugin.level.mapping;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -44,6 +44,7 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 11/01/2007 #518 S.Manoj Initial version * 11/01/2007 #518 S.Manoj Initial version
* 11/16/2009 #3120 rjpeter Refactored to use factory and level mapping. * 11/16/2009 #3120 rjpeter Refactored to use factory and level mapping.
* 04/17/2013 #1913 randerso Moved to common
* *
* @author smanoj * @author smanoj
* @version 1.0 * @version 1.0
@ -56,7 +57,7 @@ public class LevelMappingFile implements ISerializableObject {
STANDARD, COMPOSITE, BINARY, XSECT, TSECT, VRTGPH, DIAGRAM, ALL, SURFACE STANDARD, COMPOSITE, BINARY, XSECT, TSECT, VRTGPH, DIAGRAM, ALL, SURFACE
}; };
@XmlElements( { @XmlElement(name = "Level", type = LevelMapping.class) }) @XmlElements({ @XmlElement(name = "Level", type = LevelMapping.class) })
private List<LevelMapping> levelMappingFile; private List<LevelMapping> levelMappingFile;
public List<LevelMapping> getLevelMappingFile() { public List<LevelMapping> getLevelMappingFile() {

View file

@ -29,10 +29,8 @@ import java.util.ArrayDeque;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Deque; import java.util.Deque;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import com.raytheon.uf.common.localization.exception.LocalizationException; import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
@ -51,8 +49,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jun 23, 2011 mschenke Initial creation * Jun 23, 2011 mschenke Initial creation
* * Apr 12, 2013 1903 rjpeter Fix allocateLock freezing out other lock requests.
* </pre> * </pre>
* *
* @author mschenke * @author mschenke
@ -64,14 +62,26 @@ public class FileLocker {
private static class LockWaiter { private static class LockWaiter {
} }
private static enum LockState {
ACQUIRING, IN_USE, RELEASED
}
private static class LockedFile { private static class LockedFile {
Type lockType; final Type lockType;
Thread lockingThread; final Thread lockingThread;
Set<Object> lockers = new HashSet<Object>(); final List<Object> lockers = new ArrayList<Object>();
File lockFile; File lockFile;
LockState lockState = LockState.ACQUIRING;
LockedFile(Thread thread, Type type, Object locker) {
lockType = type;
lockingThread = thread;
lockers.add(locker);
}
} }
public static enum Type { public static enum Type {
@ -81,10 +91,10 @@ public class FileLocker {
private static final int MAX_WAIT = 30 * 1000; private static final int MAX_WAIT = 30 * 1000;
/** Map of waiters on threads */ /** Map of waiters on threads */
private Map<File, Deque<LockWaiter>> waiters = new HashMap<File, Deque<LockWaiter>>(); private final Map<File, Deque<LockWaiter>> waiters = new HashMap<File, Deque<LockWaiter>>();
/** Map of locks we have on files */ /** Map of locks we have on files */
private Map<File, LockedFile> locks = new HashMap<File, LockedFile>(); private final Map<File, LockedFile> locks = new HashMap<File, LockedFile>();
/** Singleton instance of FileLocker class */ /** Singleton instance of FileLocker class */
private static FileLocker instance = new FileLocker(); private static FileLocker instance = new FileLocker();
@ -181,22 +191,27 @@ public class FileLocker {
synchronized (locks) { synchronized (locks) {
lock = locks.get(file); lock = locks.get(file);
if (lock == null) { if (lock == null) {
lock = new LockedFile(); lock = new LockedFile(myThread, type, locker);
locks.put(file, lock); locks.put(file, lock);
grabbedLock = true; grabbedLock = true;
} }
} }
synchronized (lock) { if (grabbedLock) {
if (grabbedLock) { // We were able to grab the lock file ourselves
// We were able to grab the lock file ourselves return allocateLock(file, lock);
return allocateLock(locker, file, type, myThread, lock); } else {
} else if (lock.lockingThread == myThread synchronized (lock) {
|| (type == lock.lockType && type == Type.READ)) { // if the lock file has been obtained and either the thread is
// Locked on same thread to avoid indefinite waiting. If // the same as the one that obtained the lock or the original
// there are issues on how locked, they will be known // lock and this request are both read locks
lock.lockers.add(locker); if ((lock.lockState == LockState.IN_USE)
return true; && ((lock.lockingThread == myThread) || ((type == Type.READ) && (type == lock.lockType)))) {
// TODO: This is not safe as another thread could have a
// read lock and we may clobber the read
lock.lockers.add(locker);
return true;
}
} }
} }
@ -216,83 +231,121 @@ public class FileLocker {
lws.add(waiter); lws.add(waiter);
} }
while (true) { boolean waiterRemoved = false;
// Sleep
try {
Thread.sleep(10);
} catch (InterruptedException e) {
// Ignore
}
grabbedLock = false; try {
synchronized (locks) { while (true) {
lock = locks.get(file); // Sleep
if (lock == null) { try {
// File ready for grabbing Thread.sleep(10);
synchronized (lws) { } catch (InterruptedException e) {
if (lws.peek() == waiter) { // Ignore
lws.poll(); }
lock = new LockedFile();
locks.put(file, lock); grabbedLock = false;
grabbedLock = true; synchronized (locks) {
lock = locks.get(file);
if (lock == null) {
// File ready for grabbing
synchronized (lws) {
if (lws.peek() == waiter) {
lws.poll();
waiterRemoved = true;
lock = new LockedFile(myThread, type,
locker);
locks.put(file, lock);
grabbedLock = true;
}
} }
} }
} else if (lock.lockFile != null) { }
if (grabbedLock) {
// We were able to grab the lock file ourselves
return allocateLock(file, lock);
} else if (lock != null) {
synchronized (lock) { synchronized (lock) {
if ((System.currentTimeMillis() - lock.lockFile switch (lock.lockState) {
.lastModified()) > MAX_WAIT) { case IN_USE:
System.err if ((type == Type.READ)
.println("Releasing lock since: " && (type == lock.lockType)) {
+ "Lock has been allocated for more than " // A different waiter grabbed it for
+ (MAX_WAIT / 1000) + "s"); // reading, we can read it also
locks.remove(file); lock.lockers.add(locker);
return true;
} else {
long curTime = System.currentTimeMillis();
long lastMod = lock.lockFile.lastModified();
if ((curTime - lastMod) > MAX_WAIT) {
System.err
.println("Releasing lock: "
+ "Lock has been allocated for "
+ ((curTime - lastMod) / 1000)
+ "s on file "
+ file.getPath());
locks.remove(file);
}
}
break;
// ACUIRING - NOOP wait for lock to be acquired
// RELEASED - loop again and check if next waiter
} }
} }
} }
} }
if (grabbedLock) { } finally {
// We were able to grab the lock file ourselves if (!waiterRemoved) {
allocateLock(locker, file, type, myThread, lock); synchronized (lws) {
return true; lws.remove(waiter);
}
} }
} }
} }
return false; return false;
} }
private void unlockInternal(Object locker, File file) { private void unlockInternal(Object locker, File file) {
try { try {
boolean fileUnlocked = false;
LockedFile lock = null; LockedFile lock = null;
// Get the Lock // Get the Lock
synchronized (locks) { synchronized (locks) {
lock = locks.get(file); lock = locks.get(file);
// Return early if we never locked or have already been // Return early if we have never locked
// unlocked if ((lock == null) || (locker == null)) {
if (lock == null
|| (locker != null && lock.lockers.contains(locker) == false)) {
return; return;
} }
} }
// Lock has locker and is not null
synchronized (lock) { synchronized (lock) {
lock.lockers.remove(locker); if (lock.lockState == LockState.IN_USE) {
if (lock.lockers.size() == 0) { lock.lockers.remove(locker);
// No more lockers, remove lock and release
locks.remove(file); if (lock.lockers.isEmpty()) {
unallocateLock(lock); // No more lockers, remove lock and release
lock.lockState = LockState.RELEASED;
unallocateLock(lock);
fileUnlocked = true;
}
} }
} }
// Check for waiters on the file if (fileUnlocked) {
synchronized (waiters) { synchronized (locks) {
Deque<LockWaiter> lws = waiters.get(file); locks.remove(file);
if (lws == null) { }
waiters.remove(file);
} else { // Check for waiters on the file
synchronized (lws) { synchronized (waiters) {
if (lws.size() == 0) { Deque<LockWaiter> lws = waiters.get(file);
waiters.remove(file); if (lws == null) {
waiters.remove(file);
} else {
synchronized (lws) {
if (lws.isEmpty()) {
waiters.remove(file);
}
} }
} }
} }
@ -307,20 +360,13 @@ public class FileLocker {
* Function to actually allocate the lock, this needs to be cross process * Function to actually allocate the lock, this needs to be cross process
* aware and wait until other processes are finished with the file * aware and wait until other processes are finished with the file
* *
* @param locker
* @param file * @param file
* @param type * @param lock
* @param thread
* @return * @return
* @throws FileNotFoundException * @throws FileNotFoundException
* @throws IOException * @throws IOException
*/ */
private boolean allocateLock(Object locker, File file, Type type, private boolean allocateLock(File file, LockedFile lock) {
Thread thread, LockedFile lock) {
// Set tht thread of the lock and add lock allocator
lock.lockingThread = Thread.currentThread();
lock.lockers.add(locker);
// Get the lock directory, make sure it is not already taken // Get the lock directory, make sure it is not already taken
File parentDir = file.getParentFile(); File parentDir = file.getParentFile();
@ -333,23 +379,40 @@ public class FileLocker {
boolean gotLock = false; boolean gotLock = false;
File lockFile = new File(parentDir, "." + file.getName() + "_LOCK"); File lockFile = new File(parentDir, "." + file.getName() + "_LOCK");
try { try {
long waitInterval = 500; // start with a moderate wait
long tryCount = MAX_WAIT / waitInterval; long waitInterval = 100;
long curTime = System.currentTimeMillis();
long maxWaitTime = curTime + MAX_WAIT;
long fileTime; long fileTime;
for (int i = 0; !gotLock && i < tryCount; ++i) { while ((curTime = System.currentTimeMillis()) < maxWaitTime) {
gotLock = lockFile.createNewFile() gotLock = lockFile.createNewFile()
|| ((fileTime = lockFile.lastModified()) > 0 && (System || (((fileTime = lockFile.lastModified()) > 0) && ((curTime - fileTime) > MAX_WAIT));
.currentTimeMillis() - fileTime) > MAX_WAIT);
if (!gotLock) { if (gotLock) {
break;
} else {
try { try {
Thread.sleep(waitInterval); Thread.sleep(waitInterval);
} catch (InterruptedException e) { } catch (InterruptedException e) {
// Ignore // Ignore
} }
// every wait reduces the next wait down to minimum wait of
// 10 milliseconds
if (waitInterval > 10) {
waitInterval -= 10;
}
} }
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); UFStatus.getHandler().handle(Priority.PROBLEM,
"Error obtaining file lock: " + file, e);
} finally {
synchronized (lock) {
lock.lockFile = lockFile;
lock.lockFile.setLastModified(System.currentTimeMillis());
lock.lockState = LockState.IN_USE;
}
} }
if (!gotLock) { if (!gotLock) {
@ -357,14 +420,14 @@ public class FileLocker {
+ ", returning anyway"); + ", returning anyway");
Thread.dumpStack(); Thread.dumpStack();
} }
lockFile.setLastModified(System.currentTimeMillis());
lock.lockFile = lockFile;
return gotLock; return gotLock;
} }
private void unallocateLock(LockedFile lock) throws IOException { private void unallocateLock(LockedFile lock) throws IOException {
if (lock.lockFile != null) { if (lock.lockFile != null) {
lock.lockFile.delete(); lock.lockFile.delete();
lock.lockFile = null;
} }
} }
@ -381,8 +444,8 @@ public class FileLocker {
String arg = args[i]; String arg = args[i];
if (arg.startsWith("-")) { if (arg.startsWith("-")) {
// we have a key // we have a key
if (args.length > (i + 1) if ((args.length > (i + 1))
&& args[i + 1].startsWith("-") == false) { && (args[i + 1].startsWith("-") == false)) {
argumentMap.put(arg.substring(1), args[i + 1]); argumentMap.put(arg.substring(1), args[i + 1]);
++i; ++i;
} else { } else {
@ -398,12 +461,13 @@ public class FileLocker {
String fileToLock = argumentMap.get("f"); String fileToLock = argumentMap.get("f");
String threads = argumentMap.get("tc"); String threads = argumentMap.get("tc");
final boolean verbose = argumentMap.get("v") != null; final boolean verbose = argumentMap.get("v") != null;
final boolean verboseCount = argumentMap.get("vc") != null || verbose; final boolean verboseCount = (argumentMap.get("vc") != null) || verbose;
final boolean verboseErrors = argumentMap.get("ve") != null || verbose; final boolean verboseErrors = (argumentMap.get("ve") != null)
|| verbose;
String outputAtCount = argumentMap.get("c"); String outputAtCount = argumentMap.get("c");
String iterVal = argumentMap.get("i"); String iterVal = argumentMap.get("i");
if (fileToLock == null || argumentMap.get("help") != null) { if ((fileToLock == null) || (argumentMap.get("help") != null)) {
System.out.println("Required argument -f <pathToFile>" System.out.println("Required argument -f <pathToFile>"
+ " specifies the file to use in the program"); + " specifies the file to use in the program");
System.out.println("-help prints out this help message"); System.out.println("-help prints out this help message");
@ -458,6 +522,7 @@ public class FileLocker {
final int[] errors = new int[1]; final int[] errors = new int[1];
final File toLock = new File(fileToLock); final File toLock = new File(fileToLock);
List<Runnable> runnables = new ArrayList<Runnable>(threadCount); List<Runnable> runnables = new ArrayList<Runnable>(threadCount);
final Object lockObj = new Object();
final int[] i = { 0 }; final int[] i = { 0 };
for (int j = 1; j <= threadCount; ++j) { for (int j = 1; j <= threadCount; ++j) {
@ -474,8 +539,8 @@ public class FileLocker {
System.out.flush(); System.out.flush();
} }
threadArgs = "rw"; threadArgs = "rw";
} else if (threadArgs.contains("r") == false } else if ((threadArgs.contains("r") == false)
&& threadArgs.contains("w") == false) { && (threadArgs.contains("w") == false)) {
System.err.println("Error parsing thread " + j + " arguments (" System.err.println("Error parsing thread " + j + " arguments ("
+ threadArgs + "), defaulting to rw"); + threadArgs + "), defaulting to rw");
System.err.flush(); System.err.flush();
@ -496,7 +561,7 @@ public class FileLocker {
@Override @Override
public void run() { public void run() {
try { try {
if (FileLocker.lock(this, toLock, write ? Type.WRITE if (FileLocker.lock(lockObj, toLock, write ? Type.WRITE
: Type.READ)) { : Type.READ)) {
boolean canRead = true; boolean canRead = true;
if (toLock.exists() == false) { if (toLock.exists() == false) {
@ -578,7 +643,7 @@ public class FileLocker {
t.printStackTrace(); t.printStackTrace();
} }
} finally { } finally {
FileLocker.unlock(this, toLock); FileLocker.unlock(lockObj, toLock);
} }
} }
}); });
@ -586,7 +651,7 @@ public class FileLocker {
int totalErrors = 0; int totalErrors = 0;
int count = 0; int count = 0;
while (iterations == null || i[0] < iterations) { while ((iterations == null) || (i[0] < iterations)) {
List<Thread> threadList = new ArrayList<Thread>(threadCount); List<Thread> threadList = new ArrayList<Thread>(threadCount);
for (Runnable r : runnables) { for (Runnable r : runnables) {
threadList.add(new Thread(r)); threadList.add(new Thread(r));
@ -610,7 +675,8 @@ public class FileLocker {
++count; ++count;
// Output at -c val if we are verbose or indefinitely looping // Output at -c val if we are verbose or indefinitely looping
if (count == outputCountAt && (verboseCount || iterations == null)) { if ((count == outputCountAt)
&& (verboseCount || (iterations == null))) {
PrintStream out = errors[0] > 0 ? System.err : System.out; PrintStream out = errors[0] > 0 ? System.err : System.out;
out.println("Completed " + count + " iterations with " out.println("Completed " + count + " iterations with "
+ errors[0] + " errors"); + errors[0] + " errors");
@ -621,7 +687,7 @@ public class FileLocker {
} }
} }
if (i[0] % outputCountAt != 0 || !verboseCount) { if ((i[0] % outputCountAt != 0) || !verboseCount) {
totalErrors += errors[0]; totalErrors += errors[0];
PrintStream out = totalErrors > 0 ? System.err : System.out; PrintStream out = totalErrors > 0 ? System.err : System.out;
out.println("Completed " + i[0] + " iterations with " + totalErrors out.println("Completed " + i[0] + " iterations with " + totalErrors

View file

@ -83,6 +83,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* localization performance but caused updated * localization performance but caused updated
* files on the server not to be retrieved. * files on the server not to be retrieved.
* Jan 17, 2013 1412 djohnson Add jaxbMarshal. * Jan 17, 2013 1412 djohnson Add jaxbMarshal.
* Apr 12, 2013 1903 rjpeter Updated getFile to check parentFile for existence.
* </pre> * </pre>
* *
* @author njensen * @author njensen
@ -283,7 +284,7 @@ public final class LocalizationFile implements Comparable<LocalizationFile> {
adapter.retrieve(this); adapter.retrieve(this);
} }
if ((isDirectory == false) && !file.exists()) { if ((isDirectory == false) && !file.getParentFile().exists()) {
try { try {
file.getParentFile().mkdirs(); file.getParentFile().mkdirs();
} catch (Throwable t) { } catch (Throwable t) {
@ -647,7 +648,8 @@ public final class LocalizationFile implements Comparable<LocalizationFile> {
* @param jaxbManager * @param jaxbManager
* the jaxbManager * the jaxbManager
*/ */
public void jaxbMarshal(Object obj, JAXBManager jaxbManager) throws LocalizationException{ public void jaxbMarshal(Object obj, JAXBManager jaxbManager)
throws LocalizationException {
try { try {
String xml = jaxbManager.marshalToXml(obj); String xml = jaxbManager.marshalToXml(obj);
write(xml.getBytes()); write(xml.getBytes());

View file

@ -54,6 +54,8 @@ import com.raytheon.uf.common.time.util.TimeUtil;
* 02/27/2008 879 rbell Added compareTo(TimeRange) * 02/27/2008 879 rbell Added compareTo(TimeRange)
* 03/20/2013 #1774 randerso Changed toString to display times even when * 03/20/2013 #1774 randerso Changed toString to display times even when
* duration is 0, use TimeUtil constants. * duration is 0, use TimeUtil constants.
* 04/04/2013 #1787 randerso Removed a bunch of isValid checks to the logic
* works as intended by the original A1 implementation.
* *
* </pre> * </pre>
* *
@ -64,7 +66,7 @@ import com.raytheon.uf.common.time.util.TimeUtil;
* starting/ending time, or a time and a duration. If the duration is positive * starting/ending time, or a time and a duration. If the duration is positive
* (or zero), then the specified time is the start time. If the duration is * (or zero), then the specified time is the start time. If the duration is
* negative, then the specified time is the end time as shown in the design * negative, then the specified time is the end time as shown in the design
* document*. * document.
* *
* TimeRanges are generally used to define a valid time range for data files. * TimeRanges are generally used to define a valid time range for data files.
* TimeRange components (start time, end time, and duration) may be retrieved. * TimeRange components (start time, end time, and duration) may be retrieved.
@ -314,11 +316,7 @@ public class TimeRange implements Serializable, Comparable<TimeRange>,
* @return the duration * @return the duration
*/ */
public long getDuration() { public long getDuration() {
if (isValid()) { return end.getTime() - start.getTime();
return end.getTime() - start.getTime();
} else {
return 0L;
}
} }
/* /*
@ -368,16 +366,13 @@ public class TimeRange implements Serializable, Comparable<TimeRange>,
* @return * @return
*/ */
public boolean contains(Date time) { public boolean contains(Date time) {
if (!this.isValid()) {
return false;
}
if (getDuration() != 0) { if (getDuration() != 0) {
// the end time is not part of the time range (hence the < operator)
return time.getTime() >= start.getTime() return time.getTime() >= start.getTime()
&& time.getTime() < end.getTime(); && time.getTime() < end.getTime();
} else { } else {
return time.equals(start); // Special case for zero duration time // Special case for zero duration time range
// range return time.equals(start);
} }
} }
@ -388,7 +383,14 @@ public class TimeRange implements Serializable, Comparable<TimeRange>,
* @param time * @param time
* the time to be included * the time to be included
*/ */
@Deprecated
public void extend(Date time) { public void extend(Date time) {
// TODO: remove this method as it is the only method other than the
// setters required for dynamic serialization that modify a TimeRange
// The original intent was for this class to be immutable.
// I found no Java code calling this method but it's difficult to
// determine if it's called from Python since extend is a build in
// method on lists
if (!this.isValid()) { if (!this.isValid()) {
return; return;
} }
@ -409,10 +411,6 @@ public class TimeRange implements Serializable, Comparable<TimeRange>,
* @return true if a time range is contained within the range * @return true if a time range is contained within the range
*/ */
public boolean contains(TimeRange timeRange) { public boolean contains(TimeRange timeRange) {
if (!this.isValid()) {
return false;
}
if (getDuration() == 0) { if (getDuration() == 0) {
return this.equals(timeRange); return this.equals(timeRange);
} else if (timeRange.getDuration() == 0) { } else if (timeRange.getDuration() == 0) {
@ -433,10 +431,6 @@ public class TimeRange implements Serializable, Comparable<TimeRange>,
* @return true if the time ranges are adjacent * @return true if the time ranges are adjacent
*/ */
public boolean isAdjacentTo(TimeRange timeRange) { public boolean isAdjacentTo(TimeRange timeRange) {
if (!this.isValid()) {
return false;
}
return start.equals(timeRange.end) || end.equals(timeRange.start); return start.equals(timeRange.end) || end.equals(timeRange.start);
} }
@ -452,10 +446,6 @@ public class TimeRange implements Serializable, Comparable<TimeRange>,
* @return true if the time range overlaps * @return true if the time range overlaps
*/ */
public boolean overlaps(TimeRange timeRange) { public boolean overlaps(TimeRange timeRange) {
if (!this.isValid()) {
return false;
}
if (timeRange.contains(start) || contains(timeRange.getStart())) { if (timeRange.contains(start) || contains(timeRange.getStart())) {
return true; return true;
} else { } else {
@ -555,9 +545,6 @@ public class TimeRange implements Serializable, Comparable<TimeRange>,
*/ */
@Override @Override
public TimeRange clone() { public TimeRange clone() {
if (!this.isValid()) {
return new TimeRange();
}
return new TimeRange(this.start, this.end); return new TimeRange(this.start, this.end);
} }