Issue #3026 - Implement HPE bias source labels on FFMP and volume browser displays
Change-Id: Ib17ff7cfcb5efcb1737804800a93ec4f82bc6f13 Former-commit-id: 57755db0d6d77f32d64b4b569bb0af88002a23da
This commit is contained in:
parent
0308147ad4
commit
8498235fd8
45 changed files with 2702 additions and 30 deletions
|
@ -169,4 +169,10 @@
|
|||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.raytheon.uf.common.plugin.hpe"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"/>
|
||||
|
||||
</feature>
|
||||
|
|
7
cave/com.raytheon.uf.viz.hpe/.classpath
Normal file
7
cave/com.raytheon.uf.viz.hpe/.classpath
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
28
cave/com.raytheon.uf.viz.hpe/.project
Normal file
28
cave/com.raytheon.uf.viz.hpe/.project
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.raytheon.uf.viz.hpe</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,11 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
22
cave/com.raytheon.uf.viz.hpe/META-INF/MANIFEST.MF
Normal file
22
cave/com.raytheon.uf.viz.hpe/META-INF/MANIFEST.MF
Normal file
|
@ -0,0 +1,22 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Hpe
|
||||
Bundle-SymbolicName: com.raytheon.uf.viz.hpe; singleton:=true
|
||||
Bundle-Version: 1.14.0.qualifier
|
||||
Bundle-Vendor: RAYTHEON
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
com.raytheon.uf.common.dataplugin.shef;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.plugin.hpe;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.status;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.time;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.util;bundle-version="1.14.0",
|
||||
com.raytheon.uf.viz.core;bundle-version="1.14.2",
|
||||
com.raytheon.viz.hydrocommon;bundle-version="1.12.1174",
|
||||
com.raytheon.viz.ui;bundle-version="1.14.0",
|
||||
com.raytheon.uf.viz.monitor.ffmp;bundle-version="1.12.1174",
|
||||
com.raytheon.viz.grid;bundle-version="1.14.0",
|
||||
com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.geospatial;bundle-version="1.14.0",
|
||||
com.raytheon.uf.viz.core.rsc;bundle-version="1.0.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
4
cave/com.raytheon.uf.viz.hpe/build.properties
Normal file
4
cave/com.raytheon.uf.viz.hpe/build.properties
Normal file
|
@ -0,0 +1,4 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
30
cave/com.raytheon.uf.viz.hpe/plugin.xml
Normal file
30
cave/com.raytheon.uf.viz.hpe/plugin.xml
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<?eclipse version="3.3"?>
|
||||
<plugin>
|
||||
<extension
|
||||
point="com.raytheon.viz.ui.displayCustomizer">
|
||||
<displayCustomizer
|
||||
customizer="com.raytheon.uf.viz.hpe.D2DHpeDisplayCustomizer"
|
||||
perspective="D2D">
|
||||
</displayCustomizer>
|
||||
</extension>
|
||||
</plugin>
|
|
@ -0,0 +1,265 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.hpe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
|
||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource.ResourceStatus;
|
||||
import com.raytheon.uf.viz.core.rsc.IInitListener;
|
||||
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
|
||||
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
||||
import com.raytheon.uf.viz.core.rsc.ResourceList.AddListener;
|
||||
import com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener;
|
||||
import com.raytheon.uf.viz.hpe.rsc.HpeLabelResourceData;
|
||||
import com.raytheon.uf.viz.hpe.util.HpeUtils;
|
||||
import com.raytheon.viz.grid.rsc.general.D2DGridResource;
|
||||
import com.raytheon.viz.ui.perspectives.IRenderableDisplayCustomizer;
|
||||
|
||||
/**
|
||||
* This class listens to existing resources and adds the HPE "legend" text as
|
||||
* needed.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 5, 2014 3026 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class D2DHpeDisplayCustomizer implements IRenderableDisplayCustomizer {
|
||||
|
||||
/** List of listeners we have for renderable displays */
|
||||
private final List<D2DHpeResourceListener> listeners = new ArrayList<D2DHpeResourceListener>();
|
||||
|
||||
@Override
|
||||
public void customizeDisplay(IRenderableDisplay display) {
|
||||
boolean add = true;
|
||||
for (D2DHpeResourceListener listener : listeners) {
|
||||
if (display == listener.getDisplay()) {
|
||||
add = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (add) {
|
||||
listeners.add(new D2DHpeResourceListener(display));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uncustomizeDisplay(IRenderableDisplay display) {
|
||||
D2DHpeResourceListener toRemove = null;
|
||||
for (D2DHpeResourceListener listener : listeners) {
|
||||
if (listener.getDisplay() == display) {
|
||||
toRemove = listener;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (toRemove != null) {
|
||||
toRemove.dispose();
|
||||
listeners.remove(toRemove);
|
||||
}
|
||||
}
|
||||
|
||||
private static class D2DHpeResourceListener implements AddListener,
|
||||
RemoveListener, IInitListener {
|
||||
|
||||
private final IRenderableDisplay display;
|
||||
|
||||
private boolean resourcesAdded = false;
|
||||
|
||||
private ResourcePair hpeResourcePair;
|
||||
|
||||
public D2DHpeResourceListener(IRenderableDisplay display) {
|
||||
this.display = display;
|
||||
IDescriptor descriptor = display.getDescriptor();
|
||||
ResourceList list = descriptor.getResourceList();
|
||||
if (hasCompatibleResource(list)) {
|
||||
addResources(descriptor);
|
||||
}
|
||||
list.addPostAddListener(this);
|
||||
list.addPostRemoveListener(this);
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
ResourceList list = display.getDescriptor().getResourceList();
|
||||
list.removePostAddListener(this);
|
||||
list.removePostRemoveListener(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener#notifyRemove
|
||||
* (com.raytheon.uf.viz.core.drawables.ResourcePair)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void notifyRemove(ResourcePair rp)
|
||||
throws VizException {
|
||||
if (resourcesAdded) {
|
||||
if (rp.getResource() != null) {
|
||||
rp.getResource().unregisterListener(this);
|
||||
}
|
||||
if (isCompatibleResource(rp)) {
|
||||
IDescriptor descriptor = display.getDescriptor();
|
||||
if (hasCompatibleResource(descriptor.getResourceList()) == false) {
|
||||
removeResources(descriptor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.rsc.ResourceList.AddListener#notifyAdd(com
|
||||
* .raytheon .uf.viz.core.drawables.ResourcePair)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void notifyAdd(ResourcePair rp) throws VizException {
|
||||
if (!resourcesAdded) {
|
||||
AbstractVizResource<?, ?> rsc = rp.getResource();
|
||||
if (rsc != null) {
|
||||
rsc.registerListener(this);
|
||||
if (rsc.getStatus() == ResourceStatus.INITIALIZED
|
||||
&& isCompatibleResource(rp)) {
|
||||
addResources(display.getDescriptor());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasCompatibleResource(ResourceList list) {
|
||||
for (ResourcePair rp : list) {
|
||||
if (isCompatibleResource(rp)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isCompatibleResource(ResourcePair rp) {
|
||||
AbstractVizResource<?, ?> resource = rp.getResource();
|
||||
if (resource != null) {
|
||||
if (resource instanceof D2DGridResource) {
|
||||
D2DGridResource rsc = (D2DGridResource) resource;
|
||||
return HpeUtils.isHpe(rsc.getCurrentGridRecord());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private synchronized void addResources(IDescriptor descriptor) {
|
||||
if (!resourcesAdded) {
|
||||
ResourceList list = descriptor.getResourceList();
|
||||
hpeResourcePair = constructHpeLabelResource();
|
||||
list.add(hpeResourcePair);
|
||||
|
||||
list.instantiateResources(descriptor, true);
|
||||
resourcesAdded = true;
|
||||
|
||||
// add hpe resource as a listener
|
||||
for (ResourcePair rp : list) {
|
||||
AbstractVizResource<?, ?> resource = rp.getResource();
|
||||
if (resource != null) {
|
||||
if (resource instanceof D2DGridResource) {
|
||||
D2DGridResource rsc = (D2DGridResource) resource;
|
||||
rsc.getResourceData().addChangeListener(
|
||||
(IResourceDataChanged) hpeResourcePair
|
||||
.getResource());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void removeResources(IDescriptor descriptor) {
|
||||
if (resourcesAdded) {
|
||||
if (hpeResourcePair != null) {
|
||||
ResourceList list = descriptor.getResourceList();
|
||||
list.remove(hpeResourcePair);
|
||||
for (ResourcePair rp : list) {
|
||||
AbstractVizResource<?, ?> resource = rp.getResource();
|
||||
if (resource != null) {
|
||||
if (resource instanceof D2DGridResource) {
|
||||
D2DGridResource rsc = (D2DGridResource) resource;
|
||||
rsc.getResourceData().removeChangeListener(
|
||||
(IResourceDataChanged) hpeResourcePair
|
||||
.getResource());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hpeResourcePair = null;
|
||||
}
|
||||
resourcesAdded = false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.rsc.IInitListener#inited(com.raytheon.uf
|
||||
* .viz.core.rsc.AbstractVizResource)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void inited(AbstractVizResource<?, ?> rsc) {
|
||||
if (rsc instanceof D2DGridResource) {
|
||||
GridRecord gridRec = ((D2DGridResource) rsc)
|
||||
.getCurrentGridRecord();
|
||||
if (!resourcesAdded && HpeUtils.isHpe(gridRec)) {
|
||||
addResources(rsc.getDescriptor());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the IRenderableDisplay
|
||||
*
|
||||
* @return the display
|
||||
*/
|
||||
public IRenderableDisplay getDisplay() {
|
||||
return display;
|
||||
}
|
||||
}
|
||||
|
||||
private static ResourcePair constructHpeLabelResource() {
|
||||
return ResourcePair
|
||||
.constructSystemResourcePair(new HpeLabelResourceData());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,225 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.hpe.rsc;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||
import com.raytheon.uf.common.plugin.hpe.request.HpeLabelDataRequest;
|
||||
import com.raytheon.uf.common.plugin.hpe.request.HpeLabelDataResponse;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.DrawableString;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
|
||||
import com.raytheon.uf.viz.core.drawables.IFont;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
|
||||
import com.raytheon.uf.viz.hpe.util.HpeUtils;
|
||||
import com.raytheon.viz.grid.rsc.general.D2DGridResource;
|
||||
|
||||
/**
|
||||
* A resource to display HPE label text in the upper left corner of the display
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 5, 2014 3026 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class HpeLabelResource extends
|
||||
AbstractVizResource<HpeLabelResourceData, MapDescriptor> implements
|
||||
IResourceDataChanged {
|
||||
|
||||
private final IUFStatusHandler logger = UFStatus
|
||||
.getHandler(HpeLabelResource.class);
|
||||
|
||||
private final Map<Date, String> hpeTextCache = Collections
|
||||
.synchronizedMap(new HashMap<Date, String>());
|
||||
|
||||
private DrawableString drawableString = null;
|
||||
|
||||
private IFont font = null;
|
||||
|
||||
private final HpeSourceDataJob dataJob = new HpeSourceDataJob();
|
||||
|
||||
protected HpeLabelResource(HpeLabelResourceData resourceData,
|
||||
LoadProperties loadProperties) {
|
||||
super(resourceData, loadProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resourceChanged(ChangeType type, Object object) {
|
||||
if (type == ChangeType.DATA_REMOVE) {
|
||||
if (object instanceof DataTime) {
|
||||
hpeTextCache.remove(((DataTime) object).getRefTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void disposeInternal() {
|
||||
if (font != null) {
|
||||
font.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintInternal(IGraphicsTarget target,
|
||||
PaintProperties paintProps) throws VizException {
|
||||
ResourceList rscList = this.descriptor.getResourceList();
|
||||
if (rscList != null) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
// Find all D2DGridResources
|
||||
List<D2DGridResource> list = rscList
|
||||
.getResourcesByTypeAsType(D2DGridResource.class);
|
||||
if (!list.isEmpty()) {
|
||||
double[] pixel = paintProps.getView().getDisplayCoords(
|
||||
new double[] { 125, 50 }, target);
|
||||
RGB color = getCapability(ColorableCapability.class).getColor();
|
||||
for (D2DGridResource rsc : list) {
|
||||
GridRecord currentGridRec = rsc.getCurrentGridRecord();
|
||||
color = rsc.getCapability(ColorableCapability.class)
|
||||
.getColor();
|
||||
if (HpeUtils.isHpe(currentGridRec)) {
|
||||
// this is HPE so display the bias information
|
||||
String text = getText(currentGridRec.getDataTime()
|
||||
.getRefTime(), currentGridRec.getSecondaryId());
|
||||
if (text != null) {
|
||||
sb.append(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sb.length() > 0) {
|
||||
drawableString.setText(sb.toString(), color);
|
||||
drawableString.setCoordinates(pixel[0], pixel[1]);
|
||||
target.drawStrings(drawableString);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initInternal(IGraphicsTarget target) throws VizException {
|
||||
if (font == null) {
|
||||
font = target.initializeFont("Dialog", 11, null);
|
||||
}
|
||||
font.setMagnification(getCapability(MagnificationCapability.class)
|
||||
.getMagnification().floatValue());
|
||||
|
||||
drawableString = new DrawableString("", getCapability(
|
||||
ColorableCapability.class).getColor());
|
||||
drawableString.font = font;
|
||||
drawableString.horizontalAlignment = HorizontalAlignment.CENTER;
|
||||
drawableString.verticallAlignment = VerticalAlignment.MIDDLE;
|
||||
}
|
||||
|
||||
private String getText(Date date, String productId) {
|
||||
String text = hpeTextCache.get(date);
|
||||
if (text == null) {
|
||||
dataJob.scheduleRetrieval(date, productId);
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.rsc.AbstractVizResource#resourceDataChanged(
|
||||
* com.raytheon.uf.viz.core.rsc.IResourceDataChanged.ChangeType,
|
||||
* java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
protected void resourceDataChanged(ChangeType type, Object updateObject) {
|
||||
super.resourceDataChanged(type, updateObject);
|
||||
}
|
||||
|
||||
private class HpeSourceDataJob extends Job {
|
||||
private volatile String productId;
|
||||
|
||||
private volatile Date date;
|
||||
|
||||
public HpeSourceDataJob() {
|
||||
super("Get HPE Source");
|
||||
}
|
||||
|
||||
protected void scheduleRetrieval(Date date, String productId) {
|
||||
this.productId = productId;
|
||||
this.date = date;
|
||||
if (this.getState() == Job.RUNNING
|
||||
|| this.getState() == Job.SLEEPING
|
||||
|| this.getState() == Job.WAITING) {
|
||||
return;
|
||||
}
|
||||
this.schedule();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
// Request the text from edex
|
||||
try {
|
||||
HpeLabelDataRequest req = new HpeLabelDataRequest(productId,
|
||||
date);
|
||||
HpeLabelDataResponse response = (HpeLabelDataResponse) ThriftClient
|
||||
.sendRequest(req);
|
||||
Map<Date, String> data = response.getData();
|
||||
for (Date d : data.keySet()) {
|
||||
hpeTextCache.put(d, data.get(d));
|
||||
}
|
||||
} catch (VizException e) {
|
||||
statusHandler.error(e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.hpe.rsc;
|
||||
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
|
||||
/**
|
||||
* Resource data object for the HpeLabelResource.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 5, 2014 3026 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class HpeLabelResourceData extends AbstractResourceData {
|
||||
|
||||
@Override
|
||||
public AbstractVizResource<?, ?> construct(LoadProperties loadProperties,
|
||||
IDescriptor descriptor) throws VizException {
|
||||
HpeLabelResource rsc = new HpeLabelResource(this, loadProperties);
|
||||
addChangeListener(rsc);
|
||||
return rsc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Object updateData) {
|
||||
// No op
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || (!(obj instanceof HpeLabelResourceData))) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.hpe.util;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||
import com.raytheon.uf.common.dataplugin.grid.dataset.DatasetInfo;
|
||||
import com.raytheon.uf.common.dataplugin.grid.dataset.DatasetInfoLookup;
|
||||
|
||||
/**
|
||||
* HPE Utilities
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 6, 2014 3026 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class HpeUtils {
|
||||
private static final String HPE = "HPE";
|
||||
|
||||
/**
|
||||
* Determine if this title represents an HPE model.
|
||||
*
|
||||
* @param gridRecord
|
||||
* The gridRecord to check
|
||||
* @return true if model is HPE, false otherwise
|
||||
*
|
||||
*/
|
||||
public static boolean isHpe(GridRecord gridRecord) {
|
||||
String title = null;
|
||||
if (gridRecord != null) {
|
||||
DatasetInfo info = DatasetInfoLookup.getInstance().getInfo(
|
||||
gridRecord.getDatasetId());
|
||||
if (info != null) {
|
||||
title = info.getTitle();
|
||||
}
|
||||
}
|
||||
|
||||
if (title == null) {
|
||||
return false;
|
||||
}
|
||||
return HPE.equals(title);
|
||||
}
|
||||
}
|
|
@ -27,7 +27,8 @@ Require-Bundle: org.eclipse.ui,
|
|||
com.raytheon.uf.common.event;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.dataaccess;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.colormap;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.style;bundle-version="1.0.0"
|
||||
com.raytheon.uf.common.style;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.plugin.hpe;bundle-version="1.0.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Import-Package: com.raytheon.uf.common.pointdata
|
||||
|
|
|
@ -22,6 +22,7 @@ package com.raytheon.uf.viz.monitor.ffmp.ui.rsc;
|
|||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -77,6 +78,8 @@ import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager;
|
|||
import com.raytheon.uf.common.monitor.xml.DomainXML;
|
||||
import com.raytheon.uf.common.monitor.xml.ProductXML;
|
||||
import com.raytheon.uf.common.monitor.xml.SourceXML;
|
||||
import com.raytheon.uf.common.plugin.hpe.request.HpeLabelDataRequest;
|
||||
import com.raytheon.uf.common.plugin.hpe.request.HpeLabelDataResponse;
|
||||
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.PerformanceStatus;
|
||||
|
@ -85,6 +88,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.common.time.util.ITimer;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.common.util.StringUtil;
|
||||
import com.raytheon.uf.viz.core.DrawableLine;
|
||||
import com.raytheon.uf.viz.core.DrawableString;
|
||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||
|
@ -105,6 +109,7 @@ import com.raytheon.uf.viz.core.drawables.ext.colormap.IColormapShadedShapeExten
|
|||
import com.raytheon.uf.viz.core.drawables.ext.colormap.IColormapShadedShapeExtension.IColormapShadedShape;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
||||
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
|
||||
|
@ -176,6 +181,7 @@ import com.vividsolutions.jts.geom.Point;
|
|||
* Jan 21, 2014 DR 15874 gzhang Use getValue() for QPFSCAN independent.
|
||||
* Feb 19, 2014 2819 randerso Removed unnecessary .clone() call
|
||||
* Mar 3, 2014 2804 mschenke Set back up clipping pane
|
||||
* May 05, 2014 3026 mpduff Display Hpe bias source.
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
|
@ -187,7 +193,7 @@ public class FFMPResource extends
|
|||
IResourceDataChanged, IFFMPResourceListener, FFMPListener {
|
||||
|
||||
/** Status handler */
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(FFMPResource.class);
|
||||
|
||||
/** Performance log statement prefix */
|
||||
|
@ -241,6 +247,9 @@ public class FFMPResource extends
|
|||
/** expansion of the window **/
|
||||
private static final double EXPANSION_FACTOR = 1.0;
|
||||
|
||||
/** HPE Constant */
|
||||
private static final String HPE = "HPE";
|
||||
|
||||
/** the stream cross hatched area **/
|
||||
private IWireframeShape streamOutlineShape = null;
|
||||
|
||||
|
@ -412,6 +421,16 @@ public class FFMPResource extends
|
|||
/** Restore Table flag */
|
||||
private boolean restoreTable = false;
|
||||
|
||||
/** HPE bias source legend cache */
|
||||
private final Map<Date, String> hpeLegendMap = Collections
|
||||
.synchronizedMap(new HashMap<Date, String>());
|
||||
|
||||
/** Flag denoting data as HPE */
|
||||
private boolean isHpe;
|
||||
|
||||
/** The job to get the HPE bias source info */
|
||||
private final HpeSourceDataJob dataJob = new HpeSourceDataJob();
|
||||
|
||||
/**
|
||||
* FFMP resource
|
||||
*
|
||||
|
@ -496,6 +515,12 @@ public class FFMPResource extends
|
|||
statusHandler.handle(Priority.PROBLEM, "Error updating record",
|
||||
ve);
|
||||
}
|
||||
} else if (type.equals(ChangeType.DATA_REMOVE)) {
|
||||
PluginDataObject[] pdos = (PluginDataObject[]) object;
|
||||
for (PluginDataObject pdo : pdos) {
|
||||
FFMPRecord ffmpRec = (FFMPRecord) pdo;
|
||||
hpeLegendMap.remove(ffmpRec.getDataTime().getRefTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -798,9 +823,10 @@ public class FFMPResource extends
|
|||
} else {
|
||||
switch (field) {
|
||||
case QPF: {
|
||||
value = getBasin(key, field, recentTime, aggregate).getValue(recentTime);// DR 15874
|
||||
//.getAverageValue(recentTime,
|
||||
//getQpfSourceExpiration());
|
||||
value = getBasin(key, field, recentTime, aggregate)
|
||||
.getValue(recentTime);// DR 15874
|
||||
// .getAverageValue(recentTime,
|
||||
// getQpfSourceExpiration());
|
||||
break;
|
||||
}
|
||||
case GUIDANCE: {
|
||||
|
@ -814,7 +840,7 @@ public class FFMPResource extends
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.error("Problem getting basin value", e);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -883,8 +909,8 @@ public class FFMPResource extends
|
|||
if (source.getSourceType().equals(
|
||||
FFMPSourceConfigurationManager.SOURCE_TYPE.GUIDANCE
|
||||
.getSourceType())) {
|
||||
prefix.append(source.getDisplayName() + " "
|
||||
+ source.getDurationHour() + " HR");
|
||||
prefix.append(source.getDisplayName()).append(" ")
|
||||
.append(source.getDurationHour()).append(" HR");
|
||||
} else {
|
||||
prefix.append(source.getDisplayName());
|
||||
}
|
||||
|
@ -914,6 +940,8 @@ public class FFMPResource extends
|
|||
/**
|
||||
* Gets the record currently used
|
||||
*
|
||||
* @param recentTime
|
||||
*
|
||||
* @return FFMPCacheRecord
|
||||
*/
|
||||
public FFMPRecord getRateRecord(Date recentTime) {
|
||||
|
@ -924,7 +952,8 @@ public class FFMPResource extends
|
|||
getDataKey(), getPrimarySource(), recentTime, false);
|
||||
isNewRate = false;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.error("Error retrieving the current rate record",
|
||||
e);
|
||||
}
|
||||
}
|
||||
return rateRecord;
|
||||
|
@ -944,9 +973,8 @@ public class FFMPResource extends
|
|||
isNewQpe = false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.error("Error retrieving the current QPE record", e);
|
||||
}
|
||||
// System.out.println("FFMPResource.getQPERecord(): " + getTableTime());
|
||||
|
||||
return qpeRecord;
|
||||
}
|
||||
|
@ -979,7 +1007,7 @@ public class FFMPResource extends
|
|||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.error("Error retrieving the current guid record", e);
|
||||
}
|
||||
|
||||
return guidRecord;
|
||||
|
@ -1008,7 +1036,7 @@ public class FFMPResource extends
|
|||
isNewQpf = false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.error("Error retrieving the current QPF record", e);
|
||||
}
|
||||
|
||||
return qpfRecord;
|
||||
|
@ -1029,7 +1057,8 @@ public class FFMPResource extends
|
|||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.error("Error retrieving the current virtual record",
|
||||
e);
|
||||
}
|
||||
|
||||
return virtualRecord;
|
||||
|
@ -1039,6 +1068,8 @@ public class FFMPResource extends
|
|||
* General get record call
|
||||
*
|
||||
* @param pfield
|
||||
* @param recentTime
|
||||
*
|
||||
* @return FFMPCacheRecord
|
||||
*/
|
||||
public FFMPRecord getRecord(FIELDS pfield, Date recentTime) {
|
||||
|
@ -1155,18 +1186,17 @@ public class FFMPResource extends
|
|||
@Override
|
||||
public void run() {
|
||||
|
||||
if (/* this. */font == null) {
|
||||
/* this. */font = target.initializeFont("Dialog", 11, null);
|
||||
if (font == null) {
|
||||
font = target.initializeFont("Dialog", 11, null);
|
||||
}
|
||||
|
||||
font.setMagnification(getCapability(
|
||||
MagnificationCapability.class).getMagnification()
|
||||
.floatValue());
|
||||
|
||||
if (/* this. */xfont == null) {
|
||||
if (xfont == null) {
|
||||
IFont.Style[] styles = new IFont.Style[] { IFont.Style.BOLD };
|
||||
/* this. */xfont = target.initializeFont("Monospace", 12,
|
||||
styles);
|
||||
xfont = target.initializeFont("Monospace", 12, styles);
|
||||
}
|
||||
|
||||
xfont.setMagnification(getCapability(
|
||||
|
@ -1189,6 +1219,9 @@ public class FFMPResource extends
|
|||
basinLocatorString.textStyle = TextStyle.BLANKED;
|
||||
}
|
||||
});
|
||||
|
||||
// Set flag for HPE data
|
||||
isHpe = resourceData.siteKey.equalsIgnoreCase(HPE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1427,13 +1460,24 @@ public class FFMPResource extends
|
|||
PaintProperties paintProps) throws VizException {
|
||||
double[] pixel = paintProps.getView().getDisplayCoords(
|
||||
new double[] { 110, 50 }, target);
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (isAutoRefresh || isQuery) {
|
||||
fieldDescString.setText("FFMP " + df.format(getTime()) + " hour "
|
||||
+ FFMPRecord.getFieldLongDescription(getField()),
|
||||
getCapability(ColorableCapability.class).getColor());
|
||||
sb.append("FFMP ").append(df.format(getTime())).append(" hour ")
|
||||
.append(FFMPRecord.getFieldLongDescription(getField()));
|
||||
}
|
||||
|
||||
// Paint the HPE bias source text if HPE
|
||||
if (isHpe) {
|
||||
String text = getText(paintTime.getRefTime(),
|
||||
qpeRecord.getMetaData());
|
||||
if (text != null) {
|
||||
sb.append(StringUtil.NEWLINE);
|
||||
sb.append(text);
|
||||
}
|
||||
}
|
||||
|
||||
fieldDescString.setText(sb.toString(),
|
||||
getCapability(ColorableCapability.class).getColor());
|
||||
fieldDescString.setCoordinates(pixel[0], pixel[1]);
|
||||
target.drawStrings(fieldDescString);
|
||||
}
|
||||
|
@ -4081,4 +4125,52 @@ public class FFMPResource extends
|
|||
return dataTimes;
|
||||
}
|
||||
|
||||
private String getText(Date date, String productId) {
|
||||
String text = hpeLegendMap.get(date);
|
||||
if (text == null) {
|
||||
dataJob.scheduleRetrieval(date, productId);
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
private class HpeSourceDataJob extends Job {
|
||||
private volatile String productId;
|
||||
|
||||
private volatile Date date;
|
||||
|
||||
public HpeSourceDataJob() {
|
||||
super("Get HPE Source");
|
||||
}
|
||||
|
||||
protected void scheduleRetrieval(Date date, String productId) {
|
||||
this.productId = productId;
|
||||
this.date = date;
|
||||
if (this.getState() == Job.RUNNING
|
||||
|| this.getState() == Job.SLEEPING
|
||||
|| this.getState() == Job.WAITING) {
|
||||
return;
|
||||
}
|
||||
this.schedule();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
// Request the text from edex
|
||||
try {
|
||||
HpeLabelDataRequest req = new HpeLabelDataRequest(productId,
|
||||
date);
|
||||
HpeLabelDataResponse response = (HpeLabelDataResponse) ThriftClient
|
||||
.sendRequest(req);
|
||||
Map<Date, String> data = response.getData();
|
||||
for (Date d : data.keySet()) {
|
||||
hpeLegendMap.put(d, data.get(d));
|
||||
}
|
||||
} catch (VizException e) {
|
||||
statusHandler.error(e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,12 +28,12 @@ import javax.measure.unit.Unit;
|
|||
|
||||
import org.geotools.coverage.grid.GeneralGridGeometry;
|
||||
|
||||
import com.raytheon.uf.common.inventory.exception.DataCubeException;
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||
import com.raytheon.uf.common.dataplugin.grid.util.GridStyleUtil;
|
||||
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
|
||||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||
import com.raytheon.uf.common.inventory.exception.DataCubeException;
|
||||
import com.raytheon.uf.common.style.ParamLevelMatchCriteria;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
@ -54,6 +54,7 @@ import com.raytheon.uf.viz.datacube.DataCubeContainer;
|
|||
* Mar 09, 2011 bsteffen Initial creation
|
||||
* Sep 24, 2013 2404 bclement match criteria built using GridStyleUtil
|
||||
* Jan 14, 2014 2661 bsteffen Switch vectors to u,v only.
|
||||
* May 05, 2014 3026 mpduff Made getCurrentGribRecord() public
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -150,7 +151,7 @@ public class GridResource<T extends AbstractResourceData> extends
|
|||
+ record.getParameter().getName();
|
||||
}
|
||||
|
||||
protected GridRecord getCurrentGridRecord() {
|
||||
public GridRecord getCurrentGridRecord() {
|
||||
List<PluginDataObject> pdos = getCurrentPluginDataObjects();
|
||||
if (pdos == null || pdos.isEmpty()) {
|
||||
return null;
|
||||
|
|
|
@ -130,4 +130,11 @@
|
|||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.raytheon.uf.viz.hpe"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
</feature>
|
||||
|
|
16
deltaScripts/14.3.1/DR3026/addMetadataColumnFFMP.sh
Normal file
16
deltaScripts/14.3.1/DR3026/addMetadataColumnFFMP.sh
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
# DR 3026 - Add metadata column to FFMP database
|
||||
|
||||
PSQL="/awips2/psql/bin/psql"
|
||||
|
||||
echo "INFO: Adding column metadata to table ffmp"
|
||||
|
||||
${PSQL} -U awips -d metadata -c "ALTER TABLE ffmp ADD COLUMN metadata varchar(255);"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: Failed to add column metadata to table ffmp"
|
||||
echo "FATAL: The update has failed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "INFO: column metadata added successfully"
|
|
@ -90,6 +90,7 @@ import com.raytheon.uf.common.time.util.ImmutableDate;
|
|||
* Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
* Oct 14, 2013 2361 njensen Removed XML annotations
|
||||
* May 01, 2014 3026 mpduff Added metadata column.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -131,6 +132,10 @@ public class FFMPRecord extends PersistablePluginDataObject implements
|
|||
@DynamicSerializeElement
|
||||
private String siteKey;
|
||||
|
||||
@Column(length = 255)
|
||||
@DynamicSerializeElement
|
||||
private String metaData;
|
||||
|
||||
@Transient
|
||||
private FFMPBasinData basins = new FFMPBasinData();;
|
||||
|
||||
|
@ -600,6 +605,21 @@ public class FFMPRecord extends PersistablePluginDataObject implements
|
|||
return isRate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the metaData
|
||||
*/
|
||||
public String getMetaData() {
|
||||
return metaData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param metaData
|
||||
* the metaData to set
|
||||
*/
|
||||
public void setMetaData(String metaData) {
|
||||
this.metaData = metaData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Purges out old data
|
||||
*
|
||||
|
|
|
@ -127,6 +127,7 @@
|
|||
#10/03/12 - Added token section for script execution
|
||||
#02/12/2014 - Added token for default display to replace field in rwprefs table
|
||||
#02/18/14 - Added section for run_report_alarm service configuration.
|
||||
#05/05/2014 - #3026 added hpe_grib_input_dir token
|
||||
|
||||
|
||||
# ==============================================================================
|
||||
|
@ -1123,6 +1124,7 @@ dhr_dirname1 : $(data_archive_root)/radar # first part of directo
|
|||
dhr_dirname2 : DHR/layer0/res1/level256 # second part of directory name
|
||||
# containing DHR products for
|
||||
# associated or dial in radar
|
||||
|
||||
dhr_grid_dir : $(pproc_local_data)/dhr_decoded # decoded DHR radar grids
|
||||
|
||||
dhr_error_dir : $(pproc_local_data)/dhr_error # DHR error files
|
||||
|
@ -1149,6 +1151,7 @@ dsp_error_dir : $(pproc_local_data)/dsp_error # DSP error files
|
|||
dsp_arch_dir : $(pproc_local_data)/dsp_archive # DSP archives
|
||||
|
||||
|
||||
hpe_grib_input_dir : $(EDEX_HOME)/data/local/hpegrib
|
||||
hpe_generate_list : DHRMOSAIC,BDHRMOSAIC,ERMOSAIC,LSATPRE,EBMOSAIC
|
||||
hpe_qpe_fieldtype : ERMOSAIC # field type to be saved as qpe
|
||||
|
||||
|
|
7
edexOsgi/com.raytheon.uf.common.plugin.hpe/.classpath
Normal file
7
edexOsgi/com.raytheon.uf.common.plugin.hpe/.classpath
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
28
edexOsgi/com.raytheon.uf.common.plugin.hpe/.project
Normal file
28
edexOsgi/com.raytheon.uf.common.plugin.hpe/.project
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.raytheon.uf.common.plugin.hpe</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,7 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
|
@ -0,0 +1,17 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Hpe
|
||||
Bundle-SymbolicName: com.raytheon.uf.common.plugin.hpe
|
||||
Bundle-Version: 1.14.3.qualifier
|
||||
Bundle-Vendor: RAYTHEON
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
com.raytheon.uf.common.util;bundle-version="1.14.0",
|
||||
com.raytheon.uf.common.status;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.time;bundle-version="1.12.1174",
|
||||
javax.persistence;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.serialization;bundle-version="1.12.1174"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: com.raytheon.uf.common.plugin.hpe.data,
|
||||
com.raytheon.uf.common.plugin.hpe.request
|
|
@ -0,0 +1,4 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
|
@ -0,0 +1,204 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.plugin.hpe.data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.raytheon.uf.common.util.StringUtil;
|
||||
|
||||
/**
|
||||
* Data structure holding data from the RWBiasDyn and the DAABiasDyn tables.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 26, 2014 3026 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class BiasDynRecord {
|
||||
/** Radar ID */
|
||||
private String radarId;
|
||||
|
||||
/** Office ID */
|
||||
private String officeId;
|
||||
|
||||
/** Observation time */
|
||||
private Date obsTime;
|
||||
|
||||
/** MemspanIndex */
|
||||
private float memspanIndex;
|
||||
|
||||
/** Number pairs */
|
||||
private double numPairs;
|
||||
|
||||
/** Sum of Gages */
|
||||
private float sumGages;
|
||||
|
||||
/** Sum of radars */
|
||||
private float sumRadars;
|
||||
|
||||
private float bias;
|
||||
|
||||
/**
|
||||
* @return the radarId
|
||||
*/
|
||||
public String getRadarId() {
|
||||
return radarId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param radarId
|
||||
* the radarId to set
|
||||
*/
|
||||
public void setRadarId(String radarId) {
|
||||
this.radarId = radarId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the officeId
|
||||
*/
|
||||
public String getOfficeId() {
|
||||
return officeId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param officeId
|
||||
* the officeId to set
|
||||
*/
|
||||
public void setOfficeId(String officeId) {
|
||||
this.officeId = officeId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the obsTime
|
||||
*/
|
||||
public Date getObsTime() {
|
||||
return obsTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param obsTime
|
||||
* the obsTime to set
|
||||
*/
|
||||
public void setObsTime(Date obsTime) {
|
||||
this.obsTime = obsTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the memspanIndex
|
||||
*/
|
||||
public float getMemspanIndex() {
|
||||
return memspanIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param memspanIndex
|
||||
* the memspanIndex to set
|
||||
*/
|
||||
public void setMemspanIndex(float memspanIndex) {
|
||||
this.memspanIndex = memspanIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the numPairs
|
||||
*/
|
||||
public double getNumPairs() {
|
||||
return numPairs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param numPairs
|
||||
* the numPairs to set
|
||||
*/
|
||||
public void setNumPairs(double numPairs) {
|
||||
this.numPairs = numPairs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sumGages
|
||||
*/
|
||||
public float getSumGages() {
|
||||
return sumGages;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sumGages
|
||||
* the sumGages to set
|
||||
*/
|
||||
public void setSumGages(float sumGages) {
|
||||
this.sumGages = sumGages;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sumRadars
|
||||
*/
|
||||
public float getSumRadars() {
|
||||
return sumRadars;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sumRadars
|
||||
* the sumRadars to set
|
||||
*/
|
||||
public void setSumRadars(float sumRadars) {
|
||||
this.sumRadars = sumRadars;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the bias
|
||||
*/
|
||||
public float getBias() {
|
||||
return bias;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bias
|
||||
* the bias to set
|
||||
*/
|
||||
public void setBias(float bias) {
|
||||
this.bias = bias;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Bias: ").append(this.bias).append(StringUtil.NEWLINE);
|
||||
sb.append("MemSpanIndex: ").append(this.memspanIndex)
|
||||
.append(StringUtil.NEWLINE);
|
||||
sb.append("NumPairs: ").append(this.numPairs)
|
||||
.append(StringUtil.NEWLINE);
|
||||
sb.append("OfficeId: ").append(this.officeId)
|
||||
.append(StringUtil.NEWLINE);
|
||||
sb.append("RadarId: ").append(this.radarId).append(StringUtil.NEWLINE);
|
||||
sb.append("sumGages: ").append(this.sumGages)
|
||||
.append(StringUtil.NEWLINE);
|
||||
sb.append("sumRadars: ").append(this.sumRadars);
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.plugin.hpe.request;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
||||
|
||||
/**
|
||||
* HPE bias source request object.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 23, 2014 3026 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
@DynamicSerialize
|
||||
public class HpeLabelDataRequest implements IServerRequest {
|
||||
|
||||
/** HPE Product name */
|
||||
@DynamicSerializeElement
|
||||
private String productName;
|
||||
|
||||
/** HPE list of dates */
|
||||
@DynamicSerializeElement
|
||||
private List<Date> dateList;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public HpeLabelDataRequest() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param productName
|
||||
* The Hpe product name
|
||||
* @param dateList
|
||||
* List of times for the product
|
||||
*/
|
||||
public HpeLabelDataRequest(String productName, List<Date> dateList) {
|
||||
this.productName = productName;
|
||||
this.dateList = dateList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param productName
|
||||
* The Hpe product name
|
||||
* @param date
|
||||
* Date of the product
|
||||
*/
|
||||
public HpeLabelDataRequest(String productName, Date date) {
|
||||
this.productName = productName;
|
||||
dateList = new ArrayList<Date>(1);
|
||||
dateList.add(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the productName
|
||||
*/
|
||||
public String getProductName() {
|
||||
return productName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param productName
|
||||
* the productName to set
|
||||
*/
|
||||
public void setProductName(String productName) {
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dateList
|
||||
*/
|
||||
public List<Date> getDateList() {
|
||||
return dateList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dateList
|
||||
* the dateList to set
|
||||
*/
|
||||
public void setDateList(List<Date> dateList) {
|
||||
this.dateList = dateList;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.plugin.hpe.request;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
||||
/**
|
||||
* HPE bias source response object.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 23, 2014 3026 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
@DynamicSerialize
|
||||
public class HpeLabelDataResponse {
|
||||
|
||||
/** Map of Dates->bias source text */
|
||||
@DynamicSerializeElement
|
||||
private Map<Date, String> data;
|
||||
|
||||
/**
|
||||
* @return the data
|
||||
*/
|
||||
public Map<Date, String> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param data
|
||||
* the data to set
|
||||
*/
|
||||
public void setData(Map<Date, String> data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
|
@ -381,4 +381,17 @@
|
|||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.raytheon.uf.common.plugin.hpe"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"/>
|
||||
|
||||
<plugin
|
||||
id="com.raytheon.uf.edex.plugin.hpe"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
</feature>
|
||||
|
|
|
@ -19,7 +19,8 @@ Require-Bundle: com.raytheon.uf.edex.cpgsrv;bundle-version="1.11.7";resolution:=
|
|||
com.raytheon.uf.common.status;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.event;bundle-version="1.0.0",
|
||||
com.raytheon.uf.edex.event;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.stats;bundle-version="1.0.0"
|
||||
com.raytheon.uf.common.stats;bundle-version="1.0.0",
|
||||
com.raytheon.uf.edex.plugin.hpe;bundle-version="1.14.0"
|
||||
Import-Package: com.raytheon.uf.common.dataplugin.grid,
|
||||
com.raytheon.uf.common.ohd,
|
||||
com.raytheon.uf.common.status,
|
||||
|
|
|
@ -102,6 +102,7 @@ import com.vividsolutions.jts.geom.Polygon;
|
|||
* Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL
|
||||
* 09/03/2013 DR 13083 G. Zhang Added a fix in processRADAR(ArrayList<SourceBinEntry>).
|
||||
* 03 April 2014 2940 dhladky Better error message for bad configurations.
|
||||
* Apr 15, 2014 3026 mpduff Set the xmrg filename into the metadata column.
|
||||
* </pre>
|
||||
* @author dhladky
|
||||
* @version 1
|
||||
|
@ -262,6 +263,7 @@ public class FFMPProcessor {
|
|||
xmrg = (XmrgFile) config.getSourceData(
|
||||
source.getSourceName()).get(dataKey);
|
||||
xmrgData = getXMRGData();
|
||||
ffmpRec.setMetaData(xmrg.getFile().getName());
|
||||
} catch (Exception e) {
|
||||
fireBadConfigMessage(type, e);
|
||||
return;
|
||||
|
|
7
edexOsgi/com.raytheon.uf.edex.plugin.hpe/.classpath
Normal file
7
edexOsgi/com.raytheon.uf.edex.plugin.hpe/.classpath
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
28
edexOsgi/com.raytheon.uf.edex.plugin.hpe/.project
Normal file
28
edexOsgi/com.raytheon.uf.edex.plugin.hpe/.project
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.raytheon.uf.edex.plugin.hpe</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,11 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
|
@ -0,0 +1,18 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Hpe Grib Preprocessor
|
||||
Bundle-SymbolicName: com.raytheon.uf.edex.plugin.hpe
|
||||
Bundle-Version: 1.14.0.qualifier
|
||||
Bundle-Vendor: RAYTHEON
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Require-Bundle: com.raytheon.uf.common.status;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.edex.database;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.time;bundle-version="1.12.1174",
|
||||
com.google.guava;bundle-version="11.0.2",
|
||||
com.raytheon.uf.common.util;bundle-version="1.14.0",
|
||||
org.apache.camel;bundle-version="2.11.2",
|
||||
com.raytheon.uf.common.plugin.hpe;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
|
||||
com.raytheon.edex.common;bundle-version="1.12.1174"
|
|
@ -0,0 +1,5 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
res/
|
|
@ -0,0 +1,38 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||
|
||||
<bean id="hpeFilenameProcessor" class="com.raytheon.uf.edex.plugin.hpe.process.HpeGribFileNameProcessor" />
|
||||
|
||||
<bean id="hpeFileChangedStrategy"
|
||||
class="com.raytheon.uf.edex.esb.camel.FileChangedExclusiveReadLockStrategy" />
|
||||
|
||||
|
||||
<camelContext id="hpegrib-file-endpoint" xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler">
|
||||
|
||||
<endpoint id="hpeGribFileEndpoint" uri="file:${edex.home}/data/local/hpegrib?delete=true&delay=5000&maxMessagesPerPoll=1000&exclusiveReadLockStrategy=#hpeFileChangedStrategy&recursive=false" />
|
||||
|
||||
<route id="hpeGribFileConsumerRoute">
|
||||
<from ref="hpeGribFileEndpoint" />
|
||||
<doTry>
|
||||
<bean ref="fileToString" />
|
||||
<bean ref="hpeFilenameProcessor" />
|
||||
<!--
|
||||
<bean ref="manualProc" method="copyFileToArchive"/>
|
||||
-->
|
||||
<to uri="jms-durable:queue:Ingest.GribSplit" />
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:hpeGribFileEndpoint?level=ERROR"/>
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
|
||||
</camelContext>
|
||||
|
||||
<bean factory-bean="contextManager" factory-method="registerClusteredContext">
|
||||
<constructor-arg ref="hpegrib-file-endpoint" />
|
||||
</bean>
|
||||
</beans>
|
|
@ -0,0 +1,15 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
|
||||
|
||||
<bean id="hpeLabelDataHandler"
|
||||
class="com.raytheon.uf.edex.plugin.hpe.handler.HpeLabelDataHandler">
|
||||
</bean>
|
||||
|
||||
<bean factory-bean="handlerRegistry" factory-method="register">
|
||||
<constructor-arg
|
||||
value="com.raytheon.uf.common.plugin.hpe.request.HpeLabelDataRequest" />
|
||||
<constructor-arg ref="hpeLabelDataHandler" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
|
@ -0,0 +1,86 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.plugin.hpe.handler;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.plugin.hpe.request.HpeLabelDataRequest;
|
||||
import com.raytheon.uf.common.plugin.hpe.request.HpeLabelDataResponse;
|
||||
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.edex.plugin.hpe.util.HpeDataAccessor;
|
||||
import com.raytheon.uf.edex.plugin.hpe.util.HpeLabelGenerator;
|
||||
|
||||
/**
|
||||
* HPE bias source label request handler.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 23, 2014 3026 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class HpeLabelDataHandler implements
|
||||
IRequestHandler<HpeLabelDataRequest> {
|
||||
/** Status handler */
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(HpeLabelDataHandler.class);
|
||||
|
||||
@Override
|
||||
public Object handleRequest(HpeLabelDataRequest request) throws Exception {
|
||||
return getData(request);
|
||||
}
|
||||
|
||||
private HpeLabelDataResponse getData(HpeLabelDataRequest request) {
|
||||
// Generate the label string, put in response and send back
|
||||
HpeLabelDataResponse response = new HpeLabelDataResponse();
|
||||
Map<Date, String> labelMap = new HashMap<Date, String>();
|
||||
try {
|
||||
for (Date d : request.getDateList()) {
|
||||
String label = generateHpeLabel(request.getProductName(), d);
|
||||
labelMap.put(d, label);
|
||||
}
|
||||
|
||||
response.setData(labelMap);
|
||||
} catch (Exception e) {
|
||||
statusHandler.error(e.getMessage(), e);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
private String generateHpeLabel(String productName, Date date)
|
||||
throws Exception {
|
||||
HpeDataAccessor dataAccessor = new HpeDataAccessor();
|
||||
HpeLabelGenerator generator = new HpeLabelGenerator(dataAccessor);
|
||||
String text = generator.getHpeLabel(date, productName);
|
||||
return text;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.plugin.hpe.process;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.camel.Exchange;
|
||||
import org.apache.camel.Processor;
|
||||
|
||||
/**
|
||||
* Processor for HPE grib files. Adds the filename without the extension as the
|
||||
* secondaryId.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 21, 2014 3026 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class HpeGribFileNameProcessor implements Processor {
|
||||
/** Filename pattern to match for HPE grib files */
|
||||
private static final Pattern FILENAME_PATTERN = Pattern
|
||||
.compile("^([A-Za-z]*MOSAIC[0-9]*z)\\.grib$");
|
||||
|
||||
@Override
|
||||
public void process(Exchange exchange) throws Exception {
|
||||
String fileName = (String) exchange.getIn().getHeader(
|
||||
"CamelFileNameOnly");
|
||||
Matcher matcher = FILENAME_PATTERN.matcher(fileName);
|
||||
if (matcher.matches()) {
|
||||
// Take the text before the last "."
|
||||
String productName = matcher.group(1);
|
||||
exchange.getIn().setHeader("secondaryid", productName);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,244 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.plugin.hpe.util;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TimeZone;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import com.raytheon.edex.site.SiteUtil;
|
||||
import com.raytheon.uf.common.plugin.hpe.data.BiasDynRecord;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.edex.database.dao.CoreDao;
|
||||
import com.raytheon.uf.edex.database.dao.DaoConfig;
|
||||
import com.raytheon.uf.edex.plugin.hpe.util.HpeEnums.HpeDataSource;
|
||||
|
||||
/**
|
||||
* HPE database access utility class.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 26, 2014 3026 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class HpeDataAccessor {
|
||||
private static final String IHFS = "ihfs";
|
||||
|
||||
private static final String POSTGRES_DATE_STRING = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
private static final String HPE_RADAR_QUERY = "select distinct(radid) from ";
|
||||
|
||||
/**
|
||||
* Full query string for HpeRadarResult table
|
||||
*/
|
||||
public static final String FULL_HPE_RADAR_RESULT_QUERY = "select hpe_productname, producttime, "
|
||||
+ "num_radar_avail, bias_source, radar_data_source from hperadarresult";
|
||||
|
||||
/**
|
||||
* Database date string format
|
||||
*/
|
||||
private final ThreadLocal<SimpleDateFormat> sdf = TimeUtil
|
||||
.buildThreadLocalSimpleDateFormat(POSTGRES_DATE_STRING,
|
||||
TimeZone.getTimeZone("GMT"));
|
||||
|
||||
/** The data access object */
|
||||
private final CoreDao dao;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public HpeDataAccessor() {
|
||||
dao = new CoreDao(DaoConfig.forDatabase(IHFS));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a map of radar id->BiasDynRecords
|
||||
*
|
||||
* @param recdate
|
||||
* @param productName
|
||||
* @return BiasDynRecords
|
||||
* @throws Exception
|
||||
*/
|
||||
public SortedMap<String, List<BiasDynRecord>> getBiasDynRecords(
|
||||
Date recdate, String productName) throws Exception {
|
||||
SortedMap<String, List<BiasDynRecord>> dataMap = new TreeMap<String, List<BiasDynRecord>>();
|
||||
|
||||
HpeRadarResult hpeResult = getHpeRadarResult(recdate, productName);
|
||||
|
||||
HpeDataSource source = hpeResult.getRadarDataSource();
|
||||
|
||||
String table = null;
|
||||
if (source == HpeDataSource.S) {
|
||||
table = "RWBiasDyn";
|
||||
} else if (source == HpeDataSource.D) {
|
||||
table = "DAABiasDyn";
|
||||
} else {
|
||||
throw new Exception(
|
||||
"Invalid bias source defined in HPERadarResult table: "
|
||||
+ source);
|
||||
}
|
||||
|
||||
String office = SiteUtil.getSite();
|
||||
StringBuilder query = new StringBuilder("select radid, office_id, ");
|
||||
query.append("obstime, memspan_ind, numpairs, sumgag, sumrad, bias");
|
||||
query.append(" from ").append(table);
|
||||
query.append(" where office_id ").append(" = '").append(office)
|
||||
.append("'");
|
||||
query.append(" and obstime = '").append(sdf.get().format(recdate));
|
||||
query.append("'").append(" order by radid asc, memspan_ind asc");
|
||||
|
||||
Object[] results = dao.executeSQLQuery(query.toString());
|
||||
for (Object result : results) {
|
||||
if (result instanceof Object[]) {
|
||||
Object[] oa = (Object[]) result;
|
||||
BiasDynRecord rec = new BiasDynRecord();
|
||||
rec.setRadarId((String) oa[0]);
|
||||
rec.setOfficeId((String) oa[1]);
|
||||
rec.setObsTime((Date) oa[2]);
|
||||
rec.setMemspanIndex((Integer) oa[3]);
|
||||
rec.setNumPairs((Float) oa[4]);
|
||||
rec.setSumGages((Float) oa[5]);
|
||||
rec.setSumRadars((Float) oa[6]);
|
||||
rec.setBias((Float) oa[7]);
|
||||
|
||||
if (!dataMap.containsKey(rec.getOfficeId())) {
|
||||
dataMap.put(rec.getOfficeId(),
|
||||
new ArrayList<BiasDynRecord>());
|
||||
}
|
||||
|
||||
dataMap.get(rec.getRadarId()).add(rec);
|
||||
} else {
|
||||
throw new Exception(
|
||||
"Unexpected return type from bias query, expected Object[], got "
|
||||
+ result.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the hpeRadarResult entry for this product.
|
||||
*
|
||||
* @param date
|
||||
* date of the product
|
||||
* @param productName
|
||||
* name of the product
|
||||
* @return record object
|
||||
* @throws Exception
|
||||
*/
|
||||
public HpeRadarResult getHpeRadarResult(Date date, String productName)
|
||||
throws Exception {
|
||||
HpeRadarResult hpeResult = new HpeRadarResult();
|
||||
try {
|
||||
String where = " where producttime = '" + sdf.get().format(date)
|
||||
+ "' and hpe_productname = '" + productName + "'";
|
||||
|
||||
Object[] results = dao.executeSQLQuery(FULL_HPE_RADAR_RESULT_QUERY
|
||||
+ where);
|
||||
if (results != null && results.length == 5) {
|
||||
hpeResult.setHpeProductName((String) results[0]);
|
||||
hpeResult.setProductTime((Date) results[1]);
|
||||
|
||||
if (results[2] != null) {
|
||||
hpeResult.setNumRadarAvailable((Integer) results[2]);
|
||||
}
|
||||
|
||||
if (results[3] != null) {
|
||||
hpeResult.setBiasSource((String) results[3]);
|
||||
}
|
||||
|
||||
if (results[4] != null) {
|
||||
hpeResult.setRadarDataSource((String) results[4]);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new Exception("Error querying the IHFS hperadarresult table",
|
||||
e);
|
||||
}
|
||||
|
||||
return hpeResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the nPairBiasSelect value.
|
||||
*
|
||||
* @return the nPairBiasSelect value
|
||||
* @throws Exception
|
||||
*/
|
||||
public int getNPairBiasSelect() throws Exception {
|
||||
try {
|
||||
Object[] results = dao
|
||||
.executeSQLQuery("select npair_bias_select from RWBiasStat");
|
||||
if (results != null && results.length == 1) {
|
||||
return (Integer) results[0];
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new Exception("Error querying the IHFS hperadarresult table",
|
||||
e);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of HPE radars for the current time.
|
||||
*
|
||||
* @param date
|
||||
* The obstime
|
||||
* @param table
|
||||
* The table to query
|
||||
* @return List of radars
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<String> getHpeRadars(Date date, String table) throws Exception {
|
||||
StringBuilder query = new StringBuilder(HPE_RADAR_QUERY);
|
||||
query.append(table).append(" where obstime = '");
|
||||
query.append(sdf.get().format(date)).append("' order by radid");
|
||||
|
||||
List<String> radarList;
|
||||
|
||||
try {
|
||||
Object[] results = dao.executeSQLQuery(query.toString());
|
||||
radarList = new ArrayList<String>(results.length);
|
||||
for (Object o : results) {
|
||||
radarList.add((String) o);
|
||||
}
|
||||
|
||||
return radarList;
|
||||
} catch (Exception e) {
|
||||
throw new Exception("Error querying the IHFS hperadarresult table",
|
||||
e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.plugin.hpe.util;
|
||||
|
||||
/**
|
||||
* HPE Enumerations.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 23, 2014 3026 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class HpeEnums {
|
||||
/**
|
||||
* HPE Data Source
|
||||
*
|
||||
* <pre>
|
||||
* S for single pol
|
||||
* D for dual pol
|
||||
* </pre>
|
||||
*/
|
||||
public enum HpeDataSource {
|
||||
S, D
|
||||
}
|
||||
|
||||
/**
|
||||
* HPE Bias Source.
|
||||
*/
|
||||
public enum HpeBiasSource {
|
||||
RFC_MEAN_BIAS("RCF MEAN BIAS"), SITE_MEAN_BIAS("SITE MEAN BIAS"), SITE_LOCAL_BIAS(
|
||||
"SITE LOCAL BIAS"), NO_BIAS("NO BIAS");
|
||||
|
||||
private final String biasSource;
|
||||
|
||||
HpeBiasSource(String biasSource) {
|
||||
this.biasSource = biasSource;
|
||||
}
|
||||
|
||||
public String getBiasSource() {
|
||||
return biasSource;
|
||||
}
|
||||
|
||||
public static HpeBiasSource fromString(String source) {
|
||||
if (source != null) {
|
||||
for (HpeBiasSource h : HpeBiasSource.values()) {
|
||||
if (source.equalsIgnoreCase(h.getBiasSource())) {
|
||||
return h;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(
|
||||
"No souce found for HpeBiasSource value: " + source);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,183 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.plugin.hpe.util;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.SortedMap;
|
||||
|
||||
import com.raytheon.uf.common.plugin.hpe.data.BiasDynRecord;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.util.StringUtil;
|
||||
import com.raytheon.uf.edex.plugin.hpe.util.HpeEnums.HpeBiasSource;
|
||||
import com.raytheon.uf.edex.plugin.hpe.util.HpeEnums.HpeDataSource;
|
||||
|
||||
/**
|
||||
* HPE label generator. Creates labels based on the HPE bias source data.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 26, 2014 3026 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class HpeLabelGenerator {
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(HpeLabelGenerator.class);
|
||||
|
||||
/**
|
||||
* 2 decimal place formatter
|
||||
*/
|
||||
private final ThreadLocal<DecimalFormat> twoDeciamalFormatter = new ThreadLocal<DecimalFormat>() {
|
||||
|
||||
@Override
|
||||
protected DecimalFormat initialValue() {
|
||||
DecimalFormat format = new DecimalFormat("0.00");
|
||||
return format;
|
||||
}
|
||||
};
|
||||
|
||||
private static String SLASH = "/";
|
||||
|
||||
private static String SPACE = " ";
|
||||
|
||||
private static String Y = "Y";
|
||||
|
||||
private static String N = "N";
|
||||
|
||||
private final HpeDataAccessor dataAccessor;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param dataAccessor
|
||||
*/
|
||||
public HpeLabelGenerator(HpeDataAccessor dataAccessor) {
|
||||
this.dataAccessor = dataAccessor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HPE label string.
|
||||
*
|
||||
* @param recDate
|
||||
* The date of the record
|
||||
* @param productName
|
||||
* The name of the HPE product
|
||||
*
|
||||
* @return the label
|
||||
* @throws Exception
|
||||
*/
|
||||
public String getHpeLabel(Date recDate, String productName)
|
||||
throws Exception {
|
||||
HpeRadarResult hpeResult = dataAccessor.getHpeRadarResult(recDate,
|
||||
productName);
|
||||
|
||||
if (hpeResult == null || hpeResult.isEmpty()) {
|
||||
return "No HPE bias source data";
|
||||
}
|
||||
|
||||
HpeDataSource source = hpeResult.getRadarDataSource();
|
||||
HpeBiasSource biasSource = hpeResult.getBiasSource();
|
||||
|
||||
// Site->BiasDynRecord list
|
||||
SortedMap<String, List<BiasDynRecord>> dataMap = dataAccessor
|
||||
.getBiasDynRecords(recDate, productName);
|
||||
|
||||
StringBuilder label = new StringBuilder("Dual-Pol Source: ");
|
||||
|
||||
// Label if single or dual
|
||||
if (source == HpeDataSource.S) {
|
||||
label.append(N);
|
||||
} else if (source == HpeDataSource.D) {
|
||||
label.append(Y);
|
||||
}
|
||||
|
||||
label.append(StringUtil.NEWLINE);
|
||||
|
||||
// Add bias value
|
||||
if (biasSource == HpeBiasSource.SITE_MEAN_BIAS) {
|
||||
label.append("Bias Source: ");
|
||||
label.append(System.getProperty("AW_SITE_IDENTIFIER"));
|
||||
} else if (biasSource == HpeBiasSource.RFC_MEAN_BIAS) {
|
||||
label.append("Bias Source: RFC");
|
||||
} else if (biasSource == HpeBiasSource.SITE_LOCAL_BIAS) {
|
||||
label.append(System.getProperty("AW_SITE_IDENTIFIER")).append(
|
||||
" Local Bias ");
|
||||
return label.toString().trim();
|
||||
} else {
|
||||
label.append("Bias Source: none");
|
||||
return label.toString().trim();
|
||||
}
|
||||
|
||||
label.append(StringUtil.NEWLINE).append(SPACE);
|
||||
|
||||
// Process each radar to get it's part of the label
|
||||
for (String radar : dataMap.keySet()) {
|
||||
String labelEntry = getLabelEntry(radar, dataMap.get(radar));
|
||||
label.append(labelEntry).append(SPACE);
|
||||
}
|
||||
|
||||
return label.toString().trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the label entry for the radar.
|
||||
*
|
||||
* @param radar
|
||||
* radar id
|
||||
* @param records
|
||||
* BiasDynRecord objects
|
||||
* @return the label for this radar
|
||||
* @throws Exception
|
||||
*/
|
||||
private String getLabelEntry(String radar, List<BiasDynRecord> records)
|
||||
throws Exception {
|
||||
StringBuilder sb = new StringBuilder("k");
|
||||
sb.append(radar.toLowerCase()).append(SPACE);
|
||||
final int npairBiasSelect = dataAccessor.getNPairBiasSelect();
|
||||
|
||||
// process the records
|
||||
if (!records.isEmpty()) {
|
||||
for (BiasDynRecord rec : records) {
|
||||
if (rec.getNumPairs() > npairBiasSelect) {
|
||||
String bias = twoDeciamalFormatter.get().format(
|
||||
rec.getBias());
|
||||
sb.append(bias).append(SLASH)
|
||||
.append((int) rec.getNumPairs());
|
||||
sb.append(StringUtil.NEWLINE);
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,181 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.plugin.hpe.util;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.raytheon.uf.edex.plugin.hpe.util.HpeEnums.HpeBiasSource;
|
||||
import com.raytheon.uf.edex.plugin.hpe.util.HpeEnums.HpeDataSource;
|
||||
|
||||
/**
|
||||
* HpeRadarResult table data object.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 26, 2014 3026 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class HpeRadarResult {
|
||||
|
||||
private String hpeProductName;
|
||||
|
||||
private Date productTime;
|
||||
|
||||
private int numRadarAvailable;
|
||||
|
||||
private String biasSource;
|
||||
|
||||
private String radarDataSource;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public HpeRadarResult() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the hpeProductName
|
||||
*/
|
||||
public String getHpeProductName() {
|
||||
return hpeProductName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param hpeProductName
|
||||
* the hpeProductName to set
|
||||
*/
|
||||
public void setHpeProductName(String hpeProductName) {
|
||||
this.hpeProductName = hpeProductName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the productTime
|
||||
*/
|
||||
public Date getProductTime() {
|
||||
return productTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param productTime
|
||||
* the productTime to set
|
||||
*/
|
||||
public void setProductTime(Date productTime) {
|
||||
this.productTime = productTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the numRadarAvailable
|
||||
*/
|
||||
public int getNumRadarAvailable() {
|
||||
return numRadarAvailable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param numRadarAvailable
|
||||
* the numRadarAvailable to set
|
||||
*/
|
||||
public void setNumRadarAvailable(int numRadarAvailable) {
|
||||
this.numRadarAvailable = numRadarAvailable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the biasSource
|
||||
*/
|
||||
public String getBiasSourceString() {
|
||||
return biasSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the biasSource
|
||||
*/
|
||||
public HpeBiasSource getBiasSource() {
|
||||
return HpeBiasSource.fromString(biasSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param biasSource
|
||||
* the biasSource to set
|
||||
*/
|
||||
public void setBiasSource(String biasSource) {
|
||||
this.biasSource = biasSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the radarDataSource String value
|
||||
*/
|
||||
public String getRadarDataSourceString() {
|
||||
return radarDataSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the radarDataSource
|
||||
*/
|
||||
public HpeDataSource getRadarDataSource() {
|
||||
return Enum.valueOf(HpeDataSource.class, radarDataSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param radarDataSource
|
||||
* the radarDataSource to set
|
||||
*/
|
||||
public void setRadarDataSource(String radarDataSource) {
|
||||
this.radarDataSource = radarDataSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if this is an empty data object.
|
||||
*
|
||||
* @return true if empty object, false if populated with data
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
if (biasSource != null && biasSource.length() > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (hpeProductName != null && hpeProductName.length() > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (numRadarAvailable > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (productTime != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (radarDataSource != null && radarDataSource.length() > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Empty file
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -150,7 +150,7 @@ then
|
|||
new_string=`date -u +%d%H%M%S`
|
||||
new_file_name=ZETA98_${out_file%.*}_$new_string.grib
|
||||
|
||||
INPUT_DIR=$(get_apps_defaults d2d_input_dir)
|
||||
INPUT_DIR=$(get_apps_defaults hpe_grib_input_dir)
|
||||
|
||||
echo Copy grib file $HPE_DHRMOSAIC_GRIB_DIR/$out_file >> $griblog
|
||||
echo to $HPE_DHRMOSAIC_GRIB_DIR/gribfile.tmp >> $griblog
|
||||
|
@ -183,7 +183,7 @@ then
|
|||
new_string=`date -u +%d%H%M%S`
|
||||
new_file_name=ZETA98_${out_file%.*}_$new_string.grib
|
||||
|
||||
INPUT_DIR=$(get_apps_defaults d2d_input_dir)
|
||||
INPUT_DIR=$(get_apps_defaults hpe_grib_input_dir)
|
||||
|
||||
echo Copy grib file $HPE_BDHRMOSAIC_GRIB_DIR/$out_file >> $griblog
|
||||
echo to $HPE_BDHRMOSAIC_GRIB_DIR/gribfile.tmp >> $griblog
|
||||
|
@ -216,7 +216,7 @@ then
|
|||
new_string=`date -u +%d%H%M%S`
|
||||
new_file_name=ZETA98_${out_file%.*}_$new_string.grib
|
||||
|
||||
INPUT_DIR=$(get_apps_defaults d2d_input_dir)
|
||||
INPUT_DIR=$(get_apps_defaults hpe_grib_input_dir)
|
||||
|
||||
echo Copy grib file $HPE_EBMOSAIC_GRIB_DIR/$out_file >> $griblog
|
||||
echo to $HPE_EBMOSAIC_GRIB_DIR/gribfile.tmp >> $griblog
|
||||
|
@ -249,7 +249,7 @@ then
|
|||
new_string=`date -u +%d%H%M%S`
|
||||
new_file_name=ZETA98_${out_file%.*}_$new_string.grib
|
||||
|
||||
INPUT_DIR=$(get_apps_defaults d2d_input_dir)
|
||||
INPUT_DIR=$(get_apps_defaults hpe_grib_input_dir)
|
||||
|
||||
echo Copy grib file $HPE_ERMOSAIC_GRIB_DIR/$out_file >> $griblog
|
||||
echo to $HPE_ERMOSAIC_GRIB_DIR/gribfile.tmp >> $griblog
|
||||
|
|
|
@ -163,5 +163,7 @@
|
|||
<classpathentry combineaccessrules="false" kind="src" path="/com.raytheon.edex.plugin.taf"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/com.raytheon.uf.common.dataplugin.redbook"/>
|
||||
<classpathentry kind="src" path="/com.raytheon.uf.edex.datadelivery"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/com.raytheon.uf.edex.plugin.hpe"/>
|
||||
<classpathentry kind="src" path="/com.raytheon.uf.common.plugin.hpe"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
@ -0,0 +1,364 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.plugin.hpe.util;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.raytheon.uf.common.plugin.hpe.data.BiasDynRecord;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.edex.plugin.hpe.util.HpeEnums.HpeBiasSource;
|
||||
|
||||
/**
|
||||
* Test class for HpeLabelGenerator.java.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 26, 2014 3026 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class HpeLabelGeneratorTest {
|
||||
|
||||
private final HpeDataAccessor dataAccessor = mock(HpeDataAccessor.class);
|
||||
|
||||
private final Calendar cal = TimeUtil.newGmtCalendar();
|
||||
|
||||
private final String SINGLE_POL_TABLE = "RWBiasDyn";
|
||||
|
||||
private final String DUAL_POL_TABLE = "DAABiasDyn";
|
||||
|
||||
private final String productName = "ERMOSAICM60201403051225z";
|
||||
|
||||
private final SortedMap<String, List<BiasDynRecord>> meanDataMap = new TreeMap<String, List<BiasDynRecord>>();
|
||||
|
||||
private final SortedMap<String, List<BiasDynRecord>> localDataMap = new TreeMap<String, List<BiasDynRecord>>();
|
||||
|
||||
@Before
|
||||
public void setup() throws Exception {
|
||||
setCalendar();
|
||||
createBiasDynRecords();
|
||||
List<String> radarList = getRadarList();
|
||||
System.setProperty("AW_SITE_IDENTIFIER", "OAX");
|
||||
when(dataAccessor.getNPairBiasSelect()).thenReturn(10);
|
||||
when(dataAccessor.getHpeRadars(cal.getTime(), SINGLE_POL_TABLE))
|
||||
.thenReturn(radarList);
|
||||
when(dataAccessor.getHpeRadars(cal.getTime(), DUAL_POL_TABLE))
|
||||
.thenReturn(radarList);
|
||||
}
|
||||
|
||||
// Single pol tests
|
||||
@Test
|
||||
public void testLabelCreationForSinglePolSiteMeanBias() throws Exception {
|
||||
// Set up run specific data
|
||||
HpeRadarResult siteMeanBiasSingle = new HpeRadarResult();
|
||||
siteMeanBiasSingle.setHpeProductName(productName);
|
||||
siteMeanBiasSingle.setProductTime(cal.getTime());
|
||||
siteMeanBiasSingle.setBiasSource(HpeBiasSource.SITE_MEAN_BIAS
|
||||
.getBiasSource());
|
||||
siteMeanBiasSingle.setNumRadarAvailable(8);
|
||||
siteMeanBiasSingle.setRadarDataSource("S");
|
||||
|
||||
when(dataAccessor.getHpeRadarResult(cal.getTime(), productName))
|
||||
.thenReturn(siteMeanBiasSingle);
|
||||
|
||||
when(dataAccessor.getBiasDynRecords(cal.getTime(), productName))
|
||||
.thenReturn(meanDataMap);
|
||||
|
||||
// Run the code
|
||||
HpeLabelGenerator labelGen = new HpeLabelGenerator(dataAccessor);
|
||||
String label = labelGen.getHpeLabel(cal.getTime(), productName);
|
||||
|
||||
System.out.println("");
|
||||
System.out.println("Single Pol Site Mean Bias");
|
||||
System.out.println(label);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLabelCreationForSinglePolRfcMeanBias() throws Exception {
|
||||
// Set up run specific data
|
||||
HpeRadarResult rfcMeanBiasSingle = new HpeRadarResult();
|
||||
rfcMeanBiasSingle.setHpeProductName(productName);
|
||||
rfcMeanBiasSingle.setProductTime(cal.getTime());
|
||||
rfcMeanBiasSingle.setBiasSource(HpeBiasSource.RFC_MEAN_BIAS
|
||||
.getBiasSource());
|
||||
rfcMeanBiasSingle.setNumRadarAvailable(8);
|
||||
rfcMeanBiasSingle.setRadarDataSource("S");
|
||||
|
||||
when(dataAccessor.getHpeRadarResult(cal.getTime(), productName))
|
||||
.thenReturn(rfcMeanBiasSingle);
|
||||
|
||||
when(dataAccessor.getBiasDynRecords(cal.getTime(), productName))
|
||||
.thenReturn(meanDataMap);
|
||||
|
||||
// Run the code
|
||||
HpeLabelGenerator labelGen = new HpeLabelGenerator(dataAccessor);
|
||||
String label;
|
||||
label = labelGen.getHpeLabel(cal.getTime(), productName);
|
||||
|
||||
System.out.println("");
|
||||
System.out.println("Single Pol RFC Mean Bias");
|
||||
System.out.println(label);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLabelCreationForSinglePolLocalBias() throws Exception {
|
||||
// Set up run specific data
|
||||
HpeRadarResult rfcLocalBiasSingle = new HpeRadarResult();
|
||||
rfcLocalBiasSingle.setHpeProductName(productName);
|
||||
rfcLocalBiasSingle.setProductTime(cal.getTime());
|
||||
rfcLocalBiasSingle.setBiasSource(HpeBiasSource.SITE_LOCAL_BIAS
|
||||
.getBiasSource());
|
||||
rfcLocalBiasSingle.setNumRadarAvailable(8);
|
||||
rfcLocalBiasSingle.setRadarDataSource("S");
|
||||
|
||||
when(dataAccessor.getHpeRadarResult(cal.getTime(), productName))
|
||||
.thenReturn(rfcLocalBiasSingle);
|
||||
|
||||
when(dataAccessor.getBiasDynRecords(cal.getTime(), productName))
|
||||
.thenReturn(localDataMap);
|
||||
|
||||
// Run the code
|
||||
HpeLabelGenerator labelGen = new HpeLabelGenerator(dataAccessor);
|
||||
String label = labelGen.getHpeLabel(cal.getTime(), productName);
|
||||
|
||||
System.out.println("");
|
||||
System.out.println("Single Pol Local Site Bias");
|
||||
System.out.println(label);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLabelCreationForSinglePolNoBias() throws Exception {
|
||||
// Set up run specific data
|
||||
HpeRadarResult rfcLocalBiasSingle = new HpeRadarResult();
|
||||
rfcLocalBiasSingle.setHpeProductName(productName);
|
||||
rfcLocalBiasSingle.setProductTime(cal.getTime());
|
||||
rfcLocalBiasSingle.setBiasSource(HpeBiasSource.NO_BIAS.getBiasSource());
|
||||
rfcLocalBiasSingle.setNumRadarAvailable(8);
|
||||
rfcLocalBiasSingle.setRadarDataSource("S");
|
||||
|
||||
when(dataAccessor.getHpeRadarResult(cal.getTime(), productName))
|
||||
.thenReturn(rfcLocalBiasSingle);
|
||||
|
||||
when(dataAccessor.getBiasDynRecords(cal.getTime(), productName))
|
||||
.thenReturn(localDataMap);
|
||||
|
||||
// Run the code
|
||||
HpeLabelGenerator labelGen = new HpeLabelGenerator(dataAccessor);
|
||||
String label = labelGen.getHpeLabel(cal.getTime(), productName);
|
||||
|
||||
System.out.println("");
|
||||
System.out.println("Single Pol No Bias");
|
||||
System.out.println(label);
|
||||
}
|
||||
|
||||
// Dual pol tests
|
||||
@Test
|
||||
public void testLabelCreationForDualPolSiteMeanBias() throws Exception {
|
||||
// Set up run specific data
|
||||
HpeRadarResult siteMeanBiasSingle = new HpeRadarResult();
|
||||
siteMeanBiasSingle.setHpeProductName(productName);
|
||||
siteMeanBiasSingle.setProductTime(cal.getTime());
|
||||
siteMeanBiasSingle.setBiasSource(HpeBiasSource.SITE_MEAN_BIAS
|
||||
.getBiasSource());
|
||||
siteMeanBiasSingle.setNumRadarAvailable(8);
|
||||
siteMeanBiasSingle.setRadarDataSource("D");
|
||||
|
||||
when(dataAccessor.getHpeRadarResult(cal.getTime(), productName))
|
||||
.thenReturn(siteMeanBiasSingle);
|
||||
|
||||
when(dataAccessor.getBiasDynRecords(cal.getTime(), productName))
|
||||
.thenReturn(meanDataMap);
|
||||
|
||||
// Run the code
|
||||
HpeLabelGenerator labelGen = new HpeLabelGenerator(dataAccessor);
|
||||
String label = labelGen.getHpeLabel(cal.getTime(), productName);
|
||||
|
||||
System.out.println("");
|
||||
System.out.println("Dual Pol Site Mean Bias");
|
||||
System.out.println(label);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLabelCreationForDualPolRfcMeanBias() throws Exception {
|
||||
// Set up run specific data
|
||||
HpeRadarResult rfcMeanBiasSingle = new HpeRadarResult();
|
||||
rfcMeanBiasSingle.setHpeProductName(productName);
|
||||
rfcMeanBiasSingle.setProductTime(cal.getTime());
|
||||
rfcMeanBiasSingle.setBiasSource(HpeBiasSource.RFC_MEAN_BIAS
|
||||
.getBiasSource());
|
||||
rfcMeanBiasSingle.setNumRadarAvailable(8);
|
||||
rfcMeanBiasSingle.setRadarDataSource("D");
|
||||
|
||||
when(dataAccessor.getHpeRadarResult(cal.getTime(), productName))
|
||||
.thenReturn(rfcMeanBiasSingle);
|
||||
|
||||
when(dataAccessor.getBiasDynRecords(cal.getTime(), productName))
|
||||
.thenReturn(meanDataMap);
|
||||
|
||||
// Run the code
|
||||
HpeLabelGenerator labelGen = new HpeLabelGenerator(dataAccessor);
|
||||
String label = labelGen.getHpeLabel(cal.getTime(), productName);
|
||||
|
||||
System.out.println("");
|
||||
System.out.println("Dual Pol RFC Mean Bias");
|
||||
System.out.println(label);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLabelCreationForDualPolLocalBias() throws Exception {
|
||||
// Set up run specific data
|
||||
HpeRadarResult rfcLocalBiasSingle = new HpeRadarResult();
|
||||
rfcLocalBiasSingle.setHpeProductName(productName);
|
||||
rfcLocalBiasSingle.setProductTime(cal.getTime());
|
||||
rfcLocalBiasSingle.setBiasSource(HpeBiasSource.SITE_LOCAL_BIAS
|
||||
.getBiasSource());
|
||||
rfcLocalBiasSingle.setNumRadarAvailable(8);
|
||||
rfcLocalBiasSingle.setRadarDataSource("D");
|
||||
|
||||
when(dataAccessor.getHpeRadarResult(cal.getTime(), productName))
|
||||
.thenReturn(rfcLocalBiasSingle);
|
||||
|
||||
when(dataAccessor.getBiasDynRecords(cal.getTime(), productName))
|
||||
.thenReturn(localDataMap);
|
||||
|
||||
// Run the code
|
||||
HpeLabelGenerator labelGen = new HpeLabelGenerator(dataAccessor);
|
||||
String label = labelGen.getHpeLabel(cal.getTime(), productName);
|
||||
|
||||
System.out.println("");
|
||||
System.out.println("Dual Pol Local Site Bias");
|
||||
System.out.println(label);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLabelCreationForDualPolNoBias() throws Exception {
|
||||
// Set up run specific data
|
||||
HpeRadarResult rfcLocalBiasSingle = new HpeRadarResult();
|
||||
rfcLocalBiasSingle.setHpeProductName(productName);
|
||||
rfcLocalBiasSingle.setProductTime(cal.getTime());
|
||||
rfcLocalBiasSingle.setBiasSource(HpeBiasSource.NO_BIAS.getBiasSource());
|
||||
rfcLocalBiasSingle.setNumRadarAvailable(8);
|
||||
rfcLocalBiasSingle.setRadarDataSource("D");
|
||||
|
||||
when(dataAccessor.getHpeRadarResult(cal.getTime(), productName))
|
||||
.thenReturn(rfcLocalBiasSingle);
|
||||
|
||||
when(dataAccessor.getBiasDynRecords(cal.getTime(), productName))
|
||||
.thenReturn(localDataMap);
|
||||
|
||||
// Run the code
|
||||
HpeLabelGenerator labelGen = new HpeLabelGenerator(dataAccessor);
|
||||
String label = labelGen.getHpeLabel(cal.getTime(), productName);
|
||||
|
||||
System.out.println("");
|
||||
System.out.println("Dual Pol No Bias");
|
||||
System.out.println(label);
|
||||
}
|
||||
|
||||
private void setCalendar() {
|
||||
cal.set(Calendar.YEAR, 2014);
|
||||
cal.set(Calendar.MONTH, 3);
|
||||
cal.set(Calendar.DAY_OF_MONTH, 5);
|
||||
cal.set(Calendar.HOUR, 12);
|
||||
cal.set(Calendar.MINUTE, 25);
|
||||
cal.set(Calendar.SECOND, 0);
|
||||
cal.set(Calendar.MILLISECOND, 0);
|
||||
}
|
||||
|
||||
private List<String> getRadarList() {
|
||||
List<String> radarList = new ArrayList<String>();
|
||||
radarList.add("ABR");
|
||||
radarList.add("DMX");
|
||||
radarList.add("EAX");
|
||||
radarList.add("FSD");
|
||||
radarList.add("LNX");
|
||||
radarList.add("OAX");
|
||||
radarList.add("TWX");
|
||||
radarList.add("UEX");
|
||||
|
||||
return radarList;
|
||||
}
|
||||
|
||||
private void createBiasDynRecords() {
|
||||
List<String> radarList = getRadarList();
|
||||
|
||||
float[] memSpanIdx = new float[] { 0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f,
|
||||
6.0f, 7.0f, 8.0f, 9.0f };
|
||||
|
||||
double[] numPairs = new double[] { 0, 1.8534577634678e-36,
|
||||
3.9062266222742e-18, 5.102510849233e-12, 4.0175370594682e-07,
|
||||
0.0018974485809437, 7.045055608027, 40.795505532567,
|
||||
74.1231615108, 102.99244442947 };
|
||||
|
||||
float[] sumGages = new float[] { 0.381f, 0.384065f, 0.387877f,
|
||||
0.389836f, 0.391715f, 0.393323f, 0.539044f, 1.08328f, 1.15115f,
|
||||
1.16888f };
|
||||
|
||||
float[] sumRadars = new float[] { 1.21662f, 1.09099f, 1.03442f,
|
||||
1.01281f, 0.99475f, 0.980855f, 0.949928f, 0.990251f, 0.977503f,
|
||||
0.9625f };
|
||||
|
||||
float[] bias = new float[] { 0.313163f, 0.352033f, 0.37497f, 0.384905f,
|
||||
0.393782f, 0.401f, 0.567458f, 1.09394f, 1.17764f, 1.21442f };
|
||||
|
||||
// Create mean bias data
|
||||
for (String radar : radarList) {
|
||||
meanDataMap.put(radar, new ArrayList<BiasDynRecord>());
|
||||
}
|
||||
|
||||
for (String radar : radarList) {
|
||||
for (int i = 0; i < memSpanIdx.length; i++) {
|
||||
BiasDynRecord r = new BiasDynRecord();
|
||||
r.setBias(bias[i]);
|
||||
r.setMemspanIndex(memSpanIdx[i]);
|
||||
r.setNumPairs(numPairs[i]);
|
||||
r.setObsTime(cal.getTime());
|
||||
r.setOfficeId("OAX");
|
||||
r.setRadarId(radar);
|
||||
r.setSumGages(sumGages[i]);
|
||||
r.setSumRadars(sumRadars[i]);
|
||||
meanDataMap.get(radar).add(r);
|
||||
}
|
||||
}
|
||||
|
||||
// Create local bias data - local/no bias do not have bias data
|
||||
for (String radar : radarList) {
|
||||
localDataMap.put(radar, new ArrayList<BiasDynRecord>());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue