Merge branch 'omaha_14.3.1' into omaha_14.4.1

Conflicts:
	cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/internal/GLTarget.java
	edexOsgi/com.raytheon.uf.common.derivparam.python/utility/common_static/base/derivedParameters/functions/SliceSample.py
	edexOsgi/com.raytheon.uf.edex.auth/resources/thriftService.properties
	edexOsgi/com.raytheon.uf.edex.stats/src/com/raytheon/uf/edex/stats/AggregateManager.java
	edexOsgi/com.raytheon.uf.edex.stats/src/com/raytheon/uf/edex/stats/dao/StatsDao.java

Former-commit-id: 652fb19bc4 [formerly a20833879f1a0434c562a22a874b1e1722278954]
Former-commit-id: 6964df0664
This commit is contained in:
Steve Harris 2014-05-12 15:05:43 -05:00
commit 661eceea83
78 changed files with 5314 additions and 1648 deletions

View file

@ -41,6 +41,7 @@ import javax.xml.bind.annotation.XmlElement;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.DataTime.FLAG;
import com.raytheon.uf.viz.core.alerts.DataCubeAlertMessageParser;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
@ -60,6 +61,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Apr 12, 2011 bsteffen Initial creation
* May 31, 2013 1847 bsteffen D2D nsharp will now format Lat/Lons as
* stationId like NC ncharp.
* May 08, 2014 2060 njensen Constructor sets alert parser
*
* </pre>
*
@ -81,6 +83,7 @@ public abstract class D2DNSharpResourceData extends
public D2DNSharpResourceData() {
super();
this.setAlertParser(new DataCubeAlertMessageParser());
}
public D2DNSharpResourceData(String soundingType) {

View 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>

View 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>

View file

@ -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

View file

@ -0,0 +1,21 @@
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.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

View file

@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.

View 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>

View file

@ -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());
}
}

View file

@ -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;
}
}
}

View file

@ -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;
}
}

View file

@ -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);
}
}

View file

@ -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

View file

