13.4.1-3 baseline

Former-commit-id: 02412063da81fbfd3f1bbdd48700e1b1ccdeb4fd
This commit is contained in:
Steve Harris 2013-04-29 12:25:07 -05:00
parent 52f0ae4758
commit 54afedf617
78 changed files with 2156 additions and 3284 deletions

View file

@ -2,6 +2,6 @@
<?eclipse-pydev version="1.0"?>
<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_project>

View file

@ -2,19 +2,19 @@
##
# 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.
##
@ -119,7 +119,7 @@ nnn = r'(?:[A-Z]{2}[ZC])?\d{3}'
purge = r'(?P<purgeT>\d{6})-'
ugc = r'\n(?P<uhdr>' + r'[A-Z]{2}[Z|C](?:(?:\d{3})|(?:ALL))' + r'(?:[->]\n?' + nnn + \
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'.*'
@ -192,20 +192,20 @@ class ProductParser:
#l = headline_re.finditer(str)
l = single_head_re.finditer(str)
for m in l:
if m is not None:
if m is not None:
#print 'phl m = ', m
newstart = start + m.start()
m = headline_re.match(m.group(0))
if m is not None:
hdlns.append(self.dumpMatch(m, newstart))
#print 'hdlns = ', hdlns
rval['headInfo'] = hdlns
def dumpMatch(self, m, offset=0, rval=None):
if rval is None:
rval = {}
#print 'dumpmatch m = ', m.groupdict()
for k in m.groupdict().keys():
if m.start(k) != -1 and m.start(k) != m.end(k):
@ -234,7 +234,7 @@ class ProductParser:
segs = []
l = ugch_re.finditer(self._str)
for m in l:
if m is not None:
m1 = cityh_re.search(self._str, m.end())
@ -250,7 +250,7 @@ class ProductParser:
else:
continue
m4 = head_re.search(self._str, m.end(), m3.end())
d = self.dumpMatch(m)
d = self.dumpMatch(m2, rval=d)
d = self.dumpMatch(m3, rval=d)
@ -266,7 +266,7 @@ class ProductParser:
else:
d['city'] = (self.tkc(m2.start()),
self.tkc(m2.start()))
if m4 is not None:
#print 'm4 = ', m4.group()
d = self.dumpMatch(m4, rval=d)
@ -284,7 +284,7 @@ class ProductParser:
rval['frames'] = frames
return rval
def parseFromJava(self, text):
self._str = text
self._ci = None
@ -295,13 +295,13 @@ class ProductParser:
lc.append(count)
count += l
self._totals = lc
#print 'text START ----------------------'
#print text
#print 'text END ------------------------'
result = self.parse()
#print 'result = ', result
return JUtil.pyDictToJavaMap(result)

View file

