Issue #1782 Merge branch master_13.3.1 into omaha_13.3.1
Former-commit-id:7d2c1bc4d5
[formerly765be278bb
] [formerly38b952a220
] [formerly7d2c1bc4d5
[formerly765be278bb
] [formerly38b952a220
] [formerly5dc454c7ef
[formerly38b952a220
[formerly 7b2ba6522a24b0baf1ce950c1fee3cf895ba7753]]]] Former-commit-id:5dc454c7ef
Former-commit-id:68114535f2
[formerly9e97fc9efe
] [formerly b6128220fe67cb5d5fd130270ec6ca785e2ef6af [formerly160e1594b8
]] Former-commit-id: 39e44db397ec904e6c2a1254ad2d956f2cd9c180 [formerlycb5ee4a7b8
] Former-commit-id:b85e19282b
This commit is contained in:
commit
b111edeb8b
56 changed files with 1740 additions and 1523 deletions
|
@ -53,6 +53,11 @@
|
|||
<dataURI>/redbook/%/PENJ88/%</dataURI>
|
||||
<substitute key="wmo" value="PENJ88"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="bundleItem" file="bundles/Redbook.xml"
|
||||
menuText="Mesoscale Precip Discussion" id="mesoPrecipDisc">
|
||||
<dataURI>/redbook/%/PENA01/%</dataURI>
|
||||
<substitute key="wmo" value="PENA01"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="separator" id="separator1"/>
|
||||
<contribute xsi:type="subMenu" menuText="Day 1-3 Prob 4+ Inches Snow">
|
||||
<contribute xsi:type="bundleItem" file="bundles/Redbook.xml"
|
||||
|
|
|
@ -683,6 +683,10 @@
|
|||
<key>PENJ88</key>
|
||||
<value><name>Sig River Flood Outlook</name></value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>PENA01</key>
|
||||
<value><name>Mesoscale Precip Discussion</name></value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>PEBG98</key>
|
||||
<value><name>6Hr QPF - Time Proj 36-42Hrs</name></value>
|
||||
|
|
|
@ -271,6 +271,7 @@ public abstract class AbstractDescriptor extends ResourceGroup implements
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public DataTime[] getFrames() {
|
||||
return getFramesInfo().frameTimes;
|
||||
|
@ -446,6 +447,7 @@ public abstract class AbstractDescriptor extends ResourceGroup implements
|
|||
/**
|
||||
* @return the timeMatcher
|
||||
*/
|
||||
@Override
|
||||
@XmlElement
|
||||
public AbstractTimeMatcher getTimeMatcher() {
|
||||
return timeManager.timeMatcher;
|
||||
|
@ -455,6 +457,7 @@ public abstract class AbstractDescriptor extends ResourceGroup implements
|
|||
* @param timeMatcher
|
||||
* the timeMatcher to set
|
||||
*/
|
||||
@Override
|
||||
public void setTimeMatcher(AbstractTimeMatcher timeMatcher) {
|
||||
this.timeManager.timeMatcher = timeMatcher;
|
||||
}
|
||||
|
@ -477,6 +480,7 @@ public abstract class AbstractDescriptor extends ResourceGroup implements
|
|||
return currInfo.getTimeForResource(rsc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronizeTimeMatching(IDescriptor other) {
|
||||
if (other instanceof AbstractDescriptor) {
|
||||
timeManager = ((AbstractDescriptor) other).timeManager;
|
||||
|
@ -577,6 +581,8 @@ public abstract class AbstractDescriptor extends ResourceGroup implements
|
|||
return;
|
||||
}
|
||||
}
|
||||
DataTime oldTime, currTime;
|
||||
boolean frameChanged = false;
|
||||
synchronized (timeManager) {
|
||||
DataTime[] oldTimes = timeManager.frames;
|
||||
int oldIdx = this.frameIndex;
|
||||
|
@ -598,13 +604,16 @@ public abstract class AbstractDescriptor extends ResourceGroup implements
|
|||
}
|
||||
FramesInfo currInfo = getFramesInfo();
|
||||
FramesInfo oldInfo = new FramesInfo(oldTimes, oldIdx);
|
||||
DataTime oldTime = oldInfo.getCurrentFrame();
|
||||
DataTime currTime = currInfo.getCurrentFrame();
|
||||
oldTime = oldInfo.getCurrentFrame();
|
||||
currTime = currInfo.getCurrentFrame();
|
||||
if ((oldTime != null && oldTime.equals(currTime) == false)
|
||||
|| (currTime != null && currTime.equals(oldTime) == false)) {
|
||||
notifyFrameChanged(oldTime, currTime);
|
||||
frameChanged = true;
|
||||
}
|
||||
}
|
||||
if (frameChanged) {
|
||||
notifyFrameChanged(oldTime, currTime);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -115,7 +115,6 @@ public abstract class AbstractRequestableResourceData extends
|
|||
PluginDataObject record = RecordFactory.getInstance()
|
||||
.loadRecordFromUri(dataURI);
|
||||
objectToSend = record;
|
||||
|
||||
} else {
|
||||
attribs.put("dataURI", message.dataURI);
|
||||
objectToSend = Loader.loadData(attribs);
|
||||
|
@ -444,13 +443,8 @@ public abstract class AbstractRequestableResourceData extends
|
|||
*/
|
||||
public PluginDataObject[] getLatestPluginDataObjects(DataTime[] desired,
|
||||
DataTime[] current) throws VizException {
|
||||
if (desired == null || desired.length == 0 || !this.retrieveData) {
|
||||
return new PluginDataObject[0];
|
||||
}
|
||||
|
||||
// If resource is handling requests itself, do not send full record
|
||||
// updates
|
||||
if (isUpdatingOnMetadataOnly() || !isRequeryNecessaryOnTimeMatch()) {
|
||||
if (desired == null || desired.length == 0 || !isRetrieveData()
|
||||
|| !isRequeryNecessaryOnTimeMatch()) {
|
||||
return new PluginDataObject[0];
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,6 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.common.util.FileUtil;
|
||||
import com.raytheon.uf.viz.core.DescriptorMap;
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.drawables.AbstractDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay;
|
||||
|
@ -100,6 +99,7 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
|
|||
* Oct 16, 2012 1229 rferrel Changes for non-blocking ProcedureListDlg.
|
||||
* Jan 15, 2013 DR 15699 D. Friedman Prompt for save when close button clicked.
|
||||
* Jan 16, 2013 DR 15367 D. Friedman Enable save button for Up/Down changes.
|
||||
* Feb 25, 2013 1640 bsteffen Dispose old display in BundleLoader
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -864,18 +864,6 @@ public class ProcedureDlg extends CaveSWTDialog {
|
|||
editor.setLoopProperties(b.getLoopProperties());
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if the bundle was used to open the editor. If it was then we do
|
||||
* not want to clear the display.
|
||||
*/
|
||||
if (editor.getDisplayPanes()[0].getDescriptor() != b.getDisplays()[0]
|
||||
.getDescriptor()) {
|
||||
for (IDisplayPane pane : editor.getDisplayPanes()) {
|
||||
pane.getRenderableDisplay().getDescriptor().getResourceList()
|
||||
.clear();
|
||||
}
|
||||
}
|
||||
|
||||
ProcedureLoadJob.getInstance().enqueue(b, editor);
|
||||
|
||||
// add to history
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<DerivedParameter unit="m/s" name="Wind Gust" abbreviation="Gust" xmlns:ns2="group">
|
||||
<Method name="Vector" levels="Surface" models="obs">
|
||||
<Field level="Station" abbreviation="windGust"/>
|
||||
<Field abbreviation="WD"/>
|
||||
<Field abbreviation="WD" unit="deg"/>
|
||||
<ConstantField value="1.0"/>
|
||||
</Method>
|
||||
<Method name="Vector">
|
||||
|
@ -11,12 +11,12 @@
|
|||
</Method>
|
||||
<Method name="Vector">
|
||||
<Field abbreviation="WGS" unit="m/s"/>
|
||||
<Field abbreviation="WGD"/>
|
||||
<Field abbreviation="WGD" unit="deg"/>
|
||||
<ConstantField value="1.0"/>
|
||||
</Method>
|
||||
<Method name="Vector">
|
||||
<Field abbreviation="WGS" unit="m/s"/>
|
||||
<Field abbreviation="WD"/>
|
||||
<Field abbreviation="WD" unit="deg"/>
|
||||
<ConstantField value="1.0"/>
|
||||
</Method>
|
||||
<Method name="Vector">
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<DerivedParameter name="Swell Direction" abbreviation="SWdir" xmlns:ns2="group">
|
||||
<Method name="Vector">
|
||||
<ConstantField value="20"/>
|
||||
<Field abbreviation="SWDIR"/>
|
||||
<Field abbreviation="SWDIR" unit="deg"/>
|
||||
<ConstantField value="1"/>
|
||||
</Method>
|
||||
</DerivedParameter>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<DerivedParameter name="Wind Wave Direction" abbreviation="WVdir" xmlns:ns2="group">
|
||||
<Method name="Vector">
|
||||
<ConstantField value="20"/>
|
||||
<Field abbreviation="WVDIR"/>
|
||||
<Field abbreviation="WVDIR" unit="deg"/>
|
||||
<ConstantField value="1"/>
|
||||
</Method>
|
||||
</DerivedParameter>
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
</Method>
|
||||
<Method name="Vector">
|
||||
<Field abbreviation="wSp"/>
|
||||
<Field abbreviation="WD"/>
|
||||
<Field abbreviation="WD" unit="deg"/>
|
||||
<ConstantField value="1.0"/>
|
||||
</Method>
|
||||
<!-- TODO this should be an auto-generated average however
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
</Method>
|
||||
<Method name="Vector">
|
||||
<Field abbreviation="WSmean" unit="kts"/>
|
||||
<Field abbreviation="WDmean" unit="kts"/>
|
||||
<Field abbreviation="WDmean" unit="deg"/>
|
||||
<ConstantField value="1.0"/>
|
||||
</Method>
|
||||
</DerivedParameter>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<DerivedParameter name="Primary Wave Direction" abbreviation="dirPW" xmlns:ns2="group">
|
||||
<Method name="Vector">
|
||||
<ConstantField value="20"/>
|
||||
<Field abbreviation="DIRPW"/>
|
||||
<Field abbreviation="DIRPW" unit="deg"/>
|
||||
<ConstantField value="1"/>
|
||||
</Method>
|
||||
</DerivedParameter>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<DerivedParameter name="Secondary Wave Direction" abbreviation="dirSW" xmlns:ns2="group">
|
||||
<Method name="Vector">
|
||||
<ConstantField value="20"/>
|
||||
<Field abbreviation="DIRSW"/>
|
||||
<Field abbreviation="DIRSW" unit="deg"/>
|
||||
<ConstantField value="1"/>
|
||||
</Method>
|
||||
</DerivedParameter>
|
||||
|
|
|
@ -105,6 +105,7 @@ import com.vividsolutions.jts.geom.Point;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 31, 2012 #1326 randerso Initial creation
|
||||
* Feb 22, 2013 #1641 randerso Moved ID_ATTRIBUTE_NAME to package scope
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -115,7 +116,7 @@ import com.vividsolutions.jts.geom.Point;
|
|||
public class DataStoreResource extends
|
||||
AbstractVizResource<DataStoreResourceData, MapDescriptor> implements
|
||||
IPropertyChangeListener, IResourceDataChanged {
|
||||
private static final String ID_ATTRIBUTE_NAME = "Feature.ID";
|
||||
static final String ID_ATTRIBUTE_NAME = "Feature.ID";
|
||||
|
||||
private static final int CLICK_TOLERANCE = 3;
|
||||
|
||||
|
|
|
@ -44,6 +44,23 @@ import com.vividsolutions.jts.geom.Geometry;
|
|||
import com.vividsolutions.jts.geom.GeometryCollection;
|
||||
import com.vividsolutions.jts.geom.Point;
|
||||
|
||||
/**
|
||||
* Job to reload data from GIS data stores
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 31, 2012 #1326 randerso Initial creation
|
||||
* Feb 22, 2013 #1641 randerso Added checks for using ID as label or shading attribute
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author randerso
|
||||
* @version 1.0
|
||||
*/
|
||||
class ReloadJob extends Job {
|
||||
|
||||
private static final int QUEUE_LIMIT = 1;
|
||||
|
@ -199,11 +216,16 @@ class ReloadJob extends Job {
|
|||
|
||||
List<String> fields = new ArrayList<String>();
|
||||
fields.add(req.geomField);
|
||||
if (req.labelField != null && !fields.contains(req.labelField)) {
|
||||
if (req.labelField != null
|
||||
&& !fields.contains(req.labelField)
|
||||
&& !req.labelField
|
||||
.equals(DataStoreResource.ID_ATTRIBUTE_NAME)) {
|
||||
fields.add(req.labelField);
|
||||
}
|
||||
if (req.shadingField != null
|
||||
&& !fields.contains(req.shadingField)) {
|
||||
&& !fields.contains(req.shadingField)
|
||||
&& !req.shadingField
|
||||
.equals(DataStoreResource.ID_ATTRIBUTE_NAME)) {
|
||||
fields.add(req.shadingField);
|
||||
}
|
||||
|
||||
|
@ -308,6 +330,16 @@ class ReloadJob extends Job {
|
|||
}
|
||||
}
|
||||
|
||||
if (DataStoreResource.ID_ATTRIBUTE_NAME
|
||||
.equals(req.labelField)) {
|
||||
labelAttr = id;
|
||||
}
|
||||
|
||||
if (DataStoreResource.ID_ATTRIBUTE_NAME
|
||||
.equals(req.shadingField)) {
|
||||
shadingAttr = id;
|
||||
}
|
||||
|
||||
if (labelAttr != null && g != null) {
|
||||
String label;
|
||||
if (labelAttr instanceof BigDecimal) {
|
||||
|
|
|
@ -217,19 +217,23 @@ public class FFMPDataGenerator {
|
|||
setFFMPRow(fbd.get(key), tData,
|
||||
false, cwa);
|
||||
|
||||
if (virtualBasin != null) {
|
||||
for (Long id : ft
|
||||
.getVirtualGageBasinLookupIds(
|
||||
siteKey, key)) {
|
||||
setFFMPRow(
|
||||
virtualBasin
|
||||
.get(id),
|
||||
tData, true, domain
|
||||
.getCwa());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (virtualBasin != null) {
|
||||
for (Long id : ft
|
||||
.getVirtualGageBasinLookupIds(
|
||||
siteKey,
|
||||
key,
|
||||
huc,
|
||||
resource.basinTableDlg
|
||||
.getRowName())) {
|
||||
setFFMPRow(
|
||||
virtualBasin
|
||||
.get(id),
|
||||
tData, true, domain
|
||||
.getCwa());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
/*
|
||||
|
@ -281,22 +285,26 @@ public class FFMPDataGenerator {
|
|||
|| (domain.isPrimary() && fmdb
|
||||
.isPrimaryCwa())) {
|
||||
|
||||
setFFMPRow(fbd.get(key), tData,
|
||||
false, null);
|
||||
// virtual basin
|
||||
if (virtualBasin != null) {
|
||||
for (Long id : ft
|
||||
.getVirtualGageBasinLookupIds(
|
||||
siteKey, key)) {
|
||||
setFFMPRow(
|
||||
virtualBasin
|
||||
.get(id),
|
||||
tData, true, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
setFFMPRow(fbd.get(key), tData,
|
||||
false, null);
|
||||
// virtual basin
|
||||
if (virtualBasin != null) {
|
||||
for (Long id : ft
|
||||
.getVirtualGageBasinLookupIds(
|
||||
siteKey,
|
||||
key,
|
||||
huc,
|
||||
resource.basinTableDlg
|
||||
.getRowName())) {
|
||||
setFFMPRow(
|
||||
virtualBasin
|
||||
.get(id),
|
||||
tData, true, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
tData.sortData();
|
||||
|
|
|
@ -12,11 +12,11 @@ import java.util.Set;
|
|||
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleActivator;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.Constants;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -33,6 +33,7 @@ import org.eclipse.core.runtime.Platform;
|
|||
* Oct 12, 2010 mschenke Initial creation
|
||||
* Jan 24, 2013 1522 bkowal Halt initialization if a p2 installation
|
||||
* has been started
|
||||
* Mar 05, 2013 1754 djohnson Catch exceptions and allow as much of the Spring container to boot as possible.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -64,7 +65,8 @@ public class Activator implements BundleActivator {
|
|||
* @see
|
||||
* org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void start(BundleContext context) throws Exception {
|
||||
@Override
|
||||
public void start(BundleContext context) throws Exception {
|
||||
if (this.isInstallOperation()) {
|
||||
return;
|
||||
}
|
||||
|
@ -137,16 +139,27 @@ public class Activator implements BundleActivator {
|
|||
}
|
||||
}
|
||||
|
||||
if (parentContexts.size() > 0) {
|
||||
// Context with parent context
|
||||
appCtx = new OSGIXmlApplicationContext(
|
||||
new OSGIGroupApplicationContext(parentContexts),
|
||||
files.toArray(new String[0]), bundle);
|
||||
} else {
|
||||
// No parent context required
|
||||
appCtx = new OSGIXmlApplicationContext(
|
||||
files.toArray(new String[0]), bundle);
|
||||
}
|
||||
try {
|
||||
if (parentContexts.size() > 0) {
|
||||
// Context with parent context
|
||||
appCtx = new OSGIXmlApplicationContext(
|
||||
new OSGIGroupApplicationContext(
|
||||
parentContexts),
|
||||
files.toArray(new String[0]), bundle);
|
||||
} else {
|
||||
// No parent context required
|
||||
appCtx = new OSGIXmlApplicationContext(
|
||||
files.toArray(new String[0]), bundle);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
// No access to the statusHandler yet, so print the
|
||||
// stack trace to the console. By catching this, we also
|
||||
// allow as many beans as possible to continue to be
|
||||
// created
|
||||
System.err
|
||||
.println("Errors booting the Spring container. CAVE will not be fully functional.");
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
contextMap.put(bundleName, appCtx);
|
||||
|
@ -161,7 +174,8 @@ public class Activator implements BundleActivator {
|
|||
* @see
|
||||
* org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
@Override
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
plugin = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.opengis.metadata.spatial.PixelOrientation;
|
||||
import org.opengis.referencing.FactoryException;
|
||||
import org.opengis.referencing.operation.TransformException;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.GridDataHistory;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord.GridType;
|
||||
|
@ -64,6 +66,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* 01/29/2008 chammack Initial Class Skeleton.
|
||||
* 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
|
||||
* </pre>
|
||||
*
|
||||
* @author chammack
|
||||
|
@ -337,7 +340,12 @@ public abstract class AbstractGridData implements IGridData {
|
|||
}
|
||||
|
||||
// perform translation
|
||||
return translateDataFrom(sourceGrid);
|
||||
try {
|
||||
return translateDataFrom(sourceGrid);
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Error translating data", e);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -350,7 +358,8 @@ public abstract class AbstractGridData implements IGridData {
|
|||
@Override
|
||||
public abstract IGridData clone() throws CloneNotSupportedException;
|
||||
|
||||
protected abstract boolean translateDataFrom(final IGridData source);
|
||||
protected abstract boolean translateDataFrom(final IGridData source)
|
||||
throws FactoryException, TransformException;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
|
|
|
@ -30,6 +30,8 @@ import jep.INumpyable;
|
|||
import org.apache.commons.lang.mutable.MutableByte;
|
||||
import org.geotools.geometry.jts.JTS;
|
||||
import org.opengis.metadata.spatial.PixelOrientation;
|
||||
import org.opengis.referencing.FactoryException;
|
||||
import org.opengis.referencing.operation.TransformException;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.RemapGrid;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord.GridType;
|
||||
|
@ -69,6 +71,7 @@ import com.vividsolutions.jts.geom.MultiPolygon;
|
|||
* Tweak doSet() for filtered grids, fix bugs
|
||||
* 30Jan2013 #15719 jdynina Fixed allowed field size to accept more
|
||||
* than 128 characters
|
||||
* 02/19/2013 1637 randerso Added throws declarations to translateDataFrom
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -215,7 +218,8 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean translateDataFrom(IGridData sourceGrid) {
|
||||
protected boolean translateDataFrom(IGridData sourceGrid)
|
||||
throws FactoryException, TransformException {
|
||||
if (!(sourceGrid instanceof DiscreteGridData)) {
|
||||
throw new IllegalArgumentException(
|
||||
"Expected DiscreteGridData as source.");
|
||||
|
@ -586,8 +590,8 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable {
|
|||
// fancy code in here to prevent lots of repeated combining
|
||||
// for efficiency.
|
||||
// Make an array of byte...init to MAX_VALUE
|
||||
byte newValues[] = new byte[255];
|
||||
Arrays.fill(newValues, (byte)-1);
|
||||
byte newValues[] = new byte[255];
|
||||
Arrays.fill(newValues, (byte) -1);
|
||||
byte[] gridA = discreteGrid.getBuffer().array();
|
||||
byte[] pToSetA = pointsToSet.getBuffer().array();
|
||||
|
||||
|
@ -598,10 +602,10 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable {
|
|||
if ((byte) 1 == pToSetA[rowOffset + col]) {
|
||||
// pointsToSet selects this grid point
|
||||
byte dataPoint = gridA[rowOffset + col];
|
||||
int dataPointIdx = 0xFF & dataPoint;
|
||||
int dataPointIdx = 0xFF & dataPoint;
|
||||
if (dataPoint != index) {
|
||||
// value needs to change
|
||||
if (newValues[dataPointIdx] == (byte)-1) {
|
||||
if (newValues[dataPointIdx] == (byte) -1) {
|
||||
// new key hasn't been found
|
||||
DiscreteKey combinedKey = DiscreteKey.combine(
|
||||
dk, getKey()[dataPointIdx]);
|
||||
|
@ -718,8 +722,8 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable {
|
|||
// if inside grid limits, copy value to new position
|
||||
// of working grid.
|
||||
if (sliceGrid.isValid(newx, newy)) {
|
||||
//byte og = originalGrid.get(i, j);
|
||||
int og = 0xFF & originalGrid.get(i, j);
|
||||
// byte og = originalGrid.get(i, j);
|
||||
int og = 0xFF & originalGrid.get(i, j);
|
||||
byte v = translate[og];
|
||||
if (v == -1) {
|
||||
v = lookupKeyValue(originalKey[og]);
|
||||
|
@ -899,7 +903,7 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable {
|
|||
int numValues = values.getXdim() * values.getYdim();
|
||||
byte[] bp = values.getBuffer().array();
|
||||
for (int i = 0; i < numValues; i++) {
|
||||
if ((0xFF & bp[i]) > key.size() -1) {
|
||||
if ((0xFF & bp[i]) > key.size() - 1) {
|
||||
throw new IllegalArgumentException(
|
||||
"Illegal discrete grid (bad values) in gridSet()");
|
||||
}
|
||||
|
@ -946,7 +950,7 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable {
|
|||
|
||||
protected DiscreteKey doGetDiscreteValue(int x, int y) {
|
||||
byte gridValue = getGrid().get(x, y);
|
||||
int gridValueIdx = 0xFF & gridValue;
|
||||
int gridValueIdx = 0xFF & gridValue;
|
||||
return getKey()[gridValueIdx];
|
||||
}
|
||||
|
||||
|
@ -1054,14 +1058,14 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable {
|
|||
// check data values
|
||||
byte[] data = grid.getBuffer().array();
|
||||
DiscreteKey[] keys = getKey();
|
||||
//byte keySize = (byte) keys.length;
|
||||
// byte keySize = (byte) keys.length;
|
||||
int keySize = keys.length;
|
||||
|
||||
for (int j = 0; j < data.length; j++) {
|
||||
int value = 0xFF & data[j];
|
||||
int value = 0xFF & data[j];
|
||||
if (value > keySize) {
|
||||
statusHandler.handle(Priority.PROBLEM, emsg + "Data="
|
||||
+ (int) value + " Min=0 Max=" + (int) keySize);
|
||||
statusHandler.handle(Priority.PROBLEM, emsg + "Data=" + value
|
||||
+ " Min=0 Max=" + keySize);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,9 @@ import javax.measure.converter.ConversionException;
|
|||
import javax.measure.converter.UnitConverter;
|
||||
import javax.measure.unit.Unit;
|
||||
|
||||
import org.opengis.referencing.FactoryException;
|
||||
import org.opengis.referencing.operation.TransformException;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.RemapGrid;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.grid.Grid2DBit;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.grid.Grid2DFloat;
|
||||
|
@ -52,6 +55,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* 01/29/2008 chammack Initial Class Skeleton.
|
||||
* 03/13/2008 879 rbell Legacy conversion.
|
||||
* 05/20/2009 #2159 rjpeter Fixed doDelta
|
||||
* 02/19/2013 1637 randerso Added throws declarations to translateDataFrom
|
||||
* </pre>
|
||||
*
|
||||
* @author chammack
|
||||
|
@ -400,7 +404,8 @@ public class ScalarGridData extends OrderedGridData implements Cloneable {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean translateDataFrom(IGridData source) {
|
||||
protected boolean translateDataFrom(IGridData source)
|
||||
throws FactoryException, TransformException {
|
||||
if (!(source instanceof ScalarGridData)) {
|
||||
throw new IllegalArgumentException(
|
||||
"Expected ScalarGridData as source.");
|
||||
|
@ -446,14 +451,9 @@ public class ScalarGridData extends OrderedGridData implements Cloneable {
|
|||
RemapGrid remap = new RemapGrid(scalarSource.getParm()
|
||||
.getGridInfo().getGridLoc(), this.parm.getGridInfo()
|
||||
.getGridLoc());
|
||||
try {
|
||||
|
||||
Grid2DFloat scalarGrid = remap.remap(scalarSource.getGrid(),
|
||||
-99999.99f, maxLimit, minLimit, minLimit);
|
||||
setGrid(scalarGrid);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Grid2DFloat scalarGrid = remap.remap(scalarSource.getGrid(),
|
||||
-99999.99f, maxLimit, minLimit, minLimit);
|
||||
setGrid(scalarGrid);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import javax.measure.converter.UnitConverter;
|
|||
import javax.measure.unit.Unit;
|
||||
|
||||
import org.opengis.metadata.spatial.PixelOrientation;
|
||||
import org.opengis.referencing.FactoryException;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.RemapGrid;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.grid.Grid2DBit;
|
||||
|
@ -56,6 +57,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 01/29/2008 chammack Initial Class Skeleton.
|
||||
* 03/25/2008 879 rbell Legacy conversion.
|
||||
* 02/19/2013 1637 randerso Added throws declarations to translateDataFrom
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -445,7 +447,8 @@ public class VectorGridData extends OrderedGridData implements Cloneable {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean translateDataFrom(IGridData source) {
|
||||
protected boolean translateDataFrom(IGridData source)
|
||||
throws FactoryException {
|
||||
if (!(source instanceof VectorGridData)) {
|
||||
throw new IllegalArgumentException(
|
||||
"Expected VectorGridData as source.");
|
||||
|
|
|
@ -29,6 +29,8 @@ import jep.INumpyable;
|
|||
import org.apache.commons.lang.mutable.MutableByte;
|
||||
import org.geotools.geometry.jts.JTS;
|
||||
import org.opengis.metadata.spatial.PixelOrientation;
|
||||
import org.opengis.referencing.FactoryException;
|
||||
import org.opengis.referencing.operation.TransformException;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.RemapGrid;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord.GridType;
|
||||
|
@ -65,6 +67,7 @@ import com.vividsolutions.jts.geom.MultiPolygon;
|
|||
* Mar 15, 2011 randerso Initial creation
|
||||
* Jan 30, 2013 #15719 jdynina Allowed more than 128 chars in wx
|
||||
* strings
|
||||
* 02/19/2013 1637 randerso Added throws declarations to translateDataFrom
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -204,7 +207,8 @@ public class WeatherGridData extends AbstractGridData implements INumpyable {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean translateDataFrom(IGridData sourceGrid) {
|
||||
protected boolean translateDataFrom(IGridData sourceGrid)
|
||||
throws FactoryException, TransformException {
|
||||
if (!(sourceGrid instanceof WeatherGridData)) {
|
||||
throw new IllegalArgumentException(
|
||||
"Expected WeatherGridData as source.");
|
||||
|
@ -566,8 +570,8 @@ public class WeatherGridData extends AbstractGridData implements INumpyable {
|
|||
// fancy code in here to prevent lots of repeated combining
|
||||
// for efficiency.
|
||||
// Make an array of byte...init to MAX_VALUE
|
||||
byte newValues[] = new byte[255];
|
||||
Arrays.fill(newValues, (byte)-1);
|
||||
byte newValues[] = new byte[255];
|
||||
Arrays.fill(newValues, (byte) -1);
|
||||
byte[] gridA = weatherGrid.getBuffer().array();
|
||||
byte[] pToSetA = pointsToSet.getBuffer().array();
|
||||
|
||||
|
@ -579,10 +583,10 @@ public class WeatherGridData extends AbstractGridData implements INumpyable {
|
|||
if ((byte) 1 == pToSetA[rowOffset + col]) {
|
||||
// pointsToSet selects this grid point
|
||||
byte dataPoint = gridA[rowOffset + col];
|
||||
int dataPointIdx = 0xFF & dataPoint;
|
||||
int dataPointIdx = 0xFF & dataPoint;
|
||||
if (dataPoint != index) {
|
||||
// value needs to change
|
||||
if (newValues[dataPointIdx] == (byte)-1) {
|
||||
if (newValues[dataPointIdx] == (byte) -1) {
|
||||
// new key hasn't been found
|
||||
WeatherKey combinedKey = new WeatherKey(wk);
|
||||
combinedKey.addAll(getKeys()[dataPointIdx]);
|
||||
|
@ -721,7 +725,7 @@ public class WeatherGridData extends AbstractGridData implements INumpyable {
|
|||
}
|
||||
|
||||
// set up translation matrix
|
||||
//byte translate[] = new byte[128];
|
||||
// byte translate[] = new byte[128];
|
||||
byte translate[] = new byte[255];
|
||||
Arrays.fill(translate, (byte) -1);
|
||||
|
||||
|
@ -761,8 +765,8 @@ public class WeatherGridData extends AbstractGridData implements INumpyable {
|
|||
// if inside grid limits, copy value to new position
|
||||
// of working grid.
|
||||
if (sliceGrid.isValid(newx, newy)) {
|
||||
//byte og = originalGrid.get(i, j);
|
||||
int og = 0xFF & originalGrid.get(i, j);
|
||||
// byte og = originalGrid.get(i, j);
|
||||
int og = 0xFF & originalGrid.get(i, j);
|
||||
byte v = translate[og];
|
||||
if (v == -1) {
|
||||
v = lookupKeyValue(originalKey[og]);
|
||||
|
@ -876,7 +880,7 @@ public class WeatherGridData extends AbstractGridData implements INumpyable {
|
|||
int numValues = values.getXdim() * values.getYdim();
|
||||
byte[] bp = values.getBuffer().array();
|
||||
for (int i = 0; i < numValues; i++) {
|
||||
if ((0xFF & bp[i]) > key.size() -1) {
|
||||
if ((0xFF & bp[i]) > key.size() - 1) {
|
||||
throw new IllegalArgumentException(
|
||||
"Illegal weather grid (bad values) in gridSet()");
|
||||
}
|
||||
|
@ -1025,14 +1029,14 @@ public class WeatherGridData extends AbstractGridData implements INumpyable {
|
|||
// check data values
|
||||
byte[] data = grid.getBuffer().array();
|
||||
WeatherKey[] keys = getKeys();
|
||||
//byte keySize = (byte) keys.length;
|
||||
// byte keySize = (byte) keys.length;
|
||||
int keySize = keys.length;
|
||||
|
||||
for (int j = 0; j < data.length; j++) {
|
||||
int value = 0xFF & data[j];
|
||||
int value = 0xFF & data[j];
|
||||
if (value > keySize) {
|
||||
statusHandler.handle(Priority.PROBLEM, emsg + "Data="
|
||||
+ (int) value + " Min=0 Max=" + (int) keySize);
|
||||
statusHandler.handle(Priority.PROBLEM, emsg + "Data=" + value
|
||||
+ " Min=0 Max=" + keySize);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -149,6 +149,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* 08 Feb 2013 12851 jzeng Add menuToAddTo in create*Menu
|
||||
* Create createEditorPopupMenu()
|
||||
* Add mouselistener in createTextControl() for StyledText
|
||||
* 28 Feb 2013 15889 ryu Removed detachAttributionPhrase and getVTECActionCodes
|
||||
* 02/12/2013 #1597 randerso Code cleanup. Fixed possible widget disposed errors on shut down.
|
||||
*
|
||||
* </pre>
|
||||
|
@ -1156,7 +1157,6 @@ public class ProductEditorComp extends Composite implements
|
|||
|
||||
boolean retVal = true;
|
||||
if (!textComp.isCorMode()) {
|
||||
detachAttributionPhrase();
|
||||
retVal = changeTimes();
|
||||
}
|
||||
|
||||
|
@ -1257,70 +1257,6 @@ public class ProductEditorComp extends Composite implements
|
|||
return vtecList;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the list of VTEC Action Codes for this segment one Action code per
|
||||
* VTEC line
|
||||
*/
|
||||
private List<String> getVTECActionCodes(SegmentData segData,
|
||||
ProductDataStruct pds) {
|
||||
|
||||
HashMap<String, TextIndexPoints> segMap = segData.getSementMap();
|
||||
TextIndexPoints tipVtec = segMap.get("vtec");
|
||||
if (tipVtec == null) {
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
|
||||
int lineCount = tipVtec.getEndIndex().x - tipVtec.getStartIndex().x;
|
||||
ArrayList<String> actioncodes = new ArrayList<String>(lineCount);
|
||||
for (int i = 0; i < lineCount; i++) {
|
||||
String vtec = pds.getProductTextArray()[i
|
||||
+ tipVtec.getStartIndex().x];
|
||||
// extract the action code
|
||||
String vline = vtec.split("/", 3)[1];
|
||||
String ac = vline.split("\\.")[1];
|
||||
actioncodes.add(ac);
|
||||
}
|
||||
return actioncodes;
|
||||
}
|
||||
|
||||
private void detachAttributionPhrase() {
|
||||
final String attributionPhraseRgx = "THE NATIONAL WEATHER SERVICE IN [A-Z0-9\\p{Punct}\\s]+?\\n\\n";
|
||||
Pattern attribPattern = Pattern.compile(attributionPhraseRgx);
|
||||
StyledTextComp stc = textComp;
|
||||
ProductDataStruct pds = stc.getProductDataStruct();
|
||||
List<SegmentData> segs = pds.getSegmentsArray();
|
||||
for (SegmentData segData : segs) {
|
||||
String newSegTxt = null;
|
||||
String oldSegTxt = segData.getSementMap().get("ugc").getText();
|
||||
TextIndexPoints oldSegTip = segData.getSementMap().get("ugc");
|
||||
List<String> actioncodes = getVTECActionCodes(segData, pds);
|
||||
if (actioncodes == null || actioncodes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (actioncodes.contains("NEW") || actioncodes.contains("EXA")
|
||||
|| actioncodes.contains("EXB")) {
|
||||
continue;
|
||||
} else {
|
||||
// all actions in {"CON","CAN","UPG","EXT","EXP"}
|
||||
// Not the first issuance, strip the attribution phrase from
|
||||
// segment text.
|
||||
Matcher matcher = attribPattern.matcher(oldSegTxt);
|
||||
while (matcher.find()) {
|
||||
newSegTxt = matcher.replaceAll("");
|
||||
final int segNum = segs.indexOf(segData) + 1;
|
||||
statusHandler.handle(Priority.INFO,
|
||||
"Detached attribution phrase from segment data number "
|
||||
+ segNum);
|
||||
}
|
||||
}
|
||||
|
||||
if (newSegTxt != null) {
|
||||
textComp.replaceText(oldSegTip, newSegTxt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the latest active VTEC for our site from server. Filter and keep
|
||||
* only the ones for this pil.
|
||||
|
|
|
@ -65,7 +65,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* 28May2010 2187 cjeanbap Added StdTextProductFactory
|
||||
* functionality.
|
||||
* 09 NOV 2012 1298 rferrel Changes for non-blocking dialog.
|
||||
* 10Jan2012 15564 mgamazaychikov Set the awipsWanPil based on productText data
|
||||
* 08Mar2013 15564 mgamazaychikov Set the awipsWanPil based on productText data
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
|
|
|
@ -158,8 +158,9 @@ import com.vividsolutions.jts.geom.Envelope;
|
|||
* 03/01/2008 chammack Initial Creation.
|
||||
* Aug 20, 2008 dglazesk Update for the ColorMap interface change
|
||||
* Nov 23, 2011 mli set vector lineStyle
|
||||
* May 11, 2012 njensen Allow rsc to be recycled
|
||||
* May 11, 2012 njensen Allow rsc to be recycled
|
||||
* Nov 08, 2012 1298 rferrel Changes for non-blocking FuzzValueDialog.
|
||||
* Mar 04, 2013 1637 randerso Fix time matching for ISC grids
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -455,7 +456,14 @@ public class GFEResource extends
|
|||
PaintProperties paintProps) throws VizException {
|
||||
|
||||
GFEPaintProperties myPaintProps = (GFEPaintProperties) paintProps;
|
||||
this.curTime = myPaintProps.getDataTime();
|
||||
|
||||
// TODO: Time matching changes for Hazard Services broke display of ISC
|
||||
// grids when in ISC mode with no Fcst grid present. This fixes the
|
||||
// issue for now but will need to be resolved for Hazard Services
|
||||
|
||||
// this.curTime = myPaintProps.getDataTime();
|
||||
this.curTime = new DataTime(this.dataManager.getSpatialDisplayManager()
|
||||
.getSpatialEditorTime());
|
||||
|
||||
if (curTime == null) {
|
||||
return;
|
||||
|
@ -585,8 +593,9 @@ public class GFEResource extends
|
|||
if (dataManager.getParmManager().iscMode() || iscParm) {
|
||||
vectorSlice = new VectorGridSlice();
|
||||
mask = dataManager.getIscDataAccess().getCompositeGrid(
|
||||
new GridID(this.parm, this.curTime
|
||||
.getValidPeriod().getStart()), true,
|
||||
new GridID(this.parm, this.dataManager
|
||||
.getSpatialDisplayManager()
|
||||
.getSpatialEditorTime()), true,
|
||||
vectorSlice);
|
||||
}
|
||||
|
||||
|
@ -655,8 +664,9 @@ public class GFEResource extends
|
|||
if (dataManager.getParmManager().iscMode() || iscParm) {
|
||||
scalarSlice = new ScalarGridSlice();
|
||||
mask = dataManager.getIscDataAccess().getCompositeGrid(
|
||||
new GridID(this.parm, this.curTime
|
||||
.getValidPeriod().getStart()), true,
|
||||
new GridID(this.parm, this.dataManager
|
||||
.getSpatialDisplayManager()
|
||||
.getSpatialEditorTime()), true,
|
||||
scalarSlice);
|
||||
|
||||
}
|
||||
|
@ -701,8 +711,9 @@ public class GFEResource extends
|
|||
|
||||
if (dataManager.getParmManager().iscMode() || iscParm) {
|
||||
slice = new DiscreteGridSlice();
|
||||
GridID gid = new GridID(parm, this.curTime
|
||||
.getValidPeriod().getStart());
|
||||
GridID gid = new GridID(parm, this.dataManager
|
||||
.getSpatialDisplayManager()
|
||||
.getSpatialEditorTime());
|
||||
mask = dataManager.getIscDataAccess().getCompositeGrid(
|
||||
gid, true, slice);
|
||||
}
|
||||
|
@ -784,8 +795,9 @@ public class GFEResource extends
|
|||
|
||||
if (dataManager.getParmManager().iscMode() || iscParm) {
|
||||
slice = new WeatherGridSlice();
|
||||
GridID gid = new GridID(parm, this.curTime
|
||||
.getValidPeriod().getStart());
|
||||
GridID gid = new GridID(parm, this.dataManager
|
||||
.getSpatialDisplayManager()
|
||||
.getSpatialEditorTime());
|
||||
mask = dataManager.getIscDataAccess().getCompositeGrid(
|
||||
gid, true, slice);
|
||||
}
|
||||
|
|
|
@ -36,8 +36,6 @@ import org.apache.batik.util.ParsedURL;
|
|||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestableMetadataMarshaller;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.time.BinOffset;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
@ -68,9 +66,6 @@ import com.raytheon.viz.pointdata.rsc.retrieve.PointDataPlotInfoRetriever;
|
|||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class PlotResourceData extends AbstractRequestableResourceData {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(PlotResourceData.class);
|
||||
|
||||
public static final String PLOT_DIR = "plotModels" + File.separator;
|
||||
|
||||
@XmlAttribute
|
||||
|
@ -412,4 +407,15 @@ public class PlotResourceData extends AbstractRequestableResourceData {
|
|||
public void setPixelSampleDistance(int pixelSampleDistance) {
|
||||
this.pixelSampleDistance = pixelSampleDistance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUpdatingOnMetadataOnly() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRetrieveData() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,10 @@
|
|||
<vmArgs>-Xincgc -Dosgi.instance.area.readOnly=true
|
||||
-Dosgi.hook.configurators.exclude=org.eclipse.core.runtime.internal.adaptor.EclipseLogHook,org.eclipse.core.runtime.internal.adaptor.EclipseErrorHandler
|
||||
-XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -Dorg.eclipse.update.reconcile=false -XX:MaxPermSize=128m -Dorg.eclipse.ui/KEY_CONFIGURATION_ID=com.raytheon.viz.ui.awips.scheme -Dawips.mode=pypies -Dqpid.dest_syntax=BURL -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -XX:OnOutOfMemoryError="capture -t no -p $pid &" -Dlog4j.configuration=log4j-viz-core.xml</vmArgs>
|
||||
<<<<<<< HEAD
|
||||
<vmArgsLin>-Xmx1280M</vmArgsLin>
|
||||
=======
|
||||
>>>>>>> master_13.3.1
|
||||
<vmArgsWin>-Dfile.encoding=UTF-8 -Xmx768M</vmArgsWin>
|
||||
</launcherArgs>
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 8, 2013 mschenke Initial creation
|
||||
* Feb 25, 2013 1640 bsteffen Dispose old display in BundleLoader
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -296,7 +297,11 @@ public class BundleLoader extends Job {
|
|||
VizApp.runSync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
IRenderableDisplay oldDisplay = loadTo.getRenderableDisplay();
|
||||
loadTo.setRenderableDisplay(loadFrom);
|
||||
if (oldDisplay != null && oldDisplay != loadFrom) {
|
||||
oldDisplay.dispose();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
23
deltaScripts/13.2.1/fixParameterUnits.sh
Normal file
23
deltaScripts/13.2.1/fixParameterUnits.sh
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
SQL_SCRIPT="fixParameterUnits.sql"
|
||||
|
||||
# ensure that the sql script is present
|
||||
if [ ! -f ${SQL_SCRIPT} ]; then
|
||||
echo "ERROR: the required sql script - ${SQL_SCRIPT} was not found."
|
||||
echo "FATAL: the update has failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "INFO: update started - fix parameter units degree definitions"
|
||||
|
||||
# run the update
|
||||
/awips2/psql/bin/psql -U awips -d metadata -f ${SQL_SCRIPT}
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "FATAL: the update has failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "INFO: the update has completed successfully!"
|
||||
|
||||
exit 0
|
30
deltaScripts/13.2.1/fixParameterUnits.sql
Normal file
30
deltaScripts/13.2.1/fixParameterUnits.sql
Normal file
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
* 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.
|
||||
**/
|
||||
\set ON_ERROR_STOP 1
|
||||
\connect metadata;
|
||||
|
||||
-- Start a transaction
|
||||
BEGIN;
|
||||
|
||||
-- update 'Degree true' and 'deg true' to 'deg'
|
||||
update metadata.parameter set unit = 'deg' where unit like 'Deg%true' or unit like 'deg%true';
|
||||
|
||||
-- Commit the transaction
|
||||
END;
|
|
@ -606,8 +606,8 @@ HRAP = ('HRAP', POLAR_STEREOGRAPHIC,
|
|||
(0.0, 0.0), 0.0, 0.0, (1, 1), (801, 881), 0.0, 0.0, -105.0)
|
||||
|
||||
NDFD_Oceanic_10K = ('NDFD_Oceanic_10km', MERCATOR,
|
||||
(-230.094, -30.4192), (10.71, 67.03),
|
||||
(0.0, 0.0), 0.0, 0.0, (1, 1), (2517, 1289), 0.0, -109.962, 0.0)
|
||||
(-230.094, -30.4192), (10.71, 80.01),
|
||||
(0.0, 0.0), 0.0, 0.0, (1, 1), (2517, 1793), 0.0, -109.962, 0.0)
|
||||
|
||||
# list of all projections
|
||||
allProjections = [Grid201, Grid202, Grid203, Grid204, Grid205, Grid206,
|
||||
|
|
|
@ -70,6 +70,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 13, 2011 #8393 dgilling Initial creation
|
||||
* 02/19/13 #1637 randerso Added exception handling for Discrete and Weather
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -689,47 +690,43 @@ public class ASCIIGrid {
|
|||
RemapGrid remap = new RemapGrid(sourceDomain, outputDomain);
|
||||
|
||||
// some data overlaps and remapping is possible
|
||||
switch (gs.getGridInfo().getGridType()) {
|
||||
case SCALAR:
|
||||
ScalarGridSlice scalar = (ScalarGridSlice) gs;
|
||||
try {
|
||||
try {
|
||||
switch (gs.getGridInfo().getGridType()) {
|
||||
case SCALAR:
|
||||
ScalarGridSlice scalar = (ScalarGridSlice) gs;
|
||||
scalar.setScalarGrid(remap.remap(scalar.getScalarGrid(),
|
||||
-99999.99f, maxLimit, minLimit, minLimit));
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to remap scalar ASCIIGrid", e);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case VECTOR:
|
||||
VectorGridSlice vector = (VectorGridSlice) gs;
|
||||
Grid2DFloat mag = new Grid2DFloat(outputDomain.getNx(),
|
||||
outputDomain.getNy());
|
||||
Grid2DFloat dir = new Grid2DFloat(outputDomain.getNx(),
|
||||
outputDomain.getNy());
|
||||
try {
|
||||
break;
|
||||
case VECTOR:
|
||||
VectorGridSlice vector = (VectorGridSlice) gs;
|
||||
Grid2DFloat mag = new Grid2DFloat(outputDomain.getNx(),
|
||||
outputDomain.getNy());
|
||||
Grid2DFloat dir = new Grid2DFloat(outputDomain.getNx(),
|
||||
outputDomain.getNy());
|
||||
remap.remap(vector.getMagGrid(), vector.getDirGrid(),
|
||||
-99999.99f, maxLimit, minLimit, minLimit, mag, dir);
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to remap vector ASCIIGrid", e);
|
||||
return false;
|
||||
vector.setMagGrid(mag);
|
||||
vector.setDirGrid(dir);
|
||||
break;
|
||||
case WEATHER:
|
||||
WeatherGridSlice weather = (WeatherGridSlice) gs;
|
||||
weather.setWeatherGrid(remap.remap(weather.getWeatherGrid(),
|
||||
255, 0));
|
||||
break;
|
||||
case DISCRETE:
|
||||
DiscreteGridSlice discrete = (DiscreteGridSlice) gs;
|
||||
discrete.setDiscreteGrid(remap.remap(
|
||||
discrete.getDiscreteGrid(), 255, 0));
|
||||
break;
|
||||
default:
|
||||
statusHandler.handle(Priority.WARN,
|
||||
"Illegal data type detected.");
|
||||
break;
|
||||
}
|
||||
vector.setMagGrid(mag);
|
||||
vector.setDirGrid(dir);
|
||||
break;
|
||||
case WEATHER:
|
||||
WeatherGridSlice weather = (WeatherGridSlice) gs;
|
||||
weather.setWeatherGrid(remap.remap(weather.getWeatherGrid(), 255, 0));
|
||||
break;
|
||||
case DISCRETE:
|
||||
DiscreteGridSlice discrete = (DiscreteGridSlice) gs;
|
||||
discrete.setDiscreteGrid(remap.remap(discrete.getDiscreteGrid(),
|
||||
255, 0));
|
||||
break;
|
||||
default:
|
||||
statusHandler.handle(Priority.WARN, "Illegal data type detected.");
|
||||
break;
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Unable to remap ASCIIGrid",
|
||||
e);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -28,7 +28,6 @@ from datetime import datetime
|
|||
from time import gmtime,strftime
|
||||
from java.io import File
|
||||
from com.raytheon.uf.common.time import TimeRange
|
||||
from com.raytheon.uf.common.dataplugin.gfe import RemapGrid
|
||||
from com.raytheon.uf.common.dataplugin.gfe.db.objects import GridLocation
|
||||
from com.raytheon.uf.common.dataplugin.gfe.reference import ReferenceData_CoordinateType as CoordinateType
|
||||
from com.raytheon.edex.plugin.gfe.config import IFPServerConfig
|
||||
|
@ -48,6 +47,7 @@ from com.raytheon.uf.common.localization import LocalizationContext_Localization
|
|||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 07/06/09 1995 bphillip Initial Creation.
|
||||
# 02/19/13 1637 randerso Removed unused import
|
||||
#
|
||||
#
|
||||
#
|
||||
|
|
|
@ -1,165 +1,162 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gridParamInfo xmlns:ns2="group">
|
||||
<valtimeMINUSreftime>
|
||||
<fcst>302400</fcst>
|
||||
<fcst>324000</fcst>
|
||||
<fcst>345600</fcst>
|
||||
<fcst>367200</fcst>
|
||||
<fcst>388800</fcst>
|
||||
<fcst>410400</fcst>
|
||||
<fcst>432000</fcst>
|
||||
<fcst>453600</fcst>
|
||||
<fcst>475200</fcst>
|
||||
<fcst>496800</fcst>
|
||||
<fcst>518400</fcst>
|
||||
<fcst>540000</fcst>
|
||||
<fcst>561600</fcst>
|
||||
<fcst>583200</fcst>
|
||||
<fcst>604800</fcst>
|
||||
<fcst>626400</fcst>
|
||||
<fcst>648000</fcst>
|
||||
</valtimeMINUSreftime>
|
||||
<gridParameterInfo xsi:type="parameterInfo"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<short_name>mxt</short_name>
|
||||
<long_name>Maximum Temperature</long_name>
|
||||
<units>K</units>
|
||||
<udunits>degree_Kelvin</udunits>
|
||||
<uiname>maxT</uiname>
|
||||
<valid_range>180.0</valid_range>
|
||||
<valid_range>330.0</valid_range>
|
||||
<fillValue>-99999.0</fillValue>
|
||||
<n3D>1</n3D>
|
||||
<levels>FHAG 2</levels>
|
||||
</gridParameterInfo>
|
||||
<gridParameterInfo xsi:type="parameterInfo"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<short_name>staticSpacing</short_name>
|
||||
<long_name>Grid spacing</long_name>
|
||||
<units>m</units>
|
||||
<fillValue>-99999.0</fillValue>
|
||||
<n3D>0</n3D>
|
||||
</gridParameterInfo>
|
||||
<gridParameterInfo xsi:type="parameterInfo"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<short_name>mnt</short_name>
|
||||
<long_name>Minimum Temperature</long_name>
|
||||
<units>K</units>
|
||||
<udunits>degree_Kelvin</udunits>
|
||||
<uiname>minT</uiname>
|
||||
<valid_range>180.0</valid_range>
|
||||
<valid_range>330.0</valid_range>
|
||||
<fillValue>-99999.0</fillValue>
|
||||
<n3D>1</n3D>
|
||||
<levels>FHAG 2</levels>
|
||||
</gridParameterInfo>
|
||||
<gridParameterInfo xsi:type="parameterInfo"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<short_name>pop</short_name>
|
||||
<long_name>Probability of precip Delta</long_name>
|
||||
<units>%</units>
|
||||
<udunits>percent</udunits>
|
||||
<uiname>PcpProb</uiname>
|
||||
<valid_range>0.0</valid_range>
|
||||
<valid_range>100.0</valid_range>
|
||||
<fillValue>-99999.0</fillValue>
|
||||
<n3D>0</n3D>
|
||||
<levels>SFC</levels>
|
||||
</gridParameterInfo>
|
||||
<gridParameterInfo xsi:type="parameterInfo"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<short_name>staticTopo</short_name>
|
||||
<long_name>Topography</long_name>
|
||||
<units>m</units>
|
||||
<fillValue>-99999.0</fillValue>
|
||||
<n3D>0</n3D>
|
||||
</gridParameterInfo>
|
||||
<gridParameterInfo xsi:type="parameterInfo"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<short_name>ws</short_name>
|
||||
<long_name>Wind Speed</long_name>
|
||||
<units>m/s</units>
|
||||
<udunits>meter/sec</udunits>
|
||||
<uiname>windSpeed</uiname>
|
||||
<valid_range>-150.0</valid_range>
|
||||
<valid_range>150.0</valid_range>
|
||||
<fillValue>-99999.0</fillValue>
|
||||
<n3D>1</n3D>
|
||||
<levels>FHAG 10</levels>
|
||||
</gridParameterInfo>
|
||||
<gridParameterInfo xsi:type="parameterInfo"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<short_name>tcc</short_name>
|
||||
<long_name>Total Cloud Cover</long_name>
|
||||
<units>%</units>
|
||||
<udunits>percent</udunits>
|
||||
<uiname>totalCldCvr</uiname>
|
||||
<valid_range>0.0</valid_range>
|
||||
<valid_range>100.0</valid_range>
|
||||
<fillValue>-99999.0</fillValue>
|
||||
<n3D>0</n3D>
|
||||
<levels>EA</levels>
|
||||
</gridParameterInfo>
|
||||
<gridParameterInfo xsi:type="parameterInfo"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<short_name>dpt</short_name>
|
||||
<long_name>Dewpoint Temperature</long_name>
|
||||
<units>K</units>
|
||||
<udunits>degree_Kelvin</udunits>
|
||||
<uiname>Td</uiname>
|
||||
<valid_range>180.0</valid_range>
|
||||
<valid_range>330.0</valid_range>
|
||||
<fillValue>-99999.0</fillValue>
|
||||
<n3D>1</n3D>
|
||||
<levels>FHAG 2</levels>
|
||||
</gridParameterInfo>
|
||||
<gridParameterInfo xsi:type="parameterInfo"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<short_name>wx</short_name>
|
||||
<long_name>Weather</long_name>
|
||||
<units></units>
|
||||
<udunits></udunits>
|
||||
<uiname>Weather</uiname>
|
||||
<valid_range>0.0</valid_range>
|
||||
<valid_range>10.0</valid_range>
|
||||
<fillValue>-99999.0</fillValue>
|
||||
<n3D>0</n3D>
|
||||
<levels>SFC</levels>
|
||||
</gridParameterInfo>
|
||||
<gridParameterInfo xsi:type="parameterInfo"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<short_name>reftime</short_name>
|
||||
<long_name>reference time</long_name>
|
||||
<units>seconds since (1970-1-1 00:00:00.0)</units>
|
||||
<fillValue>0.0</fillValue>
|
||||
<n3D>0</n3D>
|
||||
</gridParameterInfo>
|
||||
<gridParameterInfo xsi:type="parameterInfo"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<short_name>staticCoriolis</short_name>
|
||||
<long_name>Coriolis parameter</long_name>
|
||||
<units>s^-1</units>
|
||||
<fillValue>-99999.0</fillValue>
|
||||
<n3D>0</n3D>
|
||||
</gridParameterInfo>
|
||||
<gridParameterInfo xsi:type="parameterInfo"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<short_name>valtimeMINUSreftime</short_name>
|
||||
<units>seconds</units>
|
||||
<fillValue>0.0</fillValue>
|
||||
<n3D>0</n3D>
|
||||
</gridParameterInfo>
|
||||
<gridParameterInfo xsi:type="parameterInfo"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<short_name>wd</short_name>
|
||||
<long_name>Wind Direction</long_name>
|
||||
<units>degreeTrue</units>
|
||||
<udunits>degree_True</udunits>
|
||||
<uiname>windDir</uiname>
|
||||
<valid_range>0.0</valid_range>
|
||||
<valid_range>360.0</valid_range>
|
||||
<fillValue>-99999.0</fillValue>
|
||||
<n3D>1</n3D>
|
||||
<levels>FHAG 10</levels>
|
||||
</gridParameterInfo>
|
||||
<valtimeMINUSreftime>
|
||||
<fcst>302400</fcst>
|
||||
<fcst>324000</fcst>
|
||||
<fcst>345600</fcst>
|
||||
<fcst>367200</fcst>
|
||||
<fcst>388800</fcst>
|
||||
<fcst>410400</fcst>
|
||||
<fcst>432000</fcst>
|
||||
<fcst>453600</fcst>
|
||||
<fcst>475200</fcst>
|
||||
<fcst>496800</fcst>
|
||||
<fcst>518400</fcst>
|
||||
<fcst>540000</fcst>
|
||||
<fcst>561600</fcst>
|
||||
<fcst>583200</fcst>
|
||||
<fcst>604800</fcst>
|
||||
<fcst>626400</fcst>
|
||||
<fcst>648000</fcst>
|
||||
<fcst>669600</fcst>
|
||||
<fcst>691200</fcst>
|
||||
</valtimeMINUSreftime>
|
||||
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
|
||||
<short_name>mnt</short_name>
|
||||
<long_name>Minimum Temperature</long_name>
|
||||
<units>K</units>
|
||||
<udunits>degree_Kelvin</udunits>
|
||||
<uiname>minT</uiname>
|
||||
<valid_range>180.0</valid_range>
|
||||
<valid_range>330.0</valid_range>
|
||||
<fillValue>-99999.0</fillValue>
|
||||
<n3D>1</n3D>
|
||||
<levelsDesc>FHAG 2</levelsDesc>
|
||||
<levels>
|
||||
<level>FHAG2</level>
|
||||
</levels>
|
||||
</gridParameterInfo>
|
||||
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
|
||||
<short_name>pop</short_name>
|
||||
<long_name>Probability of precip Delta</long_name>
|
||||
<units>%</units>
|
||||
<udunits>percent</udunits>
|
||||
<uiname>PcpProb</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>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>tcc</short_name>
|
||||
<long_name>Total Cloud Cover</long_name>
|
||||
<units>%</units>
|
||||
<udunits>percent</udunits>
|
||||
<uiname>totalCldCvr</uiname>
|
||||
<valid_range>0.0</valid_range>
|
||||
<valid_range>100.0</valid_range>
|
||||
<fillValue>-99999.0</fillValue>
|
||||
<n3D>0</n3D>
|
||||
<levelsDesc>EA</levelsDesc>
|
||||
<levels>
|
||||
<level>EA</level>
|
||||
</levels>
|
||||
</gridParameterInfo>
|
||||
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
|
||||
<short_name>wd</short_name>
|
||||
<long_name>Wind Direction</long_name>
|
||||
<units>degreeTrue</units>
|
||||
<udunits>degree_True</udunits>
|
||||
<uiname>windDir</uiname>
|
||||
<valid_range>0.0</valid_range>
|
||||
<valid_range>360.0</valid_range>
|
||||
<fillValue>-99999.0</fillValue>
|
||||
<n3D>1</n3D>
|
||||
<levelsDesc>FHAG 10</levelsDesc>
|
||||
<levels>
|
||||
<level>FHAG10</level>
|
||||
</levels>
|
||||
</gridParameterInfo>
|
||||
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
|
||||
<short_name>mxt</short_name>
|
||||
<long_name>Maximum Temperature</long_name>
|
||||
<units>K</units>
|
||||
<udunits>degree_Kelvin</udunits>
|
||||
<uiname>maxT</uiname>
|
||||
<valid_range>180.0</valid_range>
|
||||
<valid_range>330.0</valid_range>
|
||||
<fillValue>-99999.0</fillValue>
|
||||
<n3D>1</n3D>
|
||||
<levelsDesc>FHAG 2</levelsDesc>
|
||||
<levels>
|
||||
<level>FHAG2</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>/second</units>
|
||||
<fillValue>-99999.0</fillValue>
|
||||
</gridParameterInfo>
|
||||
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
|
||||
<short_name>ws</short_name>
|
||||
<long_name>Wind Speed</long_name>
|
||||
<units>m/s</units>
|
||||
<udunits>meter/sec</udunits>
|
||||
<uiname>windSpeed</uiname>
|
||||
<valid_range>-150.0</valid_range>
|
||||
<valid_range>150.0</valid_range>
|
||||
<fillValue>-99999.0</fillValue>
|
||||
<n3D>1</n3D>
|
||||
<levelsDesc>FHAG 10</levelsDesc>
|
||||
<levels>
|
||||
<level>FHAG10</level>
|
||||
</levels>
|
||||
</gridParameterInfo>
|
||||
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
|
||||
<short_name>wxType</short_name>
|
||||
<long_name>Weather</long_name>
|
||||
<units/>
|
||||
<udunits/>
|
||||
<uiname>Weather</uiname>
|
||||
<valid_range>0.0</valid_range>
|
||||
<valid_range>12.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>dpt</short_name>
|
||||
<long_name>Dewpoint Temperature</long_name>
|
||||
<units>K</units>
|
||||
<udunits>degree_Kelvin</udunits>
|
||||
<uiname>Td</uiname>
|
||||
<valid_range>180.0</valid_range>
|
||||
<valid_range>330.0</valid_range>
|
||||
<fillValue>-99999.0</fillValue>
|
||||
<n3D>1</n3D>
|
||||
<levelsDesc>FHAG 2</levelsDesc>
|
||||
<levels>
|
||||
<level>FHAG2</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>
|
||||
</gridParamInfo>
|
|
@ -72,6 +72,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 4/7/09 1994 bphillip Initial Creation
|
||||
* Mar 07, 2013 1771 bsteffen make subgridding deterministic.
|
||||
*
|
||||
* 1/4/13 DR 15653 M.Porricelli Shift subgrid domain
|
||||
* westward like AWIPSI
|
||||
|
@ -309,11 +310,14 @@ public class GribSpatialCache {
|
|||
double shiftX = 0;
|
||||
|
||||
// Check whether 'shiftWest' flag is set in subgrid definition xml file
|
||||
if (subGridDef.getShiftWest() != null)
|
||||
shiftSubGridWest = subGridDef.getShiftWest();
|
||||
boolean shiftThisSubGridWest = this.shiftSubGridWest;
|
||||
if (subGridDef.getShiftWest() != null) {
|
||||
shiftThisSubGridWest = subGridDef.getShiftWest();
|
||||
}
|
||||
|
||||
if (shiftSubGridWest == true)
|
||||
if (shiftThisSubGridWest == true) {
|
||||
shiftX = subGridDef.getNx() / 5;
|
||||
}
|
||||
|
||||
double xCenterPoint = subGridCenterGridCoord.x - shiftX;
|
||||
double yCenterPoint = subGridCenterGridCoord.y;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
res/
|
||||
.
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:amq="http://activemq.apache.org/schema/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd
|
||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
|
||||
http://www.springframework.org/schema/util
|
||||
http://www.springframework.org/schema/util/spring-util-2.5.xsd">
|
||||
|
||||
<util:constant id="requestServerKey"
|
||||
static-field="com.raytheon.uf.common.auth.RequestConstants.REQUEST_SERVER" />
|
||||
|
||||
</beans>
|
|
@ -34,11 +34,8 @@ import javax.media.jai.PlanarImage;
|
|||
import org.geotools.coverage.grid.GridCoverage2D;
|
||||
import org.geotools.coverage.grid.GridCoverageFactory;
|
||||
import org.geotools.coverage.grid.GridGeometry2D;
|
||||
import org.geotools.geometry.DirectPosition2D;
|
||||
import org.opengis.geometry.DirectPosition;
|
||||
import org.opengis.geometry.Envelope;
|
||||
import org.opengis.referencing.FactoryException;
|
||||
import org.opengis.referencing.operation.MathTransform;
|
||||
import org.opengis.referencing.operation.TransformException;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation;
|
||||
|
@ -48,11 +45,10 @@ import com.raytheon.uf.common.dataplugin.gfe.grid.Grid2DFloat;
|
|||
import com.raytheon.uf.common.geospatial.MapUtil;
|
||||
import com.raytheon.uf.common.geospatial.interpolation.BilinearInterpolation;
|
||||
import com.raytheon.uf.common.geospatial.interpolation.GridReprojection;
|
||||
import com.raytheon.uf.common.geospatial.interpolation.NearestNeighborInterpolation;
|
||||
import com.raytheon.uf.common.geospatial.interpolation.data.ByteBufferWrapper;
|
||||
import com.raytheon.uf.common.geospatial.interpolation.data.DataSource;
|
||||
import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
/**
|
||||
|
@ -66,6 +62,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 5/16/08 875 bphillip Initial Creation.
|
||||
* 10/10/12 #1260 randerso Added getters for source and destination glocs
|
||||
* 02/19/13 #1637 randerso Fixed remapping of byte grids
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -73,9 +70,6 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class RemapGrid {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(RemapGrid.class);
|
||||
|
||||
/** The input grid location describing the source data */
|
||||
private GridLocation sourceGloc;
|
||||
|
||||
|
@ -95,12 +89,23 @@ public class RemapGrid {
|
|||
* The source grid location describing the source data
|
||||
* @param destinationGloc
|
||||
* The destination grid location describing the destination data
|
||||
* @throws FactoryException
|
||||
*/
|
||||
public RemapGrid(GridLocation sourceGloc, GridLocation destinationGloc) {
|
||||
this.sourceGloc = sourceGloc;
|
||||
this.destinationGloc = destinationGloc;
|
||||
this(sourceGloc, destinationGloc, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new RemapGrid with the given input and output grid locations
|
||||
*
|
||||
* @param sourceGloc
|
||||
* The source grid location describing the source data
|
||||
* @param destinationGloc
|
||||
* The destination grid location describing the destination data
|
||||
* @param rescale
|
||||
* true if data is to be rescaled
|
||||
* @throws FactoryException
|
||||
*/
|
||||
public RemapGrid(GridLocation sourceGloc, GridLocation destinationGloc,
|
||||
boolean rescale) {
|
||||
this.sourceGloc = sourceGloc;
|
||||
|
@ -160,12 +165,14 @@ public class RemapGrid {
|
|||
* @param outputFill
|
||||
* The output fill value
|
||||
* @return The remapped Grid2DByte object
|
||||
* @throws TransformException
|
||||
* @throws FactoryException
|
||||
* @throws IllegalArgumentException
|
||||
* If the input dimensions do not match the source dimensions or
|
||||
* when problems occur during resampling
|
||||
*/
|
||||
public Grid2DByte remap(final Grid2DByte input, byte inputFill,
|
||||
byte outputFill) {
|
||||
byte outputFill) throws FactoryException, TransformException {
|
||||
|
||||
Grid2DByte retVal = null;
|
||||
|
||||
|
@ -198,7 +205,7 @@ public class RemapGrid {
|
|||
}
|
||||
|
||||
public Grid2DByte remap(final Grid2DByte input, int inputFill,
|
||||
int outputFill) {
|
||||
int outputFill) throws FactoryException, TransformException {
|
||||
return remap(input, (byte) inputFill, (byte) outputFill);
|
||||
}
|
||||
|
||||
|
@ -436,64 +443,40 @@ public class RemapGrid {
|
|||
|
||||
/**
|
||||
* Resamples the data from the input grid location to the destination grid
|
||||
* location.
|
||||
* location
|
||||
*
|
||||
* @param input
|
||||
* The input data
|
||||
* @return The resampled data
|
||||
* @throws TransformException
|
||||
* @throws FactoryException
|
||||
*/
|
||||
private Grid2DByte resample(final Grid2DByte input) {
|
||||
private Grid2DByte resample(final Grid2DByte input)
|
||||
throws FactoryException, TransformException {
|
||||
|
||||
if (input.getXdim() != sourceGloc.getNx()
|
||||
|| input.getYdim() != sourceGloc.getNy()) {
|
||||
statusHandler
|
||||
.handle(Priority.PROBLEM,
|
||||
"Cannot resample data. Input data dimensions do not match the input grid location");
|
||||
return input;
|
||||
}
|
||||
GridGeometry2D sourceGeometry = MapUtil.getGridGeometry(sourceGloc);
|
||||
|
||||
int dx = destinationGloc.getNx();
|
||||
int dy = destinationGloc.getNy();
|
||||
Grid2DByte data = new Grid2DByte(dx, dy);
|
||||
ByteBuffer data = input.getBuffer();
|
||||
ByteBuffer resampledData = null;
|
||||
|
||||
Coordinate srcCoord = null;
|
||||
int roundedX = 0;
|
||||
int roundedY = 0;
|
||||
try {
|
||||
for (int x = 0; x < dx; x++) {
|
||||
for (int y = 0; y < dy; y++) {
|
||||
srcCoord = getSourceCoord(x, y);
|
||||
roundedX = (int) Math.round(srcCoord.x);
|
||||
roundedY = (int) Math.round(srcCoord.y);
|
||||
if (roundedX < 0 || roundedY < 0
|
||||
|| roundedX >= input.getXdim()
|
||||
|| roundedY >= input.getYdim()) {
|
||||
data.set(x, y, 0);
|
||||
} else {
|
||||
data.set(x, y, input.get(roundedX, roundedY));
|
||||
}
|
||||
|
||||
}
|
||||
GridGeometry2D destGeometry = MapUtil.getGridGeometry(destinationGloc);
|
||||
synchronized (this) {
|
||||
if (interp == null) {
|
||||
interp = new GridReprojection(sourceGeometry, destGeometry);
|
||||
interp.computeTransformTable();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error resampling byte data!", e);
|
||||
}
|
||||
DataSource source = new ByteBufferWrapper(data, sourceGeometry);
|
||||
resampledData = interp.reprojectedGrid(
|
||||
new NearestNeighborInterpolation(), source,
|
||||
new ByteBufferWrapper(destGeometry)).getBuffer();
|
||||
|
||||
return data;
|
||||
}
|
||||
// Remap the the output data into a Grid2DFloat object
|
||||
|
||||
private Coordinate getSourceCoord(int x, int y) throws Exception {
|
||||
GridGeometry2D destGeom = MapUtil.getGridGeometry(destinationGloc);
|
||||
GridGeometry2D srcGeom = MapUtil.getGridGeometry(sourceGloc);
|
||||
Grid2DByte retVal = new Grid2DByte(destinationGloc.getNx(),
|
||||
destinationGloc.getNy(), resampledData);
|
||||
|
||||
MathTransform destToCRS = destGeom.getGridToCRS();
|
||||
MathTransform srcGridFromCRS = srcGeom.getCRSToGrid2D();
|
||||
|
||||
DirectPosition destLatLon = destToCRS.transform(new DirectPosition2D(x,
|
||||
y), null);
|
||||
DirectPosition srcCoord = srcGridFromCRS.transform(destLatLon, null);
|
||||
return new Coordinate(srcCoord.getOrdinate(0), srcCoord.getOrdinate(1));
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -550,6 +533,8 @@ public class RemapGrid {
|
|||
f1 = rasterData.getPixels(rasterData.getMinX(),
|
||||
rasterData.getMinY(), rasterData.getWidth(),
|
||||
rasterData.getHeight(), f1);
|
||||
|
||||
JAI.getDefaultInstance().getTileCache().flush();
|
||||
} else {
|
||||
GridGeometry2D destGeometry = MapUtil
|
||||
.getGridGeometry(destinationGloc);
|
||||
|
@ -569,8 +554,6 @@ public class RemapGrid {
|
|||
Grid2DFloat retVal = new Grid2DFloat(destinationGloc.getNx(),
|
||||
destinationGloc.getNy(), f1);
|
||||
|
||||
JAI.getDefaultInstance().getTileCache().flush();
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,28 @@ import com.raytheon.uf.common.monitor.xml.SCANSiteRunConfigXML;
|
|||
import com.raytheon.uf.common.monitor.xml.SCANSiteXML;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
||||
/**
|
||||
* ScanRunSiteConfigurationManager
|
||||
*
|
||||
* Holds the SCAN configuration
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 02/07/2009 2037 dhladky Initial Creation.
|
||||
* 02/25/13 1660 D. Hladky Fixed configuration bug in scan.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
|
||||
public class SCANRunSiteConfigurationManager implements
|
||||
ILocalizationFileObserver {
|
||||
|
@ -27,6 +49,9 @@ public class SCANRunSiteConfigurationManager implements
|
|||
/** Path to FFMP Source config. */
|
||||
private static final String CONFIG_FILE_NAME = "scan" + File.separatorChar
|
||||
+ "SCANRunSiteConfig.xml";
|
||||
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(SCANRunSiteConfigurationManager.class);
|
||||
|
||||
/**
|
||||
* SCAN Configuration XML object.
|
||||
|
@ -49,7 +74,7 @@ public class SCANRunSiteConfigurationManager implements
|
|||
try {
|
||||
readConfigXml();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.ERROR, "Can not read the SCAN configuration", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -77,21 +102,19 @@ public class SCANRunSiteConfigurationManager implements
|
|||
File file = lf.getFile();
|
||||
// System.out.println("Reading -- " + file.getAbsolutePath());
|
||||
if (!file.exists()) {
|
||||
System.out
|
||||
.println("WARNING [SCAN] SCANRunSiteConfigurationManager: "
|
||||
statusHandler.handle(Priority.WARN, "SCANRunSiteConfigurationManager: "
|
||||
+ file.getAbsolutePath() + " does not exist.");
|
||||
try {
|
||||
createValidConfig();
|
||||
} catch (Exception e) {
|
||||
System.out
|
||||
.println("FATAL [SCAN] SCANRunSiteConfigurationManager: Couldn't create valid runnable configuration");
|
||||
statusHandler.handle(Priority.ERROR,"SCANRunSiteConfigurationManager: Couldn't create valid runnable configuration");
|
||||
}
|
||||
}
|
||||
|
||||
SCANSiteRunConfigXML configXmltmp = null;
|
||||
|
||||
configXmltmp = (SCANSiteRunConfigXML) SerializationUtil
|
||||
.jaxbUnmarshalFromXmlFile(file.getAbsolutePath());
|
||||
configXmltmp = SerializationUtil
|
||||
.jaxbUnmarshalFromXmlFile(SCANSiteRunConfigXML.class, file.getAbsolutePath());
|
||||
|
||||
configXml = configXmltmp;
|
||||
isPopulated = true;
|
||||
|
@ -135,7 +158,8 @@ public class SCANRunSiteConfigurationManager implements
|
|||
|
||||
lf = newXmlFile;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.WARN, "SCANRunSiteConfigurationManager: "
|
||||
+ newXmlFile.getName() + " couldn't be saved.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -153,7 +177,8 @@ public class SCANRunSiteConfigurationManager implements
|
|||
}
|
||||
}
|
||||
} catch (SerializationException e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.WARN, "SCANRunSiteConfigurationManager: "
|
||||
+ message.getFileName() + " couldn't be updated.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,42 +261,28 @@ public class SCANRunSiteConfigurationManager implements
|
|||
*/
|
||||
List<String> localsites = RadarsInUseUtil.getSite(null,
|
||||
RadarsInUseUtil.LOCAL_CONSTANT);
|
||||
List<String> dialsites = RadarsInUseUtil.getSite(null,
|
||||
RadarsInUseUtil.DIAL_CONSTANT);
|
||||
|
||||
String modelDefault = "RUC130";
|
||||
|
||||
configXml = new SCANSiteRunConfigXML();
|
||||
|
||||
// run over list of available sites
|
||||
int i = 0;
|
||||
for (String site : localsites) {
|
||||
SCANSiteXML siteXML = new SCANSiteXML();
|
||||
siteXML.setScanSite(site);
|
||||
siteXML.setMenuLocation(RadarsInUseUtil.LOCAL_CONSTANT);
|
||||
if (i < 12) { // no more than 12 radars in scan config
|
||||
SCANSiteXML siteXML = new SCANSiteXML();
|
||||
siteXML.setScanSite(site);
|
||||
siteXML.setMenuLocation(RadarsInUseUtil.LOCAL_CONSTANT);
|
||||
|
||||
for (DATA_TYPE param : DATA_TYPE.values()) {
|
||||
SCANModelParameterXML paramXML = new SCANModelParameterXML();
|
||||
paramXML.setParameterName(param.getType());
|
||||
paramXML.setModelName(modelDefault);
|
||||
siteXML.addModelParameter(paramXML);
|
||||
for (DATA_TYPE param : DATA_TYPE.values()) {
|
||||
SCANModelParameterXML paramXML = new SCANModelParameterXML();
|
||||
paramXML.setParameterName(param.getType());
|
||||
paramXML.setModelName(modelDefault);
|
||||
siteXML.addModelParameter(paramXML);
|
||||
}
|
||||
|
||||
configXml.addSite(siteXML);
|
||||
i++;
|
||||
}
|
||||
|
||||
configXml.addSite(siteXML);
|
||||
}
|
||||
|
||||
for (String site : dialsites) {
|
||||
SCANSiteXML siteXML = new SCANSiteXML();
|
||||
siteXML.setScanSite(site);
|
||||
siteXML.setMenuLocation(RadarsInUseUtil.DIAL_CONSTANT);
|
||||
|
||||
for (DATA_TYPE param : DATA_TYPE.values()) {
|
||||
SCANModelParameterXML paramXML = new SCANModelParameterXML();
|
||||
paramXML.setParameterName(param.getType());
|
||||
paramXML.setModelName(modelDefault);
|
||||
siteXML.addModelParameter(paramXML);
|
||||
}
|
||||
|
||||
configXml.addSite(siteXML);
|
||||
}
|
||||
|
||||
saveConfigXml();
|
||||
|
|
|
@ -21,6 +21,7 @@ package com.raytheon.uf.common.serialization.comm;
|
|||
|
||||
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.util.registry.GenericRegistry;
|
||||
import com.raytheon.uf.common.util.registry.RegistryException;
|
||||
|
||||
|
@ -35,6 +36,8 @@ import com.raytheon.uf.common.util.registry.RegistryException;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 9, 2010 rjpeter Initial creation
|
||||
* Nov 15, 2012 1322 djohnson Add ability to route by server key.
|
||||
* Mar 05, 2013 1754 djohnson Prevent infinite loop when request.server router not registered,
|
||||
* info log when router registered.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -62,22 +65,24 @@ public final class RequestRouter {
|
|||
throws RegistryException {
|
||||
if (registry.containsKey(t)) {
|
||||
throw new RegistryException("Unable to register router",
|
||||
new IllegalStateException(
|
||||
"IRequestRouter of type ["
|
||||
+ s.getClass().getName()
|
||||
new IllegalStateException("IRequestRouter of type ["
|
||||
+ s.getClass().getName()
|
||||
+ "] already registered for key [" + t + "]"));
|
||||
}
|
||||
statusHandler.info("Registered request router for key [" + t
|
||||
+ "] of type [" + s.getClass().getName() + "]");
|
||||
return super.register(t, s);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clear the registry. Intentionally package-private so it can be cleared by test code.
|
||||
* Clear the registry. Intentionally package-private so it can be
|
||||
* cleared by test code.
|
||||
*/
|
||||
void clear() {
|
||||
registry.clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
private static final RouterRegistry routerRegistry = new RouterRegistry();
|
||||
|
||||
/**
|
||||
|
@ -119,13 +124,22 @@ public final class RequestRouter {
|
|||
*/
|
||||
public static Object route(IServerRequest request, String service)
|
||||
throws Exception {
|
||||
final IRequestRouter router = routerRegistry.getRegisteredObject(service);
|
||||
final IRequestRouter router = routerRegistry
|
||||
.getRegisteredObject(service);
|
||||
if (router == null) {
|
||||
statusHandler
|
||||
.error("There is no registered router for service ["
|
||||
+ service
|
||||
+ "]. Routing to the request service, but the request may not be able to be processed!");
|
||||
return route(request);
|
||||
if (REQUEST_SERVICE.equals(service)) {
|
||||
final String errorMessage = "There is no registered router for service ["
|
||||
+ service + "]. The request cannot be processed!";
|
||||
statusHandler.handle(Priority.FATAL, errorMessage);
|
||||
|
||||
throw new IllegalStateException(errorMessage);
|
||||
} else {
|
||||
statusHandler
|
||||
.error("There is no registered router for service ["
|
||||
+ service
|
||||
+ "]. Routing to the request service, but the request may not be able to be processed!");
|
||||
return route(request);
|
||||
}
|
||||
} else {
|
||||
return router.route(request);
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ import com.raytheon.uf.edex.dissemination.transmitted.TransmittedProductList;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 13, 2009 njensen Initial creation
|
||||
* 08/20/2012 DR 15340 D. Friedman Fix BBB problems
|
||||
* 03/08/2013 15564 mgamazaychikov Trimmed extra spaces in afosId
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -71,7 +72,7 @@ public class ModifyProduct {
|
|||
List<AfosToAwips> list = dao.lookupAfosId(ttaaii, cccc).getIdList();
|
||||
String productId = null;
|
||||
for (AfosToAwips ata : list) {
|
||||
String afosId = ata.getAfosid();
|
||||
String afosId = ata.getAfosid().trim();
|
||||
String awipsId = afosId.substring(3);
|
||||
if (awipsId.equals(productAwipsId)) {
|
||||
productId = afosId;
|
||||
|
|
|
@ -25,32 +25,31 @@ import java.util.Calendar;
|
|||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.TimeZone;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import javax.measure.unit.SI;
|
||||
|
||||
import com.raytheon.edex.msg.DataURINotificationMessage;
|
||||
import com.raytheon.edex.plugin.gfe.paraminfo.GridParamInfoLookup;
|
||||
import com.raytheon.edex.plugin.gfe.paraminfo.ParameterInfo;
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||
import com.raytheon.uf.common.dataplugin.grid.util.StaticGridData;
|
||||
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
||||
import com.raytheon.uf.common.datastorage.IDataStore;
|
||||
import com.raytheon.uf.common.datastorage.IDataStore.StoreOp;
|
||||
import com.raytheon.uf.common.datastorage.StorageException;
|
||||
import com.raytheon.uf.common.datastorage.StorageStatus;
|
||||
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
|
||||
import com.raytheon.uf.common.gridcoverage.GridCoverage;
|
||||
import com.raytheon.uf.common.parameter.Parameter;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.edex.core.EdexException;
|
||||
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
||||
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils;
|
||||
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils.LockState;
|
||||
|
@ -70,6 +69,7 @@ import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 3, 2010 rjpeter Initial creation
|
||||
* Mar 07, 2013 1587 bsteffen rewrite static data generation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -90,14 +90,35 @@ public class StaticDataGenerator {
|
|||
|
||||
private static final String STATIC_SPACING = "staticSpacing";
|
||||
|
||||
private static final String STATIC_X_SPACING = "staticXspacing";
|
||||
|
||||
private static final String STATIC_Y_SPACING = "staticYspacing";
|
||||
|
||||
private static final String STATIC_CORIOLIS = "staticCoriolis";
|
||||
|
||||
private static final String[] STATIC_PARAMETERS = { STATIC_TOPO,
|
||||
STATIC_SPACING, STATIC_X_SPACING, STATIC_Y_SPACING, STATIC_CORIOLIS };
|
||||
|
||||
private static int CACHE_SIZE = 1000;
|
||||
|
||||
/**
|
||||
* Cache of modelName, refTime, Forecast that keeps track of whether static
|
||||
* topo needs to be regen'd for that forecast time.
|
||||
* Cache of modelName, refTime, Forecast, location that keeps track of
|
||||
* whether static data has been created to avoid too many trips to db to
|
||||
* check.
|
||||
*/
|
||||
private ConcurrentMap<String, ConcurrentMap<Date, ConcurrentMap<Integer, String>>> staticTopoTimeCache = new ConcurrentHashMap<String, ConcurrentMap<Date, ConcurrentMap<Integer, String>>>(
|
||||
125);
|
||||
private Map<CacheKey, CacheKey> dataGeneratedCache = Collections
|
||||
.synchronizedMap(new LinkedHashMap<CacheKey, CacheKey>(
|
||||
(int) (CACHE_SIZE / 0.75f) + 1, 0.75f, true) {
|
||||
|
||||
private static final long serialVersionUID = 5068414717181919964L;
|
||||
|
||||
@Override
|
||||
protected boolean removeEldestEntry(
|
||||
Entry<CacheKey, CacheKey> eldest) {
|
||||
return size() > CACHE_SIZE;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
private static StaticDataGenerator instance = new StaticDataGenerator();
|
||||
|
||||
|
@ -109,183 +130,87 @@ public class StaticDataGenerator {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is the beginning of static data generation, it takes
|
||||
* notification messages and creates the appropriate static records.
|
||||
*/
|
||||
public GridRecord[] processNotification(DataURINotificationMessage msg)
|
||||
throws Exception {
|
||||
List<GridRecord> stopoRecords = new ArrayList<GridRecord>();
|
||||
Set<GridRecord> staticRecords = new HashSet<GridRecord>();
|
||||
for (String dataURI : msg.getDataURIs()) {
|
||||
if (dataURI.startsWith("/grid/")) {
|
||||
try {
|
||||
GridRecord record = new GridRecord(dataURI);
|
||||
|
||||
List<GridRecord> staticRecords = createStaticRecords(record);
|
||||
if (staticRecords != null && !staticRecords.isEmpty()) {
|
||||
stopoRecords.addAll(staticRecords);
|
||||
}
|
||||
staticRecords.addAll(processRecord(record));
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"Error creating/saving staticTopo data!", e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return stopoRecords.toArray(new GridRecord[0]);
|
||||
return staticRecords.toArray(new GridRecord[0]);
|
||||
}
|
||||
|
||||
private List<GridRecord> createStaticRecords(GridRecord record)
|
||||
throws Exception {
|
||||
/**
|
||||
* Takes a record, which should have been parsed from a notification and
|
||||
* processes the record to create any needed static records for the same
|
||||
* model and time.
|
||||
*/
|
||||
private Set<GridRecord> processRecord(GridRecord record) throws Exception {
|
||||
String datasetid = record.getDatasetId();
|
||||
GridParamInfoLookup gpif = GridParamInfoLookup.getInstance();
|
||||
ParameterInfo topoParamInfo = gpif.getParameterInfo(datasetid,
|
||||
STATIC_TOPO);
|
||||
ParameterInfo spacingParamInfo = gpif.getParameterInfo(datasetid,
|
||||
STATIC_SPACING);
|
||||
ParameterInfo coriolisParamInfo = gpif.getParameterInfo(datasetid,
|
||||
STATIC_CORIOLIS);
|
||||
if (topoParamInfo == null && spacingParamInfo == null
|
||||
&& coriolisParamInfo == null) {
|
||||
return Collections.emptyList();
|
||||
|
||||
// this list has an entry for each parameter that needs to be generated
|
||||
List<ParameterInfo> infoObjects = new ArrayList<ParameterInfo>(
|
||||
STATIC_PARAMETERS.length);
|
||||
// Populate the lsit based off the paramInfo.
|
||||
for (String parameter : STATIC_PARAMETERS) {
|
||||
ParameterInfo paramInfo = gpif.getParameterInfo(datasetid,
|
||||
parameter);
|
||||
if (paramInfo != null) {
|
||||
infoObjects.add(paramInfo);
|
||||
}
|
||||
}
|
||||
|
||||
GridRecord staticTopoGridRecord = null;
|
||||
GridRecord staticXSpacingRecord = null;
|
||||
GridRecord staticYSpacingRecord = null;
|
||||
GridRecord staticCoriolisRecord = null;
|
||||
ConcurrentMap<Date, ConcurrentMap<Integer, String>> stModelCache = staticTopoTimeCache
|
||||
.get(datasetid);
|
||||
|
||||
if (stModelCache == null) {
|
||||
// should only ever have 1 refTime in it
|
||||
stModelCache = new ConcurrentHashMap<Date, ConcurrentMap<Integer, String>>(
|
||||
4);
|
||||
staticTopoTimeCache.put(datasetid, stModelCache);
|
||||
if (infoObjects.isEmpty()) {
|
||||
// nothing to generate
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
DataTime dataTime = record.getDataTime();
|
||||
ConcurrentMap<Integer, String> stRefTimeCache = stModelCache
|
||||
.get(dataTime.getRefTime());
|
||||
|
||||
if (stRefTimeCache == null) {
|
||||
stRefTimeCache = new ConcurrentHashMap<Integer, String>(50);
|
||||
stModelCache.clear();
|
||||
stModelCache.put(dataTime.getRefTime(), stRefTimeCache);
|
||||
}
|
||||
|
||||
GridCoverage location = record.getLocation();
|
||||
GridDao dao = new GridDao();
|
||||
|
||||
CacheKey key = new CacheKey(record);
|
||||
ClusterTask ct = null;
|
||||
try {
|
||||
if (!stRefTimeCache.containsKey(dataTime.getFcstTime())) {
|
||||
if (!dataGeneratedCache.containsKey(key)) {
|
||||
// first for this forecastTime, grab lock
|
||||
ct = getStaticTopoClusterLock(record);
|
||||
}
|
||||
|
||||
/*
|
||||
* If it is Geopotential Height at Surface and this model contains
|
||||
* staticTop, then store a staticTopoRecord
|
||||
*/
|
||||
if ((record.getParameter().getAbbreviation()
|
||||
.equals(GEOPOTENTIAL_HEIGHT_PARAM) || record.getParameter()
|
||||
.getAbbreviation().equals(GEOMETRIC_HEIGHT_PARAM))
|
||||
&& record.getLevel().getMasterLevel().getName()
|
||||
.equals(SURFACE_LEVEL)) {
|
||||
boolean topoCompatible = isTopoCompatibleRecord(record);
|
||||
|
||||
// double check cache in case lock had to wait for running to finish
|
||||
if (dataGeneratedCache.containsKey(key)) {
|
||||
// if this key is been done clearing this stops processing.
|
||||
infoObjects.clear();
|
||||
if (topoCompatible) {
|
||||
// put topo back in to allow it to be processed.
|
||||
ParameterInfo paramInfo = gpif.getParameterInfo(datasetid,
|
||||
STATIC_TOPO);
|
||||
if (paramInfo != null) {
|
||||
infoObjects.add(paramInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!infoObjects.isEmpty()) {
|
||||
if (ct == null) {
|
||||
// if this is topoCompatible we can get here without locking
|
||||
// so grab it.
|
||||
ct = getStaticTopoClusterLock(record);
|
||||
}
|
||||
FloatDataRecord rawDataRecord = (FloatDataRecord) dao
|
||||
.getHDF5Data(record, -1)[0];
|
||||
float[] rawData = rawDataRecord.getFloatData();
|
||||
FloatDataRecord staticTopoData = new FloatDataRecord(
|
||||
STATIC_TOPO, "/" + location.getId(), rawData, 2,
|
||||
new long[] { location.getNx(), location.getNy() });
|
||||
staticTopoGridRecord = createTopoRecord(record);
|
||||
staticXSpacingRecord = createXSpacing(record);
|
||||
staticYSpacingRecord = createYSpacing(record);
|
||||
staticCoriolisRecord = createCoriolis(record);
|
||||
IDataStore dataStore = null;
|
||||
if (staticTopoGridRecord != null) {
|
||||
dataStore = dao.getDataStore(staticTopoGridRecord);
|
||||
} else if (staticXSpacingRecord != null) {
|
||||
dataStore = dao.getDataStore(staticXSpacingRecord);
|
||||
} else if (staticYSpacingRecord != null) {
|
||||
dataStore = dao.getDataStore(staticYSpacingRecord);
|
||||
} else if (staticCoriolisRecord != null) {
|
||||
dataStore = dao.getDataStore(staticCoriolisRecord);
|
||||
}
|
||||
dataStore.addDataRecord(staticTopoData);
|
||||
getStaticData(staticXSpacingRecord, staticYSpacingRecord,
|
||||
staticCoriolisRecord, dataStore);
|
||||
StorageStatus status = dataStore.store(StoreOp.REPLACE);
|
||||
StorageException[] se = status.getExceptions();
|
||||
if (se == null || se.length == 0) {
|
||||
persistStaticDataToDatabase(dao, staticTopoGridRecord,
|
||||
staticXSpacingRecord, staticYSpacingRecord,
|
||||
staticCoriolisRecord);
|
||||
stRefTimeCache.put(dataTime.getFcstTime(), "");
|
||||
} else {
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"Error persisting staticTopo data to hdf5", se[0]);
|
||||
staticTopoGridRecord = null;
|
||||
}
|
||||
} else if (!stRefTimeCache.containsKey(dataTime.getFcstTime())) {
|
||||
// double check cache in case lock had to wait for running to
|
||||
// finish
|
||||
staticTopoGridRecord = createTopoRecord(record);
|
||||
staticXSpacingRecord = createXSpacing(record);
|
||||
staticYSpacingRecord = createYSpacing(record);
|
||||
staticCoriolisRecord = createCoriolis(record);
|
||||
IDataStore dataStore = null;
|
||||
if (staticTopoGridRecord != null) {
|
||||
dataStore = dao.getDataStore(staticTopoGridRecord);
|
||||
} else if (staticXSpacingRecord != null) {
|
||||
dataStore = dao.getDataStore(staticXSpacingRecord);
|
||||
} else if (staticYSpacingRecord != null) {
|
||||
dataStore = dao.getDataStore(staticYSpacingRecord);
|
||||
} else if (staticCoriolisRecord != null) {
|
||||
dataStore = dao.getDataStore(staticCoriolisRecord);
|
||||
}
|
||||
String[] dataSets = null;
|
||||
|
||||
try {
|
||||
// check if its already been stored
|
||||
dataSets = dataStore.getDatasets("/" + location.getId());
|
||||
} catch (Exception e) {
|
||||
// Ignore
|
||||
}
|
||||
if (dataSets == null
|
||||
|| (dataSets != null && !Arrays.asList(dataSets)
|
||||
.contains(STATIC_TOPO))) {
|
||||
if (staticTopoGridRecord != null) {
|
||||
FloatDataRecord staticTopoRecord = StaticTopoData
|
||||
.getInstance().getStopoData(location);
|
||||
staticTopoRecord.setGroup("/" + location.getId());
|
||||
staticTopoRecord.setName(STATIC_TOPO);
|
||||
dataStore.addDataRecord(staticTopoRecord);
|
||||
}
|
||||
getStaticData(staticXSpacingRecord, staticYSpacingRecord,
|
||||
staticCoriolisRecord, dataStore);
|
||||
StorageStatus status = dataStore.store(StoreOp.REPLACE);
|
||||
StorageException[] se = status.getExceptions();
|
||||
if (se == null || se.length == 0) {
|
||||
// store to database
|
||||
persistStaticDataToDatabase(dao, staticTopoGridRecord,
|
||||
staticXSpacingRecord, staticYSpacingRecord,
|
||||
staticCoriolisRecord);
|
||||
stRefTimeCache.put(dataTime.getFcstTime(), "");
|
||||
} else {
|
||||
// failed to store
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"Error persisting staticTopo data to hdf5",
|
||||
se[0]);
|
||||
staticTopoGridRecord = null;
|
||||
}
|
||||
} else {
|
||||
// dataset existed verify in database
|
||||
persistStaticDataToDatabase(dao, staticTopoGridRecord,
|
||||
staticXSpacingRecord, staticYSpacingRecord,
|
||||
staticCoriolisRecord);
|
||||
stRefTimeCache.put(dataTime.getFcstTime(), "");
|
||||
}
|
||||
dataGeneratedCache.put(key, key);
|
||||
return createStaticRecords(infoObjects, record, topoCompatible);
|
||||
|
||||
}
|
||||
} finally {
|
||||
if (ct != null) {
|
||||
|
@ -293,22 +218,73 @@ public class StaticDataGenerator {
|
|||
.getDetails());
|
||||
}
|
||||
}
|
||||
List<GridRecord> staticRecords = new ArrayList<GridRecord>();
|
||||
if (staticTopoGridRecord != null) {
|
||||
staticRecords.add(staticTopoGridRecord);
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and persist any static records that have not already been created.
|
||||
* This method assumes cluster locking and caching is already done, it will
|
||||
* check the database and datastore for duplicates.
|
||||
*/
|
||||
private Set<GridRecord> createStaticRecords(
|
||||
List<ParameterInfo> infoObjects, GridRecord record,
|
||||
boolean topoCompatible) throws Exception {
|
||||
// the static records are created and sorted, some may need to be stored
|
||||
// to the database some may need to be stored to hdf5, some may need
|
||||
// both and some may need neither.
|
||||
//
|
||||
// 1) Brand new model runs will need to store to both
|
||||
// 2) Since all forecast times share a datastore entry, after the first
|
||||
// forecast hour only the database is persisted.
|
||||
// 3) When a topo compatible record arrives it overrides any previous
|
||||
// data and only the datastore is written.
|
||||
// 4) If this has already been handled completely by another jvm then
|
||||
// neither is written
|
||||
|
||||
GridDao dao = new GridDao();
|
||||
|
||||
// contains all the static records.
|
||||
Set<GridRecord> staticRecords = new HashSet<GridRecord>();
|
||||
// contains any static records that need to be saved to the db
|
||||
Set<GridRecord> databaseRecords = new HashSet<GridRecord>();
|
||||
// contains any static records that need to be stored to hdf5.
|
||||
Set<GridRecord> datastoreRecords = new HashSet<GridRecord>();
|
||||
|
||||
for (ParameterInfo paramInfo : infoObjects) {
|
||||
GridRecord staticRecord = createStaticRecord(record, paramInfo);
|
||||
if (topoCompatible && STATIC_TOPO.equals(paramInfo.getShort_name())) {
|
||||
// always fill topo records with topo compatible data
|
||||
copyRawData(dao, record, staticRecord);
|
||||
// force static topo into the datastore.
|
||||
datastoreRecords.add(staticRecord);
|
||||
}
|
||||
staticRecords.add(staticRecord);
|
||||
}
|
||||
if (staticXSpacingRecord != null) {
|
||||
staticRecords.add(staticXSpacingRecord);
|
||||
|
||||
databaseRecords.addAll(checkDatabase(dao, staticRecords));
|
||||
datastoreRecords.addAll(checkDatastore(dao, databaseRecords));
|
||||
if (!datastoreRecords.isEmpty()) {
|
||||
for (GridRecord staticRecord : datastoreRecords) {
|
||||
populateMessageData(staticRecord);
|
||||
}
|
||||
dao.persistToHDF5(databaseRecords.toArray(new PluginDataObject[0]));
|
||||
}
|
||||
if (staticYSpacingRecord != null) {
|
||||
staticRecords.add(staticYSpacingRecord);
|
||||
}
|
||||
if (staticCoriolisRecord != null) {
|
||||
staticRecords.add(staticCoriolisRecord);
|
||||
if (!databaseRecords.isEmpty()) {
|
||||
dao.persistToDatabase(databaseRecords
|
||||
.toArray(new PluginDataObject[0]));
|
||||
}
|
||||
|
||||
// remove records that have not changed from staticRecords so alerts are
|
||||
// only generated for new or changed records.
|
||||
staticRecords.retainAll(databaseRecords);
|
||||
staticRecords.addAll(datastoreRecords);
|
||||
return staticRecords;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cluster lock that ensures we only process topo for records like
|
||||
* the one provided once.
|
||||
*/
|
||||
private ClusterTask getStaticTopoClusterLock(GridRecord record) {
|
||||
String taskDetails = record.getDatasetId()
|
||||
+ record.getDataTime().getRefTime();
|
||||
|
@ -319,114 +295,72 @@ public class StaticDataGenerator {
|
|||
return rval;
|
||||
}
|
||||
|
||||
private GridRecord createTopoRecord(GridRecord record) throws Exception {
|
||||
GridRecord staticTopoRecord = null;
|
||||
|
||||
ParameterInfo paramInfo = GridParamInfoLookup.getInstance()
|
||||
.getParameterInfo(record.getDatasetId(), STATIC_TOPO);
|
||||
if (paramInfo == null) {
|
||||
return null;
|
||||
/**
|
||||
* Determine if the provided record contains data that can be used as topo.
|
||||
* The provided record should have been parsed from a notification.
|
||||
*/
|
||||
private boolean isTopoCompatibleRecord(GridRecord record) {
|
||||
String param = record.getParameter().getAbbreviation();
|
||||
// must be geometric or geopotential height
|
||||
if (!GEOMETRIC_HEIGHT_PARAM.equals(param)
|
||||
&& !GEOPOTENTIAL_HEIGHT_PARAM.equals(param)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
staticTopoRecord = new GridRecord(record);
|
||||
staticTopoRecord.setId(0);
|
||||
staticTopoRecord.setDataURI(null);
|
||||
staticTopoRecord.setDataTime(null);
|
||||
staticTopoRecord.setInsertTime(TimeTools.getSystemCalendar());
|
||||
|
||||
Calendar refTime = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
|
||||
refTime.setTime(record.getDataTime().getRefTime());
|
||||
DataTime dataTime = new DataTime(refTime, record.getDataTime()
|
||||
.getFcstTime());
|
||||
|
||||
Parameter param = new Parameter(paramInfo.getShort_name(),
|
||||
paramInfo.getLong_name(), SI.METER);
|
||||
staticTopoRecord.setParameter(param);
|
||||
staticTopoRecord.setLevel(LevelFactory.getInstance().getLevel("Dflt",
|
||||
0, "m"));
|
||||
|
||||
staticTopoRecord.setDataTime(dataTime);
|
||||
staticTopoRecord.getInfo().setId(null);
|
||||
staticTopoRecord.setMessageData(null);
|
||||
staticTopoRecord.setOverwriteAllowed(true);
|
||||
staticTopoRecord.constructDataURI();
|
||||
return staticTopoRecord;
|
||||
// must be surface level.
|
||||
if (!SURFACE_LEVEL.equals(record.getLevel().getMasterLevel().getName())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void getStaticData(GridRecord staticXRecord,
|
||||
GridRecord staticYRecord, GridRecord staticCoriolisRecord,
|
||||
IDataStore dataStore) throws Exception {
|
||||
/**
|
||||
* Load the hdf5 data for record into the message data for staticRecord.
|
||||
* This method should be used for topoCompatible records.
|
||||
*/
|
||||
private void copyRawData(GridDao dao, GridRecord record,
|
||||
GridRecord staticRecord) throws PluginException {
|
||||
FloatDataRecord rawDataRecord = (FloatDataRecord) dao.getHDF5Data(
|
||||
record, -1)[0];
|
||||
staticRecord.setMessageData(rawDataRecord.getFloatData());
|
||||
staticRecord.setOverwriteAllowed(true);
|
||||
}
|
||||
|
||||
if (staticXRecord != null) {
|
||||
FloatDataRecord dxRecord = StaticGridData.getInstance(
|
||||
staticXRecord.getLocation()).getDx();
|
||||
if (staticYRecord == null) {
|
||||
dxRecord.setName("staticSpacing");
|
||||
} else {
|
||||
dxRecord.setName("staticXspacing");
|
||||
}
|
||||
dxRecord.setGroup("/" + staticXRecord.getLocation().getId());
|
||||
dataStore.addDataRecord(dxRecord);
|
||||
/**
|
||||
* Populate the message data for a static record, loads the correct type of
|
||||
* data based of the parameter in the record.
|
||||
*/
|
||||
private void populateMessageData(GridRecord staticRecord) {
|
||||
if (staticRecord.getMessageData() != null) {
|
||||
// already populated, hits for static topo copied from the record.
|
||||
return;
|
||||
}
|
||||
|
||||
if (staticYRecord != null) {
|
||||
FloatDataRecord dyRecord = StaticGridData.getInstance(
|
||||
staticYRecord.getLocation()).getDy();
|
||||
dyRecord.setName("staticYspacing");
|
||||
dyRecord.setGroup("/" + staticXRecord.getLocation().getId());
|
||||
dataStore.addDataRecord(dyRecord);
|
||||
String param = staticRecord.getParameter().getAbbreviation();
|
||||
GridCoverage loc = staticRecord.getLocation();
|
||||
FloatDataRecord fdr = null;
|
||||
if (STATIC_SPACING.equals(param) || STATIC_X_SPACING.equals(param)) {
|
||||
fdr = StaticGridData.getInstance(loc).getDx();
|
||||
} else if (STATIC_Y_SPACING.equals(param)) {
|
||||
fdr = StaticGridData.getInstance(loc).getDy();
|
||||
} else if (STATIC_CORIOLIS.equals(param)) {
|
||||
fdr = StaticGridData.getInstance(loc).getCoriolis();
|
||||
} else if (STATIC_TOPO.equals(param)) {
|
||||
fdr = StaticTopoData.getInstance().getStopoData(loc);
|
||||
}
|
||||
|
||||
if (staticCoriolisRecord != null) {
|
||||
FloatDataRecord coriolisRecord = StaticGridData.getInstance(
|
||||
staticCoriolisRecord.getLocation()).getCoriolis();
|
||||
coriolisRecord.setName("staticCoriolis");
|
||||
coriolisRecord.setGroup("/" + staticXRecord.getLocation().getId());
|
||||
dataStore.addDataRecord(coriolisRecord);
|
||||
if (fdr != null) {
|
||||
staticRecord.setMessageData(fdr.getFloatData());
|
||||
}
|
||||
}
|
||||
|
||||
private GridRecord createXSpacing(GridRecord record) throws Exception {
|
||||
ParameterInfo paramInfo = GridParamInfoLookup.getInstance()
|
||||
.getParameterInfo(record.getDatasetId(), STATIC_SPACING);
|
||||
if (paramInfo == null) {
|
||||
paramInfo = GridParamInfoLookup.getInstance().getParameterInfo(
|
||||
record.getDatasetId(), "staticXspacing");
|
||||
if (paramInfo == null) {
|
||||
return null;
|
||||
} else {
|
||||
return createStaticRecord(record, "staticXspacing", paramInfo);
|
||||
}
|
||||
} else {
|
||||
return createStaticRecord(record, "staticSpacing", paramInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private GridRecord createYSpacing(GridRecord record) throws Exception {
|
||||
ParameterInfo paramInfo = GridParamInfoLookup.getInstance()
|
||||
.getParameterInfo(record.getDatasetId(), "staticYspacing");
|
||||
if (paramInfo == null) {
|
||||
return null;
|
||||
} else {
|
||||
return createStaticRecord(record, "staticYspacing", paramInfo);
|
||||
}
|
||||
}
|
||||
|
||||
private GridRecord createCoriolis(GridRecord record) throws Exception {
|
||||
ParameterInfo paramInfo = GridParamInfoLookup.getInstance()
|
||||
.getParameterInfo(record.getDatasetId(), "staticCoriolis");
|
||||
return createStaticRecord(record, "staticCoriolis", paramInfo);
|
||||
}
|
||||
|
||||
private GridRecord createStaticRecord(GridRecord record, String name,
|
||||
/**
|
||||
* Create a new GridRecord that is a copy of the provided record but is for
|
||||
* a static parameter defined with paramInfo.
|
||||
*/
|
||||
private GridRecord createStaticRecord(GridRecord record,
|
||||
ParameterInfo paramInfo) throws Exception {
|
||||
GridRecord staticRecord = null;
|
||||
|
||||
staticRecord = new GridRecord(record);
|
||||
staticRecord.setId(0);
|
||||
staticRecord.setDataURI(null);
|
||||
staticRecord.setDataTime(null);
|
||||
staticRecord.setInsertTime(TimeTools.getSystemCalendar());
|
||||
|
||||
Calendar refTime = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
|
||||
|
@ -434,60 +368,127 @@ public class StaticDataGenerator {
|
|||
DataTime dataTime = new DataTime(refTime, record.getDataTime()
|
||||
.getFcstTime());
|
||||
|
||||
Parameter param = new Parameter(name, paramInfo.getLong_name(),
|
||||
paramInfo.getUnits());
|
||||
Parameter param = new Parameter(paramInfo.getShort_name(),
|
||||
paramInfo.getLong_name(), paramInfo.getUnits());
|
||||
staticRecord.setParameter(param);
|
||||
staticRecord.setLevel(LevelFactory.getInstance().getLevel("Dflt", 0,
|
||||
"m"));
|
||||
staticRecord.getInfo().setId(null);
|
||||
staticRecord.setDataTime(dataTime);
|
||||
|
||||
staticRecord.setMessageData(null);
|
||||
staticRecord.setOverwriteAllowed(true);
|
||||
staticRecord.constructDataURI();
|
||||
return staticRecord;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to persist the static topo record to the database.
|
||||
*
|
||||
* @param topo
|
||||
* Return a set with only records which are not already in the database
|
||||
*/
|
||||
private void persistStaticDataToDatabase(GridDao dao, GridRecord topo,
|
||||
GridRecord staticXSpacing, GridRecord staticYSpacing,
|
||||
GridRecord staticCoriolis) throws SerializationException,
|
||||
EdexException {
|
||||
if (topo != null && !isSTopoInDb(dao, topo)) {
|
||||
statusHandler.handle(Priority.DEBUG,
|
||||
"Persisting static topo record to the database!!!");
|
||||
dao.persistToDatabase(topo);
|
||||
private Set<GridRecord> checkDatabase(GridDao dao,
|
||||
Set<GridRecord> staticRecords) throws DataAccessLayerException {
|
||||
if (staticRecords.isEmpty()) {
|
||||
return staticRecords;
|
||||
}
|
||||
if (staticXSpacing != null && !isSTopoInDb(dao, staticXSpacing)) {
|
||||
statusHandler.handle(Priority.DEBUG, "Persisting static "
|
||||
+ staticXSpacing.getParameter().getAbbreviation()
|
||||
+ " record to the database!!!");
|
||||
dao.persistToDatabase(staticXSpacing);
|
||||
}
|
||||
if (staticYSpacing != null && !isSTopoInDb(dao, staticYSpacing)) {
|
||||
statusHandler.handle(Priority.DEBUG, "Persisting static "
|
||||
+ staticYSpacing.getParameter().getAbbreviation()
|
||||
+ " record to the database!!!");
|
||||
dao.persistToDatabase(staticYSpacing);
|
||||
}
|
||||
if (staticCoriolis != null && !isSTopoInDb(dao, staticCoriolis)) {
|
||||
statusHandler.handle(Priority.DEBUG, "Persisting static "
|
||||
+ staticCoriolis.getParameter().getAbbreviation()
|
||||
+ " record to the database!!!");
|
||||
dao.persistToDatabase(staticCoriolis);
|
||||
Set<GridRecord> missing = new HashSet<GridRecord>();
|
||||
for (GridRecord staticRecord : staticRecords) {
|
||||
// a possible future optimization would be to do one bulk query for
|
||||
// all records.
|
||||
List<?> list = dao.queryBySingleCriteria("dataURI",
|
||||
staticRecord.getDataURI());
|
||||
if (list.isEmpty()) {
|
||||
missing.add(staticRecord);
|
||||
}
|
||||
}
|
||||
return missing;
|
||||
}
|
||||
|
||||
private boolean isSTopoInDb(GridDao dao, GridRecord record)
|
||||
throws DataAccessLayerException {
|
||||
List<String> fields = Arrays.asList("dataURI");
|
||||
List<Object> values = Arrays.asList((Object) record.getDataURI());
|
||||
List<?> list = dao.queryByCriteria(fields, values);
|
||||
return !list.isEmpty();
|
||||
/**
|
||||
* Return a set with only records which are not already in the datastore
|
||||
*/
|
||||
private Set<GridRecord> checkDatastore(GridDao dao,
|
||||
Set<GridRecord> staticRecords) throws Exception {
|
||||
if (staticRecords.isEmpty()) {
|
||||
return staticRecords;
|
||||
}
|
||||
List<String> datasets = null;
|
||||
Set<GridRecord> missing = new HashSet<GridRecord>();
|
||||
for (GridRecord staticRecord : staticRecords) {
|
||||
if (datasets == null) {
|
||||
try {
|
||||
IDataStore datastore = dao.getDataStore(staticRecord);
|
||||
String[] datasetsArr = datastore.getDatasets("/"
|
||||
+ staticRecord.getLocation().getId());
|
||||
datasets = Arrays.asList(datasetsArr);
|
||||
} catch (StorageException e) {
|
||||
// file did not exist.
|
||||
datasets = Collections.emptyList();
|
||||
}
|
||||
}
|
||||
if (datasets.contains(missing)) {
|
||||
missing.add(staticRecord);
|
||||
}
|
||||
}
|
||||
return missing;
|
||||
}
|
||||
|
||||
/**
|
||||
* Key object that holds datasetid, time and coverage for which this
|
||||
* instance has already generated static data.
|
||||
*/
|
||||
private static final class CacheKey {
|
||||
|
||||
private final String datasetid;
|
||||
|
||||
private final Date refTime;
|
||||
|
||||
private final int forecastTime;
|
||||
|
||||
private final int coverageid;
|
||||
|
||||
public CacheKey(GridRecord record) {
|
||||
this.datasetid = record.getDatasetId();
|
||||
this.refTime = record.getDataTime().getRefTime();
|
||||
this.forecastTime = record.getDataTime().getFcstTime();
|
||||
this.coverageid = record.getLocation().getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + coverageid;
|
||||
result = prime * result
|
||||
+ ((datasetid == null) ? 0 : datasetid.hashCode());
|
||||
result = prime * result + forecastTime;
|
||||
result = prime * result
|
||||
+ ((refTime == null) ? 0 : refTime.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
CacheKey other = (CacheKey) obj;
|
||||
if (coverageid != other.coverageid)
|
||||
return false;
|
||||
if (datasetid == null) {
|
||||
if (other.datasetid != null)
|
||||
return false;
|
||||
} else if (!datasetid.equals(other.datasetid))
|
||||
return false;
|
||||
if (forecastTime != other.forecastTime)
|
||||
return false;
|
||||
if (refTime == null) {
|
||||
if (other.refTime != null)
|
||||
return false;
|
||||
} else if (!refTime.equals(other.refTime))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ import com.raytheon.uf.edex.database.dao.DaoConfig;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 26, 2012 bsteffen Initial creation
|
||||
* Mar 07, 2013 1771 bsteffen fix gridcoverage duplicate checks.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -134,7 +135,7 @@ public class GetGridCoverageHandler implements
|
|||
Criteria crit = sess.createCriteria(coverage.getClass());
|
||||
|
||||
crit.add(Restrictions.eq("nx", coverage.getNx()));
|
||||
crit.add(Restrictions.eq("ny", coverage.getNx()));
|
||||
crit.add(Restrictions.eq("ny", coverage.getNy()));
|
||||
crit.add(Restrictions.between("dx", coverage.getDx()
|
||||
- GridCoverage.SPATIAL_TOLERANCE, coverage.getDx()
|
||||
+ GridCoverage.SPATIAL_TOLERANCE));
|
||||
|
@ -161,7 +162,7 @@ public class GetGridCoverageHandler implements
|
|||
crit = sess.createCriteria(coverage.getClass());
|
||||
|
||||
crit.add(Restrictions.eq("nx", coverage.getNx()));
|
||||
crit.add(Restrictions.eq("ny", coverage.getNx()));
|
||||
crit.add(Restrictions.eq("ny", coverage.getNy()));
|
||||
crit.add(Restrictions.between("dx", coverage.getDx()
|
||||
- GridCoverage.SPATIAL_TOLERANCE, coverage.getDx()
|
||||
+ GridCoverage.SPATIAL_TOLERANCE));
|
||||
|
|
|
@ -28,8 +28,11 @@ import com.raytheon.edex.urifilter.URIFilter;
|
|||
import com.raytheon.edex.urifilter.URIGenerateMessage;
|
||||
import com.raytheon.uf.common.dataplugin.cwat.CWATRecord;
|
||||
import com.raytheon.uf.common.dataplugin.cwat.dao.CWATDao;
|
||||
import com.raytheon.uf.common.dataplugin.radar.util.RadarsInUseUtil;
|
||||
import com.raytheon.uf.common.monitor.config.SCANRunSiteConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.events.MonitorConfigEvent;
|
||||
import com.raytheon.uf.common.monitor.events.MonitorConfigListener;
|
||||
import com.raytheon.uf.common.monitor.scan.ScanUtils;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
@ -37,8 +40,26 @@ import com.raytheon.uf.common.time.DataTime;
|
|||
import com.raytheon.uf.edex.cpgsrv.CompositeProductGenerator;
|
||||
import com.raytheon.uf.edex.plugin.cwat.common.CWATConfig;
|
||||
|
||||
public class CWATGenerator extends CompositeProductGenerator {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
/**
|
||||
* CWATGenerator Product
|
||||
*
|
||||
* CWAT files for use in EDEX.
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 02/25/13 1660 D. Hladky Fixed configuration bug in scan.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class CWATGenerator extends CompositeProductGenerator implements
|
||||
MonitorConfigListener {
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(CWATGenerator.class);
|
||||
|
||||
private static final String genName = "CWAT";
|
||||
|
@ -47,6 +68,9 @@ public class CWATGenerator extends CompositeProductGenerator {
|
|||
|
||||
/** Set of icaos to filter for */
|
||||
private Set<String> icaos = null;
|
||||
|
||||
/** run configuration manager **/
|
||||
public SCANRunSiteConfigurationManager srcm = null;
|
||||
|
||||
/**
|
||||
* Public CWAT constructor
|
||||
|
@ -61,12 +85,24 @@ public class CWATGenerator extends CompositeProductGenerator {
|
|||
@Override
|
||||
protected void configureFilters() {
|
||||
|
||||
statusHandler.handle(Priority.INFO, "Process Filter Config...");
|
||||
// read this from localization eventually
|
||||
icaos = new HashSet<String>(RadarsInUseUtil.getSite(null,
|
||||
RadarsInUseUtil.LOCAL_CONSTANT));
|
||||
icaos.addAll(RadarsInUseUtil.getSite(null,
|
||||
RadarsInUseUtil.DIAL_CONSTANT));
|
||||
statusHandler.handle(Priority.INFO, getGeneratorName()
|
||||
+ " process Filter Config...");
|
||||
|
||||
try {
|
||||
getRunConfig().readConfigXml();
|
||||
} catch (SerializationException e) {
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"Couldn't read CWAT(scan) configuration!!!", e);
|
||||
}
|
||||
boolean configValid = getRunConfig().isPopulated();
|
||||
|
||||
if (!configValid) {
|
||||
statusHandler.handle(Priority.WARN,
|
||||
"Configuration for CWAT(scan) is invalid!!!");
|
||||
return;
|
||||
}
|
||||
|
||||
icaos = new HashSet<String>(getRunConfig().getSiteNames());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -82,7 +118,7 @@ public class CWATGenerator extends CompositeProductGenerator {
|
|||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"Couldn't create CWAT Filter.." + icao
|
||||
+ " is not a viable RADAR site.");
|
||||
+ " is not a viable RADAR site.", e);
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
@ -97,8 +133,7 @@ public class CWATGenerator extends CompositeProductGenerator {
|
|||
cwa_config = new CWATConfig(genMessage, this);
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"CWAT Configuration parameters for run not met...");
|
||||
e.printStackTrace();
|
||||
"CWAT Configuration parameters for run not met...",e);
|
||||
return;
|
||||
|
||||
}
|
||||
|
@ -149,4 +184,26 @@ public class CWATGenerator extends CompositeProductGenerator {
|
|||
public boolean isRunning() {
|
||||
return getConfigManager().getCWATState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configChanged(MonitorConfigEvent fce) {
|
||||
if (fce.getSource() instanceof SCANRunSiteConfigurationManager) {
|
||||
statusHandler.handle(Priority.INFO,
|
||||
"Re-configuring CWAT URI filters...Run Site Config change");
|
||||
resetFilters();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* run config manager
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public SCANRunSiteConfigurationManager getRunConfig() {
|
||||
if (srcm == null) {
|
||||
srcm = SCANRunSiteConfigurationManager.getInstance();
|
||||
srcm.addListener(this);
|
||||
}
|
||||
return srcm;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,16 +12,16 @@
|
|||
<property name="maxPoolSize" value="4" />
|
||||
<property name="keepAliveSeconds" value="60000" />
|
||||
</bean>
|
||||
<bean id="ffmpProcessThreadPool"
|
||||
|
||||
<!-- <bean id="ffmpProcessThreadPool"
|
||||
class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
|
||||
<property name="corePoolSize" value="2" />
|
||||
<property name="maxPoolSize" value="4" />
|
||||
<property name="corePoolSize" value="1" />
|
||||
<property name="maxPoolSize" value="2" />
|
||||
<property name="keepAliveSeconds" value="60000" />
|
||||
</bean>
|
||||
</bean>-->
|
||||
|
||||
<bean id="ffmpGenerator" class="com.raytheon.uf.edex.plugin.ffmp.FFMPGenerator">
|
||||
<constructor-arg ref="ffmpThreadPool"/>
|
||||
<constructor-arg ref="ffmpProcessThreadPool"/>
|
||||
</bean>
|
||||
|
||||
<bean factory-bean="cpgSrvDispatcher" factory-method="register">
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -25,6 +25,7 @@ import java.text.SimpleDateFormat;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
|
@ -95,6 +96,7 @@ import com.vividsolutions.jts.geom.Polygon;
|
|||
* 07/14/09 2152 D. Hladky Initial release
|
||||
* 10/25/12 DR 15514 G. Zhang Fix ConcurrentModificationException
|
||||
* 02/01/13 1569 D. Hladky Added constants
|
||||
* 02/25/13 1660 D. Hladky FFTI design change to help mosaic processing.
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
|
@ -165,6 +167,8 @@ public class FFMPProcessor {
|
|||
private static final String sourceBinTaskName = "FFMP Source bin";
|
||||
|
||||
private boolean isFFTI = false;
|
||||
|
||||
private List<String> fftiAttribute = new ArrayList<String>();
|
||||
|
||||
private FFTISourceXML fftiSource = null;
|
||||
|
||||
|
@ -1739,16 +1743,16 @@ public class FFMPProcessor {
|
|||
SOURCE_TYPE.QPE.getSourceType())) {
|
||||
fftiSource = setting.getQpeSource();
|
||||
isFFTI = true;
|
||||
break;
|
||||
fftiAttribute.add(setting.getAttribute().getAttributeName());
|
||||
} else if (source.getSourceType().equals(
|
||||
SOURCE_TYPE.QPF.getSourceType())) {
|
||||
fftiSource = setting.getQpfSource();
|
||||
isFFTI = true;
|
||||
break;
|
||||
fftiAttribute.add(setting.getAttribute().getAttributeName());
|
||||
} else {
|
||||
fftiSource = setting.getGuidSource();
|
||||
isFFTI = true;
|
||||
break;
|
||||
fftiAttribute.add(setting.getAttribute().getAttributeName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1761,7 +1765,7 @@ public class FFMPProcessor {
|
|||
.getDisplayName())) {
|
||||
fftiSource = setting.getQpeSource();
|
||||
isFFTI = true;
|
||||
break;
|
||||
fftiAttribute.add(setting.getAttribute().getAttributeName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1776,7 +1780,7 @@ public class FFMPProcessor {
|
|||
|
||||
fftiSource = setting.getQpfSource();
|
||||
isFFTI = true;
|
||||
break;
|
||||
fftiAttribute.add(setting.getAttribute().getAttributeName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1802,6 +1806,14 @@ public class FFMPProcessor {
|
|||
public FFTISourceXML getFFTISource() {
|
||||
return fftiSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the FFTI attributes for this source
|
||||
* @return
|
||||
*/
|
||||
public List<String> getAttributes() {
|
||||
return fftiAttribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* composite source ID key
|
||||
|
|
|
@ -24,13 +24,8 @@ import java.util.ArrayList;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinData;
|
||||
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinMetaData;
|
||||
import com.raytheon.uf.common.dataplugin.ffmp.FFMPDataContainer;
|
||||
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGap;
|
||||
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceInterpolation;
|
||||
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord;
|
||||
import com.raytheon.uf.common.dataplugin.ffmp.FFMPTemplates;
|
||||
import com.raytheon.uf.common.dataplugin.ffmp.FFMPUtils;
|
||||
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager.SOURCE_TYPE;
|
||||
|
@ -58,7 +53,8 @@ import com.raytheon.uf.edex.plugin.ffmp.FFMPGenerator;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 01, 2011 dhladky Initial creation
|
||||
* July 13, 2012 dhladky Revamped to help memory
|
||||
* 02/01/13 1569 D. Hladky Added constants
|
||||
* 02/01/13 1569 D. Hladky Added constants
|
||||
* 02/25/13 1660 D. Hladky Moved FFTI processing to help with mosaic memory usage
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -80,8 +76,6 @@ public class FFTI implements Runnable {
|
|||
|
||||
private FFMPGenerator ffmpgen = null;
|
||||
|
||||
private FFMPTemplates templates = null;
|
||||
|
||||
private DecimalFormat formatter = null;
|
||||
|
||||
private Priority messagePriority = Priority.INFO;
|
||||
|
@ -94,8 +88,6 @@ public class FFTI implements Runnable {
|
|||
this.ffmpgen = ffmpgen;
|
||||
this.config = ffmpgen.config;
|
||||
this.fdm = ffmpgen.config.fdm;
|
||||
this.templates = ffmpgen.template;
|
||||
|
||||
this.formatter = new DecimalFormat();
|
||||
formatter.setMaximumFractionDigits(2);
|
||||
formatter.setMinimumIntegerDigits(1);
|
||||
|
@ -115,9 +107,6 @@ public class FFTI implements Runnable {
|
|||
alertMessage.append(createAlertMessages());
|
||||
monitorHandler.handle(messagePriority, alertMessage.toString());
|
||||
}
|
||||
// Debug
|
||||
// statusHandler.handle(Priority.INFO, alertMessage.toString());
|
||||
|
||||
}
|
||||
|
||||
private boolean processSettings() {
|
||||
|
@ -246,7 +235,7 @@ public class FFTI implements Runnable {
|
|||
|
||||
for (int j = 0; j < sites.size(); j++) {
|
||||
|
||||
FFTIAccum faccum = getAccumulationForSite(displayName,
|
||||
FFTIAccum faccum = ffmpgen.getAccumulationForSite(displayName,
|
||||
sites.get(j), dataKey, duration,
|
||||
source.getUnit());
|
||||
|
||||
|
@ -289,7 +278,7 @@ public class FFTI implements Runnable {
|
|||
source = ffmpgen.getSourceConfig().getSourceByDisplayName(
|
||||
fftiSourceKey);
|
||||
|
||||
accum = getAccumulationForSite(fftiSourceKey, fftiSiteKey,
|
||||
accum = ffmpgen.getAccumulationForSite(fftiSourceKey, fftiSiteKey,
|
||||
fftiSiteKey, duration, source.getUnit());
|
||||
|
||||
if (accum != null) {
|
||||
|
@ -338,7 +327,7 @@ public class FFTI implements Runnable {
|
|||
|
||||
for (String site : sites) {
|
||||
|
||||
FFTIRatioDiff values = getRatioAndDiffForSite(
|
||||
FFTIRatioDiff values = ffmpgen.getRatioAndDiffForSite(
|
||||
qSourceXML.getSourceName(), site,
|
||||
guidDisplayNames.get(0), duration, unit);
|
||||
|
||||
|
@ -400,7 +389,7 @@ public class FFTI implements Runnable {
|
|||
qSourceXML = ffmpgen.fscm.getSourceByDisplayName(qSourceKey);
|
||||
unit = qSourceXML.getUnit();
|
||||
|
||||
FFTIRatioDiff values = getRatioAndDiffForSite(
|
||||
FFTIRatioDiff values = ffmpgen.getRatioAndDiffForSite(
|
||||
qSourceXML.getSourceName(), qSiteKey,
|
||||
guidDisplayNames.get(0), duration, unit);
|
||||
|
||||
|
@ -789,270 +778,6 @@ public class FFTI implements Runnable {
|
|||
return sites;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value for an individual piece of the puzzle
|
||||
*
|
||||
* @param fftiSourceKey
|
||||
* @param fftiSiteKey
|
||||
* @param duration
|
||||
* @return
|
||||
*/
|
||||
private FFTIAccum getAccumulationForSite(String fftiSourceKey,
|
||||
String fftiSiteKey, String fftiDataKey, double duration, String unit) {
|
||||
|
||||
SourceXML ffmpSource = ffmpgen.getSourceConfig()
|
||||
.getSourceByDisplayName(fftiSourceKey);
|
||||
FFTIAccum accumulator = null;
|
||||
String siteDataKey = ffmpSource.getDisplayName() + "-" + fftiSiteKey
|
||||
+ "-" + fftiDataKey;
|
||||
|
||||
if (ffmpgen.isFFTI(siteDataKey)) {
|
||||
accumulator = (FFTIAccum) ffmpgen.getFFTIData(siteDataKey);
|
||||
} else {
|
||||
accumulator = new FFTIAccum();
|
||||
}
|
||||
|
||||
long expirationTime = ffmpSource.getExpirationMinutes(fftiSiteKey)
|
||||
* TimeUtil.MILLIS_PER_MINUTE;
|
||||
// This will only happen at initial load, update, duration changes.
|
||||
if (accumulator.isReset()
|
||||
|| accumulator.getDuration() != duration
|
||||
|| expirationTime < (System.currentTimeMillis() - accumulator
|
||||
.getLastUpdate())) {
|
||||
|
||||
accumulator.setDuration(duration);
|
||||
accumulator.setUnit(unit);
|
||||
|
||||
if (ffmpSource.isMosaic()) {
|
||||
accumulator.setName(ffmpSource.getDisplayName());
|
||||
} else {
|
||||
accumulator.setName(fftiSiteKey + "-" + fftiSourceKey);
|
||||
}
|
||||
|
||||
long cur = config.getDate().getTime();
|
||||
long timeBack = (long) (duration * TimeUtil.MILLIS_PER_HOUR);
|
||||
Date backDate = new Date(cur - timeBack);
|
||||
|
||||
FFMPDataContainer fdc = null;
|
||||
|
||||
ArrayList<String> hucs = new ArrayList<String>();
|
||||
hucs.add(FFMPRecord.ALL);
|
||||
|
||||
fdc = ffmpgen.getFFMPDataContainer(siteDataKey, hucs, backDate);
|
||||
|
||||
if (fdc != null) {
|
||||
|
||||
FFMPBasinData fbd = fdc.getBasinData(FFMPRecord.ALL);
|
||||
|
||||
// go over the list of CWAs gathering the pfaf list
|
||||
ArrayList<Long> pfafs = new ArrayList<Long>();
|
||||
ArrayList<String> cwaList = fdm.getCwaList();
|
||||
|
||||
Double gap = getGap(fdc, ffmpSource, duration, fftiSiteKey);
|
||||
|
||||
if (gap != Double.NaN) {
|
||||
for (Long key : fbd.getBasins().keySet()) {
|
||||
for (String cwa : cwaList) {
|
||||
|
||||
boolean primary = false;
|
||||
if (cwa.equals(config.getCWA())) {
|
||||
primary = true;
|
||||
}
|
||||
|
||||
FFMPBasinMetaData fmdb = templates.getBasin(
|
||||
fftiSiteKey, key);
|
||||
|
||||
if (fmdb == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Gets buffer zones adjacent to CWA
|
||||
if ((cwa.equals(fmdb.getCwa()))
|
||||
|| (primary && fmdb.isPrimaryCwa())) {
|
||||
if (!pfafs.contains(key)) {
|
||||
pfafs.add(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double amount = fdc.getMaxValue(pfafs, backDate,
|
||||
config.getDate(), expirationTime,
|
||||
ffmpSource.isRate());
|
||||
|
||||
// max value for monitored area
|
||||
accumulator.setAccumulation(amount);
|
||||
accumulator.setGap(gap);
|
||||
}
|
||||
}
|
||||
|
||||
// replace or insert it, memory management
|
||||
if (ffmpgen.ffmpData.containsKey(siteDataKey)) {
|
||||
ffmpgen.ffmpData.remove(siteDataKey);
|
||||
}
|
||||
accumulator.setReset(false);
|
||||
accumulator.setLastUpdate(System.currentTimeMillis());
|
||||
ffmpgen.writeFFTIData(siteDataKey, accumulator);
|
||||
}
|
||||
|
||||
return accumulator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ratio and difference values for this site
|
||||
* @param qSourceKey
|
||||
* @param qSiteKey
|
||||
* @param ffgType
|
||||
* @param duration
|
||||
* @param unit
|
||||
* @return
|
||||
*/
|
||||
private FFTIRatioDiff getRatioAndDiffForSite(String qSourceKey,
|
||||
String qSiteKey, String ffgType, double duration, String unit) {
|
||||
|
||||
FFTIRatioDiff values = null;
|
||||
SourceXML ffmpQSource = ffmpgen.fscm.getSourceByDisplayName(qSourceKey);
|
||||
|
||||
if (ffmpQSource == null) {
|
||||
ffmpQSource = ffmpgen.fscm.getSource(qSourceKey);
|
||||
}
|
||||
|
||||
String siteDataKey = ffgType + "-" + ffmpQSource.getSourceName() + "-"
|
||||
+ qSiteKey;
|
||||
|
||||
if (ffmpgen.isFFTI(siteDataKey)) {
|
||||
values = (FFTIRatioDiff) ffmpgen.getFFTIData(siteDataKey);
|
||||
if (values.getGuids() == null || values.getQpes() == null) {
|
||||
values.setReset(true);
|
||||
}
|
||||
} else {
|
||||
values = new FFTIRatioDiff();
|
||||
}
|
||||
|
||||
long expirationTime = ffmpQSource.getExpirationMinutes(qSiteKey)
|
||||
* TimeUtil.MILLIS_PER_MINUTE;
|
||||
// This will only happen at initial load, update, and duration changes.
|
||||
if (values.isReset()
|
||||
|| values.getDuration() != duration
|
||||
|| expirationTime < (System.currentTimeMillis() - values
|
||||
.getLastUpdate())) {
|
||||
|
||||
values.setDuration(duration);
|
||||
values.setUnit(unit);
|
||||
|
||||
long cur = config.getDate().getTime();
|
||||
long timeBack = (long) (duration * TimeUtil.MILLIS_PER_HOUR);
|
||||
Date backDate = new Date(cur - timeBack);
|
||||
|
||||
// make sure we have data
|
||||
Date ffgBackDate = new Date(
|
||||
config.getDate().getTime()
|
||||
- (TimeUtil.MILLIS_PER_HOUR * FFMPGenerator.FFG_SOURCE_CACHE_TIME));
|
||||
|
||||
String primarySource = ffmpgen.fscm.getPrimarySource(ffmpQSource);
|
||||
ProductXML product = ffmpgen.fscm.getProduct(primarySource);
|
||||
ArrayList<String> hucs = new ArrayList<String>();
|
||||
hucs.add(FFMPRecord.ALL);
|
||||
|
||||
FFMPDataContainer guidContainer = ffmpgen.getFFMPDataContainer(
|
||||
ffgType, hucs, ffgBackDate);
|
||||
|
||||
long guidSourceExpiration = 0l;
|
||||
|
||||
if (guidContainer == null) {
|
||||
guidContainer = new FFMPDataContainer(ffgType, hucs);
|
||||
}
|
||||
|
||||
for (SourceXML iguidSource : product
|
||||
.getGuidanceSourcesByType(ffgType)) {
|
||||
|
||||
if (guidSourceExpiration == 0l) {
|
||||
guidSourceExpiration = iguidSource
|
||||
.getExpirationMinutes(qSiteKey) * TimeUtil.MILLIS_PER_MINUTE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if still nothing, punt!
|
||||
if (guidContainer.size() == 0) {
|
||||
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"FFTI: No guidance sources available for " + qSiteKey
|
||||
+ " " + qSourceKey + " " + " comparison.");
|
||||
return values;
|
||||
}
|
||||
|
||||
FFMPDataContainer qpeContainer = ffmpgen.getFFMPDataContainer(
|
||||
ffmpQSource.getSourceName() + "-" + qSiteKey + "-"
|
||||
+ qSiteKey, hucs, backDate);
|
||||
|
||||
if (qpeContainer != null) {
|
||||
// go over the list of CWAs gathering the pfaf list
|
||||
ArrayList<Long> pfafs = new ArrayList<Long>();
|
||||
ArrayList<String> cwaList = fdm.getCwaList();
|
||||
FFMPBasinData fbd = qpeContainer.getBasinData(FFMPRecord.ALL);
|
||||
|
||||
for (Long key : fbd.getBasins().keySet()) {
|
||||
for (String cwa : cwaList) {
|
||||
|
||||
boolean primary = false;
|
||||
if (cwa.equals(config.getCWA())) {
|
||||
primary = true;
|
||||
}
|
||||
|
||||
FFMPBasinMetaData fmdb = templates.getBasin(qSiteKey,
|
||||
key);
|
||||
|
||||
if (fmdb == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Gets buffer zones adjacent to CWA
|
||||
if ((cwa.equals(fmdb.getCwa()))
|
||||
|| (primary && fmdb.isPrimaryCwa())) {
|
||||
if (!pfafs.contains(key)) {
|
||||
pfafs.add(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Double gap = getGap(qpeContainer, ffmpQSource, duration,
|
||||
qSiteKey);
|
||||
|
||||
if (gap != Double.NaN) {
|
||||
|
||||
List<Float> qpes = qpeContainer.getBasinData(FFMPRecord.ALL)
|
||||
.getAccumValues(pfafs, backDate, config.getDate(),
|
||||
expirationTime, false);
|
||||
|
||||
FFMPGuidanceInterpolation interpolator = new FFMPGuidanceInterpolation(
|
||||
ffmpgen.fscm, product, ffmpgen.frcm.getRunner(
|
||||
config.getCWA()).getProduct(qSiteKey),
|
||||
primarySource, ffgType, qSiteKey);
|
||||
interpolator.setInterpolationSources(duration);
|
||||
|
||||
List<Float> guids = guidContainer.getBasinData(FFMPRecord.ALL)
|
||||
.getGuidanceValues(pfafs, interpolator,
|
||||
guidSourceExpiration);
|
||||
|
||||
values.setQpes(qpes);
|
||||
values.setGuids(guids);
|
||||
values.setGap(gap);
|
||||
}
|
||||
} else {
|
||||
return values;
|
||||
}
|
||||
|
||||
// replace or insert it
|
||||
values.setReset(false);
|
||||
values.setLastUpdate(System.currentTimeMillis());
|
||||
ffmpgen.writeFFTIData(siteDataKey, values);
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the gap
|
||||
*
|
||||
|
@ -1061,12 +786,11 @@ public class FFTI implements Runnable {
|
|||
* @param duration
|
||||
* @return
|
||||
*/
|
||||
private Double getGap(FFMPDataContainer qpeContainer,
|
||||
SourceXML ffmpQSource, double duration, String qSiteKey) {
|
||||
public static Double getGap(FFMPDataContainer qpeContainer,
|
||||
SourceXML ffmpQSource, Date curdate, double duration, String qSiteKey) {
|
||||
|
||||
long cur = config.getDate().getTime();
|
||||
long timeBack = (long) (duration * TimeUtil.MILLIS_PER_HOUR);
|
||||
Date backDate = new Date(cur - timeBack);
|
||||
Date backDate = new Date(curdate.getTime() - timeBack);
|
||||
long expirationTime = ffmpQSource.getExpirationMinutes(qSiteKey);
|
||||
Double gapVal = 0.0;
|
||||
|
||||
|
@ -1075,7 +799,7 @@ public class FFTI implements Runnable {
|
|||
gapVal = 0.0;
|
||||
List<FFMPGap> gaps = FFMPGap.getGaps(
|
||||
qpeContainer.getOrderedTimes(backDate), expirationTime,
|
||||
backDate, config.getDate());
|
||||
backDate, curdate);
|
||||
for (FFMPGap gap : gaps) {
|
||||
gapVal += gap.getGap();
|
||||
}
|
||||
|
|
|
@ -29,7 +29,10 @@ import com.raytheon.edex.urifilter.URIGenerateMessage;
|
|||
import com.raytheon.uf.common.dataplugin.preciprate.PrecipRateRecord;
|
||||
import com.raytheon.uf.common.dataplugin.preciprate.dao.PrecipRateDao;
|
||||
import com.raytheon.uf.common.dataplugin.radar.util.RadarConstants.DHRValues;
|
||||
import com.raytheon.uf.common.dataplugin.radar.util.RadarsInUseUtil;
|
||||
import com.raytheon.uf.common.monitor.config.SCANRunSiteConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.events.MonitorConfigEvent;
|
||||
import com.raytheon.uf.common.monitor.events.MonitorConfigListener;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
@ -47,6 +50,7 @@ import com.raytheon.uf.edex.plugin.preciprate.common.PrecipRateConfig;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 01/25/10 3796 D. Hladky Initial release
|
||||
* 02/25/13 1660 D. Hladky Fixed SCAN configuration bug.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -54,13 +58,18 @@ import com.raytheon.uf.edex.plugin.preciprate.common.PrecipRateConfig;
|
|||
* @version 1
|
||||
*/
|
||||
|
||||
public class PrecipRateGenerator extends CompositeProductGenerator {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
public class PrecipRateGenerator extends CompositeProductGenerator implements
|
||||
MonitorConfigListener{
|
||||
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(PrecipRateGenerator.class);
|
||||
|
||||
private static final String genName = "PrecipRate";
|
||||
|
||||
private static final String productType = "preciprate";
|
||||
|
||||
/** run configuration manager **/
|
||||
public SCANRunSiteConfigurationManager srcm = null;
|
||||
|
||||
/** Set of icaos to filter for */
|
||||
private Set<String> icaos = null;
|
||||
|
@ -77,11 +86,24 @@ public class PrecipRateGenerator extends CompositeProductGenerator {
|
|||
@Override
|
||||
protected void configureFilters() {
|
||||
|
||||
logger.debug(getGeneratorName() + " process Filter Config...");
|
||||
icaos = new HashSet<String>(RadarsInUseUtil.getSite(null,
|
||||
RadarsInUseUtil.LOCAL_CONSTANT));
|
||||
icaos.addAll(RadarsInUseUtil.getSite(null,
|
||||
RadarsInUseUtil.DIAL_CONSTANT));
|
||||
statusHandler.handle(Priority.INFO, getGeneratorName()
|
||||
+ " process Filter Config...");
|
||||
|
||||
try {
|
||||
getRunConfig().readConfigXml();
|
||||
} catch (SerializationException e) {
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"Couldn't read PrecipRate(scan) configuration!!!", e);
|
||||
}
|
||||
boolean configValid = getRunConfig().isPopulated();
|
||||
|
||||
if (!configValid) {
|
||||
statusHandler.handle(Priority.WARN,
|
||||
"Configuration for PrecipRate(scan) is invalid!!!");
|
||||
return;
|
||||
}
|
||||
|
||||
icaos = new HashSet<String>(getRunConfig().getSiteNames());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -96,7 +118,7 @@ public class PrecipRateGenerator extends CompositeProductGenerator {
|
|||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Couldn't create PrecipRate URIFilter.." + icao
|
||||
+ " is not a know RADAR site.");
|
||||
+ " is not a know RADAR site.", e);
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
@ -168,4 +190,26 @@ public class PrecipRateGenerator extends CompositeProductGenerator {
|
|||
return getConfigManager().getPrecipRateState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configChanged(MonitorConfigEvent fce) {
|
||||
if (fce.getSource() instanceof SCANRunSiteConfigurationManager) {
|
||||
statusHandler.handle(Priority.INFO,
|
||||
"Re-configuring PrecipRate URI filters...Run Site Config change");
|
||||
resetFilters();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* run config manager
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public SCANRunSiteConfigurationManager getRunConfig() {
|
||||
if (srcm == null) {
|
||||
srcm = SCANRunSiteConfigurationManager.getInstance();
|
||||
srcm.addListener(this);
|
||||
}
|
||||
return srcm;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,8 +29,11 @@ import com.raytheon.edex.urifilter.URIGenerateMessage;
|
|||
import com.raytheon.uf.common.dataplugin.qpf.QPFRecord;
|
||||
import com.raytheon.uf.common.dataplugin.qpf.QPFRecord.DATA_TYPE;
|
||||
import com.raytheon.uf.common.dataplugin.qpf.dao.QPFDao;
|
||||
import com.raytheon.uf.common.dataplugin.radar.util.RadarsInUseUtil;
|
||||
import com.raytheon.uf.common.monitor.config.SCANRunSiteConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.events.MonitorConfigEvent;
|
||||
import com.raytheon.uf.common.monitor.events.MonitorConfigListener;
|
||||
import com.raytheon.uf.common.monitor.scan.ScanUtils;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
@ -49,6 +52,7 @@ import com.raytheon.uf.edex.plugin.qpf.common.QPFConfig;
|
|||
* 02/07/2009 1981 dhladky Initial Creation.
|
||||
* 04/27/2012 #562 dgilling Accept getter and setter
|
||||
* renames in QPFRecord.
|
||||
* 02/25/13 1660 D. Hladky Fixed configuration bug in scan.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -56,7 +60,8 @@ import com.raytheon.uf.edex.plugin.qpf.common.QPFConfig;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class QPFGenerator extends CompositeProductGenerator {
|
||||
public class QPFGenerator extends CompositeProductGenerator implements
|
||||
MonitorConfigListener {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(QPFGenerator.class);
|
||||
|
@ -65,6 +70,9 @@ public class QPFGenerator extends CompositeProductGenerator {
|
|||
|
||||
private static final String productType = "qpf";
|
||||
|
||||
/** run configuration manager **/
|
||||
public SCANRunSiteConfigurationManager srcm = null;
|
||||
|
||||
/** Set of icaos to filter for */
|
||||
private Set<String> icaos = null;
|
||||
|
||||
|
@ -92,7 +100,7 @@ public class QPFGenerator extends CompositeProductGenerator {
|
|||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Couldn't create QPF URIFilter.." + icao
|
||||
+ " is not a know RADAR site.");
|
||||
+ " is not a know RADAR site.", e);
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
@ -102,11 +110,24 @@ public class QPFGenerator extends CompositeProductGenerator {
|
|||
@Override
|
||||
protected void configureFilters() {
|
||||
|
||||
logger.info(getGeneratorName() + " process Filter Config...");
|
||||
icaos = new HashSet<String>(RadarsInUseUtil.getSite(null,
|
||||
RadarsInUseUtil.LOCAL_CONSTANT));
|
||||
icaos.addAll(RadarsInUseUtil.getSite(null,
|
||||
RadarsInUseUtil.DIAL_CONSTANT));
|
||||
statusHandler.handle(Priority.INFO, getGeneratorName()
|
||||
+ " process Filter Config...");
|
||||
|
||||
try {
|
||||
getRunConfig().readConfigXml();
|
||||
} catch (SerializationException e) {
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"Couldn't read qpf(scan) configuration!!!", e);
|
||||
}
|
||||
boolean configValid = getRunConfig().isPopulated();
|
||||
|
||||
if (!configValid) {
|
||||
statusHandler.handle(Priority.WARN,
|
||||
"Configuration for qpf(scan) is invalid!!!");
|
||||
return;
|
||||
}
|
||||
|
||||
icaos = new HashSet<String>(getRunConfig().getSiteNames());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -168,4 +189,26 @@ public class QPFGenerator extends CompositeProductGenerator {
|
|||
return getConfigManager().getQPFState();
|
||||
}
|
||||
|
||||
/**
|
||||
* run config manager
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public SCANRunSiteConfigurationManager getRunConfig() {
|
||||
if (srcm == null) {
|
||||
srcm = SCANRunSiteConfigurationManager.getInstance();
|
||||
srcm.addListener(this);
|
||||
}
|
||||
return srcm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configChanged(MonitorConfigEvent fce) {
|
||||
if (fce.getSource() instanceof SCANRunSiteConfigurationManager) {
|
||||
statusHandler.handle(Priority.INFO,
|
||||
"Re-configuring QPF URI filters...Run Site Config change");
|
||||
resetFilters();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -47,9 +47,26 @@ import com.raytheon.uf.edex.cpgsrv.CompositeProductGenerator;
|
|||
import com.raytheon.uf.edex.dat.utils.DatMenuUtil;
|
||||
import com.raytheon.uf.edex.dat.utils.ScanDataCache;
|
||||
|
||||
/**
|
||||
* Generator implementation for SCAN
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 02/25/13 1660 D. Hladky Fixed SCAN configuration bug.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
* @version 1
|
||||
*/
|
||||
|
||||
public class ScanGenerator extends CompositeProductGenerator implements
|
||||
MonitorConfigListener {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ScanGenerator.class);
|
||||
|
||||
private static final String genName = "SCAN";
|
||||
|
@ -79,21 +96,22 @@ public class ScanGenerator extends CompositeProductGenerator implements
|
|||
@Override
|
||||
protected void configureFilters() {
|
||||
|
||||
statusHandler.handle(Priority.DEBUG, getGeneratorName()
|
||||
statusHandler.handle(Priority.INFO, getGeneratorName()
|
||||
+ " process Filter Config...");
|
||||
|
||||
try {
|
||||
getRunConfig().readConfigXml();
|
||||
} catch (SerializationException e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.ERROR, "Couldn't read scan configuration!!!", e);
|
||||
}
|
||||
boolean configValid = getRunConfig().isPopulated();
|
||||
|
||||
if (!configValid) {
|
||||
statusHandler.handle(Priority.WARN,
|
||||
"Configuration for SCAN is invalid!!!");
|
||||
return;
|
||||
}
|
||||
|
||||
logger.debug(getGeneratorName() + " process Filter Config...");
|
||||
icaos = new HashSet<String>(getRunConfig().getSiteNames());
|
||||
}
|
||||
|
||||
|
@ -110,7 +128,7 @@ public class ScanGenerator extends CompositeProductGenerator implements
|
|||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Couldn't create SCAN URIFilter.." + icao
|
||||
+ " is not a known RADAR site.");
|
||||
+ " is not a known RADAR site.", e);
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,11 +26,14 @@ import java.util.Set;
|
|||
|
||||
import com.raytheon.edex.urifilter.URIFilter;
|
||||
import com.raytheon.edex.urifilter.URIGenerateMessage;
|
||||
import com.raytheon.uf.common.dataplugin.radar.util.RadarsInUseUtil;
|
||||
import com.raytheon.uf.common.dataplugin.vil.VILRecord;
|
||||
import com.raytheon.uf.common.dataplugin.vil.VILRecord.DATA_TYPE;
|
||||
import com.raytheon.uf.common.dataplugin.vil.dao.VILDao;
|
||||
import com.raytheon.uf.common.monitor.config.SCANRunSiteConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.events.MonitorConfigEvent;
|
||||
import com.raytheon.uf.common.monitor.events.MonitorConfigListener;
|
||||
import com.raytheon.uf.common.monitor.scan.ScanUtils;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
@ -47,6 +50,7 @@ import com.raytheon.uf.edex.plugin.vil.common.VILConfig;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 02/07/2009 2037 dhladky Initial Creation.
|
||||
* 02/25/13 1660 D. Hladky Fixed SCAN configuration bug.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -54,8 +58,9 @@ import com.raytheon.uf.edex.plugin.vil.common.VILConfig;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class VILGenerator extends CompositeProductGenerator {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
public class VILGenerator extends CompositeProductGenerator implements
|
||||
MonitorConfigListener {
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(VILGenerator.class);
|
||||
|
||||
private static final String genName = "VIL";
|
||||
|
@ -64,6 +69,9 @@ public class VILGenerator extends CompositeProductGenerator {
|
|||
|
||||
/** Set of icaos to filter for */
|
||||
private Set<String> icaos = null;
|
||||
|
||||
/** run configuration manager **/
|
||||
public SCANRunSiteConfigurationManager srcm = null;
|
||||
|
||||
/**
|
||||
* Public constructor for VILGenerator
|
||||
|
@ -88,7 +96,7 @@ public class VILGenerator extends CompositeProductGenerator {
|
|||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Couldn't create VIL URIFilter.." + icao
|
||||
+ " is not a know RADAR site.");
|
||||
+ " is not a know RADAR site.", e);
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
@ -98,11 +106,24 @@ public class VILGenerator extends CompositeProductGenerator {
|
|||
@Override
|
||||
protected void configureFilters() {
|
||||
|
||||
statusHandler.handle(Priority.DEBUG, "Process Filter Config...");
|
||||
icaos = new HashSet<String>(RadarsInUseUtil.getSite(null,
|
||||
RadarsInUseUtil.LOCAL_CONSTANT));
|
||||
icaos.addAll(RadarsInUseUtil.getSite(null,
|
||||
RadarsInUseUtil.DIAL_CONSTANT));
|
||||
statusHandler.handle(Priority.INFO, getGeneratorName()
|
||||
+ " process Filter Config...");
|
||||
|
||||
try {
|
||||
getRunConfig().readConfigXml();
|
||||
} catch (SerializationException e) {
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"Couldn't read VIL(scan) configuration!!!", e);
|
||||
}
|
||||
boolean configValid = getRunConfig().isPopulated();
|
||||
|
||||
if (!configValid) {
|
||||
statusHandler.handle(Priority.WARN,
|
||||
"Configuration for vil(scan) is invalid!!!");
|
||||
return;
|
||||
}
|
||||
|
||||
icaos = new HashSet<String>(getRunConfig().getSiteNames());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -161,4 +182,26 @@ public class VILGenerator extends CompositeProductGenerator {
|
|||
return getConfigManager().getVILState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configChanged(MonitorConfigEvent fce) {
|
||||
if (fce.getSource() instanceof SCANRunSiteConfigurationManager) {
|
||||
statusHandler.handle(Priority.INFO,
|
||||
"Re-configuring VIL URI filters...Run Site Config change");
|
||||
resetFilters();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* run config manager
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public SCANRunSiteConfigurationManager getRunConfig() {
|
||||
if (srcm == null) {
|
||||
srcm = SCANRunSiteConfigurationManager.getInstance();
|
||||
srcm.addListener(this);
|
||||
}
|
||||
return srcm;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -13,6 +13,7 @@ function setupEnv() {
|
|||
nasHost=nas1
|
||||
nasVolName=dataFXA # This is so we can change it for new nas!
|
||||
lsofCommand="lsof -Pns -p"
|
||||
platformName=$( hostname | cut -f2 -d'-')
|
||||
|
||||
if [[ ${logDirectory}/${logName} -ot ${logDirectory}/$( basename $0 .sh ).$(date --date='1 day ago' +%A).log ]]
|
||||
then
|
||||
|
@ -100,25 +101,41 @@ function runlsof() {
|
|||
function captureQpidStat() {
|
||||
|
||||
local returnCode=0
|
||||
local qpidConnLimit=500
|
||||
local qpidConnMedAlarm=75
|
||||
local qpidConnHighAlarm=40
|
||||
local qpidConnCritAlarm=15
|
||||
|
||||
case "${platformName}" in
|
||||
[a-z][a-z][a-z]n ) qpidConnLimit=1000 ; echo -e "\tNOTE: Setting Max qpidd connection to 1000 due to NCEP site" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out ;;
|
||||
esac
|
||||
|
||||
echo -ne "\n| START " >> ${logDirectory}/${nowTimeDate}-qpid-stat.out
|
||||
echoDate >> ${logDirectory}/${nowTimeDate}-qpid-stat.out
|
||||
echo -e "----------------------------------------------------------------|\n" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out
|
||||
|
||||
# Send ITO alarm to NCF - Thank you Sean Bowser for your guidance here. You are wise.
|
||||
numQpidConnections=$( qpid-stat -c | wc -l )
|
||||
(( numQpidConnections-=3 ))
|
||||
echo -e "Total Number of QPID Connections: ${numQpidConnections}" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out
|
||||
if [[ ${numQpidConnections} -ge 450 && ${numQpidConnections} -le 485 ]] ; then
|
||||
echo -e "\tNOTE: Sending Major ITO to NCF because number of connections is between 450 and 485" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out
|
||||
if [[ ${numQpidConnections} -ge $(( qpidConnLimit - qpidConnMedAlarm )) && ${numQpidConnections} -lt $(( qpidConnLimit - qpidConnHighAlarm )) ]] ; then
|
||||
echo -e "\tNOTE: Sending Warning ITO to NCF because number of connections is between $(( qpidConnLimit - qpidConnMedAlarm )) and $(( qpidConnLimit - qpidConnHighAlarm ))" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out
|
||||
if [[ -f /opt/OV/bin/OpC/opcmsg ]] ; then
|
||||
opt/OV/bin/OpC/opcmsg application=QPIDD object=QPIDD msg_text="Number Of Connections To QPID is between 450-485: Please check system health" severity=Major msg_grp=AWIPS
|
||||
/opt/OV/bin/OpC/opcmsg application=QPIDD object=QPIDD msg_text="Number Of Connections To QPID is between $(( qpidConnLimit - qpidConnMedAlarm )) and $(( qpidConnLimit - qpidConnHighAlarm )) : Please check for deadlock condition" severity=Warning msg_grp=AWIPS
|
||||
else
|
||||
echo -e "\tERROR - can not find /opt/OV/bin/OpC/opcmsg on $( hostname )" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out
|
||||
fi
|
||||
elif [[ ${numQpidConnections} -gt 485 ]] ; then
|
||||
echo -e "\tNOTE: Sending CRITIAL ITO to NCF because number of connections is > 485" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out
|
||||
elif [[ ${numQpidConnections} -ge $(( qpidConnLimit - qpidConnHighAlarm )) && ${numQpidConnections} -lt $(( qpidConnLimit - qpidConnCritAlarm )) ]] ; then
|
||||
echo -e "\tNOTE: Sending Major ITO to NCF because number of connections is between $(( qpidConnLimit - qpidConnHighAlarm )) and $(( qpidConnLimit - qpidConnCritAlarm ))" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out
|
||||
if [[ -f /opt/OV/bin/OpC/opcmsg ]] ; then
|
||||
/opt/OV/bin/OpC/opcmsg application=QPIDD object=QPIDD msg_text="Number Of Connections To QPID is between $(( qpidConnLimit - qpidConnMedAlarm )) and $(( qpidConnLimit - qpidConnHighAlarm )) : Please check for deadlock condition" severity=Major msg_grp=AWIPS
|
||||
else
|
||||
echo -e "\tERROR - can not find /opt/OV/bin/OpC/opcmsg on $( hostname )" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out
|
||||
fi
|
||||
elif [[ ${numQpidConnections} -ge $(( qpidConnLimit - qpidConnCritAlarm )) ]] ; then
|
||||
echo -e "\tNOTE: Sending CRITIAL ITO to NCF because number of connections is >= $(( qpidConnLimit - qpidConnCritAlarm ))" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out
|
||||
if [[ -f /opt/OV/bin/OpC/opcmsg ]] ; then
|
||||
/opt/OV/bin/OpC/opcmsg application=QPIDD object=QPIDD msg_text="Number Of Connections To QPID is > 485 -- Take IMMEDIATE action to prevent system failure" severity=Critical msg_grp=AWIPS
|
||||
/opt/OV/bin/OpC/opcmsg application=QPIDD object=QPIDD msg_text="Number Of Connections To QPID is >= $(( qpidConnLimit - qpidConnCritAlarm )) -- Take IMMEDIATE action to prevent system failure" severity=Critical msg_grp=AWIPS
|
||||
else
|
||||
echo -e "\tERROR - can not find /opt/OV/bin/OpC/opcmsg on $( hostname )" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out
|
||||
fi
|
||||
|
|
|
@ -191,7 +191,7 @@ cp -P %{_baseline_workspace}/${PATCH_DIR}/lib/* \
|
|||
cp -f %{_baseline_workspace}/${PATCH_DIR}/etc/* \
|
||||
${RPM_BUILD_ROOT}/usr/local/ldm-6.8.1/etc
|
||||
|
||||
# Merge pqact.conf.oax and pqact.conf.template to create
|
||||
# Merge pqact.conf.dev and pqact.conf.template to create
|
||||
# our pqact.conf file.
|
||||
pushd . > /dev/null 2>&1
|
||||
cd ${RPM_BUILD_ROOT}/usr/local/ldm-6.8.1/etc
|
||||
|
@ -199,8 +199,8 @@ if [ ! -f pqact.conf.template ]; then
|
|||
echo "ERROR: pqact.conf.template does not exist."
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -f pqact.conf.oax ]; then
|
||||
echo "ERROR: pqact.conf.oax does not exist."
|
||||
if [ ! -f pqact.conf.dev ]; then
|
||||
echo "ERROR: pqact.conf.dev does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -210,10 +210,10 @@ if [ ${RC} -ne 0 ]; then
|
|||
echo "ERROR: Unable to create the pqact.conf file."
|
||||
exit 1
|
||||
fi
|
||||
cat pqact.conf.oax >> pqact.conf
|
||||
cat pqact.conf.dev >> pqact.conf
|
||||
RC=$?
|
||||
if [ ${RC} -ne 0 ]; then
|
||||
echo "ERROR: Unable to merge pqact.conf.oax and pqact.conf."
|
||||
echo "ERROR: Unable to merge pqact.conf.dev and pqact.conf."
|
||||
exit 1
|
||||
fi
|
||||
popd > /dev/null 2>&1
|
||||
|
|
|
@ -38,6 +38,7 @@ import com.raytheon.uf.common.util.registry.RegistryException;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 14, 2012 1286 djohnson Initial creation
|
||||
* Mar 05, 2013 1754 djohnson Test that infinite loop for request server does not occur.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -95,10 +96,10 @@ public class RequestRouterTest {
|
|||
|
||||
verify(requestServerRouter).route(serverRequest);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testWithServiceSendsToRegisteredRouter() throws Exception {
|
||||
|
||||
|
||||
RequestRouter.route(serverRequest, SERVICE1_KEY);
|
||||
|
||||
verify(server1Router).route(serverRequest);
|
||||
|
@ -126,6 +127,13 @@ public class RequestRouterTest {
|
|||
verify(server1Router, never()).route(serverRequest);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
public void testUnregisteredRequestRouterWillThrowIllegalStateException()
|
||||
throws Throwable {
|
||||
RequestRouterTest.clearRegistry();
|
||||
RequestRouter.route(serverRequest, RequestRouter.REQUEST_SERVICE);
|
||||
}
|
||||
|
||||
@Test(expected = RegistryException.class)
|
||||
public void testRegisteringTwoRequestRoutersWithSameKeyThrowsException()
|
||||
throws Exception {
|
||||
|
|
Loading…
Add table
Reference in a new issue