@ -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,17 @@ public class FFMPResource extends
statusHandler.handle(Priority.PROBLEM, "Error updating record",
ve);
}
} else if (type.equals(ChangeType.DATA_REMOVE)) {
if (object instanceof PluginDataObject[]) {
PluginDataObject[] pdos = (PluginDataObject[]) object;
for (PluginDataObject pdo : pdos) {
FFMPRecord ffmpRec = (FFMPRecord) pdo;
hpeLegendMap.remove(ffmpRec.getDataTime().getRefTime());
}
} else if (object instanceof DataTime) {
DataTime dt = (DataTime) object;
hpeLegendMap.remove(dt.getRefTime());
}
}
}
@ -798,9 +828,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 +845,7 @@ public class FFMPResource extends
}
}
} catch (Exception e) {
e.printStackTrace();
statusHandler.error("Problem getting basin value", e);
}
return value;
}
@ -883,8 +914,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 +945,8 @@ public class FFMPResource extends
/**
* Gets the record currently used
*
* @param recentTime
*
* @return FFMPCacheRecord
*/
public FFMPRecord getRateRecord(Date recentTime) {
@ -924,7 +957,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 +978,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 +1012,7 @@ public class FFMPResource extends
}
} catch (Exception e) {
e.printStackTrace();
statusHandler.error("Error retrieving the current guid record", e);
}
return guidRecord;
@ -1008,7 +1041,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 +1062,8 @@ public class FFMPResource extends
}
} catch (Exception e) {
e.printStackTrace();
statusHandler.error("Error retrieving the current virtual record",
e);
}
return virtualRecord;
@ -1039,6 +1073,8 @@ public class FFMPResource extends
* General get record call
*
* @param pfield
* @param recentTime
*
* @return FFMPCacheRecord
*/
public FFMPRecord getRecord(FIELDS pfield, Date recentTime) {
@ -1155,18 +1191,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 +1224,10 @@ public class FFMPResource extends
basinLocatorString.textStyle = TextStyle.BLANKED;
}
});
// Set flag for HPE data
isHpe = resourceData.siteKey.equalsIgnoreCase(HPE)
|| resourceData.siteKey.equalsIgnoreCase("BHPE");
}
/**
@ -1427,13 +1466,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 && qpeRecord != null) {
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 +4131,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;
}
}
}

View file

@ -58,6 +58,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* ------------ ---------- ----------- --------------------------
* Oct 13, 2009 2307 dhladky Initial creation
* Apr 18, 2013 1916 njensen Bulk rendering
* May 09, 2014 3145 mpduff Fix threat report displays
*
*
* </pre>
@ -196,7 +197,8 @@ public class CWATLocalThreatResource extends CWATResource {
color);
ds.horizontalAlignment = HorizontalAlignment.CENTER;
ds.font = font;
ds.textStyle = TextStyle.BOXED;
ds.addTextStyle(TextStyle.BOXED);
ds.addTextStyle(TextStyle.BLANKED);
ds.verticallAlignment = VerticalAlignment.MIDDLE;
double[] center = descriptor.worldToPixel(new double[] {
loc.getLon(), loc.getLat() });

View file

@ -64,6 +64,7 @@ import com.vividsolutions.jts.geom.Point;
* ------------ ---------- ----------- --------------------------
* Oct 13, 2009 2307 dhladky Initial creation
* Apr 22, 2013 1926 njensen Faster rendering
* May 09, 2014 3145 mpduff Add getter for font so it can be disposed, javadoc fix
*
* </pre>
*
@ -85,7 +86,7 @@ public class ScanDrawer {
private RGB rscColor = null;
private GeometryFactory factory = new GeometryFactory();
private final GeometryFactory factory = new GeometryFactory();
// defaults
private double screenToWorldRatio = 0.0;
@ -668,14 +669,23 @@ public class ScanDrawer {
}
/**
* sets the screen to World ratio;
* Sets the font. The font must be disposed by class using this drawer
*
* @param screenToWorldRatio
* @param font
*/
public void setFont(IFont font) {
this.font = font;
}
/**
* Get the font
*
* @return font
*/
public IFont getFont() {
return font;
}
/**
* Sets the Cell drawing config up
*

View file

@ -85,6 +85,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Apr 02, 2013 1731 mpduff Fix problem with DMD updates.
* Apr 22, 2013 1926 njensen Faster rendering
* Mar 3, 2014 2804 mschenke Set back up clipping pane
* May 09, 2014 3145 mpduff Dispose the ScanDrawer font
* </pre>
*
* @author dhladky
@ -218,6 +219,7 @@ public class ScanResource extends
protected void disposeInternal() {
if (drawer != null) {
if (drawer.font != null) {
drawer.getFont().dispose();
drawer.setFont(null);
}
drawer = null;

View file

@ -40,6 +40,7 @@ import org.eclipse.core.runtime.Platform;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.RecordFactory;
import com.raytheon.uf.viz.core.alerts.DataCubeAlertMessageParser;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
@ -59,6 +60,7 @@ import com.raytheon.uf.viz.xy.crosssection.display.CrossSectionDescriptor;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 17, 2009 njensen Initial creation
* May 08, 2014 2060 njensen Constructor sets alert parser
*
* </pre>
*
@ -88,6 +90,10 @@ public class CrossSectionResourceData extends AbstractRequestableResourceData {
private Set<DataTime> blackListedTimes = new HashSet<DataTime>();
public CrossSectionResourceData() {
this.setAlertParser(new DataCubeAlertMessageParser());
}
@Override
public AbstractVizResource<?, ?> construct(LoadProperties loadProperties,
IDescriptor descriptor) throws VizException {

View file

@ -35,6 +35,7 @@ import org.eclipse.core.runtime.Platform;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.viz.core.RecordFactory;
import com.raytheon.uf.viz.core.alerts.DataCubeAlertMessageParser;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
@ -55,6 +56,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 23, 2009 njensen Initial creation
* May 08, 2014 2060 njensen Constructor sets alert parser
*
* </pre>
*
@ -107,6 +109,10 @@ public class TimeSeriesResourceData extends AbstractRequestableResourceData
private AbstractVizResource<?, ?> secondaryResource;
public TimeSeriesResourceData() {
this.setAlertParser(new DataCubeAlertMessageParser());
}
/*
* (non-Javadoc)
*
@ -255,10 +261,12 @@ public class TimeSeriesResourceData extends AbstractRequestableResourceData
this.source = source;
}
@Override
public String getPointLetter() {
return pointLetter;
}
@Override
public void setPointLetter(String pointLetter) {
this.pointLetter = pointLetter;
}

View file

@ -37,6 +37,7 @@ import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.RecordFactory;
import com.raytheon.uf.viz.core.alerts.DataCubeAlertMessageParser;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
@ -49,7 +50,7 @@ import com.raytheon.viz.core.rsc.ICombinedResourceData;
import com.vividsolutions.jts.geom.Coordinate;
/**
* TODO Add Description
* Resource data for var height displays
*
* <pre>
*
@ -59,6 +60,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Feb 20, 2009 njensen Initial creation
* Aug 15, 2013 2258 bsteffen Convert profiler sounding to var height
* with hodo.
* May 08, 2014 2060 njensen Constructor sets alert parser
*
* </pre>
*
@ -95,6 +97,10 @@ public class VarHeightResourceData extends AbstractRequestableResourceData
private AbstractVizResource<?, ?> secondaryResource;
public VarHeightResourceData() {
this.setAlertParser(new DataCubeAlertMessageParser());
}
/*
* (non-Javadoc)
*
@ -155,10 +161,6 @@ public class VarHeightResourceData extends AbstractRequestableResourceData
rsc.addRecord(rec);
}
return rsc;
} else {
throw new VizException(
"No resource type available for record type: "
+ pdo.getClass().getName());
}
}
throw new VizException(
@ -351,10 +353,12 @@ public class VarHeightResourceData extends AbstractRequestableResourceData
this.point = pointCoordinate;
}
@Override
public String getPointLetter() {
return pointLetter;
}
@Override
public void setPointLetter(String pointLetter) {
this.pointLetter = pointLetter;
}

View file

@ -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;

View file

@ -130,4 +130,17 @@
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"/>
<plugin
id="com.raytheon.uf.common.plugin.hpe"
download-size="0"
install-size="0"
version="0.0.0"/>
</feature>

View file

@ -1,7 +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.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 exported="true" kind="lib" path="jna.jar"/>
<classpathentry exported="true" kind="lib" path="jna-4.1.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -1,4 +1,3 @@
#Fri Mar 25 11:20:40 CDT 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6

View file

@ -1,10 +1,10 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Jna
Bundle-Name: JNA FOSS
Bundle-SymbolicName: com.sun.jna
Bundle-Version: 3.3.0
Bundle-ClassPath: jna.jar
Bundle-Vendor: Raytheon-bundled OSS
Bundle-Version: 4.1.0
Bundle-ClassPath: jna-4.1.0.jar
Export-Package: com.sun.jna,
com.sun.jna.ptr
com.sun.jna.ptr,
com.sun.jna.win32
Bundle-RequiredExecutionEnvironment: JavaSE-1.6

View file

@ -1,2 +1,2 @@
bin.includes = META-INF/,\
jna.jar
jna-4.1.0.jar

Binary file not shown.

Binary file not shown.

View 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"

View file

@ -741,6 +741,7 @@ public class GeospatialDataGenerator {
private String getTimeStamp(GeospatialTime curTime,
GeospatialTime lastRunTime) {
long tmStampMs = 0;
if (lastRunTime != null) {
if (curTime.getAreaSourceTime() != lastRunTime.getAreaSourceTime()) {
tmStampMs = curTime.getAreaSourceTime();
} else if (curTime.getParentSourceTime() != lastRunTime
@ -750,6 +751,9 @@ public class GeospatialDataGenerator {
.getTimeZoneSourceTime()) {
tmStampMs = curTime.getTimeZoneSourceTime();
}
} else {
tmStampMs = curTime.getAreaSourceTime();
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));

View file

@ -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
*

View file

@ -36,7 +36,6 @@ import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.gridcoverage.GridCoverage;
import com.raytheon.uf.common.gridcoverage.convert.GridCoverageConverter;
import com.raytheon.uf.common.parameter.Parameter;
import com.raytheon.uf.common.parameter.ParameterConverter;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@ -107,7 +106,7 @@ public class GridInfoRecord extends PersistableDataObject<Integer> {
@ManyToOne
@PrimaryKeyJoinColumn
@DataURI(position = 4, converter = ParameterConverter.class)
@DataURI(position = 4, embedded = true)
@DynamicSerializeElement
private Parameter parameter;

View file

@ -41,6 +41,7 @@ import com.raytheon.uf.common.geospatial.ISpatialEnabled;
import com.raytheon.uf.common.geospatial.ISpatialObject;
import com.raytheon.uf.common.gridcoverage.GridCoverage;
import com.raytheon.uf.common.parameter.Parameter;
import com.raytheon.uf.common.parameter.lookup.ParameterLookup;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@ -66,6 +67,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Dec 16, 2013 2574 bsteffen Remove getDecoderGettable.
* Apr 15, 2014 2060 njensen Remove dataURI column
* May 07, 2014 2060 njensen GridRecord(String) will do parameter lookup
*
* </pre>
*
@ -117,6 +119,14 @@ public class GridRecord extends PersistablePluginDataObject implements
public GridRecord(String uri) {
super(uri);
String abbrev = this.getInfo().getParameter().getAbbreviation();
if (abbrev != null) {
Parameter paramWithUnits = ParameterLookup.getInstance()
.getParameter(abbrev);
if (paramWithUnits != null) {
this.getInfo().setParameter(paramWithUnits);
}
}
}
public GridInfoRecord getInfo() {

View file

@ -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

View file

@ -34,6 +34,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@ -70,6 +71,7 @@ public class Parameter extends PersistableDataObject implements
@Id
@DynamicSerializeElement
@XmlElement
@DataURI(position = 0)
private String abbreviation;
@Column(nullable = false)

View 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>

View 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>

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.

View file

@ -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();
}
}

View file

@ -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;
}
}

View file

@ -17,14 +17,16 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.parameter;
package com.raytheon.uf.common.plugin.hpe.request;
import com.raytheon.uf.common.dataplugin.annotations.DataURIFieldConverter;
import com.raytheon.uf.common.parameter.lookup.ParameterLookup;
import java.util.Date;
import java.util.Map;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* A DataURIFieldConverter that ensures that a String parameter abbreviation
* will be looked up to potentially contain all the fields.
* HPE bias source response object.
*
* <pre>
*
@ -32,28 +34,32 @@ import com.raytheon.uf.common.parameter.lookup.ParameterLookup;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 6, 2014 2060 njensen Initial creation
* Apr 23, 2014 3026 mpduff Initial creation
*
* </pre>
*
* @author njensen
* @author mpduff
* @version 1.0
*/
@DynamicSerialize
public class HpeLabelDataResponse {
public class ParameterConverter implements DataURIFieldConverter<Parameter> {
/** Map of Dates->bias source text */
@DynamicSerializeElement
private Map<Date, String> data;
@Override
public String toString(Parameter field) {
return field.getAbbreviation();
/**
* @return the data
*/
public Map<Date, String> getData() {
return data;
}
@Override
public Parameter fromString(String string) {
Parameter p = ParameterLookup.getInstance().getParameter(string);
if (p == null) {
p = new Parameter(string);
/**
* @param data
* the data to set
*/
public void setData(Map<Date, String> data) {
this.data = data;
}
return p;
}
}

View file

@ -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>

View file

@ -171,6 +171,7 @@ public class SatPrecipFileBuilder {
xmfile.setData(data);
xmfile.save(fname);
logger.info("Successfully created satellite precip xmrg file: " + fname);
}
/**

View file

@ -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,

View file

@ -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
@ -218,7 +219,7 @@ public class FFMPProcessor {
}
statusHandler.handle(Priority.INFO,
"Processed Source: " + ffmpRec.getSourceName() + " sitekey: "
"Processed Source: " + source.getSourceName() + " sitekey: "
+ siteKey + " dataKey: " + dataKey + " time: "
+ (System.currentTimeMillis() - time));
@ -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;
@ -1826,18 +1828,25 @@ public class FFMPProcessor {
}
/**
* Gets the XMRG data array
* Gets the XMRG data array, checks HRAP/XMRG config for sanity.
*
* @return
*/
private short[][] getXMRGData() throws Exception {
String fileName = "MISSING";
if (xmrg.getFile() != null) {
fileName = xmrg.getFile().getAbsolutePath();
}
this.extent = getExtents(source.getHrapGridFactor());
setHRAPSubGrid(extent, source.getHrapGridFactor());
if (xmrg.getHrapExtent() != null) {
xmrgData = xmrg.getData(extent);
} else {
throw new MalformedDataException("The XMRG data is malformed or the file is non-readable.");
throw new MalformedDataException("The XMRG data is malformed or the file is non-readable. "+fileName);
}
return xmrgData;

View 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>

View 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>

View file

@ -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

View file

@ -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"

View file

@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
res/

View file

@ -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&amp;delay=5000&amp;maxMessagesPerPoll=1000&amp;exclusiveReadLockStrategy=#hpeFileChangedStrategy&amp;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>

View file

@ -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>

View file

@ -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;
}
}

View file

@ -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);
}
}
}