@ -24,6 +24,7 @@ import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.NavigableSet;
import java.util.Set;
import java.util.TreeSet;
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.LevelFactory;
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;
/**
@ -57,8 +59,8 @@ public class LevelUtilities {
static {
try {
hPa = (Unit<?>) UnitFormat.getUCUMInstance().parseProductUnit(
"hPa", new ParsePosition(0));
hPa = UnitFormat.getUCUMInstance().parseProductUnit("hPa",
new ParsePosition(0));
} catch (Exception e) {
// this is bad
}
@ -122,7 +124,15 @@ public class LevelUtilities {
};
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
.getMasterLevel().getName());
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.graphing;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
Import-Package: com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.dataplugin.grid,
com.raytheon.uf.common.dataplugin.level,
com.raytheon.uf.common.dataplugin.radar,
com.raytheon.uf.common.dataplugin.radar.util,
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.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.ConstraintType;
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.viz.core.datastructure.DataCubeContainer;
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.rsc.DisplayType;
import com.raytheon.uf.viz.core.style.level.SingleLevel;
@ -238,6 +238,7 @@ public class PointDataTimeSeriesAdapter extends
return loadDataOAInternal(recordsToLoad);
}
@Override
public SingleLevel getLevel() {
SingleLevel level = new SingleLevel("SURFACE");
level.setValue(0.0);
@ -246,7 +247,8 @@ public class PointDataTimeSeriesAdapter extends
return level;
}
try {
LevelMapping mapping = LevelMappingFactory.getInstance()
LevelMapping mapping = LevelMappingFactory.getInstance(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getLevelMappingForKey(resourceData.getLevelKey());
for (Level l : mapping.getLevels()) {
if (LevelUtilities.isPressureLevel(l)) {
@ -260,7 +262,7 @@ public class PointDataTimeSeriesAdapter extends
}
}
}
} catch (VizException e) {
} catch (Exception e) {
// return the default
}
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.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.derivparam.tree.AbstractNode;
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.viz.core.exception.VizCommunicationException;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
import com.raytheon.uf.viz.core.level.LevelUtilities;
import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
import com.raytheon.uf.viz.derivparam.data.FloatRequestableData;
@ -137,27 +137,36 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
if (this == obj) {
return true;
if (obj == null)
}
if (obj == null) {
return false;
if (getClass() != obj.getClass())
}
if (getClass() != obj.getClass()) {
return false;
}
StackEntry other = (StackEntry) obj;
if (!getOuterType().equals(other.getOuterType()))
if (!getOuterType().equals(other.getOuterType())) {
return false;
if (level != other.level)
}
if (level != other.level) {
return false;
}
if (source == null) {
if (other.source != null)
if (other.source != null) {
return false;
} else if (!source.equals(other.source))
}
} else if (!source.equals(other.source)) {
return false;
}
if (parameter == null) {
if (other.parameter != null)
if (other.parameter != null) {
return false;
} else if (!parameter.equals(other.parameter))
}
} else if (!parameter.equals(other.parameter)) {
return false;
}
return true;
}
@ -474,8 +483,10 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
protected Collection<Level> getAllLevels() {
if (allLevels == null) {
try {
return LevelMappingFactory.getInstance().getAllLevels();
} catch (VizCommunicationException e) {
return LevelMappingFactory.getInstance(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getAllLevels();
} catch (CommunicationException e) {
// TODO recover from this.
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
@ -1094,7 +1105,13 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
// because it is valid for all requests
} else if (type == LevelType.LevelMapping) {
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,
fieldLevel, stack, nodata);
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.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.adapters.UnitAdapter;
import com.raytheon.uf.viz.core.exception.VizCommunicationException;
import com.raytheon.uf.viz.core.level.LevelMapping;
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
/**
* Metadata about a derived parameter field.
@ -131,7 +131,8 @@ public class DerivParamField implements ISerializableObject, IDerivParamField {
public boolean setLevel(String level) throws VizCommunicationException {
levelType = LevelType.parseLevel(level);
if (levelType == LevelType.LevelMapping) {
levelMapping = LevelMappingFactory.getInstance()
levelMapping = LevelMappingFactory.getInstance(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getLevelMappingForKey(level);
if (levelMapping == 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.MasterLevel;
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.MultipleMappingException;
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
@ -74,7 +74,8 @@ public class ValidLevelGenerator {
private Set<MasterLevel> masterLevelsHandled;
public ValidLevelGenerator() {
lmf = LevelMappingFactory.getInstance();
lmf = LevelMappingFactory
.getInstance(LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE);
lf = LevelFactory.getInstance();
lm = LevelMapper.getInstance();
}
@ -84,61 +85,65 @@ public class ValidLevelGenerator {
masterLevels = new HashMap<MasterLevel, Set<Level>>();
validLevels = new HashSet<Level>();
masterLevelsHandled = new HashSet<MasterLevel>();
if (validLevelsString != null && validLevelsString.length() > 0) {
String[] levelTokenArray = validLevelsString.split(",");
List<String> tokensToProcess = new ArrayList<String>(
levelTokenArray.length);
try {
if (validLevelsString != null && validLevelsString.length() > 0) {
String[] levelTokenArray = validLevelsString.split(",");
List<String> tokensToProcess = new ArrayList<String>(
levelTokenArray.length);
for (String token : levelTokenArray) {
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);
for (String token : levelTokenArray) {
tokensToProcess.add(token);
}
// See if this is a group.
Map<MasterLevel, Set<Level>> tmp = lmf
.getLevelMapForGroup(token);
if (tmp != null) {
masterLevels = tmp;
iter.remove();
break;
}
}
// generate initial list
Iterator<String> iter = tokensToProcess.iterator();
if (masterLevels.size() == 0 && tokensToProcess.size() > 0) {
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);
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);
levels.add(l);
}
}
if (tokensToProcess.size() > 0) {
for (String token : tokensToProcess) {
try {
processLevelToken(token);
} catch (CommunicationException e) {
throw new VizCommunicationException(e);
if (tmp != null) {
masterLevels = tmp;
iter.remove();
break;
}
}
} else {
for (Set<Level> levels : masterLevels.values()) {
validLevels.addAll(levels);
if (masterLevels.size() == 0 && tokensToProcess.size() > 0) {
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;

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/20/13 1635 D. Hladky Fixed multi guidance sources
* Mar 6, 2013 1769 dhladky Changed threading to use count down latch.
* Apr 9, 2013 1890 dhladky Fixed the broken cache file load
*
* </pre>
*
@ -386,19 +387,40 @@ public class FFMPMonitor extends ResourceMonitor {
* @param dataKey
* @param source
*/
public void insertFFMPData(FFMPAggregateRecord data, String siteKey,
String source) {
// TODO do we need this method if we're no longer supporting cache
// records?
if (siteDataMap.containsSite(siteKey)) {
if (siteDataMap.get(siteKey).containsSource(source)) {
for (Entry<String, FFMPBasinData> entry : data.getBasinsMap()
.entrySet()) {
FFMPBasinData basinData = entry.getValue();
basinData.populate(data.getTimes());
public void insertFFMPData(FFMPAggregateRecord data,
NavigableMap<Date, List<String>> uris, String siteKey, String source) {
// get record from cache
FFMPSourceData sourceData = siteDataMap.get(siteKey).getSourceData(source);
FFMPRecord curRecord = sourceData.getRecord();
if (curRecord == null) {
// add each huc requested
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 RetrieveMergeDlg.
* Changes for non-blocking LoadSaveDeleteSelectDlg.
* Apr, 15, 2013 #1911 dhladky dialog wouldn't open every time to retrieve file.
*
* </pre>
*
@ -1607,8 +1608,8 @@ public class FFFGDlg extends CaveSWTDialog implements ISourceCompAction,
}
if (isDialogClear() && (fileNameLbl.getText().trim().length() == 0)) {
return;
} else {
getRetrieveFilename(RetrieveMergeAction.RETRIEVE);
} else {
if (retMergeDlg == null) {
retMergeDlg = new RetrieveMergeDlg(shell);
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
* getting ColorCell and ReverseFilter
* Apr 15. 2013 1890 dhladky Added Mikes fix for singleton.
*
* </pre>
*
@ -123,27 +124,9 @@ public class FFMPConfig {
}
public static synchronized FFMPConfig getInstance() {
if (classInstance == null) {
classInstance = new FFMPConfig();
}
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() {
threshMgrMap = new HashMap<ThreshColNames, ThresholdManager>();

View file

@ -319,8 +319,8 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
dataLoadFont.dispose();
timeDurFont.dispose();
FFMPConfig.getInstance().disposeResources();
FFMPConfig.unloadConfig();
//FFMPConfig.getInstance().disposeResources();
//FFMPConfig.unloadConfig();
if (refreshColor != null) {
refreshColor.dispose();
@ -1311,15 +1311,20 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
if (attributeDlg == null || attributeDlg.isDisposed()) {
attrData = ffmpTable.getVisibleColumns();
attributeDlg = new AttributesDlg(shell, resource, attrData, this);
attributeDlg.open();
} else {
attributeDlg.bringToTop();
}
attributeDlg.open();
}
private void displayThresholdsDialog(ThreshColNames colName) {
if (attrThreshDlg == null) {
attrThreshDlg = new AttributeThresholdDlg(shell, colName, this);
attrThreshDlg.open();
} else {
attrThreshDlg.bringToTop();
}
attrThreshDlg.open();
attrThreshDlg.newThreshold(colName);
}
@ -2105,13 +2110,17 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
shell.pack();
}
String prefix = null;
String prefix = null;
if (status.getLoaderType() == LOADER_TYPE.SECONDARY) {
prefix = " Secondary Data Load: ";
} else {
prefix = " Tertiary Data Load: ";
}
if (status.getLoaderType() == LOADER_TYPE.SECONDARY) {
prefix = " Secondary Data Load: ";
} else if (status.getLoaderType() == LOADER_TYPE.TERTIARY) {
prefix = " Tertiary Data Load: ";
} else if (status.getLoaderType() == LOADER_TYPE.GENERAL) {
prefix = " General Data Load: ";
} else {
prefix = " Tertiary Data Load: ";
}
if (status.isDone() == false) {
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.FFMPGuidanceInterpolation;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPTemplates;
import com.raytheon.uf.common.monitor.config.FFFGDataMgr;
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
* 01/14/13 1569 dhladky changed arraylist to list
* 04/15/13 1890 dhladky Changed COUNTY to use constant
*
* </pre>
*
@ -132,7 +134,7 @@ public class FFFGForceUtil {
pfafList = ft.getAggregatePfafs(cBasin.getPfaf(),
resource.getSiteKey(), resource.getHuc());
} else if (!domain.equals("NA")) {
if (!resource.getHuc().equals("ALL")) {
if (!resource.getHuc().equals(FFMPRecord.ALL)) {
pfafList = ft.getAggregatePfafsByDomain(cBasin.getPfaf(),
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 20, 2013 1635 dhladky Fixed multi guidance displays
* 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>
* @author dhladky
* @version 1.0
@ -497,7 +499,7 @@ public class FFMPDataGenerator {
forced = forceUtil.isForced();
}
if ((!forcedPfafs.isEmpty()) && forced) {
if ((!forcedPfafs.isEmpty()) && forced && centeredAggregationKey == null) {
// Recalculate the guidance using the forced
// value(s)
guidance = guidRecords
@ -510,7 +512,7 @@ public class FFMPDataGenerator {
guidance,
forcedPfafs,
resource.getGuidSourceExpiration(guidType));
} else if (!forcedPfafs.isEmpty()) {
} else if (!forcedPfafs.isEmpty() && centeredAggregationKey == null) {
guidance = guidRecords
.get(guidType)
.getBasinData(ALL)
@ -522,7 +524,7 @@ public class FFMPDataGenerator {
forcedPfafs,
resource.getGuidSourceExpiration(guidType));
forced = true;
} else if (!pfafList.isEmpty()) {
} else if (!pfafList.isEmpty() && centeredAggregationKey == null) {
guidance = guidRecords
.get(guidType)
.getBasinData(ALL)
@ -674,7 +676,7 @@ public class FFMPDataGenerator {
forced = forceUtil.isForced();
}
if ((!forcedPfafs.isEmpty()) && forced) {
if ((!forcedPfafs.isEmpty()) && forced && centeredAggregationKey == null) {
// Recalculate the guidance using the forced
// value(s)
guidance = guidRecords
@ -687,7 +689,7 @@ public class FFMPDataGenerator {
guidance,
forcedPfafs,
resource.getGuidSourceExpiration(guidType));
} else if (!forcedPfafs.isEmpty()) {
} else if (!forcedPfafs.isEmpty() && centeredAggregationKey == null) {
guidance = guidRecords
.get(guidType)
.getBasinData(ALL)
@ -699,7 +701,7 @@ public class FFMPDataGenerator {
forcedPfafs,
resource.getGuidSourceExpiration(guidType));
forced = true;
} else if (!pfafList.isEmpty()) {
} else if (!pfafList.isEmpty() && centeredAggregationKey == null) {
guidance = guidRecords
.get(guidType)
.getBasinData(ALL)
@ -843,7 +845,7 @@ public class FFMPDataGenerator {
ArrayList<Long> pfafs = ft.getAggregatePfafs(basin.getPfaf(),
siteKey, huc);
if (!pfafs.isEmpty()) {
if (huc.equals("COUNTY")) {
if (huc.equals(FFMPRecord.COUNTY)) {
name = ft.getCountyStateName(siteKey, basin.getPfaf());
} else {
for (int i = 0; i < pfafs.size(); i++) {

View file

@ -20,7 +20,6 @@
package com.raytheon.uf.viz.monitor.ffmp.ui.rsc;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
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
* 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.
* Apr 9, 2013 1890 dhladky removed loading of phantom Virtual template and cache file processing.
* </pre>
*
* @author dhladky
@ -74,7 +74,8 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.listeners.FFMPLoaderEvent;
*/
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;
@ -156,13 +157,14 @@ public class FFMPDataLoader extends Thread {
@Override
public void run() {
long time = System.currentTimeMillis();
try {
resourceData.setLoader(loadType);
FFMPMonitor monitor = getMonitor();
FFMPSourceConfigurationManager sourceConfig = monitor.getSourceConfig();
FFMPMonitor monitor = getMonitor();
FFMPSourceConfigurationManager sourceConfig = monitor
.getSourceConfig();
ProductRunXML productRun = runner.getProduct(siteKey);
ArrayList<String> qpfSources = new ArrayList<String>();
@ -235,6 +237,10 @@ public class FFMPDataLoader extends Thread {
if (loadType == LOADER_TYPE.TERTIARY) {
hucsToLoad.clear();
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()) {
@ -253,29 +259,28 @@ public class FFMPDataLoader extends Thread {
}
// qpes
fireLoaderEvent(loadType, "Processing " + product.getQpe(), isDone());
fireLoaderEvent(loadType, "Processing " + product.getQpe(),
isDone());
FFMPAggregateRecord qpeCache = null;
if (loadType == LOADER_TYPE.INITIAL) {
SourceXML source = sourceConfig.getSource(
product.getQpe());
SourceXML source = sourceConfig.getSource(product.getQpe());
qpeCache = readAggregateRecord(source, dataKey, wfo);
if (qpeCache != null) {
monitor.insertFFMPData(qpeCache, siteKey,
product.getQpe());
monitor.insertFFMPData(qpeCache, qpeURIs, siteKey, 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) {
for (String phuc : hucsToLoad) {
if (phuc.equals(layer)
|| phuc.equals(FFMPRecord.ALL)) {
monitor.processUris(qpeURIs, isProductLoad,
siteKey, product.getQpe(), timeBack, phuc);
if (phuc.equals(layer) || phuc.equals(FFMPRecord.ALL)) {
monitor.processUris(qpeURIs, isProductLoad, siteKey,
product.getQpe(), timeBack, phuc);
}
}
}
@ -291,7 +296,6 @@ public class FFMPDataLoader extends Thread {
if (loadType == LOADER_TYPE.INITIAL) {
SourceXML source = sourceConfig
.getSource(qpfSources.get(i));
@ -300,36 +304,36 @@ public class FFMPDataLoader extends Thread {
if (qpfCache != null) {
for (String phuc : hucsToLoad) {
if ((phuc.equals(layer) || phuc.equals(FFMPRecord.ALL))
if ((phuc.equals(layer) || phuc
.equals(FFMPRecord.ALL))
&& loadType == LOADER_TYPE.INITIAL
&& source.getSourceName().equals(
config.getFFMPConfigData()
.getIncludedQPF())) {
.getIncludedQPF())) {
if (!qpfURIs.isEmpty()) {
monitor.processUris(qpfURIs,
isProductLoad, siteKey,
source.getSourceName(), timeBack,
phuc);
monitor.processUris(qpfURIs, isProductLoad,
siteKey, source.getSourceName(),
timeBack, phuc);
}
}
}
monitor.insertFFMPData(qpfCache, siteKey,
monitor.insertFFMPData(qpfCache, qpfURIs, siteKey,
source.getSourceName());
}
}
// if (isUrisProcessNeeded(qpfData,qpfURIs))
// {/*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()) {
for (String phuc : hucsToLoad) {
if (phuc.equals(layer)
|| phuc.equals(FFMPRecord.ALL)) { // old
// code:
// keep
// for
// reference*/
if (phuc.equals(layer) || phuc.equals(FFMPRecord.ALL)) { // old
// code:
// keep
// for
// reference*/
// if (isHucProcessNeeded(phuc)) {/*DR13839*/
monitor.processUris(qpfURIs, isProductLoad,
siteKey, product.getQpf(i), timeBack, phuc);
@ -344,24 +348,8 @@ public class FFMPDataLoader extends Thread {
fireLoaderEvent(loadType, "Processing " + product.getVirtual(),
isDone());
FFMPAggregateRecord vgbCache = null;
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()) {
// process virtual all for all only, never uses cache files
if (!virtualURIs.isEmpty()) {
monitor.processUris(virtualURIs, isProductLoad, siteKey,
product.getVirtual(), timeBack, FFMPRecord.ALL);
}
@ -379,10 +367,12 @@ public class FFMPDataLoader extends Thread {
.get(guidSource.getSourceName());
fireLoaderEvent(loadType,
"Processing " + guidSource.getSourceName(), isDone());
"Processing " + guidSource.getSourceName(),
isDone());
monitor.processUris(iguidURIs, isProductLoad, siteKey,
guidSource.getSourceName(), timeBack, FFMPRecord.ALL);
guidSource.getSourceName(), timeBack,
FFMPRecord.ALL);
fireLoaderEvent(loadType, guidSource.getSourceName(),
isDone());
@ -390,10 +380,11 @@ public class FFMPDataLoader extends Thread {
}
}
} 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 {
latch.countDown();
synchronized(this) {
synchronized (this) {
this.notifyAll();
}
}
@ -406,7 +397,8 @@ public class FFMPDataLoader extends Thread {
}
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());
}
@ -503,7 +495,8 @@ public class FFMPDataLoader extends Thread {
try {
// we are just checking if it exists or not
String pdataKey = product.getProductKey();
String sourceSiteDataKey = getSourceSiteDataKey(source, pdataKey);
String sourceSiteDataKey = getSourceSiteDataKey(source,
pdataKey);
File hdf5File = FFMPUtils.getHdf5File(wfo, sourceSiteDataKey);
DataStoreFactory.getDataStore(hdf5File);
@ -516,16 +509,16 @@ public class FFMPDataLoader extends Thread {
return siteKey;
}
/**
* Get the sourceSiteDataKey for this piece of data
*
* @param source
* @param pdataKey
* @return
*/
private String getSourceSiteDataKey(SourceXML source, String pdataKey) {
return source.getSourceName() + "-" + siteKey + "-"
+ pdataKey;
return source.getSourceName() + "-" + siteKey + "-" + pdataKey;
}
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 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.
* Apr 9, 2013 1890 dhladky General cleanup.
* Apr 10, 2013 1896 bsteffen Make FFMPResource work better with D2D
* time matcher.
* </pre>
@ -1219,7 +1220,7 @@ public class FFMPResource extends
paintProps.setAlpha(getCapability(ImagingCapability.class)
.getAlpha());
boolean isShaded = isPolygonal();
boolean isShaded = true;
FFMPDrawable drawable = null;
if (paintTime != null) {
@ -1571,14 +1572,6 @@ public class FFMPResource extends
return geometryType;
}
protected boolean isLineal() {
return getGeometryType().endsWith("LINESTRING");
}
protected boolean isPolygonal() {
return getGeometryType().endsWith("POLYGON");
}
/**
* 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.core.contours;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-ActivationPolicy: lazy
Export-Package: com.raytheon.uf.viz.objectiveanalysis.rsc
Import-Package: com.raytheon.uf.common.comm,
com.raytheon.uf.common.dataplugin.level,
com.raytheon.uf.common.dataplugin.radar,
com.raytheon.uf.common.gridcoverage,
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.LevelFactory;
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.viz.core.exception.VizCommunicationException;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
@ -196,29 +196,30 @@ public class OAResourceData extends AbstractRequestableResourceData {
DataTime[] times = super.getAvailableTimes();
if (this.levelKey.equals(ALL_TILTS)) {
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>();
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);
try {
MasterLevel ml = factory.getMasterLevel("TILT");
Set<Level> allLevels = LevelMappingFactory.getInstance(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getAllLevels();
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
.toArray(new DataTime[timesWithLevels.size()]);

View file

@ -67,6 +67,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* 03/13/2008 879 rbell Legacy conversion.
* 06/10/2009 2159 rjpeter Updated isValid to call gridSlice.isValid
* 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>
*
* @author chammack
@ -1026,16 +1028,20 @@ public abstract class AbstractGridData implements IGridData {
return false;
}
if (!((AbstractGridData) source).gridSlice.getGridInfo().equals(
this.gridSlice.getGridInfo())) {
if (!source.getParm().getGridInfo()
.equals(this.getParm().getGridInfo())) {
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;
}
if (!source.getGridTime().equals(getGridTime())) {
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;
}

View file

@ -25,7 +25,8 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.viz.points;bundle-version="1.0.0",
com.raytheon.uf.common.gridcoverage,
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
Export-Package: com.raytheon.viz.grid,
com.raytheon.viz.grid.inv,
@ -36,7 +37,6 @@ Export-Package: com.raytheon.viz.grid,
Import-Package: com.raytheon.edex.scriptfactory,
com.raytheon.uf.common.colormap,
com.raytheon.uf.common.comm,
com.raytheon.uf.common.dataplugin.level,
com.raytheon.uf.common.derivparam.tree,
com.raytheon.uf.common.localization,
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.LevelFactory;
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.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizCommunicationException;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.ResourceProperties;
import com.raytheon.uf.viz.core.rsc.ResourceType;
@ -195,8 +194,11 @@ public class GridProductBrowserDataDefinition extends
params = Arrays.asList(value);
} else if (key.equals(GridInventory.MASTER_LEVEL_QUERY)) {
if (levels == null) {
levels = new ArrayList<Level>(LevelMappingFactory
.getInstance().getAllLevels());
levels = new ArrayList<Level>(
LevelMappingFactory
.getInstance(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getAllLevels());
}
Iterator<Level> iter = levels.iterator();
while (iter.hasNext()) {
@ -209,8 +211,11 @@ public class GridProductBrowserDataDefinition extends
} else if (key.equals(GridInventory.LEVEL_ONE_QUERY)) {
double doubleValue = Double.parseDouble(value);
if (levels == null) {
levels = new ArrayList<Level>(LevelMappingFactory
.getInstance().getAllLevels());
levels = new ArrayList<Level>(
LevelMappingFactory
.getInstance(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getAllLevels());
}
Iterator<Level> iter = levels.iterator();
while (iter.hasNext()) {
@ -221,8 +226,11 @@ public class GridProductBrowserDataDefinition extends
} else if (key.equals(GridInventory.LEVEL_TWO_QUERY)) {
double doubleValue = Double.parseDouble(value);
if (levels == null) {
levels = new ArrayList<Level>(LevelMappingFactory
.getInstance().getAllLevels());
levels = new ArrayList<Level>(
LevelMappingFactory
.getInstance(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getAllLevels());
}
Iterator<Level> iter = levels.iterator();
while (iter.hasNext()) {
@ -280,9 +288,6 @@ public class GridProductBrowserDataDefinition extends
return returnQueue.toArray(new String[0]);
}
}
} catch (VizCommunicationException e) {
statusHandler.handle(Priority.ERROR, "Unable to query data for "
+ productName, e);
} catch (CommunicationException e) {
statusHandler.handle(Priority.ERROR, "Unable to query data for "
+ productName, e);

View file

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

View file

@ -1,4 +1,5 @@
com.raytheon.viz.mpe.ui.rsc.MPERadarRingOverlayResourceData
com.raytheon.viz.mpe.ui.displays.MPEMapRenderableDisplay
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
* 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>
*
@ -401,6 +402,10 @@ public class MPEDisplayManager {
private DisplayFieldData displayedField;
private int displayedAccumHrs;
private ArealDisplay displayedArealDisplay;
private final MPEFieldResourceData fieldResourceData = new MPEFieldResourceData();
private MPEFieldResource displayedFieldResource;
@ -698,9 +703,14 @@ public class MPEDisplayManager {
*/
public void displayFieldData(DisplayFieldData fieldToDisplay,
int accumulationHrs, ArealDisplay arealDisplay) {
if (displayedField != fieldToDisplay || displayedFieldResource == null) {
if (displayedField != fieldToDisplay || displayedFieldResource == null
|| accumulationHrs != displayedAccumHrs
|| arealDisplay != displayedArealDisplay) {
DisplayFieldData oldField = displayedField;
displayedField = fieldToDisplay;
displayedAccumHrs = accumulationHrs;
displayedArealDisplay = arealDisplay;
ResourceList list = display.getDescriptor().getResourceList();
if (displayedFieldResource != null) {
@ -725,14 +735,6 @@ public class MPEDisplayManager {
listener.displayFieldChanged(oldField, fieldToDisplay);
}
}
// reset gages
List<MPEGageResource> rscs = display.getDescriptor()
.getResourceList()
.getResourcesByTypeAsType(MPEGageResource.class);
for (MPEGageResource rsc : rscs) {
rsc.reloadGages();
}
}
displayedFieldResource.issueRefresh();
@ -1118,4 +1120,15 @@ public class MPEDisplayManager {
+ " - 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 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.mpe.ui.DisplayFieldData;
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
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
@ -39,6 +42,7 @@ import com.raytheon.viz.mpe.ui.colors.MPEColorManager;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 5, 2008 mschenke Initial creation
* Apr 18, 2013 1920 mpduff Set new ColorMap.
* </pre>
*
* @author mschenke
@ -69,9 +73,24 @@ public class MPEColorScaleMgrAction extends AbstractHandler {
colorScaleDlg.open();
}
DisplayFieldData dt = MPEDisplayManager.getCurrent()
.getDisplayFieldType();
MPEDisplayManager.getCurrent().displayFieldData(dt);
MPEFieldResource displayedFieldResource = MPEDisplayManager
.getCurrent().getDisplayedFieldResource();
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;
}

View file

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

View file

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

View file

@ -18,7 +18,8 @@ Require-Bundle: org.apache.batik,
com.raytheon.uf.viz.localization;bundle-version="1.12.1174",
org.jep;bundle-version="1.0.0",
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
Export-Package: com.raytheon.viz.pointdata,
com.raytheon.viz.pointdata.drawables,
@ -28,7 +29,6 @@ Export-Package: com.raytheon.viz.pointdata,
Import-Package: com.raytheon.edex.meteoLib,
com.raytheon.uf.common.comm,
com.raytheon.uf.common.dataplugin.grid,
com.raytheon.uf.common.dataplugin.level,
com.raytheon.uf.common.derivparam.tree,
com.raytheon.uf.common.message.response,
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.dataplugin.level.Level;
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.localization.IPathManager;
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.time.BinOffset;
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
import com.raytheon.uf.viz.core.exception.VizCommunicationException;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
import com.raytheon.uf.viz.core.map.MapDescriptor;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.ResourceType;
@ -281,14 +280,15 @@ public class PlotModelDataDefinition extends
try {
Level level = LevelFactory.getInstance().getLevel(
Long.parseLong(levelid));
validLevels.add(LevelMappingFactory.getInstance()
.getLevelMappingForLevel(level).getDisplayName());
validLevels
.add(LevelMappingFactory
.getInstance(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getLevelMappingForLevel(level)
.getDisplayName());
} catch (CommunicationException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
} catch (VizCommunicationException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
}
}
return validLevels.toArray(new String[0]);

View file

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

View file

@ -25,8 +25,10 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.raytheon.uf.common.comm.CommunicationException;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.level.Level;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
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.IDataCubeAdapter;
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.level.LevelMappingFactory;
import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
import com.raytheon.uf.viz.derivparam.inv.AvailabilityContainer;
@ -143,8 +145,15 @@ public class PointDataCubeAdapter implements IDataCubeAdapter {
source += type;
}
List<Level> levels = LevelMappingFactory.getInstance()
.getLevelMappingForKey(levelKey).getLevels();
List<Level> levels;
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,
Arrays.asList(parameters), levels);
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",
gov.noaa.nws.ncep.ui.nsharp;bundle-version="1.0.0",
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
Export-Package: com.raytheon.viz.volumebrowser,
com.raytheon.viz.volumebrowser.catalog,
@ -41,7 +43,6 @@ Export-Package: com.raytheon.viz.volumebrowser,
Import-Package: com.raytheon.uf.common.comm,
com.raytheon.uf.common.dataplugin.grid,
com.raytheon.uf.common.dataplugin.grid.dataset,
com.raytheon.uf.common.dataplugin.level,
com.raytheon.uf.common.gridcoverage,
com.raytheon.uf.common.menus.xml,
com.raytheon.uf.viz.core.maps.display,

View file

@ -29,15 +29,16 @@ import java.util.List;
import java.util.Set;
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.mapping.LevelMapping;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizCommunicationException;
import com.raytheon.uf.viz.core.level.LevelMapping;
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
import com.raytheon.uf.viz.core.level.LevelUtilities;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.DisplayType;
@ -373,12 +374,13 @@ public abstract class AbstractDataCatalog implements IDataCatalog {
}
} else {
try {
LevelMappingFactory lmf = LevelMappingFactory.getInstance();
LevelMappingFactory lmf = LevelMappingFactory
.getInstance(LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE);
LevelMapping lm = lmf.getLevelMappingForKey(planesKey);
if (lm != null) {
levels = lm.getLevels();
}
} catch (VizCommunicationException e) {
} catch (CommunicationException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
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.dataplugin.level.Level;
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.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
import com.raytheon.uf.viz.core.exception.VizCommunicationException;
import com.raytheon.uf.viz.core.level.LevelMapping;
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
import com.raytheon.uf.viz.core.level.LevelUtilities;
import com.raytheon.uf.viz.derivparam.inv.AbstractInventory;
import com.raytheon.viz.volumebrowser.vbui.DataListsProdTableComp.DataSelection;
@ -184,16 +184,13 @@ public abstract class AbstractInventoryDataCatalog extends AbstractDataCatalog {
}
request.addAvailablePlane("spatial-"
+ level.getMasterLevel().getName());
try {
LevelMapping lm = LevelMappingFactory.getInstance()
.getLevelMappingForLevel(level);
LevelMapping lm = LevelMappingFactory
.getInstance(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getLevelMappingForLevel(level);
if (lm != null) {
request.addAvailablePlane(lm.getKey());
}
} catch (VizCommunicationException e) {
statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
if (lm != null) {
request.addAvailablePlane(lm.getKey());
}
} catch (CommunicationException e) {
statusHandler.handle(Priority.PROBLEM,
@ -255,6 +252,7 @@ public abstract class AbstractInventoryDataCatalog extends AbstractDataCatalog {
return result;
}
@Override
public List<String> getSupportedSources() {
return getSupportedSourcesInternal();
}
@ -280,7 +278,8 @@ public abstract class AbstractInventoryDataCatalog extends AbstractDataCatalog {
if (selectedPlanes == null || selectedPlanes.length == 0) {
return null;
}
LevelMappingFactory lmf = LevelMappingFactory.getInstance();
LevelMappingFactory lmf = LevelMappingFactory
.getInstance(LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE);
for (String plane : selectedPlanes) {
Collection<Level> levels = Collections.emptyList();
if (plane.startsWith("spatial-")) {
@ -297,7 +296,7 @@ public abstract class AbstractInventoryDataCatalog extends AbstractDataCatalog {
if (lm != null) {
try {
levels = lm.getLevels();
} catch (VizCommunicationException e) {
} catch (CommunicationException e) {
statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}

View file

@ -35,8 +35,10 @@ import org.geotools.geometry.Envelope2D;
import org.geotools.geometry.jts.ReferencedEnvelope;
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.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.ConstraintType;
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.exception.VizCommunicationException;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
import com.raytheon.uf.viz.core.level.LevelUtilities;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
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
List<Level> selectedLevels = Collections.emptyList();
try {
LevelMappingFactory lmf = LevelMappingFactory.getInstance();
LevelMappingFactory lmf = LevelMappingFactory
.getInstance(LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE);
selectedLevels = new ArrayList<Level>(lmf
.getLevelMappingForKey(
catalogEntry.selectedPlanesKey).getLevels());
} catch (VizCommunicationException e) {
} catch (CommunicationException e) {
statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
@ -422,8 +424,8 @@ public class GridDataCatalog extends AbstractInventoryDataCatalog {
.getCoordinateReferenceSystem());
Envelope2D env = gridGeom.getEnvelope2D();
for (String letter : pointLetters) {
Coordinate c = PointsDataManager.getInstance()
.getCoordinate(letter);
Coordinate c = PointsDataManager.getInstance()
.getCoordinate(letter);
DirectPosition2D dp = new DirectPosition2D(c.x, c.y);
llToCRS.transform(dp, dp);
if (env.contains(dp.x, dp.y)) {
@ -508,8 +510,8 @@ public class GridDataCatalog extends AbstractInventoryDataCatalog {
.getTransformFromLatLon(gridGeom
.getCoordinateReferenceSystem());
Envelope2D env = gridGeom.getEnvelope2D();
for (String letter : pdm.getPointNames()) {
Coordinate c = pdm.getCoordinate(letter);
for (String letter : pdm.getPointNames()) {
Coordinate c = pdm.getCoordinate(letter);
DirectPosition2D dp = new DirectPosition2D(c.x, c.y);
llToCRS.transform(dp, dp);
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.BlockingQueue;
import com.raytheon.uf.common.comm.CommunicationException;
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.ConstraintType;
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.time.BinOffset;
import com.raytheon.uf.viz.core.catalog.DbQuery;
import com.raytheon.uf.viz.core.exception.VizCommunicationException;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.ResourceType;
import com.raytheon.uf.viz.d2d.nsharp.rsc.BufruaNSharpResourceData;
@ -390,9 +390,11 @@ public class PointDataCatalog extends AbstractInventoryDataCatalog {
@Override
protected Collection<? extends Level> get3DLevels() {
try {
return LevelMappingFactory.getInstance()
return LevelMappingFactory
.getInstance(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getLevelMappingForKey("Station").getLevels();
} catch (VizCommunicationException e) {
} catch (CommunicationException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
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.MenuItem;
import com.raytheon.uf.viz.core.level.LevelMapping;
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMapping;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory;
import com.raytheon.viz.volumebrowser.vbui.MenuItemManager;
import com.raytheon.viz.volumebrowser.xml.MenuContribution;
@ -93,7 +93,8 @@ public class MenuContributionItem extends ContributionItem {
item.setData(this);
if (menuContribution.xml.textLookup.equals("LevelMapping")) {
LevelMapping mapping = LevelMappingFactory.getInstance()
LevelMapping mapping = LevelMappingFactory.getInstance(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getLevelMappingForKey(menuContribution.xml.key);
if (mapping != null) {
menuContribution.xml.menuText = mapping.getDisplayName();

View file

@ -21,7 +21,10 @@ package com.raytheon.viz.warngen.gis;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.geotools.coverage.grid.GeneralGridEnvelope;
import org.geotools.coverage.grid.GridGeometry2D;
@ -57,6 +60,8 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
* ------------ ---------- ----------- --------------------------
* Dec 1, 2010 mschenke Initial creation
* 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>
*
@ -982,4 +987,178 @@ public class PolygonUtil {
coordinate.x = x / 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().
* Feb 18, 2013 #1633 rferrel Changed checkFollowupSelection to use SimulatedTime.
* 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>
*
* @author chammack
@ -1426,7 +1426,6 @@ public class WarngenDialog extends CaveSWTDialog implements
.getBullets(), warngenLayer.getConfiguration()
.getDamInfoBullets());
refreshBulletList();
updateMaps(bulletListManager.getMapsToLoad());
// duration
boolean enableDuration = warngenLayer.getConfiguration()
@ -1626,7 +1625,10 @@ public class WarngenDialog extends CaveSWTDialog implements
bulletListManager.recreateBullets(warngenLayer
.getConfiguration().getBullets(), warngenLayer
.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 {
bulletListManager.recreateBulletsFromFollowup(
warngenLayer.getConfiguration(), action, oldWarning);
@ -1729,7 +1731,10 @@ public class WarngenDialog extends CaveSWTDialog implements
bulletList.deselectAll();
bulletList.setItems(bulletListManager.getAllBulletTexts());
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) {

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
* 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.
* 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.
* 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>
*
* @author mschenke
@ -197,7 +199,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
private class CustomMaps extends Job {
private final Set<String> customMaps = new HashSet<String>();
private Set<String> customMaps = new HashSet<String>();
private Set<String> mapsToLoad;
@ -228,7 +230,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
for (String load : toLoad) {
manager.loadMapByName(load);
}
customMaps = toLoad;
issueRefresh();
}
@ -241,6 +243,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
synchronized (this) {
mapsToLoad = new HashSet<String>(maps);
}
schedule();
}
@ -285,6 +288,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
}
try {
warningPolygon = PolygonUtil.removeDuplicateCoordinate(warningPolygon);
Polygon hatched = polygonUtil.hatchWarningArea(
warningPolygon,
removeCounties(warningArea,
@ -293,7 +297,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
// DR 15559
Coordinate[] coords = hatched.getCoordinates();
PolygonUtil.round(coords, 2);
WarngenUIState.adjustPolygon(coords);
PolygonUtil.adjustPolygon(coords);
GeometryFactory gf = new GeometryFactory();
LinearRing lr = gf.createLinearRing(coords);
hatchedArea = gf.createPolygon(lr, null);

View file

@ -45,6 +45,11 @@ import com.vividsolutions.jts.geom.Polygon;
* and adjustPolygon().
* Feb 15, 2013 1624 jsanchez Fix NullPointerException in removeDuplicateCoordinate.
* 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>
*
@ -126,180 +131,6 @@ public class WarngenUIState {
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
* local
@ -326,7 +157,7 @@ public class WarngenUIState {
* the warningPolygon to set
*/
public void setWarningPolygon(Polygon warningPolygon) {
this.warningPolygon = removeDuplicateCoordinate(warningPolygon);
this.warningPolygon = warningPolygon;
}
public Set<String> getFipsOutsidePolygon() {

View file

@ -33,6 +33,7 @@ import java.util.regex.Pattern;
* Sep 24, 2012 15332 jsanchez Initial creation
* Oct 18, 2012 15332 jsanchez Replaced listOfAreaNamesPtrn with String pattern.
* 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>
*
@ -56,7 +57,7 @@ public interface ICommonPatterns {
// LOCK_END can be added at the start of the line if a previous line has
// been locked.
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
// previous line should be blank.

View file

@ -33,6 +33,7 @@ import java.util.regex.Pattern;
* ------------ ---------- ----------- --------------------------
* Sep 24, 2012 15322 jsanchez Initial creation
* 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>
*
@ -48,24 +49,13 @@ public class WrapUtil implements ICommonPatterns {
private static final String BULLET_START = "* ";
private static final Pattern wrapUgcPtrn = Pattern.compile("(\\S{1,"
+ (MAX_WIDTH - 1) + "}-)");
// Guess at the amount of extra characters added by wrapping
private static final int WRAP_COUNT_GUESS = 16 * 3; // *3 for bullet indent + \n
private static final Pattern wrapListOfNamesPtrn = Pattern.compile("(.{1,"
+ (MAX_WIDTH - 4) + "} \\w{2}-)");
// Locations in 4th bullet or locations paragraph of followup
// 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+$)");
private static final String DELIM_GROUP = "\0";
private static final String[] NORMAL_DELIMS = { " ", "...", DELIM_GROUP, "-" };
private static final String[] AREA_DELIMS = { "-", "...", DELIM_GROUP, " " };
private static final String[] UGC_DELIMS = AREA_DELIMS;
// ugc pattern
private static final Pattern ugcPtrn = Pattern.compile(ugc);
@ -93,19 +83,24 @@ public class WrapUtil implements ICommonPatterns {
if (unlocked.trim().length() == 0) { // BLANK LINE
inBullet = false;
addLine = line;
} else if (unlocked.length() <= MAX_WIDTH) { // LESS THAN MAX
// Add indenting if the template didn't account for it yet.
if (inBullet && !unlocked.startsWith(INDENT)) {
sb.append(INDENT);
}
} else {
boolean wasInBullet = inBullet;
if (unlocked.startsWith(BULLET_START)) {
inBullet = true;
}
addLine = line;
} else { // NEEDS TO BE WRAPPED
addLine = wrapLongLines(line, inBullet);
// Add indenting if the template didn't account for it yet.
int add = wasInBullet && !unlocked.startsWith(INDENT) ? INDENT
.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);
@ -125,34 +120,122 @@ public class WrapUtil implements ICommonPatterns {
* @return
*/
private static String wrapLongLines(String line, boolean inBullet) {
StringBuffer sb = new StringBuffer(line.length());
String unlockedLine = line.replaceAll(LOCK_START + "|" + LOCK_END, "");
String[] delims = getDelimiters(line);
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());
String tmp = inBullet && !unlockedLine.startsWith(BULLET_START) ? INDENT
: "";
while (m.find()) {
String group = m.group();
String unlocked = group.replaceAll(LOCK_START + "|" + LOCK_END, "");
int len = tmp.replaceAll(LOCK_START + "|" + LOCK_END, "").length();
if (len + unlocked.length() > MAX_WIDTH && tmp.trim().length() > 0) {
sb.append(tmp + "\n");
tmp = inBullet ? INDENT : "";
tmp += group;
} else {
tmp += group;
/*
* Skip over initial bullet point and/or indent OR add indentation if
* missing.
*/
if (inBullet) {
char[] cb = new char[2];
int i = indexIgnoringLockMarkers(line, start, 0);
int o = 0;
while (i < line.length() && o < 2) {
cb[o++] = line.charAt(i);
i = indexIgnoringLockMarkers(line, i, 1);
}
if (o == 2) {
String lead = new String(cb, 0, o);
if (INDENT.equals(lead) || BULLET_START.equals(lead)) {
allowLength -= lead.length();
start = i;
sb.append(line, 0, i);
} else {
allowLength -= INDENT.length();
sb.append(INDENT);
}
}
}
if (tmp.trim().length() > 0) {
sb.append(tmp);
while (start < line.length()) {
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();
@ -164,21 +247,73 @@ public class WrapUtil implements ICommonPatterns {
* @param line
* @return
*/
private static Pattern getPattern(String line) {
private static String[] getDelimiters(String line) {
Matcher m = ugcPtrn.matcher(line);
// UGC line or FIPS line
if (m.find()) {
return wrapUgcPtrn;
return UGC_DELIMS;
}
m = listOfAreaNamePtrn.matcher(line);
// List of area names.
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.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@ -74,6 +75,8 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
* String array returned from getText method
* Jun 04, 2012 DR14992 mgamazaychikov Reversed the previous changes
* 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>
*
@ -152,7 +155,7 @@ public abstract class AbstractWWAResource extends
protected List<AbstractWarningRecord> recordsToLoad;
protected WarningRecordComparator comparator = new WarningRecordComparator();
protected Comparator<AbstractWarningRecord> comparator;
protected abstract void updateDisplay(IGraphicsTarget target)
throws VizException;
@ -284,18 +287,24 @@ public abstract class AbstractWWAResource extends
PaintProperties paintProps) throws VizException {
FramesInfo info = paintProps.getFramesInfo();
DataTime[] frames = info.getFrameTimes();
int frameToRequestedCompare = frames[0].compareTo(earliestRequested);
if (frameToRequestedCompare < 0) {
// we haven't requested data this far back
if (earliestRequested == null) {
this.requestData(frames[0]);
} else if (frameToRequestedCompare > 0) {
// 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);
} else {
int frameToRequestedCompare = frames[0]
.compareTo(earliestRequested);
if (frameToRequestedCompare < 0) {
// we haven't requested data this far back
this.requestData(frames[0]);
} else if (frameToRequestedCompare > 0) {
// 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();
@ -436,16 +445,13 @@ public abstract class AbstractWWAResource extends
if (action == WarningAction.CAN && refTime.equals(paintTime)) {
return false;
// If this entry has been altered/updated, display its pre-altered
// version
// only in the frames prior to the time it was altered
// version only in the frames prior to the time it was altered
} else if (entry.altered) {
if (frameStart.getTime() >= refTime.getTime()
&& frameStart.getTime() < (entry.timeAltered.getTime())
&& frameStart.getTime() < entry.frameAltered.getTime())
&& frameStart.getTime() <= (entry.timeAltered.getTime())
&& frameStart.getTime() < entry.frameAltered.getTime()) {
return true;
if (frameStart.getTime() >= (entry.timeAltered.getTime()))
return false;
}
} else if (refTime.equals(paintTime)
|| recordPeriod.contains(frameTime)
|| (framePeriod.contains(centerTime) && (!lastFrame || !entry.altered))) {
@ -518,8 +524,9 @@ public abstract class AbstractWWAResource extends
}
}
/* Sorts by phensig, etn, starttime (descending), act */
Collections.sort(sortedWarnings, comparator);
if (comparator != null) {
Collections.sort(sortedWarnings, comparator);
}
return sortedWarnings.toArray(new AbstractWarningRecord[sortedWarnings
.size()]);
}

View file

@ -18,6 +18,7 @@ import com.raytheon.uf.common.dataplugin.warning.WarningRecord.WarningAction;
* ------------ ---------- ----------- --------------------------
* May 12, 2011 jsanchez Initial creation
* 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>
*
* @author jsanchez
@ -27,8 +28,8 @@ public class WarningRecordComparator implements
Comparator<AbstractWarningRecord> {
/**
* Compares the WarningRecords by phenSig, ETN, action, then starttime
* (descending order)
* Compares the WarningRecords by phenSig, ETN, starttime (ascending order),
* then action
*/
@Override
public int compare(AbstractWarningRecord wr1, AbstractWarningRecord wr2) {
@ -43,6 +44,11 @@ public class WarningRecordComparator implements
rval = Double.compare(Double.parseDouble(wr1.getEtn()),
Double.parseDouble(wr2.getEtn()));
}
if (rval == 0) {
rval = wr1.getStartTime().compareTo(wr2.getStartTime());
}
if (rval == 0) {
if (wr1.getAct() != null && wr2.getAct() != null) {
WarningAction act1 = WarningAction.valueOf(wr1.getAct());
@ -55,24 +61,15 @@ public class WarningRecordComparator implements
rval = 1;
} else if (act1 == WarningAction.CON
&& (act2 == WarningAction.CAN || act2 == WarningAction.EXP)) {
return -1;
return 1;
} else if (act2 == WarningAction.CON
&& (act1 == WarningAction.CAN || act1 == WarningAction.EXP)) {
return 1;
return -1;
} else {
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;

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
* NEW warning when CAN warning is issued
* 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>
*
* @author jsanchez
@ -104,6 +105,7 @@ public class WarningsResource extends AbstractWWAResource {
*/
public WarningsResource(WWAResourceData data, LoadProperties props) {
super(data, props);
comparator = new WarningRecordComparator();
resourceName = "Warnings";
}
@ -148,7 +150,7 @@ public class WarningsResource extends AbstractWWAResource {
synchronized (WarningsResource.this) {
{
try {
addRecord(pdo);
addRecord(sort(pdo));
} catch (VizException e) {
statusHandler.handle(Priority.SIGNIFICANT,
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) {
super(data, props);
comparator = new WatchesComparator();
timer = new Timer();
expTaskSet = new HashSet<Long>();
resourceName = "Watches";

View file

@ -32,8 +32,9 @@ import JUtil
# ------------ ---------- ----------- --------------------------
# 04/10/08 chammack Initial Creation.
# 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
def encodeJavaTimeRange(javaTimeRange):
if not javaTimeRange.isValid():
return None
time = TimeRange(javaTimeRange)
start = time.startTime()
end = time.endTime()

View file

@ -24,7 +24,10 @@
# 02/16/12 14439 jdynina modified haines thresholds
# 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.
# 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
@ -836,8 +839,8 @@ class Forecaster(GridUtilities):
def __sortTimes(self, methods, validTime):
rval = []
calced = []
haveNoData = {}
for we, mthd, args in methods:
# LogStream.logEvent("Evaluating times for calc"+we)
calced.append(we)
args = filter(lambda x, ma=self.magicArgs().keys() + [we]:
x not in ma, args)
@ -865,27 +868,36 @@ class Forecaster(GridUtilities):
if validTime is None:
valid = True
elif jtr.contains(validTime):
valid = True
else:
# 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:
timelist = TimeRange.encodeJavaTimeRange(jtr)
pylist.append(timelist)
ttimes.append(pylist)
timeList = ttimes[len(ttimes)-1]
result = 0
for xtime in timeList:
result += xtime[1] - xtime[0]
if result == 0:
if not haveNoData.has_key(we):
haveNoData[we] = [p]
else:
haveNoData[we].append(p)
# msg = "Times available for " + p + " " + str(validTime) + ":\n"
# timeList = ttimes[len(ttimes)-1]
# for xtime in timeList:
# msg += '('
# stime = time.gmtime(xtime[0])
# etime = time.gmtime(xtime[1])
# stime = time.strftime('%Y%m%d_%H%M', stime)
# etime = time.strftime('%Y%m%d_%H%M', etime)
# msg += stime + ", " + etime
# msg += ')\n'
# LogStream.logEvent(msg)
# compare the times of each parm and find where they match up
times = self.__compTimes(None, ttimes)
# LogStream.logEvent("nargs:",nargs)
# LogStream.logEvent("ttimes:",ttimes)
# LogStream.logEvent("times:",times)
hadDataButSkipped = {}
for i in range(len(ttimes)):
timeList = ttimes[i]
@ -896,7 +908,16 @@ class Forecaster(GridUtilities):
hadDataButSkipped[xtime].append(parmName)
else:
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 = {}
for xtime in hadDataButSkipped:
stime = time.gmtime(xtime[0])
@ -908,16 +929,17 @@ class Forecaster(GridUtilities):
for parmName in nargs:
if not hadDataButSkipped[xtime].__contains__(parmName):
if parmName in calced:
if haveNoData.has_key(parmName):
missing[msg].append(parmName)
else:
if parmName in haveNoData.values():
missing[msg].append(parmName)
if not len(missing[msg]):
del missing[msg]
missing[msg].append(parmName)
if len(missing) == 0 and len(hadNoData) > 0:
msg = ''
if (validTime is not None):
vtime = validTime.getTime()/1000
vtime = time.gmtime(vtime)
msg = time.strftime('%Y%m%d_%H%M', vtime)
missing[msg] = hadNoData
# LogStream.logEvent("missing:",missing)
if len(missing):
LogStream.logEvent("Skipping calc" + we + " for some times due to the following " +
"missing data:", missing)
@ -1130,7 +1152,7 @@ class Forecaster(GridUtilities):
parm = self.__getNewWE(m[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
if not tr.isValid():
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.raytheon.uf.common.util;bundle-version="1.12.1174",
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"
Export-Package: com.raytheon.edex.plugin.gfe,
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.comm,
com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.dataplugin.level,
com.raytheon.uf.common.dataplugin.persist,
com.raytheon.uf.common.dataplugin.warning,
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.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.hibernate.Query;
import org.hibernate.SQLQuery;
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.gfe.db.objects.DatabaseID;
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.GridInfoConstants;
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
import com.raytheon.uf.common.dataplugin.level.Level;
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
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.common.dataquery.db.QueryParam.QueryOperand;
import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.database.query.DatabaseQuery;
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
* ------------ ---------- ----------- --------------------------
* 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>
*
@ -81,27 +69,6 @@ public class GFED2DDao extends GridDao {
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 {
super();
}
@ -116,20 +83,12 @@ public class GFED2DDao extends GridDao {
* @throws DataAccessLayerException
* If errors occur while querying the metadata database
*/
public List<Integer> getD2DForecastTimes(DatabaseID dbId)
public List<Integer> getForecastTimes(String d2dModelName, Date refTime)
throws DataAccessLayerException {
DatabaseQuery query = new DatabaseQuery(GridRecord.class.getName());
query.addDistinctParameter(FCST_TIME);
try {
IFPServerConfig config = IFPServerConfigManager
.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.addQueryParam(GridConstants.DATASET_ID, d2dModelName);
query.addQueryParam(REF_TIME, refTime);
query.addOrder(FCST_TIME, true);
@SuppressWarnings("unchecked")
@ -152,14 +111,16 @@ public class GFED2DDao extends GridDao {
* @throws DataAccessLayerException
* 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 {
Session s = null;
try {
s = getHibernateTemplate().getSessionFactory().openSession();
// 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,
// this is for static data since all times are the same
@ -198,108 +159,75 @@ public class GFED2DDao extends GridDao {
* @throws DataAccessLayerException
* 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 {
String levelName = GridTranslator.getLevelName(id.getParmLevel());
double[] levelValues = GridTranslator.getLevelValue(id.getParmLevel());
boolean levelOnePresent = (levelValues[0] != Level
.getInvalidLevelValue());
boolean levelTwoPresent = (levelValues[1] != Level
.getInvalidLevelValue());
Level level = null;
// to have a level 2, must have a level one
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");
DatabaseQuery query = new DatabaseQuery(GridRecord.class.getName());
query.addReturnedField(FCST_TIME);
query.addReturnedField("id");
query.addQueryParam(GridConstants.DATASET_ID, d2dModelName);
query.addQueryParam(REF_TIME, refTime);
query.addQueryParam(GridConstants.PARAMETER_ABBREVIATION, d2dParmName);
query.addQueryParam(GridConstants.LEVEL_ID, d2dLevel.getId());
query.addOrder(FCST_TIME, true);
@SuppressWarnings("unchecked")
List<Object[]> results = modelQuery.list();
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>();
}
List<Object[]> firstTry = (List<Object[]>) this.queryByCriteria(query);
SortedMap<Integer, Integer> dataTimes = new TreeMap<Integer, Integer>();
for (Object[] rows : timeResults) {
dataTimes.put((Integer) rows[0], (Integer) rows[1]);
if (firstTry.isEmpty()) {
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;
}
@ -311,66 +239,18 @@ public class GFED2DDao extends GridDao {
* @return the list of forecast hours
* @throws DataAccessLayerException
*/
public List<Integer> queryFcstHourByD2DParmId(ParmID id)
public List<Integer> queryFcstHourByParmId(String d2dModelName,
Date refTime, String d2dParmName, Level d2dLevel)
throws DataAccessLayerException {
List<Integer> timeList = new ArrayList<Integer>();
Session s = null;
try {
s = getHibernateTemplate().getSessionFactory().openSession();
if (id.getParmName().equalsIgnoreCase("wind")) {
String idString = id.toString();
Matcher idWindMatcher = WIND_PATTERN.matcher(idString);
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);
}
SortedMap<Integer, Integer> results = queryByParmId(d2dModelName,
refTime, d2dParmName, d2dLevel, s);
for (Integer o : results.keySet()) {
timeList.add(o);
}
} finally {
if (s != null) {
@ -395,7 +275,7 @@ public class GFED2DDao extends GridDao {
* @return
* @throws DataAccessLayerException
*/
public List<Date> getD2DModelRunTimes(String d2dModelName, int maxRecords)
public List<Date> getModelRunTimes(String d2dModelName, int maxRecords)
throws DataAccessLayerException {
DatabaseQuery query = new DatabaseQuery(GridRecord.class.getName());
query.addDistinctParameter(REF_TIME);

View file

@ -23,7 +23,6 @@ package com.raytheon.edex.plugin.gfe.server.database;
import java.awt.Rectangle;
import java.nio.FloatBuffer;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
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.ParameterInfo;
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.gfe.GridDataHistory;
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.GridRecord;
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.IDataStore;
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
* GFE performance testing
* 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>
*
@ -167,8 +170,7 @@ public class D2DGridDatabase extends VGridDatabase {
try {
GFED2DDao dao = new GFED2DDao();
List<Date> result = dao.getD2DModelRunTimes(d2dModelName,
maxRecords);
List<Date> result = dao.getModelRunTimes(d2dModelName, maxRecords);
List<DatabaseID> dbInventory = new ArrayList<DatabaseID>();
for (Date date : result) {
@ -195,6 +197,8 @@ public class D2DGridDatabase extends VGridDatabase {
private static final Pattern parmHrPattern = Pattern
.compile("(\\D+)\\d+hr");
private static final String GFE_LEVEL_MAPPING_FILE = "grid/gfeLevelMappingFile.xml";
private final IPerformanceStatusHandler perfLog = PerformanceStatus
.getHandler("GFE:");
@ -209,6 +213,8 @@ public class D2DGridDatabase extends VGridDatabase {
private String[] components;
private Level level;
public D2DParm(ParmID parmId, GridParmInfo gpi,
Map<Integer, TimeRange> fcstHrToTimeRange, String... components) {
this.parmId = parmId;
@ -222,6 +228,8 @@ public class D2DGridDatabase extends VGridDatabase {
for (Entry<Integer, TimeRange> entry : fcstHrToTimeRange.entrySet()) {
this.timeRangeToFcstHr.put(entry.getValue(), entry.getKey());
}
this.level = getD2DLevel(parmId.getParmLevel());
}
public ParmID getParmId() {
@ -244,6 +252,10 @@ public class D2DGridDatabase extends VGridDatabase {
return components;
}
public Level getLevel() {
return level;
}
@Override
public String toString() {
return this.parmId.toString();
@ -252,7 +264,7 @@ public class D2DGridDatabase extends VGridDatabase {
private String d2dModelName;
private Date modelTime;
private Date refTime;
private GridParamInfo modelInfo;
@ -275,20 +287,20 @@ public class D2DGridDatabase extends VGridDatabase {
* The database ID of this database
*/
public D2DGridDatabase(IFPServerConfig config, String d2dModelName,
Date modelTime) throws GfeException {
Date refTime) throws GfeException {
super(config);
this.d2dModelName = d2dModelName;
this.modelTime = modelTime;
this.refTime = refTime;
this.modelInfo = GridParamInfoLookup.getInstance().getGridParamInfo(
d2dModelName);
if (modelInfo == null) {
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.
this.dbId = getDbId(this.d2dModelName, this.modelTime, this.config);
this.dbId = getDbId(this.d2dModelName, this.refTime, this.config);
this.valid = this.dbId.isValid();
// 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,
atts.getShort_name());
d2dParmName);
this.gfeParms.put(pid, d2dParm);
this.d2dParms.put(compositeName(atts.getShort_name(), level), d2dParm);
}
@ -450,8 +464,11 @@ public class D2DGridDatabase extends VGridDatabase {
availableTimes.get(i));
}
String uD2dParmName = getD2DParmName(uatts.getShort_name());
String vD2dParmName = getD2DParmName(vatts.getShort_name());
D2DParm d2dParm = new D2DParm(pid, gpi, possibleInventorySlots,
uatts.getShort_name(), vatts.getShort_name());
uD2dParmName, vD2dParmName);
this.gfeParms.put(pid, d2dParm);
this.d2dParms.put(compositeName(uatts.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
for (String component : parm.getComponents()) {
ParmID compPid = new ParmID(component, dbId,
id.getParmLevel());
List<Integer> compInv = dao
.queryFcstHourByD2DParmId(compPid);
List<Integer> compInv = dao.queryFcstHourByParmId(
d2dModelName, refTime, component, parm.getLevel());
if (dbInv == null) {
dbInv = compInv;
@ -828,17 +843,18 @@ public class D2DGridDatabase extends VGridDatabase {
try {
// Gets the metadata from the grib metadata database
D2DParm parm = this.gfeParms.get(parmId);
Integer fcstHr = null;
if (!GridPathProvider.STATIC_PARAMETERS.contains(parmId
.getParmName())) {
D2DParm parm = this.gfeParms.get(parmId);
fcstHr = parm.getTimeRangeToFcstHr().get(timeRange);
if (fcstHr == null) {
throw new GfeException("Invalid time range " + timeRange
+ " for " + parmId);
}
}
d2dRecord = dao.getD2DGrid(parmId, fcstHr, gpi);
d2dRecord = dao.getGrid(d2dModelName, refTime,
parm.getComponents()[0], parm.getLevel(), fcstHr, gpi);
} catch (DataAccessLayerException e) {
throw new GfeException(
"Error retrieving D2D Grid record from database", e);
@ -955,21 +971,18 @@ public class D2DGridDatabase extends VGridDatabase {
+ parmId);
}
String mappedModel = config.d2dModelNameMapping(dbId.getModelName());
if (windParm.getComponents()[0].equals("uw")) {
// TODO clean up the hard coded d2d parm names
if (windParm.getComponents()[0].equals("uW")) {
try {
GridRecord uRecord = null;
GridRecord vRecord = null;
// Get the metadata from the grib metadata database
uRecord = dao.getD2DGrid(
new ParmID("uw", this.dbId, parmId.getParmLevel()),
fcstHr, gpi);
vRecord = dao.getD2DGrid(
new ParmID("vw", this.dbId, parmId.getParmLevel()),
fcstHr, gpi);
uRecord = dao.getGrid(d2dModelName, refTime, "uW",
windParm.getLevel(), fcstHr, gpi);
vRecord = dao.getGrid(d2dModelName, refTime, "vW",
windParm.getLevel(), fcstHr, gpi);
// Gets the raw grid data from the D2D grib HDF5 files
Grid2DFloat uData = getRawGridData(uRecord);
@ -977,8 +990,7 @@ public class D2DGridDatabase extends VGridDatabase {
// Resample the data to fit the desired region
float fillV = Float.MAX_VALUE;
ParameterInfo pa = GridParamInfoLookup.getInstance()
.getParameterInfo(mappedModel, "uw");
ParameterInfo pa = modelInfo.getParameterInfo("uw");
if (pa != null) {
fillV = pa.getFillValue();
}
@ -1003,12 +1015,10 @@ public class D2DGridDatabase extends VGridDatabase {
GridRecord dRecord = null;
// Get the metadata from the grib metadata database
sRecord = dao.getD2DGrid(
new ParmID("ws", this.dbId, parmId.getParmLevel()),
fcstHr, gpi);
dRecord = dao.getD2DGrid(
new ParmID("wd", this.dbId, parmId.getParmLevel()),
fcstHr, gpi);
sRecord = dao.getGrid(d2dModelName, refTime, "WS",
windParm.getLevel(), fcstHr, gpi);
dRecord = dao.getGrid(d2dModelName, refTime, "WD",
windParm.getLevel(), fcstHr, gpi);
// Gets the raw grid data from the D2D grib HDF5 files
Grid2DFloat sData = getRawGridData(sRecord);
@ -1016,8 +1026,7 @@ public class D2DGridDatabase extends VGridDatabase {
// Resample the data to fit the desired region
float fillV = Float.MAX_VALUE;
ParameterInfo pa = GridParamInfoLookup.getInstance()
.getParameterInfo(mappedModel, "ws");
ParameterInfo pa = modelInfo.getParameterInfo("ws");
if (pa != null) {
fillV = pa.getFillValue();
}
@ -1153,14 +1162,11 @@ public class D2DGridDatabase extends VGridDatabase {
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>();
Calendar validTimeCalc = Calendar.getInstance();
Date refTime = dbId.getModelTimeAsDate();
for (Integer fcstTime : fcstTimes) {
validTimeCalc.setTime(refTime);
validTimeCalc.add(Calendar.SECOND, fcstTime.intValue());
validTimes.add(validTimeCalc.getTime());
validTimes.add(new Date(refTime.getTime() + fcstTime
* TimeUtil.MILLIS_PER_SECOND));
}
return validTimes;
}
@ -1175,27 +1181,33 @@ public class D2DGridDatabase extends VGridDatabase {
// no-op
}
public D2DParm getD2DParm(String d2dParmName, Level level) {
public D2DParm getD2DParm(String d2dParmName, Level d2dLevel) {
String gfeParmName = getGfeParmName(d2dParmName);
String levelName = GridTranslator.getShortLevelName(level
.getMasterLevel().getName(), level.getLevelonevalue(), level
.getLeveltwovalue());
String gfeLevel = getGFELevel(d2dLevel);
if (gfeLevel == null) {
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) {
// try to find one with duration (XXXnnhr)
Matcher matcher = parmHrPattern.matcher(d2dParmName);
if (matcher.find()) {
String abbrev = matcher.group(1);
gfeParmName = getGfeParmName(abbrev);
parm = d2dParms.get(compositeName(gfeParmName, levelName));
parm = d2dParms.get(compositeName(gfeParmName, gfeLevel));
}
}
if (parm == null) {
statusHandler.warn("No gridParameterInfo found for "
+ compositeName(gfeParmName, levelName) + ":"
+ compositeName(gfeParmName, gfeLevel) + ":"
+ dbId.getModelId() + ". Check parameterInfo file.");
}
@ -1214,6 +1226,18 @@ public class D2DGridDatabase extends VGridDatabase {
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) {
D2DParm parm = this.gfeParms.get(parmID);
if (parm == null) {
@ -1227,4 +1251,38 @@ public class D2DGridDatabase extends VGridDatabase {
private String compositeName(String parmName, String 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.
* Mar 20, 2013 #1774 randerso Refactor to use grid durations from D2DGridDatabase
* 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>
*

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"?>
<!--
REVISION HISTORY
Date Ticket# Engineer Description
04/17/2013 #1913 randerso Corrected level for SLI
-->
<gridParamInfo xmlns:ns2="group">
<valtimeMINUSreftime>
<fcst>0</fcst>
@ -445,9 +451,9 @@
<valid_range>20.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>MB 0&gt;500</levelsDesc>
<levelsDesc>SFC</levelsDesc>
<levels>
<level>MB0500</level>
<level>SFC</level>
</levels>
</gridParameterInfo>
<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"?>
<!--
REVISION HISTORY
Date Ticket# Engineer Description
04/17/2013 #1913 randerso Corrected level for SLI
-->
<gridParamInfo xmlns:ns2="group">
<valtimeMINUSreftime>
<fcst>0</fcst>
@ -445,9 +451,9 @@
<valid_range>20.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>MB 0&gt;500</levelsDesc>
<levelsDesc>SFC</levelsDesc>
<levels>
<level>MB0500</level>
<level>SFC</level>
</levels>
</gridParameterInfo>
<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"?>
<!--
REVISION HISTORY
Date Ticket# Engineer Description
04/17/2013 #1913 randerso Corrected level for SLI
-->
<gridParamInfo xmlns:ns2="group">
<valtimeMINUSreftime>
<fcst>0</fcst>
@ -275,9 +281,9 @@
<valid_range>20.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>MB 0&gt;500</levelsDesc>
<levelsDesc>SFC</levelsDesc>
<levels>
<level>MB0500</level>
<level>SFC</level>
</levels>
</gridParameterInfo>
<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"?>
<!--
REVISION HISTORY
Date Ticket# Engineer Description
04/17/2013 #1913 randerso Corrected level for SLI
-->
<gridParamInfo xmlns:ns2="group">
<valtimeMINUSreftime>
<fcst>0</fcst>
@ -445,9 +451,9 @@
<valid_range>20.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>MB 0&gt;500</levelsDesc>
<levelsDesc>SFC</levelsDesc>
<levels>
<level>MB0500</level>
<level>SFC</level>
</levels>
</gridParameterInfo>
<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"?>
<!--
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">
<valtimeMINUSreftime>
@ -129,7 +133,7 @@
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>wx</short_name>
<long_name>Weather</long_name>
<units/>
<units>wx</units>
<udunits/>
<uiname>Weather</uiname>
<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"?>
<!--
REVISION HISTORY
Date Ticket# Engineer Description
04/17/2013 #1913 randerso Corrected level for SLI
-->
<gridParamInfo xmlns:ns2="group">
<valtimeMINUSreftime>
<fcst>0</fcst>
@ -457,9 +463,9 @@
<valid_range>20.0</valid_range>
<fillValue>-99999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>SFC</levelsDesc>
<levelsDesc>MB 0&gt;500</levelsDesc>
<levels>
<level>SFC</level>
<level>MB0500</level>
</levels>
</gridParameterInfo>
<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
*
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 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
* usable
* Jan 10, 2013 15648 ryu Added removeDuplicates() method.
*
* Apr 18, 2013 1920 mpduff Default changed to true.
*
* </pre>
*
*
* @author chammack
* @version 1
*/
@ -67,7 +68,7 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
private Buffer glBuffer;
private boolean changed = false;
private boolean changed = true;
/**
* 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.
*
*
* @param name
* Name for the new ColorMap
* @param map
@ -107,12 +108,11 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
this.name = name;
colors = new ArrayList<Color>();
colors.addAll(map.getColors());
this.changed = true;
}
/**
* Do not instantiate directly, use GLTarget methods
*
*
* @param name
* @param red
* @param green
@ -139,9 +139,10 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
/*
* (non-Javadoc)
*
*
* @see com.raytheon.uf.common.colormap.IColorMap#getBlue()
*/
@Override
public float[] getBlue() {
int colorNum = colors.size();
float[] blues = new float[colorNum];
@ -153,9 +154,10 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
/*
* (non-Javadoc)
*
*
* @see com.raytheon.uf.common.colormap.IColorMap#getGreen()
*/
@Override
public float[] getGreen() {
int colorNum = colors.size();
float[] greens = new float[colorNum];
@ -167,9 +169,10 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
/*
* (non-Javadoc)
*
*
* @see com.raytheon.uf.common.colormap.IColorMap#getRed()
*/
@Override
public float[] getRed() {
int colorNum = colors.size();
float[] reds = new float[colorNum];
@ -181,18 +184,20 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
/*
* (non-Javadoc)
*
*
* @see com.raytheon.uf.common.colormap.IColorMap#getSize()
*/
@Override
public int getSize() {
return colors.size();
}
/*
* (non-Javadoc)
*
*
* @see com.raytheon.uf.common.colormap.IColorMap#getAlpha()
*/
@Override
public float[] getAlpha() {
int colorNum = colors.size();
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 colorMap buffer
*/
public synchronized Buffer getColorMap() {
@ -233,20 +238,22 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
/*
* (non-Javadoc)
*
*
* @see com.raytheon.edex.colormap.IColorMap#getName()
*/
@Override
public String getName() {
return name;
}
@Override
public List<Color> getColors() {
return colors;
}
/*
* (non-Javadoc)
*
*
* @see java.lang.Object#toString()
*/
@Override
@ -254,10 +261,12 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
return "COLORMAP { " + getName() + " }";
}
@Override
public boolean isChanged() {
return changed;
}
@Override
public void setAlpha(float[] anAlpha) {
int size = anAlpha.length;
for (int i = 0; i < size; ++i) {
@ -270,6 +279,7 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
changed = true;
}
@Override
public void setBlue(float[] aBlue) {
int size = aBlue.length;
for (int i = 0; i < size; ++i) {
@ -282,6 +292,7 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
changed = true;
}
@Override
public void setGreen(float[] aGreen) {
int size = aGreen.length;
for (int i = 0; i < size; ++i) {
@ -294,6 +305,7 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
changed = true;
}
@Override
public void setRed(float[] aRed) {
int size = aRed.length;
for (int i = 0; i < size; ++i) {
@ -310,10 +322,12 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
this.colors.set(index, color);
}
@Override
public void setChanged(boolean aChanged) {
changed = aChanged;
}
@Override
public void setName(String aName) {
name = aName;
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
* reverse spectrum is generated. The red, green, and blue indexes are
* returned through the calling arguments.
*
*
* @param numOfColors
* @param minWaveLength
* @param maxWaveLength
@ -416,10 +430,10 @@ public class ColorMap extends AbstractColorMap implements ISerializableObject {
public void removeDuplicates() {
List<Color> colors = new ArrayList<Color>();
Color current = null;
for (Color color: this.colors) {
for (Color color : this.colors) {
if (!color.equals(current)) {
colors.add(color);
current = color;
colors.add(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.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.time.util.ImmutableDate;
/**
* 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.io.File;
import java.io.FileNotFoundException;
import java.lang.ref.WeakReference;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import javax.persistence.Column;
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.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.hibernate.annotations.Index;
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.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.util.ImmutableDate;
/**
* 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
* Apr 4, 2013 1846 bkowal Added an index on refTime and forecastTime
* 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>
*
@ -131,6 +137,8 @@ public class FFMPRecord extends PersistablePluginDataObject
@Transient
private boolean isRate = false;
protected static ConcurrentMap<Long, WeakReference<ImmutableDate>> cacheTimes = new ConcurrentHashMap<Long, WeakReference<ImmutableDate>>();
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(FFMPRecord.class);
@ -384,103 +392,96 @@ public class FFMPRecord extends PersistablePluginDataObject
}
fbd = getBasinData(huc);
ImmutableDate idate = getCacheDate(date);
synchronized (template) {
SourceXML source = FFMPSourceConfigurationManager.getInstance()
.getSource(sourceName);
SourceXML source = FFMPSourceConfigurationManager.getInstance()
.getSource(sourceName);
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(), domain.getCwa(), huc);
if (map != null && map.keySet().size() > 0) {
if (map != null && !map.isEmpty()) {
IDataRecord rec = null;
IDataRecord rec = null;
try {
rec = dataStore.retrieve(uri + "/" + domain.getCwa(),
huc, Request.ALL);
} catch (Exception e) {
statusHandler.handle(Priority.DEBUG,
"FFMPRecord: no data record for: " + uri + "/"
+ domain.getCwa());
}
try {
rec = dataStore.retrieve(uri + "/" + domain.getCwa(), huc,
Request.ALL);
} catch (Exception e) {
statusHandler.handle(Priority.DEBUG,
"FFMPRecord: no data record for: " + uri + "/"
+ domain.getCwa());
}
if (rec != null) {
float[] values = ((FloatDataRecord) rec).getFloatData();
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);
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 == 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(idate,
sourceName);
float curval = basin.getValue(
date, sourceName);
if (curval != FFMPUtils.MISSING
|| !curval.isNaN()) {
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,
if (curval >= 0.0f && values[j] >= 0.0f) {
basin.setValue(sourceName, idate,
(curval + values[j]) / 2);
} else if (values[j] >= 0.0f){
basin.setValue(sourceName, idate,
values[j]);
}
j++;
} catch (Exception e) {
break;
}
// do not overwrite original value
} else {
basin.setValue(sourceName, idate,
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;
}
} 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(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()
.getSource(sourceName);
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(),
domain.getCwa(), huc);
if (map != null && map.get(pfaf) != null) {
if (map != null && map.get(pfaf) != null) {
int index = 0;
for (Long pfafToCheck : map.keySet()) {
if (pfafToCheck.equals(pfaf)) {
break;
}
index++;
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)));
try {
IDataRecord rec = dataStore.retrieve(
uri + "/" + domain.getCwa(), huc,
Request.buildPointRequest(new Point(index, 0)));
if (rec != null) {
float[] values = ((FloatDataRecord) rec)
.getFloatData();
if (rec != null) {
float[] values = ((FloatDataRecord) rec)
.getFloatData();
boolean isFFG = false;
boolean isFFG = false;
if (source.getSourceType().equals(
SOURCE_TYPE.GUIDANCE.getSourceType())) {
isFFG = true;
}
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]);
}
if (values != null) {
// System.err.println(sourceName);
if (isFFG) {
((FFMPGuidanceBasin) basin).setValue(
sourceName, idate, values[0]);
} else {
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) {
statusHandler.handle(Priority.ERROR, "ERROR Retrieving HUC..."
+ huc);
@ -575,56 +576,54 @@ public class FFMPRecord extends PersistablePluginDataObject
boolean aggregate = false;
fbd = getBasinData(ALL);
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
.getVirtualGageBasins(key, domain.getCwa());
if (lids != null) {
int size = lids.size();
if (lids != null) {
int size = lids.size();
if (size > 0) {
if (size > 0) {
IDataRecord rec = null;
IDataRecord rec = null;
try {
rec = dataStore.retrieve(
uri + "/" + domain.getCwa(), ALL,
Request.ALL);
} catch (Exception e) {
// This is a routine error. Sometimes you can not have data for a configured source
// This suppresses spurrious messages that would inflate the loags needlessly.
if (statusHandler.isPriorityEnabled(Priority.DEBUG)) {
statusHandler.handle(Priority.DEBUG,
"FFMPRecord: no data for: " + uri + "/"
+ domain.getCwa());
}
try {
rec = dataStore.retrieve(uri + "/" + domain.getCwa(),
ALL, Request.ALL);
} catch (Exception e) {
// This is a routine error. Sometimes you can not have
// data for a configured source
// This suppresses spurrious messages that would inflate
// the loags needlessly.
if (statusHandler.isPriorityEnabled(Priority.DEBUG)) {
statusHandler.handle(Priority.DEBUG,
"FFMPRecord: no data for: " + uri + "/"
+ domain.getCwa());
}
}
if (rec != null) {
float[] values = ((FloatDataRecord) rec)
.getFloatData();
if (values != null) {
int j = 0;
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++;
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(idate, values[j]);
j++;
}
}
}
@ -646,11 +645,11 @@ public class FFMPRecord extends PersistablePluginDataObject
boolean aggregate = false;
fbd = getBasinData(ALL);
String key = getDataKey();
ImmutableDate idate = getCacheDate(date);
for (DomainXML domain : template.getDomains()) {
LinkedHashMap<String, FFMPVirtualGageBasinMetaData> lids = template
.getVirtualGageBasins(key, domain.getCwa());
LinkedHashMap<String, FFMPVirtualGageBasinMetaData> lids = template.getVirtualGageBasins(key, domain.getCwa());
int size = lids.size();
if (size > 0) {
@ -677,7 +676,7 @@ public class FFMPRecord extends PersistablePluginDataObject
fvgbmd.getLookupId(), aggregate);
fbd.put(fvgbmd.getLookupId(), vgbasin);
}
vgbasin.setValue(date, values[j]);
vgbasin.setValue(idate, values[j]);
j++;
}
}
@ -814,5 +813,45 @@ public class FFMPRecord extends PersistablePluginDataObject
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
* @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;
HashMap<String, LinkedHashMap<Long, ?>> hucMap = null;
@ -1389,7 +1389,7 @@ public class FFMPTemplates {
*
* @return
*/
public LinkedHashMap<String, FFMPVirtualGageBasinMetaData> getVirtualGageBasins(
public synchronized LinkedHashMap<String, FFMPVirtualGageBasinMetaData> getVirtualGageBasins(
String dataKey, String cwa) {
LinkedHashMap<String, FFMPVirtualGageBasinMetaData> map = null;

View file

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

View file

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

View file

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

View file

@ -18,7 +18,7 @@
* 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.List;
@ -44,6 +44,7 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
* ------------ ---------- ----------- --------------------------
* 11/01/2007 #518 S.Manoj Initial version
* 11/16/2009 #3120 rjpeter Refactored to use factory and level mapping.
* 04/17/2013 #1913 randerso Moved to common
*
* @author smanoj
* @version 1.0
@ -56,7 +57,7 @@ public class LevelMappingFile implements ISerializableObject {
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;
public List<LevelMapping> getLevelMappingFile() {

View file

@ -29,10 +29,8 @@ import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.status.UFStatus;
@ -51,8 +49,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
*
* 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>
*
* @author mschenke
@ -64,14 +62,26 @@ public class FileLocker {
private static class LockWaiter {
}
private static enum LockState {
ACQUIRING, IN_USE, RELEASED
}
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;
LockState lockState = LockState.ACQUIRING;
LockedFile(Thread thread, Type type, Object locker) {
lockType = type;
lockingThread = thread;
lockers.add(locker);
}
}
public static enum Type {
@ -81,10 +91,10 @@ public class FileLocker {
private static final int MAX_WAIT = 30 * 1000;
/** 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 */
private Map<File, LockedFile> locks = new HashMap<File, LockedFile>();
private final Map<File, LockedFile> locks = new HashMap<File, LockedFile>();
/** Singleton instance of FileLocker class */
private static FileLocker instance = new FileLocker();
@ -181,22 +191,27 @@ public class FileLocker {
synchronized (locks) {
lock = locks.get(file);
if (lock == null) {
lock = new LockedFile();
lock = new LockedFile(myThread, type, locker);
locks.put(file, lock);
grabbedLock = true;
}
}
synchronized (lock) {
if (grabbedLock) {
// We were able to grab the lock file ourselves
return allocateLock(locker, file, type, myThread, lock);
} else if (lock.lockingThread == myThread
|| (type == lock.lockType && type == Type.READ)) {
// Locked on same thread to avoid indefinite waiting. If
// there are issues on how locked, they will be known
lock.lockers.add(locker);
return true;
if (grabbedLock) {
// We were able to grab the lock file ourselves
return allocateLock(file, lock);
} else {
synchronized (lock) {
// if the lock file has been obtained and either the thread is
// the same as the one that obtained the lock or the original
// lock and this request are both read locks
if ((lock.lockState == LockState.IN_USE)
&& ((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);
}
while (true) {
// Sleep
try {
Thread.sleep(10);
} catch (InterruptedException e) {
// Ignore
}
boolean waiterRemoved = false;
grabbedLock = false;
synchronized (locks) {
lock = locks.get(file);
if (lock == null) {
// File ready for grabbing
synchronized (lws) {
if (lws.peek() == waiter) {
lws.poll();
lock = new LockedFile();
locks.put(file, lock);
grabbedLock = true;
try {
while (true) {
// Sleep
try {
Thread.sleep(10);
} catch (InterruptedException e) {
// Ignore
}
grabbedLock = false;
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) {
if ((System.currentTimeMillis() - lock.lockFile
.lastModified()) > MAX_WAIT) {
System.err
.println("Releasing lock since: "
+ "Lock has been allocated for more than "
+ (MAX_WAIT / 1000) + "s");
locks.remove(file);
switch (lock.lockState) {
case IN_USE:
if ((type == Type.READ)
&& (type == lock.lockType)) {
// A different waiter grabbed it for
// reading, we can read it also
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) {
// We were able to grab the lock file ourselves
allocateLock(locker, file, type, myThread, lock);
return true;
} finally {
if (!waiterRemoved) {
synchronized (lws) {
lws.remove(waiter);
}
}
}
}
return false;
}
private void unlockInternal(Object locker, File file) {
try {
boolean fileUnlocked = false;
LockedFile lock = null;
// Get the Lock
synchronized (locks) {
lock = locks.get(file);
// Return early if we never locked or have already been
// unlocked
if (lock == null
|| (locker != null && lock.lockers.contains(locker) == false)) {
// Return early if we have never locked
if ((lock == null) || (locker == null)) {
return;
}
}
// Lock has locker and is not null
synchronized (lock) {
lock.lockers.remove(locker);
if (lock.lockers.size() == 0) {
// No more lockers, remove lock and release
locks.remove(file);
unallocateLock(lock);
if (lock.lockState == LockState.IN_USE) {
lock.lockers.remove(locker);
if (lock.lockers.isEmpty()) {
// No more lockers, remove lock and release
lock.lockState = LockState.RELEASED;
unallocateLock(lock);
fileUnlocked = true;
}
}
}
// Check for waiters on the file
synchronized (waiters) {
Deque<LockWaiter> lws = waiters.get(file);
if (lws == null) {
waiters.remove(file);
} else {
synchronized (lws) {
if (lws.size() == 0) {
waiters.remove(file);
if (fileUnlocked) {
synchronized (locks) {
locks.remove(file);
}
// Check for waiters on the file
synchronized (waiters) {
Deque<LockWaiter> lws = waiters.get(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
* aware and wait until other processes are finished with the file
*
* @param locker
* @param file
* @param type
* @param thread
* @param lock
* @return
* @throws FileNotFoundException
* @throws IOException
*/
private boolean allocateLock(Object locker, File file, Type type,
Thread thread, LockedFile lock) {
// Set tht thread of the lock and add lock allocator
lock.lockingThread = Thread.currentThread();
lock.lockers.add(locker);
private boolean allocateLock(File file, LockedFile lock) {
// Get the lock directory, make sure it is not already taken
File parentDir = file.getParentFile();
@ -333,23 +379,40 @@ public class FileLocker {
boolean gotLock = false;
File lockFile = new File(parentDir, "." + file.getName() + "_LOCK");
try {
long waitInterval = 500;
long tryCount = MAX_WAIT / waitInterval;
// start with a moderate wait
long waitInterval = 100;
long curTime = System.currentTimeMillis();
long maxWaitTime = curTime + MAX_WAIT;
long fileTime;
for (int i = 0; !gotLock && i < tryCount; ++i) {
while ((curTime = System.currentTimeMillis()) < maxWaitTime) {
gotLock = lockFile.createNewFile()
|| ((fileTime = lockFile.lastModified()) > 0 && (System
.currentTimeMillis() - fileTime) > MAX_WAIT);
if (!gotLock) {
|| (((fileTime = lockFile.lastModified()) > 0) && ((curTime - fileTime) > MAX_WAIT));
if (gotLock) {
break;
} else {
try {
Thread.sleep(waitInterval);
} catch (InterruptedException e) {
// Ignore
}
// every wait reduces the next wait down to minimum wait of
// 10 milliseconds
if (waitInterval > 10) {
waitInterval -= 10;
}
}
}
} 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) {
@ -357,14 +420,14 @@ public class FileLocker {
+ ", returning anyway");
Thread.dumpStack();
}
lockFile.setLastModified(System.currentTimeMillis());
lock.lockFile = lockFile;
return gotLock;
}
private void unallocateLock(LockedFile lock) throws IOException {
if (lock.lockFile != null) {
lock.lockFile.delete();
lock.lockFile = null;
}
}
@ -381,8 +444,8 @@ public class FileLocker {
String arg = args[i];
if (arg.startsWith("-")) {
// we have a key
if (args.length > (i + 1)
&& args[i + 1].startsWith("-") == false) {
if ((args.length > (i + 1))
&& (args[i + 1].startsWith("-") == false)) {
argumentMap.put(arg.substring(1), args[i + 1]);
++i;
} else {
@ -398,12 +461,13 @@ public class FileLocker {
String fileToLock = argumentMap.get("f");
String threads = argumentMap.get("tc");
final boolean verbose = argumentMap.get("v") != null;
final boolean verboseCount = argumentMap.get("vc") != null || verbose;
final boolean verboseErrors = argumentMap.get("ve") != null || verbose;
final boolean verboseCount = (argumentMap.get("vc") != null) || verbose;
final boolean verboseErrors = (argumentMap.get("ve") != null)
|| verbose;
String outputAtCount = argumentMap.get("c");
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>"
+ " specifies the file to use in the program");
System.out.println("-help prints out this help message");
@ -458,6 +522,7 @@ public class FileLocker {
final int[] errors = new int[1];
final File toLock = new File(fileToLock);
List<Runnable> runnables = new ArrayList<Runnable>(threadCount);
final Object lockObj = new Object();
final int[] i = { 0 };
for (int j = 1; j <= threadCount; ++j) {
@ -474,8 +539,8 @@ public class FileLocker {
System.out.flush();
}
threadArgs = "rw";
} else if (threadArgs.contains("r") == false
&& threadArgs.contains("w") == false) {
} else if ((threadArgs.contains("r") == false)
&& (threadArgs.contains("w") == false)) {
System.err.println("Error parsing thread " + j + " arguments ("
+ threadArgs + "), defaulting to rw");
System.err.flush();
@ -496,7 +561,7 @@ public class FileLocker {
@Override
public void run() {
try {
if (FileLocker.lock(this, toLock, write ? Type.WRITE
if (FileLocker.lock(lockObj, toLock, write ? Type.WRITE
: Type.READ)) {
boolean canRead = true;
if (toLock.exists() == false) {
@ -578,7 +643,7 @@ public class FileLocker {
t.printStackTrace();
}
} finally {
FileLocker.unlock(this, toLock);
FileLocker.unlock(lockObj, toLock);
}
}
});
@ -586,7 +651,7 @@ public class FileLocker {
int totalErrors = 0;
int count = 0;
while (iterations == null || i[0] < iterations) {
while ((iterations == null) || (i[0] < iterations)) {
List<Thread> threadList = new ArrayList<Thread>(threadCount);
for (Runnable r : runnables) {
threadList.add(new Thread(r));
@ -610,7 +675,8 @@ public class FileLocker {
++count;
// 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;
out.println("Completed " + count + " iterations with "
+ 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];
PrintStream out = totalErrors > 0 ? System.err : System.out;
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
* files on the server not to be retrieved.
* Jan 17, 2013 1412 djohnson Add jaxbMarshal.
* Apr 12, 2013 1903 rjpeter Updated getFile to check parentFile for existence.
* </pre>
*
* @author njensen
@ -283,7 +284,7 @@ public final class LocalizationFile implements Comparable<LocalizationFile> {
adapter.retrieve(this);
}
if ((isDirectory == false) && !file.exists()) {
if ((isDirectory == false) && !file.getParentFile().exists()) {
try {
file.getParentFile().mkdirs();
} catch (Throwable t) {
@ -647,7 +648,8 @@ public final class LocalizationFile implements Comparable<LocalizationFile> {
* @param jaxbManager
* the jaxbManager
*/
public void jaxbMarshal(Object obj, JAXBManager jaxbManager) throws LocalizationException{
public void jaxbMarshal(Object obj, JAXBManager jaxbManager)
throws LocalizationException {
try {
String xml = jaxbManager.marshalToXml(obj);
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)
* 03/20/2013 #1774 randerso Changed toString to display times even when
* 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>
*
@ -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
* (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
* document*.
* document.
*
* TimeRanges are generally used to define a valid time range for data files.
* 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
*/
public long getDuration() {
if (isValid()) {
return end.getTime() - start.getTime();
} else {
return 0L;
}
return end.getTime() - start.getTime();
}
/*
@ -368,16 +366,13 @@ public class TimeRange implements Serializable, Comparable<TimeRange>,
* @return
*/
public boolean contains(Date time) {
if (!this.isValid()) {
return false;
}
if (getDuration() != 0) {
// the end time is not part of the time range (hence the < operator)
return time.getTime() >= start.getTime()
&& time.getTime() < end.getTime();
} else {
return time.equals(start); // Special case for zero duration time
// range
// Special case for zero duration time range
return time.equals(start);
}
}
@ -388,7 +383,14 @@ public class TimeRange implements Serializable, Comparable<TimeRange>,
* @param time
* the time to be included
*/
@Deprecated
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()) {
return;
}
@ -409,10 +411,6 @@ public class TimeRange implements Serializable, Comparable<TimeRange>,
* @return true if a time range is contained within the range
*/
public boolean contains(TimeRange timeRange) {
if (!this.isValid()) {
return false;
}
if (getDuration() == 0) {
return this.equals(timeRange);
} else if (timeRange.getDuration() == 0) {
@ -433,10 +431,6 @@ public class TimeRange implements Serializable, Comparable<TimeRange>,
* @return true if the time ranges are adjacent
*/
public boolean isAdjacentTo(TimeRange timeRange) {
if (!this.isValid()) {
return false;
}
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
*/
public boolean overlaps(TimeRange timeRange) {
if (!this.isValid()) {
return false;
}
if (timeRange.contains(start) || contains(timeRange.getStart())) {
return true;
} else {
@ -555,9 +545,6 @@ public class TimeRange implements Serializable, Comparable<TimeRange>,
*/
@Override
public TimeRange clone() {
if (!this.isValid()) {
return new TimeRange();
}
return new TimeRange(this.start, this.end);
}