View file

@ -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);
}
}
}

View file

@ -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);
}
}
}

View file

@ -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();
}
}

View file

@ -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;
}
}

View file

@ -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

View file

@ -11,6 +11,9 @@
* Date Ticket# Engineer Description
* ------- ------- -------- -----------
* 03/23/2010 229 Chin Chen Initial coding
* 05/08/2014 3108 bkowal Disabled loading of native libraries that
* are not available to Windows when the Windows
* OS is detected.
*
* </pre>
*

View file

@ -32,7 +32,8 @@ Require-Bundle: org.eclipse.ui,
gov.noaa.nws.ncep.viz.gempak;bundle-version="1.0.0",
gov.noaa.nws.ncep.viz.gempak.nativelib;bundle-version="1.0.0",
com.raytheon.uf.common.style;bundle-version="1.0.0",
com.raytheon.uf.common.numeric;bundle-version="1.14.0"
com.raytheon.uf.common.numeric;bundle-version="1.14.0",
org.apache.commons.lang;bundle-version="2.3.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: gov.noaa.nws.ncep.viz.rsc.ncgrid,

View file

@ -6,6 +6,8 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.apache.commons.lang.SystemUtils;
/**
* The activator class controls the plug-in life cycle
*/
@ -35,6 +37,9 @@ public class Activator extends AbstractUIPlugin {
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
if (SystemUtils.IS_OS_WINDOWS) {
return;
}
LibraryLoader.load("cnflib");
// LibraryLoader.load("xml2");
LibraryLoader.load("gempak");

View file

@ -1,17 +1,47 @@
/**
*
*
* This java class performs the NSHARP NsharpNative functions.
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
*
* <pre>
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------- ------- -------- -----------
* ??/??/??? ? Initial coding
* 05/08/2014 3108 bkowal Updated structure classes for the JNA upgrade.
*
*
* </pre>
*
* @author ?
* @version 1.0
*/
package gov.noaa.nws.ncep.viz.tools.aodt.natives;
import java.util.Arrays;
import java.util.List;
import com.sun.jna.Structure;
public class datagrid extends Structure {
public float[][] temp = new float[500][500];
public float[][] lat = new float[500][500];
public float[][] lon = new float[500][500];
public int numx;
public int numy;
public datagrid() {
super();
}
public datagrid(float temp[][], float lat[][], float lon[][], int numx, int numy) {
public datagrid(float temp[][], float lat[][], float lon[][], int numx,
int numy) {
super();
if (temp.length != this.temp.length)
throw new java.lang.IllegalArgumentException("Wrong array size !");
@ -25,10 +55,31 @@ public class datagrid extends Structure {
this.numx = numx;
this.numy = numy;
}
protected ByReference newByReference() { return new ByReference(); }
protected ByValue newByValue() { return new ByValue(); }
protected datagrid newInstance() { return new datagrid(); }
public static class ByReference extends datagrid implements com.sun.jna.Structure.ByReference {}
public static class ByValue extends datagrid implements com.sun.jna.Structure.ByValue {}
protected ByReference newByReference() {
return new ByReference();
}
protected ByValue newByValue() {
return new ByValue();
}
protected datagrid newInstance() {
return new datagrid();
}
public static class ByReference extends datagrid implements
com.sun.jna.Structure.ByReference {
}
public static class ByValue extends datagrid implements
com.sun.jna.Structure.ByValue {
}
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[] { "temp", "lat", "lon", "numx",
"numy" });
}
}

View file

@ -1,27 +1,75 @@
/**
*
*
* This java class performs the NSHARP NsharpNative functions.
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
*
* <pre>
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------- ------- -------- -----------
* ??/??/??? ? Initial coding
* 05/08/2014 3108 bkowal Updated structure classes for the JNA upgrade.
*
*
* </pre>
*
* @author ?
* @version 1.0
*/
package gov.noaa.nws.ncep.viz.tools.aodt.natives;
import java.util.Arrays;
import java.util.List;
import com.sun.jna.Structure;
public class dis_vars extends Structure{
/// Output number of lines
public class dis_vars extends Structure {
// / Output number of lines
public double xrectl;
/// Output number of elems
// / Output number of elems
public double xrecte;
public dis_vars() {
super();
}
/**
* @param xrectl Output number of lines<br>
* @param xrecte Output number of elems
* @param xrectl
* Output number of lines<br>
* @param xrecte
* Output number of elems
*/
public dis_vars(double xrectl, double xrecte) {
super();
this.xrectl = xrectl;
this.xrecte = xrecte;
}
protected ByReference newByReference() { return new ByReference(); }
protected ByValue newByValue() { return new ByValue(); }
protected dis_vars newInstance() { return new dis_vars(); }
public static class ByReference extends dis_vars implements com.sun.jna.Structure.ByReference {}
public static class ByValue extends dis_vars implements com.sun.jna.Structure.ByValue {}
protected ByReference newByReference() {
return new ByReference();
}
protected ByValue newByValue() {
return new ByValue();
}
protected dis_vars newInstance() {
return new dis_vars();
}
public static class ByReference extends dis_vars implements
com.sun.jna.Structure.ByReference {
}
public static class ByValue extends dis_vars implements
com.sun.jna.Structure.ByValue {
}
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[] { "xrectl", "xrecte" });
}
}

View file

@ -1,5 +1,28 @@
/**
*
*
* This java class performs the NSHARP NsharpNative functions.
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
*
* <pre>
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------- ------- -------- -----------
* ??/??/??? ? Initial coding
* 05/08/2014 3108 bkowal Updated structure classes for the JNA upgrade.
*
*
* </pre>
*
* @author ?
* @version 1.0
*/
package gov.noaa.nws.ncep.viz.tools.aodt.natives;
import java.util.Arrays;
import java.util.List;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
@ -7,59 +30,130 @@ public class irdata extends Structure {
public static class ByReference extends irdata implements
Structure.ByReference {
}
public int date;
public int time;
public float TrawO;
public float Traw;
public float Tfinal;
public float Tfinal3;
public float CI;
public float eyet;
public float warmt;
public float cloudt;
public float cloudt2;
public float cwcloudt;
public float latitude;
public float longitude;
public float warmlatitude;
public float warmlongitude;
public float eyesize;
public float eyestdv;
public float cloudsymave;
public int sattype;
public int eyescene;
public int cloudscene;
public int eyesceneold;
public int cloudsceneold;
public int rule9;
public int rule8;
public int land;
public int eyefft;
public int cloudfft;
public int cwring;
public int ringcb;
public int ringcbval;
public int ringcbvalmax;
public float ringcblatmax;
public float ringcblonmax;
public float CIadjp;
public float sst;
public float TIEraw;
public float TIEavg;
public int TIEflag;
public int autopos;
public int LBflag;
public float rmw;
public byte[] comment = new byte[(50)];
public irdata() {
super();
}
public irdata(Pointer p) {
useMemory(p);
}
protected ByReference newByReference() { return new ByReference(); }
protected ByValue newByValue() { return new ByValue(); }
protected irdata newInstance() { return new irdata(); }
//public static class ByReference extends irdata implements ByReference {}
public static class ByValue extends irdata implements com.sun.jna.Structure.ByValue {}
protected ByReference newByReference() {
return new ByReference();
}
protected ByValue newByValue() {
return new ByValue();
}
protected irdata newInstance() {
return new irdata();
}
// public static class ByReference extends irdata implements ByReference {}
public static class ByValue extends irdata implements
com.sun.jna.Structure.ByValue {
}
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[] { "date", "time", "TrawO", "Traw",
"Tfinal", "Tfinal3", "CI", "eyet", "warmt", "cloudt",
"cloudt2", "cwcloudt", "latitude", "longitude", "warmlatitude",
"warmlongitude", "eyesize", "eyestdv", "cloudsymave",
"sattype", "eyescene", "cloudscene", "eyesceneold",
"cloudsceneold", "rule9", "rule8", "land", "eyefft",
"cloudfft", "cwring", "ringcb", "ringcbval", "ringcbvalmax",
"ringcblatmax", "ringcblonmax", "CIadjp", "sst", "TIEraw",
"TIEavg", "TIEflag", "autopos", "LBflag", "rmw", "comment" });
}
}

View file

@ -1,26 +1,73 @@
/**
*
*
* This java class performs the NSHARP NsharpNative functions.
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
*
* <pre>
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------- ------- -------- -----------
* ??/??/??? ? Initial coding
* 05/08/2014 3108 bkowal Updated structure classes for the JNA upgrade.
*
*
* </pre>
*
* @author ?
* @version 1.0
*/
package gov.noaa.nws.ncep.viz.tools.aodt.natives;
import java.util.Arrays;
import java.util.List;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
public class odtdata extends Structure{
public class odtdata extends Structure {
public irdata IR;
public odtdata.ByReference nextrec;
public odtdata() {
super();
}
public odtdata(Pointer p) {
useMemory(p);
}
public odtdata(irdata IR, odtdata.ByReference nextrec) {
super();
this.IR = IR;
this.nextrec = nextrec;
}
public ByReference newByReference() { return new ByReference(); }
public ByValue newByValue() { return new ByValue(); }
public odtdata newInstance() { return new odtdata(); }
public static class ByReference extends odtdata implements com.sun.jna.Structure.ByReference {}
public static class ByValue extends odtdata implements com.sun.jna.Structure.ByValue {}
public ByReference newByReference() {
return new ByReference();
}
public ByValue newByValue() {
return new ByValue();
}
public odtdata newInstance() {
return new odtdata();
}
public static class ByReference extends odtdata implements
com.sun.jna.Structure.ByReference {
}
public static class ByValue extends odtdata implements
com.sun.jna.Structure.ByValue {
}
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[] { "IR", "nextrec" });
}
}

View file

@ -1,37 +1,91 @@
/**
*
*
* This java class performs the NSHARP NsharpNative functions.
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
*
* <pre>
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------- ------- -------- -----------
* ??/??/??? ? Initial coding
* 05/08/2014 3108 bkowal Updated structure classes for the JNA upgrade.
*
*
* </pre>
*
* @author ?
* @version 1.0
*/
package gov.noaa.nws.ncep.viz.tools.aodt.natives;
import java.util.Arrays;
import java.util.List;
import gov.noaa.nws.ncep.viz.tools.aodt.natives.AODTv64Native.aodtv64.FILE;
import com.sun.jna.Structure;
public class remap_vars extends Structure {
/// Block size (bytes) input file
// / Block size (bytes) input file
public int in_bfw;
/// Block size (bytes) output file
// / Block size (bytes) output file
public int out_bfw;
/// Number of splines/line
// / Number of splines/line
public int nspl;
/// Number of splines/elem
// / Number of splines/elem
public int nspe;
/// Source blocksize
// / Source blocksize
public int slb;
/// Dest blocksize
// / Dest blocksize
public int dlb;
/// Number of corners in line
// / Number of corners in line
public int ncl;
/// Number of corners in elem
// / Number of corners in elem
public int nce;
/// Input file descriptor
// / Input file descriptor
public FILE in_fd;
/// Output file descriptor
// / Output file descriptor
public FILE out_fd;
public remap_vars() {
super();
}
protected ByReference newByReference() { return new ByReference(); }
protected ByValue newByValue() { return new ByValue(); }
protected remap_vars newInstance() { return new remap_vars(); }
public static class ByReference extends remap_vars implements com.sun.jna.Structure.ByReference {}
public static class ByValue extends remap_vars implements com.sun.jna.Structure.ByValue {}
protected ByReference newByReference() {
return new ByReference();
}
protected ByValue newByValue() {
return new ByValue();
}
protected remap_vars newInstance() {
return new remap_vars();
}
public static class ByReference extends remap_vars implements
com.sun.jna.Structure.ByReference {
}
public static class ByValue extends remap_vars implements
com.sun.jna.Structure.ByValue {
}
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[] { "in_bfw", "out_bfw", "nspl",
"nspe", "slb", "dlb", "ncl", "nce", "in_fd", "out_fd" });
}
}

View file

@ -1,26 +1,76 @@
/**
*
*
* This java class performs the NSHARP NsharpNative functions.
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
*
* <pre>
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------- ------- -------- -----------
* ??/??/??? ? Initial coding
* 05/08/2014 3108 bkowal Updated structure classes for the JNA upgrade.
*
*
* </pre>
*
* @author ?
* @version 1.0
*/
package gov.noaa.nws.ncep.viz.tools.aodt.natives;
import java.util.Arrays;
import java.util.List;
import com.sun.jna.Structure;
public class ringdata extends Structure {
public float dist;
public float angle;
public float temp;
public ringdata.ByReference nextrec;
public ringdata() {
super();
}
public ringdata(float dist, float angle, float temp, ringdata.ByReference nextrec) {
public ringdata(float dist, float angle, float temp,
ringdata.ByReference nextrec) {
super();
this.dist = dist;
this.angle = angle;
this.temp = temp;
this.nextrec = nextrec;
}
protected ByReference newByReference() { return new ByReference(); }
protected ByValue newByValue() { return new ByValue(); }
protected ringdata newInstance() { return new ringdata(); }
public static class ByReference extends ringdata implements com.sun.jna.Structure.ByReference {}
public static class ByValue extends ringdata implements com.sun.jna.Structure.ByValue {}
protected ByReference newByReference() {
return new ByReference();
}
protected ByValue newByValue() {
return new ByValue();
}
protected ringdata newInstance() {
return new ringdata();
}
public static class ByReference extends ringdata implements
com.sun.jna.Structure.ByReference {
}
public static class ByValue extends ringdata implements
com.sun.jna.Structure.ByValue {
}
@Override
protected List getFieldOrder() {
return Arrays
.asList(new String[] { "dist", "angle", "temp", "nextrec" });
}
}

View file

@ -1,21 +1,51 @@
/**
*
*
* This java class performs the NSHARP NsharpNative functions.
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
*
* <pre>
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------- ------- -------- -----------
* ??/??/??? ? Initial coding
* 05/08/2014 3108 bkowal Updated structure classes for the JNA upgrade.
*
*
* </pre>
*
* @author ?
* @version 1.0
*/
package gov.noaa.nws.ncep.viz.tools.aodt.natives;
import java.util.Arrays;
import java.util.List;
import com.sun.jna.Structure;
public class tiff_header extends Structure{
/// Byte order
public class tiff_header extends Structure {
// / Byte order
public int order;
/// Version
// / Version
public int version;
/// Pointer
// / Pointer
public int point;
public tiff_header() {
super();
}
/**
* @param order Byte order<br>
* @param version Version<br>
* @param point Pointer
* @param order
* Byte order<br>
* @param version
* Version<br>
* @param point
* Pointer
*/
public tiff_header(int order, int version, int point) {
super();
@ -23,10 +53,30 @@ public class tiff_header extends Structure{
this.version = version;
this.point = point;
}
protected ByReference newByReference() { return new ByReference(); }
protected ByValue newByValue() { return new ByValue(); }
protected tiff_header newInstance() { return new tiff_header(); }
public static class ByReference extends tiff_header implements com.sun.jna.Structure.ByReference {}
public static class ByValue extends tiff_header implements com.sun.jna.Structure.ByValue {}
protected ByReference newByReference() {
return new ByReference();
}
protected ByValue newByValue() {
return new ByValue();
}
protected tiff_header newInstance() {
return new tiff_header();
}
public static class ByReference extends tiff_header implements
com.sun.jna.Structure.ByReference {
}
public static class ByValue extends tiff_header implements
com.sun.jna.Structure.ByValue {
}
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[] { "order", "version", "point" });
}
}

View file

@ -1,24 +1,56 @@
/**
*
*
* This java class performs the NSHARP NsharpNative functions.
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
*
* <pre>
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------- ------- -------- -----------
* ??/??/??? ? Initial coding
* 05/08/2014 3108 bkowal Updated structure classes for the JNA upgrade.
*
*
* </pre>
*
* @author ?
* @version 1.0
*/
package gov.noaa.nws.ncep.viz.tools.aodt.natives;
import java.util.Arrays;
import java.util.List;
import com.sun.jna.Structure;
public class tiff_record extends Structure{
/// TIFF tag
public class tiff_record extends Structure {
// / TIFF tag
public int tag;
/// Data type
// / Data type
public int type;
/// Length
// / Length
public int length;
/// Pointer or value
// / Pointer or value
public int voff;
public tiff_record() {
super();
}
/**
* @param tag TIFF tag<br>
* @param type Data type<br>
* @param length Length<br>
* @param voff Pointer or value
* @param tag
* TIFF tag<br>
* @param type
* Data type<br>
* @param length
* Length<br>
* @param voff
* Pointer or value
*/
public tiff_record(int tag, int type, int length, int voff) {
super();
@ -27,10 +59,30 @@ public class tiff_record extends Structure{
this.length = length;
this.voff = voff;
}
protected ByReference newByReference() { return new ByReference(); }
protected ByValue newByValue() { return new ByValue(); }
protected tiff_record newInstance() { return new tiff_record(); }
public static class ByReference extends tiff_record implements com.sun.jna.Structure.ByReference {}
public static class ByValue extends tiff_record implements com.sun.jna.Structure.ByValue {}
protected ByReference newByReference() {
return new ByReference();
}
protected ByValue newByValue() {
return new ByValue();
}
protected tiff_record newInstance() {
return new tiff_record();
}
public static class ByReference extends tiff_record implements
com.sun.jna.Structure.ByReference {
}
public static class ByValue extends tiff_record implements
com.sun.jna.Structure.ByValue {
}
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[] { "tag", "type", "length", "voff" });
}
}

View file

@ -1,21 +1,55 @@
/**
*
*
* This java class performs the NSHARP NsharpNative functions.
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
*
* <pre>
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------- ------- -------- -----------
* ??/??/??? ? Initial coding
* 05/08/2014 3108 bkowal Updated structure classes for the JNA upgrade.
*
*
* </pre>
*
* @author ?
* @version 1.0
*/
package gov.noaa.nws.ncep.viz.tools.aodt.natives;
import java.util.Arrays;
import java.util.List;
import com.sun.jna.Structure;
public class tiff_vars extends Structure{
public class tiff_vars extends Structure {
public int nbits;
public int photo;
public int unit;
public int in_lines;
public int in_elems;
public int out_lines;
public int out_elems;
public int[] ratx = new int[(2)];
public int[] raty = new int[(2)];
public tiff_vars() {
super();
}
public tiff_vars(int nbits, int photo, int unit, int in_lines, int in_elems, int out_lines, int out_elems, int ratx[], int raty[]) {
public tiff_vars(int nbits, int photo, int unit, int in_lines,
int in_elems, int out_lines, int out_elems, int ratx[], int raty[]) {
super();
this.nbits = nbits;
this.photo = photo;
@ -31,10 +65,32 @@ public class tiff_vars extends Structure{
throw new java.lang.IllegalArgumentException("Wrong array size !");
this.raty = raty;
}
protected ByReference newByReference() { return new ByReference(); }
protected ByValue newByValue() { return new ByValue(); }
protected tiff_vars newInstance() { return new tiff_vars(); }
public static class ByReference extends tiff_vars implements com.sun.jna.Structure.ByReference {}
public static class ByValue extends tiff_vars implements com.sun.jna.Structure.ByValue {}
protected ByReference newByReference() {
return new ByReference();
}
protected ByValue newByValue() {
return new ByValue();
}
protected tiff_vars newInstance() {
return new tiff_vars();
}
public static class ByReference extends tiff_vars implements
com.sun.jna.Structure.ByReference {
}
public static class ByValue extends tiff_vars implements
com.sun.jna.Structure.ByValue {
}
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[] { "nbits", "photo", "unit",
"in_lines", "in_elems", "out_lines", "out_elems", "ratx",
"raty" });
}
}

View file

@ -162,6 +162,7 @@
<classpathentry kind="lib" path="lib/jetty-security-7.6.14.v20131031.jar"/>
<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>

View file

@ -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>());
}
}
}