diff --git a/cave/com.raytheon.uf.viz.d2d.nsharp/src/com/raytheon/uf/viz/d2d/nsharp/rsc/D2DNSharpResourceData.java b/cave/com.raytheon.uf.viz.d2d.nsharp/src/com/raytheon/uf/viz/d2d/nsharp/rsc/D2DNSharpResourceData.java index 0463297fdf..5d9e3e5c52 100644 --- a/cave/com.raytheon.uf.viz.d2d.nsharp/src/com/raytheon/uf/viz/d2d/nsharp/rsc/D2DNSharpResourceData.java +++ b/cave/com.raytheon.uf.viz.d2d.nsharp/src/com/raytheon/uf/viz/d2d/nsharp/rsc/D2DNSharpResourceData.java @@ -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 * * * @@ -81,6 +83,7 @@ public abstract class D2DNSharpResourceData extends public D2DNSharpResourceData() { super(); + this.setAlertParser(new DataCubeAlertMessageParser()); } public D2DNSharpResourceData(String soundingType) { diff --git a/cave/com.raytheon.uf.viz.hpe/.classpath b/cave/com.raytheon.uf.viz.hpe/.classpath new file mode 100644 index 0000000000..ad32c83a78 --- /dev/null +++ b/cave/com.raytheon.uf.viz.hpe/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/cave/com.raytheon.uf.viz.hpe/.project b/cave/com.raytheon.uf.viz.hpe/.project new file mode 100644 index 0000000000..52f6993c01 --- /dev/null +++ b/cave/com.raytheon.uf.viz.hpe/.project @@ -0,0 +1,28 @@ + + + com.raytheon.uf.viz.hpe + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/cave/com.raytheon.uf.viz.hpe/.settings/org.eclipse.jdt.core.prefs b/cave/com.raytheon.uf.viz.hpe/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..8000cd6ca6 --- /dev/null +++ b/cave/com.raytheon.uf.viz.hpe/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/cave/com.raytheon.uf.viz.hpe/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.hpe/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..4a28e037d0 --- /dev/null +++ b/cave/com.raytheon.uf.viz.hpe/META-INF/MANIFEST.MF @@ -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 diff --git a/cave/com.raytheon.uf.viz.hpe/build.properties b/cave/com.raytheon.uf.viz.hpe/build.properties new file mode 100644 index 0000000000..34d2e4d2da --- /dev/null +++ b/cave/com.raytheon.uf.viz.hpe/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/cave/com.raytheon.uf.viz.hpe/plugin.xml b/cave/com.raytheon.uf.viz.hpe/plugin.xml new file mode 100644 index 0000000000..488e536235 --- /dev/null +++ b/cave/com.raytheon.uf.viz.hpe/plugin.xml @@ -0,0 +1,30 @@ + + + + + + + + + diff --git a/cave/com.raytheon.uf.viz.hpe/src/com/raytheon/uf/viz/hpe/D2DHpeDisplayCustomizer.java b/cave/com.raytheon.uf.viz.hpe/src/com/raytheon/uf/viz/hpe/D2DHpeDisplayCustomizer.java new file mode 100644 index 0000000000..e13442a35d --- /dev/null +++ b/cave/com.raytheon.uf.viz.hpe/src/com/raytheon/uf/viz/hpe/D2DHpeDisplayCustomizer.java @@ -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. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 5, 2014     3026    mpduff      Initial creation
+ * 
+ * 
+ * + * @author mpduff + * @version 1.0 + */ + +public class D2DHpeDisplayCustomizer implements IRenderableDisplayCustomizer { + + /** List of listeners we have for renderable displays */ + private final List listeners = new ArrayList(); + + @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()); + } +} diff --git a/cave/com.raytheon.uf.viz.hpe/src/com/raytheon/uf/viz/hpe/rsc/HpeLabelResource.java b/cave/com.raytheon.uf.viz.hpe/src/com/raytheon/uf/viz/hpe/rsc/HpeLabelResource.java new file mode 100644 index 0000000000..1d89badae1 --- /dev/null +++ b/cave/com.raytheon.uf.viz.hpe/src/com/raytheon/uf/viz/hpe/rsc/HpeLabelResource.java @@ -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 + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 5, 2014    3026     mpduff      Initial creation
+ * 
+ * 
+ * + * @author mpduff + * @version 1.0 + */ + +public class HpeLabelResource extends + AbstractVizResource implements + IResourceDataChanged { + + private final IUFStatusHandler logger = UFStatus + .getHandler(HpeLabelResource.class); + + private final Map hpeTextCache = Collections + .synchronizedMap(new HashMap()); + + 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 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 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; + } + } +} diff --git a/cave/com.raytheon.uf.viz.hpe/src/com/raytheon/uf/viz/hpe/rsc/HpeLabelResourceData.java b/cave/com.raytheon.uf.viz.hpe/src/com/raytheon/uf/viz/hpe/rsc/HpeLabelResourceData.java new file mode 100644 index 0000000000..d660dd27a7 --- /dev/null +++ b/cave/com.raytheon.uf.viz.hpe/src/com/raytheon/uf/viz/hpe/rsc/HpeLabelResourceData.java @@ -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. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 5, 2014      3026   mpduff      Initial creation
+ * 
+ * 
+ * + * @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; + } +} diff --git a/cave/com.raytheon.uf.viz.hpe/src/com/raytheon/uf/viz/hpe/util/HpeUtils.java b/cave/com.raytheon.uf.viz.hpe/src/com/raytheon/uf/viz/hpe/util/HpeUtils.java new file mode 100644 index 0000000000..7d38180a93 --- /dev/null +++ b/cave/com.raytheon.uf.viz.hpe/src/com/raytheon/uf/viz/hpe/util/HpeUtils.java @@ -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 + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 6, 2014     3026    mpduff      Initial creation
+ * 
+ * 
+ * + * @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); + } +} diff --git a/cave/com.raytheon.uf.viz.monitor.ffmp/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.monitor.ffmp/META-INF/MANIFEST.MF index 05f56b95ed..dcbff667ab 100644 --- a/cave/com.raytheon.uf.viz.monitor.ffmp/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.monitor.ffmp/META-INF/MANIFEST.MF @@ -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 diff --git a/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/ui/rsc/FFMPResource.java b/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/ui/rsc/FFMPResource.java index c778f99e98..4474c409d7 100644 --- a/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/ui/rsc/FFMPResource.java +++ b/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/ui/rsc/FFMPResource.java @@ -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. * * * @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 hpeLegendMap = Collections + .synchronizedMap(new HashMap()); + + /** 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 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; + } + } } diff --git a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/resource/CWATLocalThreatResource.java b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/resource/CWATLocalThreatResource.java index 50ca859700..c991ff8b04 100644 --- a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/resource/CWATLocalThreatResource.java +++ b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/resource/CWATLocalThreatResource.java @@ -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 * * * @@ -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() }); diff --git a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/resource/ScanDrawer.java b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/resource/ScanDrawer.java index 4a06c56d0b..890507793b 100644 --- a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/resource/ScanDrawer.java +++ b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/resource/ScanDrawer.java @@ -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 * * * @@ -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 * diff --git a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/resource/ScanResource.java b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/resource/ScanResource.java index 0cc16d4de6..b9698bd02f 100644 --- a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/resource/ScanResource.java +++ b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/resource/ScanResource.java @@ -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 * * * @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; diff --git a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionResourceData.java b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionResourceData.java index a9a1ef4d2f..5d5296d1fe 100644 --- a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionResourceData.java +++ b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionResourceData.java @@ -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 * * * @@ -88,6 +90,10 @@ public class CrossSectionResourceData extends AbstractRequestableResourceData { private Set blackListedTimes = new HashSet(); + public CrossSectionResourceData() { + this.setAlertParser(new DataCubeAlertMessageParser()); + } + @Override public AbstractVizResource construct(LoadProperties loadProperties, IDescriptor descriptor) throws VizException { diff --git a/cave/com.raytheon.uf.viz.xy.timeseries/src/com/raytheon/uf/viz/xy/timeseries/rsc/TimeSeriesResourceData.java b/cave/com.raytheon.uf.viz.xy.timeseries/src/com/raytheon/uf/viz/xy/timeseries/rsc/TimeSeriesResourceData.java index c15aa1eab0..4018fd3dfe 100644 --- a/cave/com.raytheon.uf.viz.xy.timeseries/src/com/raytheon/uf/viz/xy/timeseries/rsc/TimeSeriesResourceData.java +++ b/cave/com.raytheon.uf.viz.xy.timeseries/src/com/raytheon/uf/viz/xy/timeseries/rsc/TimeSeriesResourceData.java @@ -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 * * * @@ -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; } diff --git a/cave/com.raytheon.uf.viz.xy.varheight/src/com/raytheon/uf/viz/xy/varheight/rsc/VarHeightResourceData.java b/cave/com.raytheon.uf.viz.xy.varheight/src/com/raytheon/uf/viz/xy/varheight/rsc/VarHeightResourceData.java index 1d803ffc92..d87bcd841a 100644 --- a/cave/com.raytheon.uf.viz.xy.varheight/src/com/raytheon/uf/viz/xy/varheight/rsc/VarHeightResourceData.java +++ b/cave/com.raytheon.uf.viz.xy.varheight/src/com/raytheon/uf/viz/xy/varheight/rsc/VarHeightResourceData.java @@ -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 * *
  * 
@@ -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
  * 
  * 
* @@ -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; } diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/GridResource.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/GridResource.java index 73cd259f94..bed96f158d 100644 --- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/GridResource.java +++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/GridResource.java @@ -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 * * * @@ -150,7 +151,7 @@ public class GridResource extends + record.getParameter().getName(); } - protected GridRecord getCurrentGridRecord() { + public GridRecord getCurrentGridRecord() { List pdos = getCurrentPluginDataObjects(); if (pdos == null || pdos.isEmpty()) { return null; diff --git a/cave/com.raytheon.viz.hydro.feature/feature.xml b/cave/com.raytheon.viz.hydro.feature/feature.xml index a0fab3939d..d97c7d6c57 100644 --- a/cave/com.raytheon.viz.hydro.feature/feature.xml +++ b/cave/com.raytheon.viz.hydro.feature/feature.xml @@ -130,4 +130,17 @@ version="0.0.0" unpack="false"/> + + + + diff --git a/cots/com.sun.jna/.classpath b/cots/com.sun.jna/.classpath index fdf6ee4767..410e1da7cb 100644 --- a/cots/com.sun.jna/.classpath +++ b/cots/com.sun.jna/.classpath @@ -1,7 +1,7 @@ - + - + diff --git a/cots/com.sun.jna/.settings/org.eclipse.jdt.core.prefs b/cots/com.sun.jna/.settings/org.eclipse.jdt.core.prefs index 001f2d2882..c537b63063 100644 --- a/cots/com.sun.jna/.settings/org.eclipse.jdt.core.prefs +++ b/cots/com.sun.jna/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/cots/com.sun.jna/META-INF/MANIFEST.MF b/cots/com.sun.jna/META-INF/MANIFEST.MF index 389310e0f2..8d1acd8664 100644 --- a/cots/com.sun.jna/META-INF/MANIFEST.MF +++ b/cots/com.sun.jna/META-INF/MANIFEST.MF @@ -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 diff --git a/cots/com.sun.jna/build.properties b/cots/com.sun.jna/build.properties index 315c860036..48701da7af 100644 --- a/cots/com.sun.jna/build.properties +++ b/cots/com.sun.jna/build.properties @@ -1,2 +1,2 @@ bin.includes = META-INF/,\ - jna.jar + jna-4.1.0.jar diff --git a/cots/com.sun.jna/com.sun.jna.ecl b/cots/com.sun.jna/com.sun.jna.ecl deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/cots/com.sun.jna/jna-4.1.0.jar b/cots/com.sun.jna/jna-4.1.0.jar new file mode 100644 index 0000000000..b1a3922fec Binary files /dev/null and b/cots/com.sun.jna/jna-4.1.0.jar differ diff --git a/cots/com.sun.jna/jna.jar b/cots/com.sun.jna/jna.jar deleted file mode 100644 index 57f31c3168..0000000000 Binary files a/cots/com.sun.jna/jna.jar and /dev/null differ diff --git a/deltaScripts/14.3.1/DR3026/addMetadataColumnFFMP.sh b/deltaScripts/14.3.1/DR3026/addMetadataColumnFFMP.sh new file mode 100644 index 0000000000..76ea698a49 --- /dev/null +++ b/deltaScripts/14.3.1/DR3026/addMetadataColumnFFMP.sh @@ -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" diff --git a/edexOsgi/com.raytheon.edex.plugin.warning/src/com/raytheon/edex/plugin/warning/gis/GeospatialDataGenerator.java b/edexOsgi/com.raytheon.edex.plugin.warning/src/com/raytheon/edex/plugin/warning/gis/GeospatialDataGenerator.java index 4af2dce791..5e74490853 100644 --- a/edexOsgi/com.raytheon.edex.plugin.warning/src/com/raytheon/edex/plugin/warning/gis/GeospatialDataGenerator.java +++ b/edexOsgi/com.raytheon.edex.plugin.warning/src/com/raytheon/edex/plugin/warning/gis/GeospatialDataGenerator.java @@ -741,14 +741,18 @@ public class GeospatialDataGenerator { private String getTimeStamp(GeospatialTime curTime, GeospatialTime lastRunTime) { long tmStampMs = 0; - if (curTime.getAreaSourceTime() != lastRunTime.getAreaSourceTime()) { + if (lastRunTime != null) { + if (curTime.getAreaSourceTime() != lastRunTime.getAreaSourceTime()) { + tmStampMs = curTime.getAreaSourceTime(); + } else if (curTime.getParentSourceTime() != lastRunTime + .getParentSourceTime()) { + tmStampMs = curTime.getParentSourceTime(); + } else if (curTime.getTimeZoneSourceTime() != lastRunTime + .getTimeZoneSourceTime()) { + tmStampMs = curTime.getTimeZoneSourceTime(); + } + } else { tmStampMs = curTime.getAreaSourceTime(); - } else if (curTime.getParentSourceTime() != lastRunTime - .getParentSourceTime()) { - tmStampMs = curTime.getParentSourceTime(); - } else if (curTime.getTimeZoneSourceTime() != lastRunTime - .getTimeZoneSourceTime()) { - tmStampMs = curTime.getTimeZoneSourceTime(); } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/src/com/raytheon/uf/common/dataplugin/ffmp/FFMPRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/src/com/raytheon/uf/common/dataplugin/ffmp/FFMPRecord.java index 3e07637fbe..1afaa5a5f0 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/src/com/raytheon/uf/common/dataplugin/ffmp/FFMPRecord.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/src/com/raytheon/uf/common/dataplugin/ffmp/FFMPRecord.java @@ -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. * * * @@ -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 * diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridInfoRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridInfoRecord.java index 1ed01e29bb..7a40edd823 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridInfoRecord.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridInfoRecord.java @@ -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 { @ManyToOne @PrimaryKeyJoinColumn - @DataURI(position = 4, converter = ParameterConverter.class) + @DataURI(position = 4, embedded = true) @DynamicSerializeElement private Parameter parameter; diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridRecord.java index eed4f41d18..807e7fa89e 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridRecord.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridRecord.java @@ -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 * * * @@ -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() { diff --git a/edexOsgi/com.raytheon.uf.common.ohd/utility/common_static/base/hydro/Apps_defaults b/edexOsgi/com.raytheon.uf.common.ohd/utility/common_static/base/hydro/Apps_defaults index 59d708ef3b..819a0815db 100644 --- a/edexOsgi/com.raytheon.uf.common.ohd/utility/common_static/base/hydro/Apps_defaults +++ b/edexOsgi/com.raytheon.uf.common.ohd/utility/common_static/base/hydro/Apps_defaults @@ -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 diff --git a/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/Parameter.java b/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/Parameter.java index 6479a8a49b..b7ecd7d3bb 100644 --- a/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/Parameter.java +++ b/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/Parameter.java @@ -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) diff --git a/edexOsgi/com.raytheon.uf.common.plugin.hpe/.classpath b/edexOsgi/com.raytheon.uf.common.plugin.hpe/.classpath new file mode 100644 index 0000000000..098194ca4b --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.plugin.hpe/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/edexOsgi/com.raytheon.uf.common.plugin.hpe/.project b/edexOsgi/com.raytheon.uf.common.plugin.hpe/.project new file mode 100644 index 0000000000..d621d2b9da --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.plugin.hpe/.project @@ -0,0 +1,28 @@ + + + com.raytheon.uf.common.plugin.hpe + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/edexOsgi/com.raytheon.uf.common.plugin.hpe/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.common.plugin.hpe/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..c537b63063 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.plugin.hpe/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/edexOsgi/com.raytheon.uf.common.plugin.hpe/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.plugin.hpe/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..980394b25f --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.plugin.hpe/META-INF/MANIFEST.MF @@ -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 diff --git a/edexOsgi/com.raytheon.uf.common.plugin.hpe/build.properties b/edexOsgi/com.raytheon.uf.common.plugin.hpe/build.properties new file mode 100644 index 0000000000..34d2e4d2da --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.plugin.hpe/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/edexOsgi/com.raytheon.uf.common.plugin.hpe/src/com/raytheon/uf/common/plugin/hpe/data/BiasDynRecord.java b/edexOsgi/com.raytheon.uf.common.plugin.hpe/src/com/raytheon/uf/common/plugin/hpe/data/BiasDynRecord.java new file mode 100644 index 0000000000..3d7a407d5c --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.plugin.hpe/src/com/raytheon/uf/common/plugin/hpe/data/BiasDynRecord.java @@ -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. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Mar 26, 2014    3026    mpduff      Initial creation
+ * 
+ * 
+ * + * @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(); + } +} diff --git a/edexOsgi/com.raytheon.uf.common.plugin.hpe/src/com/raytheon/uf/common/plugin/hpe/request/HpeLabelDataRequest.java b/edexOsgi/com.raytheon.uf.common.plugin.hpe/src/com/raytheon/uf/common/plugin/hpe/request/HpeLabelDataRequest.java new file mode 100644 index 0000000000..21825000e4 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.plugin.hpe/src/com/raytheon/uf/common/plugin/hpe/request/HpeLabelDataRequest.java @@ -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. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 23, 2014   3026     mpduff      Initial creation
+ * 
+ * 
+ * + * @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 dateList; + + /** + * Constructor. + */ + public HpeLabelDataRequest() { + + } + + /** + * Constructor. + * + * @param productName + * The Hpe product name + * @param dateList + * List of times for the product + */ + public HpeLabelDataRequest(String productName, List 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(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 getDateList() { + return dateList; + } + + /** + * @param dateList + * the dateList to set + */ + public void setDateList(List dateList) { + this.dateList = dateList; + } +} diff --git a/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/ParameterConverter.java b/edexOsgi/com.raytheon.uf.common.plugin.hpe/src/com/raytheon/uf/common/plugin/hpe/request/HpeLabelDataResponse.java similarity index 55% rename from edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/ParameterConverter.java rename to edexOsgi/com.raytheon.uf.common.plugin.hpe/src/com/raytheon/uf/common/plugin/hpe/request/HpeLabelDataResponse.java index 7ebeab9c80..4a9fb1028a 100644 --- a/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/ParameterConverter.java +++ b/edexOsgi/com.raytheon.uf.common.plugin.hpe/src/com/raytheon/uf/common/plugin/hpe/request/HpeLabelDataResponse.java @@ -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. * *
  * 
@@ -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
  * 
  * 
* - * @author njensen + * @author mpduff * @version 1.0 */ +@DynamicSerialize +public class HpeLabelDataResponse { -public class ParameterConverter implements DataURIFieldConverter { + /** Map of Dates->bias source text */ + @DynamicSerializeElement + private Map data; - @Override - public String toString(Parameter field) { - return field.getAbbreviation(); + /** + * @return the data + */ + public Map getData() { + return data; } - @Override - public Parameter fromString(String string) { - Parameter p = ParameterLookup.getInstance().getParameter(string); - if (p == null) { - p = new Parameter(string); - } - return p; + /** + * @param data + * the data to set + */ + public void setData(Map data) { + this.data = data; } - } diff --git a/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml b/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml index 62015e6f02..46b70f5435 100644 --- a/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml +++ b/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml @@ -381,4 +381,17 @@ version="0.0.0" unpack="false"/> + + + + diff --git a/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/pproc/SatPrecipFileBuilder.java b/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/pproc/SatPrecipFileBuilder.java index a23aa8d668..6ba1a77223 100644 --- a/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/pproc/SatPrecipFileBuilder.java +++ b/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/pproc/SatPrecipFileBuilder.java @@ -171,6 +171,7 @@ public class SatPrecipFileBuilder { xmfile.setData(data); xmfile.save(fname); + logger.info("Successfully created satellite precip xmrg file: " + fname); } /** diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/META-INF/MANIFEST.MF index a14e28f88a..e54447274f 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/META-INF/MANIFEST.MF @@ -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, diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/FFMPProcessor.java b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/FFMPProcessor.java index be1166159b..d315b4d954 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/FFMPProcessor.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/FFMPProcessor.java @@ -95,13 +95,14 @@ import com.vividsolutions.jts.geom.Polygon; * ------------ ---------- ----------- -------------------------- * * 07/14/09 2152 D. Hladky Initial release - * 10/25/12 DR 15514 G. Zhang Fix ConcurrentModificationException + * 10/25/12 DR 15514 G. Zhang Fix ConcurrentModificationException * 02/01/13 1569 D. Hladky Added constants * 02/25/13 1660 D. Hladky FFTI design change to help mosaic processing. * 05/01/2013 15684 zhao Unlock when Exception caught * 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). + * 09/03/2013 DR 13083 G. Zhang Added a fix in processRADAR(ArrayList). * 03 April 2014 2940 dhladky Better error message for bad configurations. + * Apr 15, 2014 3026 mpduff Set the xmrg filename into the metadata column. * * @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; @@ -637,12 +639,12 @@ public class FFMPProcessor { + source.getDisplayName(); } - Date backDate = new Date(ffmpRec.getDataTime().getRefTime() - .getTime()-(FFMPGenerator.SOURCE_CACHE_TIME * TimeUtil.MILLIS_PER_HOUR)); - - FFMPDataContainer ffgContainer = generator - .getFFMPDataContainer(sourceNameString, - backDate); + Date backDate = new Date(ffmpRec.getDataTime().getRefTime() + .getTime()-(FFMPGenerator.SOURCE_CACHE_TIME * TimeUtil.MILLIS_PER_HOUR)); + + FFMPDataContainer ffgContainer = generator + .getFFMPDataContainer(sourceNameString, + backDate); if (ffgContainer != null && ffgContainer.containsKey(source.getSourceName())) { @@ -1139,19 +1141,19 @@ public class FFMPProcessor { if (radarRec.getMnemonic().equals("DHR")) { for (int j = 0; j < dataVals.length; j++) { - try { - val += ScanUtils.getZRvalue2(dataVals[j],//fval,// DR 13083 - dhrMap.get(DHRValues.ZRMULTCOEFF), - dhrMap.get(DHRValues.MAXPRECIPRATEALLOW), - dhrMap.get(DHRValues.ZRPOWERCOEFF), - dhrMap.get(DHRValues.BIAS_TO_USE)) - * areas[j]; - area += areas[j]; - } catch (Exception e) { - statusHandler - .error("DHR parameters are NULL, can't process!" - + e.getMessage()); - } + try { + val += ScanUtils.getZRvalue2(dataVals[j],//fval,// DR 13083 + dhrMap.get(DHRValues.ZRMULTCOEFF), + dhrMap.get(DHRValues.MAXPRECIPRATEALLOW), + dhrMap.get(DHRValues.ZRPOWERCOEFF), + dhrMap.get(DHRValues.BIAS_TO_USE)) + * areas[j]; + area += areas[j]; + } catch (Exception e) { + statusHandler + .error("DHR parameters are NULL, can't process!" + + e.getMessage()); + } } } else if (radarRec.getMnemonic().equals("DPR")) { @@ -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; diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.hpe/.classpath b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/.classpath new file mode 100644 index 0000000000..ad32c83a78 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.hpe/.project b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/.project new file mode 100644 index 0000000000..57c93e109e --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/.project @@ -0,0 +1,28 @@ + + + com.raytheon.uf.edex.plugin.hpe + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.hpe/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..8000cd6ca6 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.hpe/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..afff97de3b --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/META-INF/MANIFEST.MF @@ -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" diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.hpe/build.properties b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/build.properties new file mode 100644 index 0000000000..5791d48d5f --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + res/ diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.hpe/res/spring/hpe-file-endpoint.xml b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/res/spring/hpe-file-endpoint.xml new file mode 100644 index 0000000000..78fb11a3e6 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/res/spring/hpe-file-endpoint.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + java.lang.Throwable + + + + + + + + + + + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.hpe/res/spring/hpe-request.xml b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/res/spring/hpe-request.xml new file mode 100644 index 0000000000..05916c959d --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/res/spring/hpe-request.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.hpe/src/com/raytheon/uf/edex/plugin/hpe/handler/HpeLabelDataHandler.java b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/src/com/raytheon/uf/edex/plugin/hpe/handler/HpeLabelDataHandler.java new file mode 100644 index 0000000000..5f6709cf64 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/src/com/raytheon/uf/edex/plugin/hpe/handler/HpeLabelDataHandler.java @@ -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. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 23, 2014    3026    mpduff      Initial creation
+ * 
+ * 
+ * + * @author mpduff + * @version 1.0 + */ + +public class HpeLabelDataHandler implements + IRequestHandler { + /** 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 labelMap = new HashMap(); + 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; + } +} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.hpe/src/com/raytheon/uf/edex/plugin/hpe/process/HpeGribFileNameProcessor.java b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/src/com/raytheon/uf/edex/plugin/hpe/process/HpeGribFileNameProcessor.java new file mode 100644 index 0000000000..800a5c8898 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/src/com/raytheon/uf/edex/plugin/hpe/process/HpeGribFileNameProcessor.java @@ -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. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 21, 2014    3026    mpduff      Initial creation
+ * 
+ * 
+ * + * @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); + } + } +} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.hpe/src/com/raytheon/uf/edex/plugin/hpe/util/HpeDataAccessor.java b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/src/com/raytheon/uf/edex/plugin/hpe/util/HpeDataAccessor.java new file mode 100644 index 0000000000..7974098139 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/src/com/raytheon/uf/edex/plugin/hpe/util/HpeDataAccessor.java @@ -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. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Mar 26, 2014    3026    mpduff      Initial creation
+ * 
+ * 
+ * + * @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 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> getBiasDynRecords( + Date recdate, String productName) throws Exception { + SortedMap> dataMap = new TreeMap>(); + + 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()); + } + + 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 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 radarList; + + try { + Object[] results = dao.executeSQLQuery(query.toString()); + radarList = new ArrayList(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); + } + } +} \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.hpe/src/com/raytheon/uf/edex/plugin/hpe/util/HpeEnums.java b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/src/com/raytheon/uf/edex/plugin/hpe/util/HpeEnums.java new file mode 100644 index 0000000000..63b32a0d51 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/src/com/raytheon/uf/edex/plugin/hpe/util/HpeEnums.java @@ -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. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 23, 2014    3026    mpduff      Initial creation
+ * 
+ * 
+ * + * @author mpduff + * @version 1.0 + */ + +public class HpeEnums { + /** + * HPE Data Source + * + *
+     * S for single pol 
+     * D for dual pol
+     * 
+ */ + 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); + } + } +} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.hpe/src/com/raytheon/uf/edex/plugin/hpe/util/HpeLabelGenerator.java b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/src/com/raytheon/uf/edex/plugin/hpe/util/HpeLabelGenerator.java new file mode 100644 index 0000000000..08a9c32672 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/src/com/raytheon/uf/edex/plugin/hpe/util/HpeLabelGenerator.java @@ -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. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Mar 26, 2014   3026     mpduff      Initial creation
+ * 
+ * 
+ * + * @author mpduff + * @version 1.0 + */ + +public class HpeLabelGenerator { + private static final IUFStatusHandler statusHandler = UFStatus + .getHandler(HpeLabelGenerator.class); + + /** + * 2 decimal place formatter + */ + private final ThreadLocal twoDeciamalFormatter = new ThreadLocal() { + + @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> 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 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(); + } +} \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.hpe/src/com/raytheon/uf/edex/plugin/hpe/util/HpeRadarResult.java b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/src/com/raytheon/uf/edex/plugin/hpe/util/HpeRadarResult.java new file mode 100644 index 0000000000..1efd32d79c --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.hpe/src/com/raytheon/uf/edex/plugin/hpe/util/HpeRadarResult.java @@ -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. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Mar 26, 2014    3026    mpduff      Initial creation
+ * 
+ * 
+ * + * @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; + } +} \ No newline at end of file diff --git a/nativeLib/files.native/awipsShare/hydroapps/precip_proc/bin/process_hpe_grib_files b/nativeLib/files.native/awipsShare/hydroapps/precip_proc/bin/process_hpe_grib_files index 5303433502..be04b650a4 100755 --- a/nativeLib/files.native/awipsShare/hydroapps/precip_proc/bin/process_hpe_grib_files +++ b/nativeLib/files.native/awipsShare/hydroapps/precip_proc/bin/process_hpe_grib_files @@ -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 diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp.win64/bignsharp.dll b/ncep/gov.noaa.nws.ncep.ui.nsharp.win64/bignsharp.dll index c002c75ed3..861fa0bb71 100644 Binary files a/ncep/gov.noaa.nws.ncep.ui.nsharp.win64/bignsharp.dll and b/ncep/gov.noaa.nws.ncep.ui.nsharp.win64/bignsharp.dll differ diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/Activator.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/Activator.java index 27e3df0778..fb92fa6fe4 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/Activator.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/Activator.java @@ -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. * * * diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpDataPaneResource.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpDataPaneResource.java index 5d1ec4c830..cc97b6713f 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpDataPaneResource.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpDataPaneResource.java @@ -263,7 +263,7 @@ public class NsharpDataPaneResource extends NsharpAbstractPaneResource{ * * */ - //if we can not Interpolates a temp with 700 mb pressure, then we dont have enough raw data + //if we can not Interpolates a temp with 700 mb pressure, then we dont have enough raw data if ((nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib.itemp(700.0F)) == 0)) { target.drawString(myfont, " " +NO_DATA, rect.x, rect.y, 0.0, diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/natives/NsharpNative.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/natives/NsharpNative.java index e2e6be8cb5..32a90ce92d 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/natives/NsharpNative.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/natives/NsharpNative.java @@ -13,6 +13,8 @@ * 03/23/2010 229 Chin Chen Initial coding * 5/2012 736 T. Lee Added cave_ccl, cave_soar, cave_dmpi, * cave_wmax, cave_mdpi_windex, nc_mix_height + * 05/08/2014 3108 bkowal Updated structure classes for the JNA upgrade. + * * * * @@ -20,10 +22,12 @@ * @version 1.0 */ package gov.noaa.nws.ncep.ui.nsharp.natives; + import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer; import gov.noaa.nws.ncep.ui.nsharp.NsharpConfigManager; import gov.noaa.nws.ncep.viz.localization.NcPathManager.NcPathConstants; import java.nio.ByteBuffer; +import java.util.Arrays; import java.util.List; //Chin-T import com.raytheon.uf.common.sounding.SoundingLayer; @@ -33,1370 +37,1847 @@ import com.sun.jna.Structure; import com.sun.jna.Pointer; import com.sun.jna.ptr.FloatByReference; - public class NsharpNative { - public static int SNDG_SFC=0; - public static int SNDG_OBS= 1; - public static int SNDG_MDL= 2; - public static int SNDG_PFC= 3; - public static int SNDG_ACARS= 4; - public static int SNDG_ARCH= 5; - - public NsharpLibrary nsharpLib; - - /** Setting up Singleton */ - /* DECP private static NsharpNative instance;*/ + public static int SNDG_SFC = 0; + + public static int SNDG_OBS = 1; + + public static int SNDG_MDL = 2; + + public static int SNDG_PFC = 3; + + public static int SNDG_ACARS = 4; + + public static int SNDG_ARCH = 5; + + public NsharpLibrary nsharpLib; + + /** Setting up Singleton */ + /* DECP private static NsharpNative instance; */ public NsharpNative() { - super(); - //nsharpLib = NsharpLibrary.INSTANCE; - nsharpLib = (NsharpLibrary) Native.loadLibrary("bignsharp", NsharpLibrary.class); - nsharpLib.initStaticGlobalsMem(); - } - - public void setSarsSupcellFileName(){ - NsharpConfigManager configMgr = NsharpConfigManager.getInstance(); - String sarsFilePath = configMgr.getBigNsharpFlPath(NcPathConstants.NSHARP_NLIST_FILE); - ByteBuffer sarsBuf=null; - if(sarsFilePath!=null){ - sarsBuf = ByteBuffer.allocate(sarsFilePath.length()); - sarsBuf.put(sarsFilePath.getBytes()); - } - String supercellFilePath = configMgr.getBigNsharpFlPath(NcPathConstants.NSHARP_SUP_FILE); - - ByteBuffer supBuf=null; - if(supercellFilePath!=null){ - supBuf = ByteBuffer.allocate(supercellFilePath.length()); - supBuf.put(supercellFilePath.getBytes()); - } - int sarslm=sarsBuf.limit(); - int suplm=supBuf.limit(); - //System.out.println("Nsharp setSarsSupcellFileName: sarFilepath="+sarsFilePath+ " supFilepath="+ supercellFilePath); - //Chin: for unknown reason calling setSarsSupcellFileName() without passing ByteBuffer limit will cause one extra bytes - // set at end of file name. Therefore, passing buffer size limit specifically to fix this issue. - if(sarsBuf!=null&& supBuf!=null){ - nsharpLib.setSarsSupcellFileName(sarsBuf,sarslm,supBuf,suplm);//(sarsFilePathAry,supercellFilePathAry); - } + super(); + // nsharpLib = NsharpLibrary.INSTANCE; + nsharpLib = (NsharpLibrary) Native.loadLibrary("bignsharp", + NsharpLibrary.class); + nsharpLib.initStaticGlobalsMem(); } - + + public void setSarsSupcellFileName() { + NsharpConfigManager configMgr = NsharpConfigManager.getInstance(); + String sarsFilePath = configMgr + .getBigNsharpFlPath(NcPathConstants.NSHARP_NLIST_FILE); + ByteBuffer sarsBuf = null; + if (sarsFilePath != null) { + sarsBuf = ByteBuffer.allocate(sarsFilePath.length()); + sarsBuf.put(sarsFilePath.getBytes()); + } + String supercellFilePath = configMgr + .getBigNsharpFlPath(NcPathConstants.NSHARP_SUP_FILE); + + ByteBuffer supBuf = null; + if (supercellFilePath != null) { + supBuf = ByteBuffer.allocate(supercellFilePath.length()); + supBuf.put(supercellFilePath.getBytes()); + } + int sarslm = sarsBuf.limit(); + int suplm = supBuf.limit(); + // System.out.println("Nsharp setSarsSupcellFileName: sarFilepath="+sarsFilePath+ + // " supFilepath="+ supercellFilePath); + // Chin: for unknown reason calling setSarsSupcellFileName() without + // passing ByteBuffer limit will cause one extra bytes + // set at end of file name. Therefore, passing buffer size limit + // specifically to fix this issue. + if (sarsBuf != null && supBuf != null) { + nsharpLib.setSarsSupcellFileName(sarsBuf, sarslm, supBuf, suplm);// (sarsFilePathAry,supercellFilePathAry); + } + } + public void populateSndgData(List soundingLys) { - if((soundingLys != null) && (soundingLys.size() > 0)){ - //Note: one has to initialize Structure array this way.... - NsharpLibrary.CaveSndgParms[] snDataArray = (NsharpLibrary.CaveSndgParms[])(new NsharpLibrary.CaveSndgParms().toArray(soundingLys.size())); + if ((soundingLys != null) && (soundingLys.size() > 0)) { + // Note: one has to initialize Structure array this way.... + NsharpLibrary.CaveSndgParms[] snDataArray = (NsharpLibrary.CaveSndgParms[]) (new NsharpLibrary.CaveSndgParms() + .toArray(soundingLys.size())); - /*if (winDir == NsharpNativeConstants.NSHARP_NATIVE_INVALID_DATA){ - winDir = NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA; - } - if (winSpd == NsharpNativeConstants.NSHARP_NATIVE_INVALID_DATA){ - winSpd = NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA; - }*/ - float omega,pres, ht, tem, dew, ws, wd; - int skipNumber=0; - for (int i =0; i< soundingLys.size() ; i++){ - NcSoundingLayer sndLy = soundingLys.get(i); - pres = sndLy.getPressure(); - if(pres <100 ){ - skipNumber++; - continue; - } - omega = sndLy.getOmega(); - ht = sndLy.getGeoHeight(); - tem = sndLy.getTemperature(); - dew = sndLy.getDewpoint(); - wd = sndLy.getWindDirection(); - ws = sndLy.getWindSpeed(); - if (omega == NsharpNativeConstants.NSHARP_NATIVE_INVALID_DATA){ - omega = NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA; - } - if (pres == NsharpNativeConstants.NSHARP_NATIVE_INVALID_DATA){ - pres = NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA; - } - if (ht == NsharpNativeConstants.NSHARP_NATIVE_INVALID_DATA){ - ht = NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA; - } - if (tem == NsharpNativeConstants.NSHARP_NATIVE_INVALID_DATA){ - tem = NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA; - } - if (dew == NsharpNativeConstants.NSHARP_NATIVE_INVALID_DATA){ - dew = NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA; - } - if (ws == NsharpNativeConstants.NSHARP_NATIVE_INVALID_DATA){ - ws = NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA; - } - if (wd == NsharpNativeConstants.NSHARP_NATIVE_INVALID_DATA){ - wd = NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA; - } - snDataArray[i-skipNumber].fillData(omega, pres, ht, tem, - dew, wd, ws); - } + /* + * if (winDir == NsharpNativeConstants.NSHARP_NATIVE_INVALID_DATA){ + * winDir = NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA; } + * if (winSpd == NsharpNativeConstants.NSHARP_NATIVE_INVALID_DATA){ + * winSpd = NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA; } + */ + float omega, pres, ht, tem, dew, ws, wd; + int skipNumber = 0; + for (int i = 0; i < soundingLys.size(); i++) { + NcSoundingLayer sndLy = soundingLys.get(i); + pres = sndLy.getPressure(); + if (pres < 100) { + skipNumber++; + continue; + } + omega = sndLy.getOmega(); + ht = sndLy.getGeoHeight(); + tem = sndLy.getTemperature(); + dew = sndLy.getDewpoint(); + wd = sndLy.getWindDirection(); + ws = sndLy.getWindSpeed(); + if (omega == NsharpNativeConstants.NSHARP_NATIVE_INVALID_DATA) { + omega = NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA; + } + if (pres == NsharpNativeConstants.NSHARP_NATIVE_INVALID_DATA) { + pres = NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA; + } + if (ht == NsharpNativeConstants.NSHARP_NATIVE_INVALID_DATA) { + ht = NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA; + } + if (tem == NsharpNativeConstants.NSHARP_NATIVE_INVALID_DATA) { + tem = NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA; + } + if (dew == NsharpNativeConstants.NSHARP_NATIVE_INVALID_DATA) { + dew = NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA; + } + if (ws == NsharpNativeConstants.NSHARP_NATIVE_INVALID_DATA) { + ws = NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA; + } + if (wd == NsharpNativeConstants.NSHARP_NATIVE_INVALID_DATA) { + wd = NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA; + } + snDataArray[i - skipNumber].fillData(omega, pres, ht, tem, dew, + wd, ws); + } - nsharpLib.populateSndgDataStatic(snDataArray, soundingLys.size()-skipNumber , 1);//use 1 for testing for now Chin... - } + nsharpLib.populateSndgDataStatic(snDataArray, soundingLys.size() + - skipNumber, 1);// use 1 for testing for now Chin... + } } - - + public interface NsharpLibrary extends Library { - //library name is libbignsharp.so. but only use "bignsharp" as lib name when loading - NsharpLibrary INSTANCE = (NsharpLibrary) Native.loadLibrary("bignsharp", NsharpLibrary.class); - - /// native declaration : line 1 - public static class _lplvalues extends Structure { - /// C type : char[40] - public byte[] desc = new byte[(40)]; - public float pres; - public float temp; - public float dwpt; - public float presval; - public short flag; - public _lplvalues() { - super(); - } - /// @param desc C type : char[40] - public _lplvalues(byte desc[], float pres, float temp, float dwpt, float presval,short flag) { - super(); - if (desc.length != this.desc.length) - throw new java.lang.IllegalArgumentException("Wrong array size !"); - this.desc = desc; - this.pres = pres; - this.temp = temp; - this.dwpt = dwpt; - this.presval = presval; - this.flag = flag; - } - protected ByReference newByReference() { return new ByReference(); } - protected ByValue newByValue() { return new ByValue(); } - protected _lplvalues newInstance() { return new _lplvalues(); } - public static class ByReference extends _lplvalues implements Structure.ByReference { - - } - public static class ByValue extends _lplvalues implements Structure.ByValue { - - } - } - /// native declaration : line 10 - public static class _parcel extends Structure{ - public float lplpres; - public float lpltemp; - public float lpldwpt; - public float blayer; - public float tlayer; - public float entrain; - public float lclpres; - public float lfcpres; - public float elpres; - public float mplpres; - public float bplus; - public float bminus; - public float bfzl; - public float cape3km; - public float cape6km; - public float wm10c; - public float wm30c; - public float li5; - public float li3; - public float brn; - public float limax; - public float limaxpres; - public float cap; - public float cappres; + // library name is libbignsharp.so. but only use "bignsharp" as lib name + // when loading + NsharpLibrary INSTANCE = (NsharpLibrary) Native.loadLibrary( + "bignsharp", NsharpLibrary.class); - public _parcel() { - super(); - } - protected ByReference newByReference() { return new ByReference(); } - protected ByValue newByValue() { return new ByValue(); } - protected _parcel newInstance() { return new _parcel(); } - public static class ByReference extends _parcel implements Structure.ByReference { - - } - public static class ByValue extends _parcel implements Structure.ByValue { - - } - } - - //from our own SndgParms - public static class CaveSndgParms extends com.sun.jna.Structure { - public float omega; - public float pres; - public float hght; - public float temp; - public float dwpt; - public float drct; - public float sped; - public CaveSndgParms() { - super(); - } - public CaveSndgParms(float omega, float pres, float hght, float temp, float dwpt, float drct, float sped) { - super(); - this.omega = omega; - this.pres = pres; - this.hght = hght; - this.temp = temp; - this.dwpt = dwpt; - this.drct = drct; - this.sped = sped; - } - - public void fillData(float omega, float pres, float hght, float temp, float dwpt, float drct, float sped) { - this.omega = omega; - this.pres = pres; - this.hght = hght; - this.temp = temp; - this.dwpt = dwpt; - this.drct = drct; - this.sped = sped; - } - protected ByReference newByReference() { return new ByReference(); } - protected ByValue newByValue() { return new ByValue(); } - protected CaveSndgParms newInstance() { return new CaveSndgParms(); } - public static class ByReference extends CaveSndgParms implements Structure.ByReference { - - } - public static class ByValue extends CaveSndgParms implements Structure.ByValue { - - } - - } - public static class SarsInfoStr extends Structure { - public static int SARS_STRING_LEN=40; - public static int SARS_STRING_LINES = 12; - /// max=10 - public int numHailstr; - /// C type : char[10][60] - public byte[] hailStr = new byte[SARS_STRING_LINES * SARS_STRING_LEN]; - /// C type : int[10] - public int[] hailStrColor = new int[(SARS_STRING_LINES)]; - /// C type : char[2][60] - //public byte[] sighailStr = new byte[2 * 60]; - //public int sighailStrColor; - /// max=10 - public int numsupcellstr; - /// C type : char[10][60] - public byte[] supcellStr = new byte[SARS_STRING_LINES * SARS_STRING_LEN]; - /// C type : int[10] - public int[] supcellStrColor = new int[(SARS_STRING_LINES)]; - /// C type : char[2][60] - //public byte[] torStr = new byte[2 * 60]; - //public int torStrColor; - public SarsInfoStr() { - super(); - } - protected ByReference newByReference() { return new ByReference(); } - protected ByValue newByValue() { return new ByValue(); } - protected SarsInfoStr newInstance() { return new SarsInfoStr(); } - public static class ByReference extends SarsInfoStr implements Structure.ByReference { - - } - public static class ByValue extends SarsInfoStr implements Structure.ByValue { - - } - public int getNumHailstr() { - return numHailstr; - } - public byte[] getHailStr() { - return hailStr; - } - public int[] getHailStrColor() { - return hailStrColor; - } - /*public byte[] getSighailStr() { - return sighailStr; - } - public int getSighailStrColor() { - return sighailStrColor; - }*/ - public int getNumsupcellstr() { - return numsupcellstr; - } - public byte[] getSupcellStr() { - return supcellStr; - } - public int[] getSupcellStrColor() { - return supcellStrColor; - } - /*public byte[] getTorStr() { - return torStr; - } - public int getTorStrColor() { - return torStrColor; - }*/ - - } - public static class FireInfoStr extends Structure { - public int sfcRhColor=31; - public int pwColor=31; - public int blMaxColor=31; - public int fosbergColor=31; - public byte[] sfcRh = new byte[(60)]; - public byte[] sfc = new byte[(60)]; - public byte[] zeroOneKmRh = new byte[(60)]; - public byte[] zeroOneKmMean = new byte[(60)]; - public byte[] blMeanRh = new byte[(60)]; - public byte[] blMean = new byte[(60)]; - public byte[] pw = new byte[(60)]; - public byte[] blMax = new byte[(60)]; - public byte[] fosberg = new byte[(60)]; - public FireInfoStr() { - super(); - // TODO Auto-generated constructor stub - } - public static class ByReference extends FireInfoStr implements Structure.ByReference { + // / native declaration : line 1 + public static class _lplvalues extends Structure { + // / C type : char[40] + public byte[] desc = new byte[(40)]; - } - public static class ByValue extends FireInfoStr implements Structure.ByValue { + public float pres; - } - protected ByReference newByReference() { return new ByReference(); } - protected ByValue newByValue() { return new ByValue(); } - public int getSfcRhColor() { - return sfcRhColor; - } - public int getPwColor() { - return pwColor; - } - public int getBlMaxColor() { - return blMaxColor; - } - public int getFosbergColor() { - return fosbergColor; - } - public byte[] getSfcRh() { - return sfcRh; - } - public byte[] getSfc() { - return sfc; - } - public byte[] getZeroOneKmRh() { - return zeroOneKmRh; - } - public byte[] getZeroOneKmMean() { - return zeroOneKmMean; - } - public byte[] getBlMeanRh() { - return blMeanRh; - } - public byte[] getBlMean() { - return blMean; - } - public byte[] getPw() { - return pw; - } - public byte[] getBlMax() { - return blMax; - } - public byte[] getFosberg() { - return fosberg; - } - - } - public static class WinterInfoStr extends Structure { - public float mopw; - /*public float htop; - public float hbot; - public float mrh; - public float mq; - public float mo; - public float pw; - public float pLevel;*/ - public byte[] oprh = new byte[(60)]; - public byte[] layerDepth = new byte[(60)]; - public byte[] meanLayerRh = new byte[(60)]; - public byte[] meanLayerMixRat = new byte[(60)]; - public byte[] meanLayerPw = new byte[(60)]; - public byte[] meanLayerOmega = new byte[(60)]; - public byte[] initPhase = new byte[(100)]; - public byte[] tempProfile1 = new byte[(60)]; - public byte[] tempProfile2 = new byte[(60)]; - public byte[] tempProfile3 = new byte[(60)]; - public byte[] wetbulbProfile1 = new byte[(60)]; - public byte[] wetbulbProfile2 = new byte[(60)]; - public byte[] wetbulbProfile3 = new byte[(60)]; - public byte[] bestGuess1 = new byte[(60)]; - public byte[] bestGuess2 = new byte[(60)]; - public WinterInfoStr() { - super(); - // TODO Auto-generated constructor stub - } - public static class ByReference extends WinterInfoStr implements Structure.ByReference { + public float temp; - } - public static class ByValue extends WinterInfoStr implements Structure.ByValue { + public float dwpt; - } - protected ByReference newByReference() { return new ByReference(); } - protected ByValue newByValue() { return new ByValue(); } - public float getMopw() { - return mopw; - } - - public byte[] getOprh() { - return oprh; - } - public byte[] getLayerDepth() { - return layerDepth; - } - public byte[] getMeanLayerRh() { - return meanLayerRh; - } - public byte[] getMeanLayerMixRat() { - return meanLayerMixRat; - } - public byte[] getMeanLayerPw() { - return meanLayerPw; - } - public byte[] getMeanLayerOmega() { - return meanLayerOmega; - } - public byte[] getInitPhase() { - return initPhase; - } - public byte[] getTempProfile1() { - return tempProfile1; - } - public byte[] getTempProfile2() { - return tempProfile2; - } - public byte[] getTempProfile3() { - return tempProfile3; - } - public byte[] getWetbulbProfile1() { - return wetbulbProfile1; - } - public byte[] getWetbulbProfile2() { - return wetbulbProfile2; - } - public byte[] getWetbulbProfile3() { - return wetbulbProfile3; - } - public byte[] getBestGuess1() { - return bestGuess1; - } - public byte[] getBestGuess2() { - return bestGuess2; - } - - } - public static int MAX_CLOUD_LAYER=20; - //cloudTypeFM value defined in caveNsharp.c OVC=1, BKN=2, SCT=3*/ - public static String[] CLOUD_TYPE = {"dummy","OVC", "BKN", "SCT"}; - public static class CloudInfoStr extends Structure { - /* FM: Fred Mosher's Algorithm */ - public int sizeFM; - public float[] preStartFM= new float[MAX_CLOUD_LAYER]; - public float[] preEndFM= new float[MAX_CLOUD_LAYER]; - public int[] cloudTypeFM= new int[MAX_CLOUD_LAYER]; - /* CE: Chernykh and Eskridge Algorithm */ - public int sizeCE; - public float[] preStartCE= new float[MAX_CLOUD_LAYER]; - public float[] preEndCE= new float[MAX_CLOUD_LAYER]; - - public CloudInfoStr() { - super(); - sizeFM=0; - sizeCE=0; - } - - protected ByReference newByReference() { return new ByReference(); } - protected ByValue newByValue() { return new ByValue(); } - protected CloudInfoStr newInstance() { return new CloudInfoStr(); } - public static class ByReference extends CloudInfoStr implements Structure.ByReference { + public float presval; - } - public static class ByValue extends CloudInfoStr implements Structure.ByValue { + public short flag; - } - public int getSizeFM() { - return sizeFM; - } + public _lplvalues() { + super(); + } - public int[] getCloudTypeFM() { - return cloudTypeFM; - } + // / @param desc C type : char[40] + public _lplvalues(byte desc[], float pres, float temp, float dwpt, + float presval, short flag) { + super(); + if (desc.length != this.desc.length) + throw new java.lang.IllegalArgumentException( + "Wrong array size !"); + this.desc = desc; + this.pres = pres; + this.temp = temp; + this.dwpt = dwpt; + this.presval = presval; + this.flag = flag; + } - public int getSizeCE() { - return sizeCE; - } + protected ByReference newByReference() { + return new ByReference(); + } - public float[] getPreStartCE() { - return preStartCE; - } + protected ByValue newByValue() { + return new ByValue(); + } - public float[] getPreEndCE() { - return preEndCE; - } + protected _lplvalues newInstance() { + return new _lplvalues(); + } - public float[] getPreStartFM() { - return preStartFM; - } + public static class ByReference extends _lplvalues implements + Structure.ByReference { - public float[] getPreEndFM() { - return preEndFM; - } - - - } - public static class StormSlinkyStr extends Structure { - public int size; - public float tottim; - public float angl; - /// C type : float[200][2] - public float[] tsuv = new float[200 * 2]; - public int[] color = new int[200]; - public StormSlinkyStr() { - super(); - size=-1; - } - - protected ByReference newByReference() { return new ByReference(); } - protected ByValue newByValue() { return new ByValue(); } - protected StormSlinkyStr newInstance() { return new StormSlinkyStr(); } - public static class ByReference extends StormSlinkyStr implements Structure.ByReference { + } - } - public static class ByValue extends StormSlinkyStr implements Structure.ByValue { + public static class ByValue extends _lplvalues implements + Structure.ByValue { - } + } - public float getTottim() { - return tottim; - } - public void setTottim(float tottim) { - this.tottim = tottim; - } - public float getAngl() { - return angl; - } - public void setAngl(float angl) { - this.angl = angl; - } - public float[] getTsuv() { - return tsuv; - } - public void setTsuv(float[] tsuv) { - this.tsuv = tsuv; - } - public int getSize() { - return size; - } - public void setSize(int size) { - this.size = size; - } - public int[] getColor() { - return color; - } - public void setColor(int[] color) { - this.color = color; - } - - } - - //From our own caveNsharp.c - float aglT(int l1high, int l2high); - void initStaticGlobalsMem(); - //void setSarsSupcellFileName(char sarsFlName[], char supercellFlName[]); - //@java.lang.Deprecated - //void setSarsSupcellFileName(Pointer sarsFlName, Pointer supercellFlName); - void setSarsSupcellFileName(ByteBuffer sarsFlName, int sarsLen,ByteBuffer supercellFlName, int supLen); - void populateSndgData(NsharpLibrary.CaveSndgParms snDataArray[], int arraySize, int datatype); - int populateSndgDataStatic(CaveSndgParms snDataArray[], int arraySize, int datatype); - void get_lpvaluesData(NsharpLibrary._lplvalues pParcel); - //void populateSndgTestData() ; - void get_surface(FloatByReference pressure, FloatByReference temp, FloatByReference dewpt); - void get_surfaceWind(FloatByReference windSp, FloatByReference windDir); - //void get_top(FloatByReference pressure, FloatByReference temp, FloatByReference dewpt); - void get_storm(FloatByReference speed, FloatByReference direction); - void set_storm(float speed, float direction); - void cave_visual1 ( float lower, float upper, float pres, float temp, float dwpt , NsharpLibrary.StormSlinkyStr stmSlinky); - void draw_Clouds( NsharpLibrary.CloudInfoStr cloudInfo ); - void getWinterInfo(NsharpLibrary.WinterInfoStr winterInfo ); - void getFireInfo(NsharpLibrary.FireInfoStr fireInfo); - void getSarsInfo(NsharpLibrary.SarsInfoStr sarsInfo); - //float cave_bulk_rich ( float lplpres, float bplus,FloatByReference brnshear ); - float cave_bulk_rich2 ( FloatByReference brnshear ); - float cave_ship(); - int cave_ww_type(); - float cave_criticalAngel(); - void get_effectLayertopBotPres(FloatByReference topP, FloatByReference botP); - void nc_mix_height(FloatByReference pres, FloatByReference drct, FloatByReference sped, FloatByReference del_t, FloatByReference lr, FloatByReference drct_mean, FloatByReference sped_mean, FloatByReference drct_max, FloatByReference sped_max, short flag); - float cave_mdpi_windex (FloatByReference windex); - int cave_dmpi(); - void cave_ccl (float mixr, FloatByReference pccl, FloatByReference tccl, FloatByReference zccl); - void cave_soar (float slev, FloatByReference ctax, FloatByReference zconv, FloatByReference tconv, FloatByReference zthrm, FloatByReference tthrm, FloatByReference soar, FloatByReference ttrig); - float cave_wmax (float[] vvel); - //void printSfcInfo(); - //void showSndgData(); - //From basic.h - /** - * Original signature : float i_temp(float)
- * native declaration : line 57 - */ - float itemp(float pres); - /** - * Original signature : float i_dwpt(float)
- * native declaration : line 58 - */ - float idwpt(float pres); - /** - * Original signature : float i_hght(float)
- * native declaration : line 59 - */ - float ihght(float pres); - /** - * Original signature : float i_vtmp(float)
- * native declaration : line 60 - */ - float ivtmp(float pres); - /** - * Original signature : float i_wdir(float)
- * native declaration : line 61 - */ - float iwdir(float pres); - /** - * Original signature : float i_wspd(float)
- * native declaration : line 62 - */ - float iwspd(float pres); - /** - * Original signature : float i_wndu(float)
- * native declaration : line 63 - */ - float iwndu(float pres); - /** - * Original signature : float i_wndv(float)
- * native declaration : line 64 - */ - float iwndv(float pres); - /** - * Original signature : float i_pres(float)
- * native declaration : line 65 - */ - float ipres(float hght); - /** - * Original signature : float i_omeg(float)
- * native declaration : line 66 - */ - float iomeg(float pres); - /** - * Original signature : sfc()
- * native declaration : line 67 - */ - int sfc(); - /** - * Original signature : float top_pres()
- * native declaration : line 68 - */ - float top_pres(); - /** - * Original signature : qc(float)
- * native declaration : line 69 - */ - int qc(float value); - /** - * Original signature : char* qc2(float, char*, short)
- * native declaration : line 70
- * @deprecated use the safer methods {@link #qc2(float, java.nio.ByteBuffer, short)} and {@link #qc2(float, com.sun.jna.Pointer, short)} instead - */ - @java.lang.Deprecated - Pointer qc2(float value, Pointer label, short prec); - /** - * Original signature : char* qc2(float, char*, short)
- * native declaration : line 70 - */ - Pointer qc2(float value, ByteBuffer label, short prec); - /** - * Original signature : float ftom(float)
- * native declaration : line 71 - */ - float ftom(float value); - /** - * Original signature : float mtof(float)
- * native declaration : line 72 - */ - float mtof(float value); - /** - * Original signature : float ftoc(float)
- * native declaration : line 73 - */ - float ftoc(float value); - /** - * Original signature : float ctof(float)
- * native declaration : line 74 - */ - float ctof(float value); - /** - * Original signature : float agl(float)
- * native declaration : line 75 - */ - float agl(float height); - /** - * Original signature : float msl(float)
- * native declaration : line 76 - */ - float msl(float height); - /** - * Original signature : float kt_to_mps(float)
- * native declaration : line 77 - */ - float kt_to_mps(float spd); - /** - * Original signature : float virtemp(float, float, float)
- * native declaration : line 78 - */ - float virtemp(float pres, float temp, float dwpt); - - /** - * from skparams.h - */ - float Mean_thetae(FloatByReference param, float lower, float upper); - /** - * Original signature : float bulk_rich(_parcel, float*)
- * native declaration : line 24
- * @deprecated use the safer methods {@link #bulk_rich(nsharp.NsharpLibrary._parcel.ByValue, java.nio.FloatBuffer)} and {@link #bulk_rich(nsharp.NsharpLibrary._parcel.ByValue, com.sun.jna.ptr.FloatByReference)} instead - */ - //@Mangling({"_Z9bulk_rich7_parcelPf", "?bulk_rich@@YAM7_parcelPAM@Z"}) - //@java.lang.Deprecated - float bulk_rich(NsharpLibrary._parcel.ByValue pcl, FloatByReference brnshear); - /** - * Original signature : float cnvtv_temp(float*, float)
- * native declaration : line 25
- * @deprecated use the safer methods {@link #cnvtv_temp(java.nio.FloatBuffer, float)} and {@link #cnvtv_temp(com.sun.jna.ptr.FloatByReference, float)} instead - */ - //@Mangling({"_Z10cnvtv_tempPff", "?cnvtv_temp@@YAMPAMM@Z"}) - //@java.lang.Deprecated - float cnvtv_temp(FloatByReference param, float mincinh); - /** - * Original signature : void define_parcel(short, float)
- * native declaration : line 26 - */ - /*flag - Parcel selection. */ - /* -1 = Use Previous Selection */ - /* 1 = Observed sfc parcel */ - /* 2 = Fcst sfc parcel */ - /* 3 = Most unstable parcel */ - /* 4 = Mean mixlyr parcel */ - /* 5 = User defined parcel */ - /* 6 = Eff */ - /* */ - /* pres - Pressure(mb) of user defined parcel. */ - - void define_parcel(short flag, float pres); - /** - * Original signature : float delta_t(float*)
- * native declaration : line 27
- * @deprecated use the safer methods {@link #delta_t(java.nio.FloatBuffer)} and {@link #delta_t(com.sun.jna.ptr.FloatByReference)} instead - */ - //@Mangling({"_Z7delta_tPf", "?delta_t@@YAMPAM@Z"}) - //@java.lang.Deprecated - float delta_t(FloatByReference param); - /** - * Original signature : float ehi(float, float)
- * native declaration : line 28 - */ - //@Mangling({"_Z3ehiff", "?ehi@@YAMMM@Z"}) - float ehi(float cape, float hel); - /** - * Original signature : grab_level(float)
- * native declaration : line 29 - */ - //@Mangling({"_Z10grab_levelf", "?grab_level@@YAXM@Z"}) - int grab_level(float pres); - /** - * Original signature : float k_index(float*)
- * native declaration : line 30
- * @deprecated use the safer methods {@link #k_index(java.nio.FloatBuffer)} and {@link #k_index(com.sun.jna.ptr.FloatByReference)} instead - */ - //@Mangling({"_Z7k_indexPf", "?k_index@@YAMPAM@Z"}) - //@java.lang.Deprecated - float k_index(FloatByReference param); - /** - * Original signature : float lapse_rate(float*, float, float)
- * native declaration : line 31
- * @deprecated use the safer methods {@link #lapse_rate(java.nio.FloatBuffer, float, float)} and {@link #lapse_rate(com.sun.jna.ptr.FloatByReference, float, float)} instead - */ - //@Mangling({"_Z10lapse_ratePfff", "?lapse_rate@@YAMPAMMM@Z"}) - //@java.lang.Deprecated - float lapse_rate(FloatByReference param, float lower, float upper); - /** - * Original signature : void low_inv(float*, float*)
- * native declaration : line 32
- * @deprecated use the safer methods {@link #low_inv(java.nio.FloatBuffer, java.nio.FloatBuffer)} and {@link #low_inv(com.sun.jna.ptr.FloatByReference, com.sun.jna.ptr.FloatByReference)} instead - */ - //@Mangling({"_Z7low_invPfPf", "?low_inv@@YAXPAMPAM@Z"}) - //@java.lang.Deprecated - void low_inv(FloatByReference inv_mb, FloatByReference inv_dC); - /** - * Original signature : float max_temp(float*, float)
- * native declaration : line 33
- * @deprecated use the safer methods {@link #max_temp(java.nio.FloatBuffer, float)} and {@link #max_temp(com.sun.jna.ptr.FloatByReference, float)} instead - */ - //@Mangling({"_Z8max_tempPff", "?max_temp@@YAMPAMM@Z"}) - //@java.lang.Deprecated - float max_temp(FloatByReference param, float mixlyr); - /** - * Original signature : float mean_dwpt(float*, float, float)
- * native declaration : line 34
- * @deprecated use the safer methods {@link #mean_dwpt(java.nio.FloatBuffer, float, float)} and {@link #mean_dwpt(com.sun.jna.ptr.FloatByReference, float, float)} instead - */ - //@Mangling({"_Z9mean_dwptPfff", "?mean_dwpt@@YAMPAMMM@Z"}) - //@java.lang.Deprecated - float mean_dwpt(FloatByReference param, float lower, float upper); - /** - * Original signature : float mean_mixratio(float*, float, float)
- * native declaration : line 35
- * @deprecated use the safer methods {@link #mean_mixratio(java.nio.FloatBuffer, float, float)} and {@link #mean_mixratio(com.sun.jna.ptr.FloatByReference, float, float)} instead - */ - //@Mangling({"_Z13mean_mixratioPfff", "?mean_mixratio@@YAMPAMMM@Z"}) - //@java.lang.Deprecated - float mean_mixratio(FloatByReference param, float lower, float upper); - /** - * Original signature : float mean_relhum(float*, float, float)
- * native declaration : line 36
- * @deprecated use the safer methods {@link #mean_relhum(java.nio.FloatBuffer, float, float)} and {@link #mean_relhum(com.sun.jna.ptr.FloatByReference, float, float)} instead - */ - //@Mangling({"_Z11mean_relhumPfff", "?mean_relhum@@YAMPAMMM@Z"}) - //@java.lang.Deprecated - float mean_relhum(FloatByReference param, float lower, float upper); - /** - * Original signature : float mean_theta(float*, float, float)
- * native declaration : line 37
- * @deprecated use the safer methods {@link #mean_theta(java.nio.FloatBuffer, float, float)} and {@link #mean_theta(com.sun.jna.ptr.FloatByReference, float, float)} instead - */ - //@Mangling({"_Z10mean_thetaPfff", "?mean_theta@@YAMPAMMM@Z"}) - //@java.lang.Deprecated - float mean_theta(FloatByReference param, float lower, float upper); - /** - * Original signature : float Mean_WBtemp(float*, float, float)
- * native declaration : line 38
- * @deprecated use the safer methods {@link #Mean_WBtemp(java.nio.FloatBuffer, float, float)} and {@link #Mean_WBtemp(com.sun.jna.ptr.FloatByReference, float, float)} instead - */ - //@Mangling({"_Z11Mean_WBtempPfff", "?Mean_WBtemp@@YAMPAMMM@Z"}) - //@java.lang.Deprecated - float Mean_WBtemp(FloatByReference param, float lower, float upper); - /** - * Original signature : void mix_height(float*, float*, float*, float*, float*, float*, float*, short)
- * native declaration : line 39
- * @deprecated use the safer methods {@link #mix_height(java.nio.FloatBuffer, java.nio.FloatBuffer, java.nio.FloatBuffer, java.nio.FloatBuffer, java.nio.FloatBuffer, java.nio.FloatBuffer, java.nio.FloatBuffer, short)} and {@link #mix_height(com.sun.jna.ptr.FloatByReference, com.sun.jna.ptr.FloatByReference, com.sun.jna.ptr.FloatByReference, com.sun.jna.ptr.FloatByReference, com.sun.jna.ptr.FloatByReference, com.sun.jna.ptr.FloatByReference, com.sun.jna.ptr.FloatByReference, short)} instead - */ - //@Mangling({"_Z10mix_heightPfPfPfPfPfPfPfi", "?mix_height@@YAXPAMPAMPAMPAMPAMPAMPAMH@Z"}) - //@java.lang.Deprecated - void mix_height(FloatByReference mh_mb, FloatByReference mh_drct, FloatByReference mh_sped, FloatByReference mh_dC, FloatByReference mh_lr, FloatByReference mh_drct_max, FloatByReference mh_sped_max, short flag); - /** - * Original signature : float old_cnvtv_temp(float*)
- * native declaration : line 42
- * @deprecated use the safer methods {@link #old_cnvtv_temp(java.nio.FloatBuffer)} and {@link #old_cnvtv_temp(com.sun.jna.ptr.FloatByReference)} instead - */ - //@Mangling({"_Z14old_cnvtv_tempPf", "?old_cnvtv_temp@@YAMPAM@Z"}) - //@java.lang.Deprecated - float old_cnvtv_temp(FloatByReference param); - /** - * Original signature : float parcel(float, float, float, float, float, _parcel*)
- * native declaration : line 43 - */ - //@Mangling({"_Z6parcelfffffP7_parcel", "?parcel@@YAMMMMMMPA7_parcel@Z"}) - float parcel(float lower, float upper, float pres, float temp, float dwpt, NsharpLibrary._parcel pcl); - /** - * Original signature : float parcelx(float, float, float, float, float, _parcel*)
- * native declaration : line 45 - */ - //@Mangling({"_Z7parcelxfffffP7_parcel", "?parcelx@@YAMMMMMMPA7_parcel@Z"}) - float parcelx(float lower, float upper, float pres, float temp, float dwpt, NsharpLibrary._parcel pcl); - /** - * Original signature : float precip_water(float*, float, float)
- * native declaration : line 47
- * @deprecated use the safer methods {@link #precip_water(java.nio.FloatBuffer, float, float)} and {@link #precip_water(com.sun.jna.ptr.FloatByReference, float, float)} instead - */ - //@Mangling({"_Z12precip_waterPfff", "?precip_water@@YAMPAMMM@Z"}) - //@java.lang.Deprecated - float precip_water(FloatByReference param, float lower, float upper); - /** - * Original signature : float Rogash_QPF(float*)
- * native declaration : line 48
- * @deprecated use the safer methods {@link #Rogash_QPF(java.nio.FloatBuffer)} and {@link #Rogash_QPF(com.sun.jna.ptr.FloatByReference)} instead - */ - //@Mangling({"_Z10Rogash_QPFPf", "?Rogash_QPF@@YAMPAM@Z"}) - //@java.lang.Deprecated - float Rogash_QPF(FloatByReference param); - - float dcape(FloatByReference level, FloatByReference drtemp); - /** - * Original signature : float sweat_index(float*)
- * native declaration : line 49
- * @deprecated use the safer methods {@link #sweat_index(java.nio.FloatBuffer)} and {@link #sweat_index(com.sun.jna.ptr.FloatByReference)} instead - */ - //@Mangling({"_Z11sweat_indexPf", "?sweat_index@@YAMPAM@Z"}) - //@java.lang.Deprecated - float sweat_index(FloatByReference param); - /** - * Original signature : float temp_lvl(float, float*)
- * native declaration : line 50
- * @deprecated use the safer methods {@link #temp_lvl(float, java.nio.FloatBuffer)} and {@link #temp_lvl(float, com.sun.jna.ptr.FloatByReference)} instead - */ - //@Mangling({"_Z8temp_lvlfPf", "?temp_lvl@@YAMMPAM@Z"}) - //@java.lang.Deprecated - float temp_lvl(float temp, FloatByReference param); - /** - * Original signature : float ThetaE_diff(float*)
- * native declaration : line 51
- * @deprecated use the safer methods {@link #ThetaE_diff(java.nio.FloatBuffer)} and {@link #ThetaE_diff(com.sun.jna.ptr.FloatByReference)} instead - */ - //@Mangling({"_Z11ThetaE_diffPf", "?ThetaE_diff@@YAMPAM@Z"}) - //@java.lang.Deprecated - float ThetaE_diff(FloatByReference param); - /** - * Original signature : float top_moistlyr(float*)
- * native declaration : line 52
- * @deprecated use the safer methods {@link #top_moistlyr(java.nio.FloatBuffer)} and {@link #top_moistlyr(com.sun.jna.ptr.FloatByReference)} instead - */ - //@Mangling({"_Z12top_moistlyrPf", "?top_moistlyr@@YAMPAM@Z"}) - //@java.lang.Deprecated - float top_moistlyr(FloatByReference param); - /** - * Original signature : float t_totals(float*, float*, float*)
- * native declaration : line 53
- * @deprecated use the safer methods {@link #t_totals(java.nio.FloatBuffer, java.nio.FloatBuffer, java.nio.FloatBuffer)} and {@link #t_totals(com.sun.jna.ptr.FloatByReference, com.sun.jna.ptr.FloatByReference, com.sun.jna.ptr.FloatByReference)} instead - */ - //@Mangling({"_Z8t_totalsPfPfPf", "?t_totals@@YAMPAMPAMPAM@Z"}) - //@java.lang.Deprecated - float t_totals(FloatByReference param, FloatByReference ct, FloatByReference vt); - /** - * Original signature : float unstbl_lvl(float*, float, float)
- * native declaration : line 54
- * @deprecated use the safer methods {@link #unstbl_lvl(java.nio.FloatBuffer, float, float)} and {@link #unstbl_lvl(com.sun.jna.ptr.FloatByReference, float, float)} instead - */ - //@Mangling({"_Z10unstbl_lvlPfff", "?unstbl_lvl@@YAMPAMMM@Z"}) - //@java.lang.Deprecated - float unstbl_lvl(FloatByReference param, float lower, float upper); - /** - * Original signature : float vert_tot(float*)
- * native declaration : line 55
- * @deprecated use the safer methods {@link #vert_tot(java.nio.FloatBuffer)} and {@link #vert_tot(com.sun.jna.ptr.FloatByReference)} instead - */ - //@Mangling({"_Z8vert_totPf", "?vert_tot@@YAMPAM@Z"}) - //@java.lang.Deprecated - float vert_tot(FloatByReference param); - /** - * Original signature : float wb_lvl(float, float*)
- * native declaration : line 56
- * @deprecated use the safer methods {@link #wb_lvl(float, java.nio.FloatBuffer)} and {@link #wb_lvl(float, com.sun.jna.ptr.FloatByReference)} instead - */ - //@Mangling({"_Z6wb_lvlfPf", "?wb_lvl@@YAMMPAM@Z"}) - //@java.lang.Deprecated - float wb_lvl(float temp, FloatByReference param); - - //from wind.h - float helicity ( float lower, float upper, float sdir, float sspd, - FloatByReference phel, FloatByReference nhel ); - void sr_wind ( float pbot, float ptop, float stdir, float stspd, - FloatByReference mnu, FloatByReference mnv, FloatByReference wdir, FloatByReference wspd ); - void mean_wind ( float pbot, float ptop, FloatByReference mnu, FloatByReference mnv, - FloatByReference wdir, FloatByReference wspd ); - void wind_shear ( float pbot, float ptop, FloatByReference shu, FloatByReference shv, - FloatByReference sdir, FloatByReference smag ); - float ucomp( float wdir, float wspd ); - float vcomp( float wdir, float wspd ); - - //from thermo.h - float thetae ( float pres, float temp, float dwpt ); - void drylift ( float p1, float t1, float td1, FloatByReference p2, FloatByReference t2 ); - float wetlift ( float pres, float temp, float pres2 ); - float wetbulb ( float pres, float temp, float dwpt ); - void effective_inflow_layer_thermo(float ecape, float ecinh, FloatByReference p_bot,FloatByReference p_top); - float relh(float pres, FloatByReference param); - //from xwvid.c - short vert_coords ( float hgt, float maxhgt ); - void corfidi_MCS_motion(FloatByReference fpu, FloatByReference fpv, FloatByReference fp_dir, FloatByReference fp_spd, FloatByReference bpu, FloatByReference bpv, FloatByReference bp_dir, FloatByReference bp_spd); - void bunkers_left_motion(FloatByReference u, FloatByReference v, FloatByReference dir, FloatByReference spd); - void bunkers_storm_motion(FloatByReference u, FloatByReference v, FloatByReference dir, FloatByReference spd); - float damaging_wind(); - float esp(); - float coniglio1(); - float scp(float stdir, float stspd); - float sigtorn_cin(float stdir, float stspd); - float sigtorn(float stdir, float stspd); - float sigtorn_fixed(float stdir, float stspd); - float sigtorn_test(float stdir, float stspd); - - - float advection_layer(FloatByReference param, float lower, float upper); + @Override + protected List getFieldOrder() { + return Arrays.asList(new String[] { "desc", "pres", "temp", + "dwpt", "presval", "flag" }); + } + } + + // / native declaration : line 10 + public static class _parcel extends Structure { + public float lplpres; + + public float lpltemp; + + public float lpldwpt; + + public float blayer; + + public float tlayer; + + public float entrain; + + public float lclpres; + + public float lfcpres; + + public float elpres; + + public float mplpres; + + public float bplus; + + public float bminus; + + public float bfzl; + + public float cape3km; + + public float cape6km; + + public float wm10c; + + public float wm30c; + + public float li5; + + public float li3; + + public float brn; + + public float limax; + + public float limaxpres; + + public float cap; + + public float cappres; + + public _parcel() { + super(); + } + + protected ByReference newByReference() { + return new ByReference(); + } + + protected ByValue newByValue() { + return new ByValue(); + } + + protected _parcel newInstance() { + return new _parcel(); + } + + public static class ByReference extends _parcel implements + Structure.ByReference { + + } + + public static class ByValue extends _parcel implements + Structure.ByValue { + + } + + @Override + protected List getFieldOrder() { + return Arrays.asList(new String[] { "lplpres", "lpltemp", + "lpldwpt", "blayer", "tlayer", "entrain", "lclpres", + "lfcpres", "elpres", "mplpres", "bplus", "bminus", + "bfzl", "cape3km", "cape6km", "wm10c", "wm30c", "li5", + "li3", "brn", "limax", "limaxpres", "cap", "cappres" }); + } + } + + // from our own SndgParms + public static class CaveSndgParms extends com.sun.jna.Structure { + public float omega; + + public float pres; + + public float hght; + + public float temp; + + public float dwpt; + + public float drct; + + public float sped; + + public CaveSndgParms() { + super(); + } + + public CaveSndgParms(float omega, float pres, float hght, + float temp, float dwpt, float drct, float sped) { + super(); + this.omega = omega; + this.pres = pres; + this.hght = hght; + this.temp = temp; + this.dwpt = dwpt; + this.drct = drct; + this.sped = sped; + } + + public void fillData(float omega, float pres, float hght, + float temp, float dwpt, float drct, float sped) { + this.omega = omega; + this.pres = pres; + this.hght = hght; + this.temp = temp; + this.dwpt = dwpt; + this.drct = drct; + this.sped = sped; + } + + protected ByReference newByReference() { + return new ByReference(); + } + + protected ByValue newByValue() { + return new ByValue(); + } + + protected CaveSndgParms newInstance() { + return new CaveSndgParms(); + } + + public static class ByReference extends CaveSndgParms implements + Structure.ByReference { + + } + + public static class ByValue extends CaveSndgParms implements + Structure.ByValue { + + } + + @Override + protected List getFieldOrder() { + return Arrays.asList(new String[] { "omega", "pres", "hght", + "temp", "dwpt", "drct", "sped" }); + } + + } + + public static class SarsInfoStr extends Structure { + public static int SARS_STRING_LEN = 40; + + public static int SARS_STRING_LINES = 12; + + // / max=10 + public int numHailstr; + + // / C type : char[10][60] + public byte[] hailStr = new byte[SARS_STRING_LINES + * SARS_STRING_LEN]; + + // / C type : int[10] + public int[] hailStrColor = new int[(SARS_STRING_LINES)]; + + // / C type : char[2][60] + // public byte[] sighailStr = new byte[2 * 60]; + // public int sighailStrColor; + // / max=10 + public int numsupcellstr; + + // / C type : char[10][60] + public byte[] supcellStr = new byte[SARS_STRING_LINES + * SARS_STRING_LEN]; + + // / C type : int[10] + public int[] supcellStrColor = new int[(SARS_STRING_LINES)]; + + // / C type : char[2][60] + // public byte[] torStr = new byte[2 * 60]; + // public int torStrColor; + public SarsInfoStr() { + super(); + } + + protected ByReference newByReference() { + return new ByReference(); + } + + protected ByValue newByValue() { + return new ByValue(); + } + + protected SarsInfoStr newInstance() { + return new SarsInfoStr(); + } + + public static class ByReference extends SarsInfoStr implements + Structure.ByReference { + + } + + public static class ByValue extends SarsInfoStr implements + Structure.ByValue { + + } + + public int getNumHailstr() { + return numHailstr; + } + + public byte[] getHailStr() { + return hailStr; + } + + public int[] getHailStrColor() { + return hailStrColor; + } + + /* + * public byte[] getSighailStr() { return sighailStr; } public int + * getSighailStrColor() { return sighailStrColor; } + */ + public int getNumsupcellstr() { + return numsupcellstr; + } + + public byte[] getSupcellStr() { + return supcellStr; + } + + public int[] getSupcellStrColor() { + return supcellStrColor; + } + + /* + * public byte[] getTorStr() { return torStr; } public int + * getTorStrColor() { return torStrColor; } + */ + + @Override + protected List getFieldOrder() { + return Arrays.asList(new String[] { "numHailstr", "hailStr", + "hailStrColor", "numsupcellstr", "supcellStr", + "supcellStrColor" }); + } + + } + + public static class FireInfoStr extends Structure { + public int sfcRhColor = 31; + + public int pwColor = 31; + + public int blMaxColor = 31; + + public int fosbergColor = 31; + + public byte[] sfcRh = new byte[(60)]; + + public byte[] sfc = new byte[(60)]; + + public byte[] zeroOneKmRh = new byte[(60)]; + + public byte[] zeroOneKmMean = new byte[(60)]; + + public byte[] blMeanRh = new byte[(60)]; + + public byte[] blMean = new byte[(60)]; + + public byte[] pw = new byte[(60)]; + + public byte[] blMax = new byte[(60)]; + + public byte[] fosberg = new byte[(60)]; + + public FireInfoStr() { + super(); + // TODO Auto-generated constructor stub + } + + public static class ByReference extends FireInfoStr implements + Structure.ByReference { + + } + + public static class ByValue extends FireInfoStr implements + Structure.ByValue { + + } + + protected ByReference newByReference() { + return new ByReference(); + } + + protected ByValue newByValue() { + return new ByValue(); + } + + public int getSfcRhColor() { + return sfcRhColor; + } + + public int getPwColor() { + return pwColor; + } + + public int getBlMaxColor() { + return blMaxColor; + } + + public int getFosbergColor() { + return fosbergColor; + } + + public byte[] getSfcRh() { + return sfcRh; + } + + public byte[] getSfc() { + return sfc; + } + + public byte[] getZeroOneKmRh() { + return zeroOneKmRh; + } + + public byte[] getZeroOneKmMean() { + return zeroOneKmMean; + } + + public byte[] getBlMeanRh() { + return blMeanRh; + } + + public byte[] getBlMean() { + return blMean; + } + + public byte[] getPw() { + return pw; + } + + public byte[] getBlMax() { + return blMax; + } + + public byte[] getFosberg() { + return fosberg; + } + + @Override + protected List getFieldOrder() { + return Arrays.asList(new String[] { "sfcRhColor", "pwColor", + "blMaxColor", "fosbergColor", "sfcRh", "sfc", + "zeroOneKmRh", "zeroOneKmMean", "blMeanRh", "blMean", + "pw", "blMax", "fosberg" }); + } + + } + + public static class WinterInfoStr extends Structure { + public float mopw; + + /* + * public float htop; public float hbot; public float mrh; public + * float mq; public float mo; public float pw; public float pLevel; + */ + public byte[] oprh = new byte[(60)]; + + public byte[] layerDepth = new byte[(60)]; + + public byte[] meanLayerRh = new byte[(60)]; + + public byte[] meanLayerMixRat = new byte[(60)]; + + public byte[] meanLayerPw = new byte[(60)]; + + public byte[] meanLayerOmega = new byte[(60)]; + + public byte[] initPhase = new byte[(100)]; + + public byte[] tempProfile1 = new byte[(60)]; + + public byte[] tempProfile2 = new byte[(60)]; + + public byte[] tempProfile3 = new byte[(60)]; + + public byte[] wetbulbProfile1 = new byte[(60)]; + + public byte[] wetbulbProfile2 = new byte[(60)]; + + public byte[] wetbulbProfile3 = new byte[(60)]; + + public byte[] bestGuess1 = new byte[(60)]; + + public byte[] bestGuess2 = new byte[(60)]; + + public WinterInfoStr() { + super(); + // TODO Auto-generated constructor stub + } + + public static class ByReference extends WinterInfoStr implements + Structure.ByReference { + + } + + public static class ByValue extends WinterInfoStr implements + Structure.ByValue { + + } + + protected ByReference newByReference() { + return new ByReference(); + } + + protected ByValue newByValue() { + return new ByValue(); + } + + public float getMopw() { + return mopw; + } + + public byte[] getOprh() { + return oprh; + } + + public byte[] getLayerDepth() { + return layerDepth; + } + + public byte[] getMeanLayerRh() { + return meanLayerRh; + } + + public byte[] getMeanLayerMixRat() { + return meanLayerMixRat; + } + + public byte[] getMeanLayerPw() { + return meanLayerPw; + } + + public byte[] getMeanLayerOmega() { + return meanLayerOmega; + } + + public byte[] getInitPhase() { + return initPhase; + } + + public byte[] getTempProfile1() { + return tempProfile1; + } + + public byte[] getTempProfile2() { + return tempProfile2; + } + + public byte[] getTempProfile3() { + return tempProfile3; + } + + public byte[] getWetbulbProfile1() { + return wetbulbProfile1; + } + + public byte[] getWetbulbProfile2() { + return wetbulbProfile2; + } + + public byte[] getWetbulbProfile3() { + return wetbulbProfile3; + } + + public byte[] getBestGuess1() { + return bestGuess1; + } + + public byte[] getBestGuess2() { + return bestGuess2; + } + + @Override + protected List getFieldOrder() { + return Arrays.asList(new String[] { "oprh", "layerDepth", + "meanLayerRh", "meanLayerMixRat", "meanLayerPw", + "meanLayerOmega", "initPhase", "tempProfile1", + "tempProfile2", "tempProfile3", "wetbulbProfile1", + "wetbulbProfile2", "wetbulbProfile3", "bestGuess1", + "bestGuess2" }); + } + + } + + public static int MAX_CLOUD_LAYER = 20; + + // cloudTypeFM value defined in caveNsharp.c OVC=1, BKN=2, SCT=3*/ + public static String[] CLOUD_TYPE = { "dummy", "OVC", "BKN", "SCT" }; + + public static class CloudInfoStr extends Structure { + /* FM: Fred Mosher's Algorithm */ + public int sizeFM; + + public float[] preStartFM = new float[MAX_CLOUD_LAYER]; + + public float[] preEndFM = new float[MAX_CLOUD_LAYER]; + + public int[] cloudTypeFM = new int[MAX_CLOUD_LAYER]; + + /* CE: Chernykh and Eskridge Algorithm */ + public int sizeCE; + + public float[] preStartCE = new float[MAX_CLOUD_LAYER]; + + public float[] preEndCE = new float[MAX_CLOUD_LAYER]; + + public CloudInfoStr() { + super(); + sizeFM = 0; + sizeCE = 0; + } + + protected ByReference newByReference() { + return new ByReference(); + } + + protected ByValue newByValue() { + return new ByValue(); + } + + protected CloudInfoStr newInstance() { + return new CloudInfoStr(); + } + + public static class ByReference extends CloudInfoStr implements + Structure.ByReference { + + } + + public static class ByValue extends CloudInfoStr implements + Structure.ByValue { + + } + + public int getSizeFM() { + return sizeFM; + } + + public int[] getCloudTypeFM() { + return cloudTypeFM; + } + + public int getSizeCE() { + return sizeCE; + } + + public float[] getPreStartCE() { + return preStartCE; + } + + public float[] getPreEndCE() { + return preEndCE; + } + + public float[] getPreStartFM() { + return preStartFM; + } + + public float[] getPreEndFM() { + return preEndFM; + } + + @Override + protected List getFieldOrder() { + return Arrays.asList(new String[] { "sizeFM", "preStartFM", + "preEndFM", "cloudTypeFM", "sizeCE", "preStartCE", + "preEndCE" }); + } + + } + + public static class StormSlinkyStr extends Structure { + public int size; + + public float tottim; + + public float angl; + + // / C type : float[200][2] + public float[] tsuv = new float[200 * 2]; + + public int[] color = new int[200]; + + public StormSlinkyStr() { + super(); + size = -1; + } + + protected ByReference newByReference() { + return new ByReference(); + } + + protected ByValue newByValue() { + return new ByValue(); + } + + protected StormSlinkyStr newInstance() { + return new StormSlinkyStr(); + } + + public static class ByReference extends StormSlinkyStr implements + Structure.ByReference { + + } + + public static class ByValue extends StormSlinkyStr implements + Structure.ByValue { + + } + + public float getTottim() { + return tottim; + } + + public void setTottim(float tottim) { + this.tottim = tottim; + } + + public float getAngl() { + return angl; + } + + public void setAngl(float angl) { + this.angl = angl; + } + + public float[] getTsuv() { + return tsuv; + } + + public void setTsuv(float[] tsuv) { + this.tsuv = tsuv; + } + + public int getSize() { + return size; + } + + public void setSize(int size) { + this.size = size; + } + + public int[] getColor() { + return color; + } + + public void setColor(int[] color) { + this.color = color; + } + + @Override + protected List getFieldOrder() { + return Arrays.asList(new String[] { "size", "tottim", "angl", + "tsuv", "color" }); + } + + } + + // From our own caveNsharp.c + float aglT(int l1high, int l2high); + + void initStaticGlobalsMem(); + + // void setSarsSupcellFileName(char sarsFlName[], char + // supercellFlName[]); + // @java.lang.Deprecated + // void setSarsSupcellFileName(Pointer sarsFlName, Pointer + // supercellFlName); + void setSarsSupcellFileName(ByteBuffer sarsFlName, int sarsLen, + ByteBuffer supercellFlName, int supLen); + + void populateSndgData(NsharpLibrary.CaveSndgParms snDataArray[], + int arraySize, int datatype); + + int populateSndgDataStatic(CaveSndgParms snDataArray[], int arraySize, + int datatype); + + void get_lpvaluesData(NsharpLibrary._lplvalues pParcel); + + // void populateSndgTestData() ; + void get_surface(FloatByReference pressure, FloatByReference temp, + FloatByReference dewpt); + + void get_surfaceWind(FloatByReference windSp, FloatByReference windDir); + + // void get_top(FloatByReference pressure, FloatByReference temp, + // FloatByReference dewpt); + void get_storm(FloatByReference speed, FloatByReference direction); + + void set_storm(float speed, float direction); + + void cave_visual1(float lower, float upper, float pres, float temp, + float dwpt, NsharpLibrary.StormSlinkyStr stmSlinky); + + void draw_Clouds(NsharpLibrary.CloudInfoStr cloudInfo); + + void getWinterInfo(NsharpLibrary.WinterInfoStr winterInfo); + + void getFireInfo(NsharpLibrary.FireInfoStr fireInfo); + + void getSarsInfo(NsharpLibrary.SarsInfoStr sarsInfo); + + // float cave_bulk_rich ( float lplpres, float bplus,FloatByReference + // brnshear ); + float cave_bulk_rich2(FloatByReference brnshear); + + float cave_ship(); + + int cave_ww_type(); + + float cave_criticalAngel(); + + void get_effectLayertopBotPres(FloatByReference topP, + FloatByReference botP); + + void nc_mix_height(FloatByReference pres, FloatByReference drct, + FloatByReference sped, FloatByReference del_t, + FloatByReference lr, FloatByReference drct_mean, + FloatByReference sped_mean, FloatByReference drct_max, + FloatByReference sped_max, short flag); + + float cave_mdpi_windex(FloatByReference windex); + + int cave_dmpi(); + + void cave_ccl(float mixr, FloatByReference pccl, FloatByReference tccl, + FloatByReference zccl); + + void cave_soar(float slev, FloatByReference ctax, + FloatByReference zconv, FloatByReference tconv, + FloatByReference zthrm, FloatByReference tthrm, + FloatByReference soar, FloatByReference ttrig); + + float cave_wmax(float[] vvel); + + // void printSfcInfo(); + // void showSndgData(); + // From basic.h + /** + * Original signature : float i_temp(float)
+ * native declaration : line 57 + */ + float itemp(float pres); + + /** + * Original signature : float i_dwpt(float)
+ * native declaration : line 58 + */ + float idwpt(float pres); + + /** + * Original signature : float i_hght(float)
+ * native declaration : line 59 + */ + float ihght(float pres); + + /** + * Original signature : float i_vtmp(float)
+ * native declaration : line 60 + */ + float ivtmp(float pres); + + /** + * Original signature : float i_wdir(float)
+ * native declaration : line 61 + */ + float iwdir(float pres); + + /** + * Original signature : float i_wspd(float)
+ * native declaration : line 62 + */ + float iwspd(float pres); + + /** + * Original signature : float i_wndu(float)
+ * native declaration : line 63 + */ + float iwndu(float pres); + + /** + * Original signature : float i_wndv(float)
+ * native declaration : line 64 + */ + float iwndv(float pres); + + /** + * Original signature : float i_pres(float)
+ * native declaration : line 65 + */ + float ipres(float hght); + + /** + * Original signature : float i_omeg(float)
+ * native declaration : line 66 + */ + float iomeg(float pres); + + /** + * Original signature : sfc()
+ * native declaration : line 67 + */ + int sfc(); + + /** + * Original signature : float top_pres()
+ * native declaration : line 68 + */ + float top_pres(); + + /** + * Original signature : qc(float)
+ * native declaration : line 69 + */ + int qc(float value); + + /** + * Original signature : char* qc2(float, char*, short)
+ * native declaration : line 70
+ * + * @deprecated use the safer methods + * {@link #qc2(float, java.nio.ByteBuffer, short)} and + * {@link #qc2(float, com.sun.jna.Pointer, short)} instead + */ + @java.lang.Deprecated + Pointer qc2(float value, Pointer label, short prec); + + /** + * Original signature : char* qc2(float, char*, short)
+ * native declaration : line 70 + */ + Pointer qc2(float value, ByteBuffer label, short prec); + + /** + * Original signature : float ftom(float)
+ * native declaration : line 71 + */ + float ftom(float value); + + /** + * Original signature : float mtof(float)
+ * native declaration : line 72 + */ + float mtof(float value); + + /** + * Original signature : float ftoc(float)
+ * native declaration : line 73 + */ + float ftoc(float value); + + /** + * Original signature : float ctof(float)
+ * native declaration : line 74 + */ + float ctof(float value); + + /** + * Original signature : float agl(float)
+ * native declaration : line 75 + */ + float agl(float height); + + /** + * Original signature : float msl(float)
+ * native declaration : line 76 + */ + float msl(float height); + + /** + * Original signature : float kt_to_mps(float)
+ * native declaration : line 77 + */ + float kt_to_mps(float spd); + + /** + * Original signature : float virtemp(float, float, float)
+ * native declaration : line 78 + */ + float virtemp(float pres, float temp, float dwpt); + + /** + * from skparams.h + */ + float Mean_thetae(FloatByReference param, float lower, float upper); + + /** + * Original signature : float bulk_rich(_parcel, float*)
+ * native declaration : line 24
+ * + * @deprecated use the safer methods + * {@link #bulk_rich(nsharp.NsharpLibrary._parcel.ByValue, java.nio.FloatBuffer)} + * and + * {@link #bulk_rich(nsharp.NsharpLibrary._parcel.ByValue, com.sun.jna.ptr.FloatByReference)} + * instead + */ + // @Mangling({"_Z9bulk_rich7_parcelPf", "?bulk_rich@@YAM7_parcelPAM@Z"}) + // @java.lang.Deprecated + float bulk_rich(NsharpLibrary._parcel.ByValue pcl, + FloatByReference brnshear); + + /** + * Original signature : float cnvtv_temp(float*, float)
+ * native declaration : line 25
+ * + * @deprecated use the safer methods + * {@link #cnvtv_temp(java.nio.FloatBuffer, float)} and + * {@link #cnvtv_temp(com.sun.jna.ptr.FloatByReference, float)} + * instead + */ + // @Mangling({"_Z10cnvtv_tempPff", "?cnvtv_temp@@YAMPAMM@Z"}) + // @java.lang.Deprecated + float cnvtv_temp(FloatByReference param, float mincinh); + + /** + * Original signature : void define_parcel(short, float)
+ * native declaration : line 26 + */ + /* flag - Parcel selection. */ + /* -1 = Use Previous Selection */ + /* 1 = Observed sfc parcel */ + /* 2 = Fcst sfc parcel */ + /* 3 = Most unstable parcel */ + /* 4 = Mean mixlyr parcel */ + /* 5 = User defined parcel */ + /* 6 = Eff */ + /* */ + /* pres - Pressure(mb) of user defined parcel. */ + + void define_parcel(short flag, float pres); + + /** + * Original signature : float delta_t(float*)
+ * native declaration : line 27
+ * + * @deprecated use the safer methods + * {@link #delta_t(java.nio.FloatBuffer)} and + * {@link #delta_t(com.sun.jna.ptr.FloatByReference)} + * instead + */ + // @Mangling({"_Z7delta_tPf", "?delta_t@@YAMPAM@Z"}) + // @java.lang.Deprecated + float delta_t(FloatByReference param); + + /** + * Original signature : float ehi(float, float)
+ * native declaration : line 28 + */ + // @Mangling({"_Z3ehiff", "?ehi@@YAMMM@Z"}) + float ehi(float cape, float hel); + + /** + * Original signature : grab_level(float)
+ * native declaration : line 29 + */ + // @Mangling({"_Z10grab_levelf", "?grab_level@@YAXM@Z"}) + int grab_level(float pres); + + /** + * Original signature : float k_index(float*)
+ * native declaration : line 30
+ * + * @deprecated use the safer methods + * {@link #k_index(java.nio.FloatBuffer)} and + * {@link #k_index(com.sun.jna.ptr.FloatByReference)} + * instead + */ + // @Mangling({"_Z7k_indexPf", "?k_index@@YAMPAM@Z"}) + // @java.lang.Deprecated + float k_index(FloatByReference param); + + /** + * Original signature : + * float lapse_rate(float*, float, float)
+ * native declaration : line 31
+ * + * @deprecated use the safer methods + * {@link #lapse_rate(java.nio.FloatBuffer, float, float)} + * and + * {@link #lapse_rate(com.sun.jna.ptr.FloatByReference, float, float)} + * instead + */ + // @Mangling({"_Z10lapse_ratePfff", "?lapse_rate@@YAMPAMMM@Z"}) + // @java.lang.Deprecated + float lapse_rate(FloatByReference param, float lower, float upper); + + /** + * Original signature : void low_inv(float*, float*)
+ * native declaration : line 32
+ * + * @deprecated use the safer methods + * {@link #low_inv(java.nio.FloatBuffer, java.nio.FloatBuffer)} + * and + * {@link #low_inv(com.sun.jna.ptr.FloatByReference, com.sun.jna.ptr.FloatByReference)} + * instead + */ + // @Mangling({"_Z7low_invPfPf", "?low_inv@@YAXPAMPAM@Z"}) + // @java.lang.Deprecated + void low_inv(FloatByReference inv_mb, FloatByReference inv_dC); + + /** + * Original signature : float max_temp(float*, float)
+ * native declaration : line 33
+ * + * @deprecated use the safer methods + * {@link #max_temp(java.nio.FloatBuffer, float)} and + * {@link #max_temp(com.sun.jna.ptr.FloatByReference, float)} + * instead + */ + // @Mangling({"_Z8max_tempPff", "?max_temp@@YAMPAMM@Z"}) + // @java.lang.Deprecated + float max_temp(FloatByReference param, float mixlyr); + + /** + * Original signature : + * float mean_dwpt(float*, float, float)
+ * native declaration : line 34
+ * + * @deprecated use the safer methods + * {@link #mean_dwpt(java.nio.FloatBuffer, float, float)} + * and + * {@link #mean_dwpt(com.sun.jna.ptr.FloatByReference, float, float)} + * instead + */ + // @Mangling({"_Z9mean_dwptPfff", "?mean_dwpt@@YAMPAMMM@Z"}) + // @java.lang.Deprecated + float mean_dwpt(FloatByReference param, float lower, float upper); + + /** + * Original signature : + * float mean_mixratio(float*, float, float)
+ * native declaration : line 35
+ * + * @deprecated use the safer methods + * {@link #mean_mixratio(java.nio.FloatBuffer, float, float)} + * and + * {@link #mean_mixratio(com.sun.jna.ptr.FloatByReference, float, float)} + * instead + */ + // @Mangling({"_Z13mean_mixratioPfff", "?mean_mixratio@@YAMPAMMM@Z"}) + // @java.lang.Deprecated + float mean_mixratio(FloatByReference param, float lower, float upper); + + /** + * Original signature : + * float mean_relhum(float*, float, float)
+ * native declaration : line 36
+ * + * @deprecated use the safer methods + * {@link #mean_relhum(java.nio.FloatBuffer, float, float)} + * and + * {@link #mean_relhum(com.sun.jna.ptr.FloatByReference, float, float)} + * instead + */ + // @Mangling({"_Z11mean_relhumPfff", "?mean_relhum@@YAMPAMMM@Z"}) + // @java.lang.Deprecated + float mean_relhum(FloatByReference param, float lower, float upper); + + /** + * Original signature : + * float mean_theta(float*, float, float)
+ * native declaration : line 37
+ * + * @deprecated use the safer methods + * {@link #mean_theta(java.nio.FloatBuffer, float, float)} + * and + * {@link #mean_theta(com.sun.jna.ptr.FloatByReference, float, float)} + * instead + */ + // @Mangling({"_Z10mean_thetaPfff", "?mean_theta@@YAMPAMMM@Z"}) + // @java.lang.Deprecated + float mean_theta(FloatByReference param, float lower, float upper); + + /** + * Original signature : + * float Mean_WBtemp(float*, float, float)
+ * native declaration : line 38
+ * + * @deprecated use the safer methods + * {@link #Mean_WBtemp(java.nio.FloatBuffer, float, float)} + * and + * {@link #Mean_WBtemp(com.sun.jna.ptr.FloatByReference, float, float)} + * instead + */ + // @Mangling({"_Z11Mean_WBtempPfff", "?Mean_WBtemp@@YAMPAMMM@Z"}) + // @java.lang.Deprecated + float Mean_WBtemp(FloatByReference param, float lower, float upper); + + /** + * Original signature : + * void mix_height(float*, float*, float*, float*, float*, float*, float*, short) + *
+ * native declaration : line 39
+ * + * @deprecated use the safer methods + * {@link #mix_height(java.nio.FloatBuffer, java.nio.FloatBuffer, java.nio.FloatBuffer, java.nio.FloatBuffer, java.nio.FloatBuffer, java.nio.FloatBuffer, java.nio.FloatBuffer, short)} + * and + * {@link #mix_height(com.sun.jna.ptr.FloatByReference, com.sun.jna.ptr.FloatByReference, com.sun.jna.ptr.FloatByReference, com.sun.jna.ptr.FloatByReference, com.sun.jna.ptr.FloatByReference, com.sun.jna.ptr.FloatByReference, com.sun.jna.ptr.FloatByReference, short)} + * instead + */ + // @Mangling({"_Z10mix_heightPfPfPfPfPfPfPfi", + // "?mix_height@@YAXPAMPAMPAMPAMPAMPAMPAMH@Z"}) + // @java.lang.Deprecated + void mix_height(FloatByReference mh_mb, FloatByReference mh_drct, + FloatByReference mh_sped, FloatByReference mh_dC, + FloatByReference mh_lr, FloatByReference mh_drct_max, + FloatByReference mh_sped_max, short flag); + + /** + * Original signature : float old_cnvtv_temp(float*)
+ * native declaration : line 42
+ * + * @deprecated use the safer methods + * {@link #old_cnvtv_temp(java.nio.FloatBuffer)} and + * {@link #old_cnvtv_temp(com.sun.jna.ptr.FloatByReference)} + * instead + */ + // @Mangling({"_Z14old_cnvtv_tempPf", "?old_cnvtv_temp@@YAMPAM@Z"}) + // @java.lang.Deprecated + float old_cnvtv_temp(FloatByReference param); + + /** + * Original signature : + * float parcel(float, float, float, float, float, _parcel*) + *
+ * native declaration : line 43 + */ + // @Mangling({"_Z6parcelfffffP7_parcel", + // "?parcel@@YAMMMMMMPA7_parcel@Z"}) + float parcel(float lower, float upper, float pres, float temp, + float dwpt, NsharpLibrary._parcel pcl); + + /** + * Original signature : + * float parcelx(float, float, float, float, float, _parcel*) + *
+ * native declaration : line 45 + */ + // @Mangling({"_Z7parcelxfffffP7_parcel", + // "?parcelx@@YAMMMMMMPA7_parcel@Z"}) + float parcelx(float lower, float upper, float pres, float temp, + float dwpt, NsharpLibrary._parcel pcl); + + /** + * Original signature : + * float precip_water(float*, float, float)
+ * native declaration : line 47
+ * + * @deprecated use the safer methods + * {@link #precip_water(java.nio.FloatBuffer, float, float)} + * and + * {@link #precip_water(com.sun.jna.ptr.FloatByReference, float, float)} + * instead + */ + // @Mangling({"_Z12precip_waterPfff", "?precip_water@@YAMPAMMM@Z"}) + // @java.lang.Deprecated + float precip_water(FloatByReference param, float lower, float upper); + + /** + * Original signature : float Rogash_QPF(float*)
+ * native declaration : line 48
+ * + * @deprecated use the safer methods + * {@link #Rogash_QPF(java.nio.FloatBuffer)} and + * {@link #Rogash_QPF(com.sun.jna.ptr.FloatByReference)} + * instead + */ + // @Mangling({"_Z10Rogash_QPFPf", "?Rogash_QPF@@YAMPAM@Z"}) + // @java.lang.Deprecated + float Rogash_QPF(FloatByReference param); + + float dcape(FloatByReference level, FloatByReference drtemp); + + /** + * Original signature : float sweat_index(float*)
+ * native declaration : line 49
+ * + * @deprecated use the safer methods + * {@link #sweat_index(java.nio.FloatBuffer)} and + * {@link #sweat_index(com.sun.jna.ptr.FloatByReference)} + * instead + */ + // @Mangling({"_Z11sweat_indexPf", "?sweat_index@@YAMPAM@Z"}) + // @java.lang.Deprecated + float sweat_index(FloatByReference param); + + /** + * Original signature : float temp_lvl(float, float*)
+ * native declaration : line 50
+ * + * @deprecated use the safer methods + * {@link #temp_lvl(float, java.nio.FloatBuffer)} and + * {@link #temp_lvl(float, com.sun.jna.ptr.FloatByReference)} + * instead + */ + // @Mangling({"_Z8temp_lvlfPf", "?temp_lvl@@YAMMPAM@Z"}) + // @java.lang.Deprecated + float temp_lvl(float temp, FloatByReference param); + + /** + * Original signature : float ThetaE_diff(float*)
+ * native declaration : line 51
+ * + * @deprecated use the safer methods + * {@link #ThetaE_diff(java.nio.FloatBuffer)} and + * {@link #ThetaE_diff(com.sun.jna.ptr.FloatByReference)} + * instead + */ + // @Mangling({"_Z11ThetaE_diffPf", "?ThetaE_diff@@YAMPAM@Z"}) + // @java.lang.Deprecated + float ThetaE_diff(FloatByReference param); + + /** + * Original signature : float top_moistlyr(float*)
+ * native declaration : line 52
+ * + * @deprecated use the safer methods + * {@link #top_moistlyr(java.nio.FloatBuffer)} and + * {@link #top_moistlyr(com.sun.jna.ptr.FloatByReference)} + * instead + */ + // @Mangling({"_Z12top_moistlyrPf", "?top_moistlyr@@YAMPAM@Z"}) + // @java.lang.Deprecated + float top_moistlyr(FloatByReference param); + + /** + * Original signature : + * float t_totals(float*, float*, float*)
+ * native declaration : line 53
+ * + * @deprecated use the safer methods + * {@link #t_totals(java.nio.FloatBuffer, java.nio.FloatBuffer, java.nio.FloatBuffer)} + * and + * {@link #t_totals(com.sun.jna.ptr.FloatByReference, com.sun.jna.ptr.FloatByReference, com.sun.jna.ptr.FloatByReference)} + * instead + */ + // @Mangling({"_Z8t_totalsPfPfPf", "?t_totals@@YAMPAMPAMPAM@Z"}) + // @java.lang.Deprecated + float t_totals(FloatByReference param, FloatByReference ct, + FloatByReference vt); + + /** + * Original signature : + * float unstbl_lvl(float*, float, float)
+ * native declaration : line 54
+ * + * @deprecated use the safer methods + * {@link #unstbl_lvl(java.nio.FloatBuffer, float, float)} + * and + * {@link #unstbl_lvl(com.sun.jna.ptr.FloatByReference, float, float)} + * instead + */ + // @Mangling({"_Z10unstbl_lvlPfff", "?unstbl_lvl@@YAMPAMMM@Z"}) + // @java.lang.Deprecated + float unstbl_lvl(FloatByReference param, float lower, float upper); + + /** + * Original signature : float vert_tot(float*)
+ * native declaration : line 55
+ * + * @deprecated use the safer methods + * {@link #vert_tot(java.nio.FloatBuffer)} and + * {@link #vert_tot(com.sun.jna.ptr.FloatByReference)} + * instead + */ + // @Mangling({"_Z8vert_totPf", "?vert_tot@@YAMPAM@Z"}) + // @java.lang.Deprecated + float vert_tot(FloatByReference param); + + /** + * Original signature : float wb_lvl(float, float*)
+ * native declaration : line 56
+ * + * @deprecated use the safer methods + * {@link #wb_lvl(float, java.nio.FloatBuffer)} and + * {@link #wb_lvl(float, com.sun.jna.ptr.FloatByReference)} + * instead + */ + // @Mangling({"_Z6wb_lvlfPf", "?wb_lvl@@YAMMPAM@Z"}) + // @java.lang.Deprecated + float wb_lvl(float temp, FloatByReference param); + + // from wind.h + float helicity(float lower, float upper, float sdir, float sspd, + FloatByReference phel, FloatByReference nhel); + + void sr_wind(float pbot, float ptop, float stdir, float stspd, + FloatByReference mnu, FloatByReference mnv, + FloatByReference wdir, FloatByReference wspd); + + void mean_wind(float pbot, float ptop, FloatByReference mnu, + FloatByReference mnv, FloatByReference wdir, + FloatByReference wspd); + + void wind_shear(float pbot, float ptop, FloatByReference shu, + FloatByReference shv, FloatByReference sdir, + FloatByReference smag); + + float ucomp(float wdir, float wspd); + + float vcomp(float wdir, float wspd); + + // from thermo.h + float thetae(float pres, float temp, float dwpt); + + void drylift(float p1, float t1, float td1, FloatByReference p2, + FloatByReference t2); + + float wetlift(float pres, float temp, float pres2); + + float wetbulb(float pres, float temp, float dwpt); + + void effective_inflow_layer_thermo(float ecape, float ecinh, + FloatByReference p_bot, FloatByReference p_top); + + float relh(float pres, FloatByReference param); + + // from xwvid.c + short vert_coords(float hgt, float maxhgt); + + void corfidi_MCS_motion(FloatByReference fpu, FloatByReference fpv, + FloatByReference fp_dir, FloatByReference fp_spd, + FloatByReference bpu, FloatByReference bpv, + FloatByReference bp_dir, FloatByReference bp_spd); + + void bunkers_left_motion(FloatByReference u, FloatByReference v, + FloatByReference dir, FloatByReference spd); + + void bunkers_storm_motion(FloatByReference u, FloatByReference v, + FloatByReference dir, FloatByReference spd); + + float damaging_wind(); + + float esp(); + + float coniglio1(); + + float scp(float stdir, float stspd); + + float sigtorn_cin(float stdir, float stspd); + + float sigtorn(float stdir, float stspd); + + float sigtorn_fixed(float stdir, float stspd); + + float sigtorn_test(float stdir, float stspd); + + float advection_layer(FloatByReference param, float lower, float upper); } /* - public interface Nsharp95Library extends Library { - //library name is libnsharp.so. but only use "nsharp" as lib name when loading - NsharpLibrary INSTANCE = (NsharpLibrary) Native.loadLibrary("nsharp", NsharpLibrary.class); - /// native declaration : line 1 - public static class _lplvalues extends Structure { - /// C type : char[40] - public byte[] desc = new byte[(40)]; - public float pres; - public float temp; - public float dwpt; - public short flag; - public _lplvalues() { - super(); - } - /// @param desc C type : char[40] - public _lplvalues(byte desc[], float pres, float temp, float dwpt, short flag) { - super(); - if (desc.length != this.desc.length) - throw new java.lang.IllegalArgumentException("Wrong array size !"); - this.desc = desc; - this.pres = pres; - this.temp = temp; - this.dwpt = dwpt; - this.flag = flag; - } - protected ByReference newByReference() { return new ByReference(); } - protected ByValue newByValue() { return new ByValue(); } - protected _lplvalues newInstance() { return new _lplvalues(); } - public static class ByReference extends _lplvalues implements Structure.ByReference { - - } - public static class ByValue extends _lplvalues implements Structure.ByValue { - - } - } - /// native declaration : line 10 - public static class _parcel extends Structure{ - public float lplpres; - public float lpltemp; - public float lpldwpt; - public float blayer; - public float tlayer; - public float entrain; - public float lclpres; - public float lfcpres; - public float elpres; - public float mplpres; - public float bplus; - public float bminus; - public float bfzl; - public float li5; - public float li3; - public float brn; - public float limax; - public float limaxpres; - public float cap; - public float cappres; - public _parcel() { - super(); - } - protected ByReference newByReference() { return new ByReference(); } - protected ByValue newByValue() { return new ByValue(); } - protected _parcel newInstance() { return new _parcel(); } - public static class ByReference extends _parcel implements Structure.ByReference { - - } - public static class ByValue extends _parcel implements Structure.ByValue { - - } - } - - //from our own SndgParms - public static class SndgParms extends com.sun.jna.Structure { - public float omega; - public float pres; - public float hght; - public float temp; - public float dwpt; - public float drct; - public float sped; - public SndgParms() { - super(); - } - public SndgParms(float omega, float pres, float hght, float temp, float dwpt, float drct, float sped) { - super(); - this.omega = omega; - this.pres = pres; - this.hght = hght; - this.temp = temp; - this.dwpt = dwpt; - this.drct = drct; - this.sped = sped; - } - - public void fillData(float omega, float pres, float hght, float temp, float dwpt, float drct, float sped) { - this.omega = omega; - this.pres = pres; - this.hght = hght; - this.temp = temp; - this.dwpt = dwpt; - this.drct = drct; - this.sped = sped; - } - protected ByReference newByReference() { return new ByReference(); } - protected ByValue newByValue() { return new ByValue(); } - protected SndgParms newInstance() { return new SndgParms(); } - public static class ByReference extends SndgParms implements Structure.ByReference { - - } - public static class ByValue extends SndgParms implements Structure.ByValue { - - } - - } - - public static class StormSlinkyStr extends Structure { - public int size; - public float tottim; - public float angl; - /// C type : float[200][2] - public float[] tsuv = new float[200 * 2]; - public StormSlinkyStr() { - super(); - size=-1; - } - /// @param tsuv C type : float[200][2] - public StormSlinkyStr(int size, float tottim, float angl, float tsuv[]) { - super(); - this.size = size; - this.tottim = tottim; - this.angl = angl; - if (tsuv.length != this.tsuv.length) - throw new java.lang.IllegalArgumentException("Wrong array size !"); - this.tsuv = tsuv; - } - protected ByReference newByReference() { return new ByReference(); } - protected ByValue newByValue() { return new ByValue(); } - protected StormSlinkyStr newInstance() { return new StormSlinkyStr(); } - public static class ByReference extends StormSlinkyStr implements Structure.ByReference { + * public interface Nsharp95Library extends Library { //library name is + * libnsharp.so. but only use "nsharp" as lib name when loading + * NsharpLibrary INSTANCE = (NsharpLibrary) Native.loadLibrary("nsharp", + * NsharpLibrary.class); /// native declaration : line 1 public + * static class _lplvalues extends Structure { /// C type : char[40] public + * byte[] desc = new byte[(40)]; public float pres; public float temp; + * public float dwpt; public short flag; public _lplvalues() { super(); } + * /// @param desc C type : char[40] public _lplvalues(byte desc[], float + * pres, float temp, float dwpt, short flag) { super(); if (desc.length != + * this.desc.length) throw new + * java.lang.IllegalArgumentException("Wrong array size !"); this.desc = + * desc; this.pres = pres; this.temp = temp; this.dwpt = dwpt; this.flag = + * flag; } protected ByReference newByReference() { return new + * ByReference(); } protected ByValue newByValue() { return new ByValue(); } + * protected _lplvalues newInstance() { return new _lplvalues(); } public + * static class ByReference extends _lplvalues implements + * Structure.ByReference { + * + * } public static class ByValue extends _lplvalues implements + * Structure.ByValue { + * + * } } /// native declaration : line 10 public static class _parcel + * extends Structure{ public float lplpres; public float lpltemp; public + * float lpldwpt; public float blayer; public float tlayer; public float + * entrain; public float lclpres; public float lfcpres; public float elpres; + * public float mplpres; public float bplus; public float bminus; public + * float bfzl; public float li5; public float li3; public float brn; public + * float limax; public float limaxpres; public float cap; public float + * cappres; public _parcel() { super(); } protected ByReference + * newByReference() { return new ByReference(); } protected ByValue + * newByValue() { return new ByValue(); } protected _parcel newInstance() { + * return new _parcel(); } public static class ByReference extends _parcel + * implements Structure.ByReference { + * + * } public static class ByValue extends _parcel implements + * Structure.ByValue { + * + * } } + * + * //from our own SndgParms public static class SndgParms extends + * com.sun.jna.Structure { public float omega; public float pres; public + * float hght; public float temp; public float dwpt; public float drct; + * public float sped; public SndgParms() { super(); } public SndgParms(float + * omega, float pres, float hght, float temp, float dwpt, float drct, float + * sped) { super(); this.omega = omega; this.pres = pres; this.hght = hght; + * this.temp = temp; this.dwpt = dwpt; this.drct = drct; this.sped = sped; } + * + * public void fillData(float omega, float pres, float hght, float temp, + * float dwpt, float drct, float sped) { this.omega = omega; this.pres = + * pres; this.hght = hght; this.temp = temp; this.dwpt = dwpt; this.drct = + * drct; this.sped = sped; } protected ByReference newByReference() { return + * new ByReference(); } protected ByValue newByValue() { return new + * ByValue(); } protected SndgParms newInstance() { return new SndgParms(); + * } public static class ByReference extends SndgParms implements + * Structure.ByReference { + * + * } public static class ByValue extends SndgParms implements + * Structure.ByValue { + * + * } + * + * } + * + * public static class StormSlinkyStr extends Structure { public int size; + * public float tottim; public float angl; /// C type : float[200][2] public + * float[] tsuv = new float[200 * 2]; public StormSlinkyStr() { super(); + * size=-1; } /// @param tsuv C type : float[200][2] public + * StormSlinkyStr(int size, float tottim, float angl, float tsuv[]) { + * super(); this.size = size; this.tottim = tottim; this.angl = angl; if + * (tsuv.length != this.tsuv.length) throw new + * java.lang.IllegalArgumentException("Wrong array size !"); this.tsuv = + * tsuv; } protected ByReference newByReference() { return new + * ByReference(); } protected ByValue newByValue() { return new ByValue(); } + * protected StormSlinkyStr newInstance() { return new StormSlinkyStr(); } + * public static class ByReference extends StormSlinkyStr implements + * Structure.ByReference { + * + * } public static class ByValue extends StormSlinkyStr implements + * Structure.ByValue { + * + * } + * + * public float getTottim() { return tottim; } public void setTottim(float + * tottim) { this.tottim = tottim; } public float getAngl() { return angl; } + * public void setAngl(float angl) { this.angl = angl; } public float[] + * getTsuv() { return tsuv; } public void setTsuv(float[] tsuv) { this.tsuv + * = tsuv; } public int getSize() { return size; } public void setSize(int + * size) { this.size = size; } + * + * } + * + * //From our own caveNsharp.c void + * populateSndgData(NsharpLibrary.CaveSndgParms snDataArray[], int + * arraySize, float winDir, float winSpd); void + * get_lpvaluesData(NsharpLibrary._lplvalues pParcel); void + * populateSndgTestData() ; void get_surface(FloatByReference pressure, + * FloatByReference temp, FloatByReference dewpt); void + * get_surfaceWind(FloatByReference windSp, FloatByReference windDir); + * //void get_top(FloatByReference pressure, FloatByReference temp, + * FloatByReference dewpt); void get_storm(FloatByReference speed, + * FloatByReference direction); void set_storm(float speed, float + * direction); void cave_visual1 ( float lower, float upper, float pres, + * float temp, float dwpt , NsharpLibrary.StormSlinkyStr stmSlinky); float + * cave_bulk_rich ( float lplpres, float bplus,FloatByReference brnshear ); + * //void printSfcInfo(); //void showSndgData(); //From basic.h + * + * float i_temp(float pres); + * + * float i_dwpt(float pres); + * + * float i_hght(float pres); + * + * float i_vtmp(float pres); + * + * float i_wdir(float pres); + * + * float i_wspd(float pres); + * + * float i_wndu(float pres); + * + * float i_wndv(float pres); + * + * float i_pres(float hght); + * + * float i_omeg(float pres); + * + * int sfc(); + * + * float top_pres(); + * + * int qc(float value); + * + * @java.lang.Deprecated Pointer qc2(float value, Pointer label, short + * prec); + * + * Pointer qc2(float value, ByteBuffer label, short prec); + * + * float ftom(float value); + * + * float mtof(float value); + * + * float ftoc(float value); + * + * float ctof(float value); + * + * float agl(float height); + * + * float msl(float height); + * + * float kt_to_mps(float spd); + * + * float virtemp(float pres, float temp, float dwpt); + * + * //* //* from skparams.h // + * + * //@Mangling({"_Z9bulk_rich7_parcelPf", "?bulk_rich@@YAM7_parcelPAM@Z"}) + * //@java.lang.Deprecated float bulk_rich(NsharpLibrary._parcel.ByValue + * pcl, FloatByReference brnshear); + * + * //@Mangling({"_Z10cnvtv_tempPff", "?cnvtv_temp@@YAMPAMM@Z"}) + * //@java.lang.Deprecated float cnvtv_temp(FloatByReference param, float + * mincinh); + * + * /*flag - Parcel selection. + */ + /* -1 = Use Previous Selection */ + /* 1 = Observed sfc parcel */ + /* 2 = Fcst sfc parcel */ + /* 3 = Mean mixlyr parcel */ + /* 4 = Most unstable parcel */ + /* 5 = User defined parcel */ + /* */ + /* pres - Pressure(mb) of user defined parcel. */ + /* + * void define_parcel(short flag, float pres); + * + * //@Mangling({"_Z7delta_tPf", "?delta_t@@YAMPAM@Z"}) + * //@java.lang.Deprecated float delta_t(FloatByReference param); + * + * //@Mangling({"_Z3ehiff", "?ehi@@YAMMM@Z"}) float ehi(float cape, float + * hel); + * + * //@Mangling({"_Z10grab_levelf", "?grab_level@@YAXM@Z"}) int + * grab_level(float pres); + * + * //@Mangling({"_Z7k_indexPf", "?k_index@@YAMPAM@Z"}) + * //@java.lang.Deprecated float k_index(FloatByReference param); + * + * //@Mangling({"_Z10lapse_ratePfff", "?lapse_rate@@YAMPAMMM@Z"}) + * //@java.lang.Deprecated float lapse_rate(FloatByReference param, float + * lower, float upper); + * + * //@Mangling({"_Z7low_invPfPf", "?low_inv@@YAXPAMPAM@Z"}) + * //@java.lang.Deprecated void low_inv(FloatByReference inv_mb, + * FloatByReference inv_dC); + * + * //@Mangling({"_Z8max_tempPff", "?max_temp@@YAMPAMM@Z"}) + * //@java.lang.Deprecated float max_temp(FloatByReference param, float + * mixlyr); + * + * //@Mangling({"_Z9mean_dwptPfff", "?mean_dwpt@@YAMPAMMM@Z"}) + * //@java.lang.Deprecated float mean_dwpt(FloatByReference param, float + * lower, float upper); + * + * //@Mangling({"_Z13mean_mixratioPfff", "?mean_mixratio@@YAMPAMMM@Z"}) + * //@java.lang.Deprecated float mean_mixratio(FloatByReference param, float + * lower, float upper); + * + * //@Mangling({"_Z11mean_relhumPfff", "?mean_relhum@@YAMPAMMM@Z"}) + * //@java.lang.Deprecated float mean_relhum(FloatByReference param, float + * lower, float upper); + * + * //@Mangling({"_Z10mean_thetaPfff", "?mean_theta@@YAMPAMMM@Z"}) + * //@java.lang.Deprecated float mean_theta(FloatByReference param, float + * lower, float upper); + * + * //@Mangling({"_Z11Mean_WBtempPfff", "?Mean_WBtemp@@YAMPAMMM@Z"}) + * //@java.lang.Deprecated float Mean_WBtemp(FloatByReference param, float + * lower, float upper); + * + * //@Mangling({"_Z10mix_heightPfPfPfPfPfPfPfi", + * "?mix_height@@YAXPAMPAMPAMPAMPAMPAMPAMH@Z"}) //@java.lang.Deprecated void + * mix_height(FloatByReference mh_mb, FloatByReference mh_drct, + * FloatByReference mh_sped, FloatByReference mh_dC, FloatByReference mh_lr, + * FloatByReference mh_drct_max, FloatByReference mh_sped_max, short flag); + * + * //@Mangling({"_Z14old_cnvtv_tempPf", "?old_cnvtv_temp@@YAMPAM@Z"}) + * //@java.lang.Deprecated float old_cnvtv_temp(FloatByReference param); + * + * //@Mangling({"_Z6parcelfffffP7_parcel", "?parcel@@YAMMMMMMPA7_parcel@Z"}) + * float parcel(float lower, float upper, float pres, float temp, float + * dwpt, NsharpLibrary._parcel pcl); + * + * //@Mangling({"_Z7parcelxfffffP7_parcel", + * "?parcelx@@YAMMMMMMPA7_parcel@Z"}) float parcelx(float lower, float + * upper, float pres, float temp, float dwpt, NsharpLibrary._parcel pcl); + * + * //@Mangling({"_Z12precip_waterPfff", "?precip_water@@YAMPAMMM@Z"}) + * //@java.lang.Deprecated float precip_water(FloatByReference param, float + * lower, float upper); + * + * //@Mangling({"_Z10Rogash_QPFPf", "?Rogash_QPF@@YAMPAM@Z"}) + * //@java.lang.Deprecated float Rogash_QPF(FloatByReference param); + * + * //@Mangling({"_Z11sweat_indexPf", "?sweat_index@@YAMPAM@Z"}) + * //@java.lang.Deprecated float sweat_index(FloatByReference param); + * + * //@Mangling({"_Z8temp_lvlfPf", "?temp_lvl@@YAMMPAM@Z"}) + * //@java.lang.Deprecated float temp_lvl(float temp, FloatByReference + * param); + * + * //@Mangling({"_Z11ThetaE_diffPf", "?ThetaE_diff@@YAMPAM@Z"}) + * //@java.lang.Deprecated float ThetaE_diff(FloatByReference param); + * + * //@Mangling({"_Z12top_moistlyrPf", "?top_moistlyr@@YAMPAM@Z"}) + * //@java.lang.Deprecated float top_moistlyr(FloatByReference param); + * + * //@Mangling({"_Z8t_totalsPfPfPf", "?t_totals@@YAMPAMPAMPAM@Z"}) + * //@java.lang.Deprecated float t_totals(FloatByReference param, + * FloatByReference ct, FloatByReference vt); + * + * //@Mangling({"_Z10unstbl_lvlPfff", "?unstbl_lvl@@YAMPAMMM@Z"}) + * //@java.lang.Deprecated float unstbl_lvl(FloatByReference param, float + * lower, float upper); + * + * //@Mangling({"_Z8vert_totPf", "?vert_tot@@YAMPAM@Z"}) + * //@java.lang.Deprecated float vert_tot(FloatByReference param); + * + * //@Mangling({"_Z6wb_lvlfPf", "?wb_lvl@@YAMMPAM@Z"}) + * //@java.lang.Deprecated float wb_lvl(float temp, FloatByReference param); + * + * //from wind.h float helicity ( float lower, float upper, float sdir, + * float sspd, FloatByReference phel, FloatByReference nhel ); void sr_wind + * ( float pbot, float ptop, float stdir, float stspd, FloatByReference mnu, + * FloatByReference mnv, FloatByReference wdir, FloatByReference wspd ); + * void mean_wind ( float pbot, float ptop, FloatByReference mnu, + * FloatByReference mnv, FloatByReference wdir, FloatByReference wspd ); + * void wind_shear ( float pbot, float ptop, FloatByReference shu, + * FloatByReference shv, FloatByReference sdir, FloatByReference smag ); + * float ucomp( float wdir, float wspd ); float vcomp( float wdir, float + * wspd ); + * + * //from thermo.h float thetae ( float pres, float temp, float dwpt ); void + * drylift ( float p1, float t1, float td1, FloatByReference p2, + * FloatByReference t2 ); float wetlift ( float pres, float temp, float + * pres2 ); float wetbulb ( float pres, float temp, float dwpt ); //from + * xwvid.c short vert_coords ( float hgt, float maxhgt ); } + */ - } - public static class ByValue extends StormSlinkyStr implements Structure.ByValue { - - } - - public float getTottim() { - return tottim; - } - public void setTottim(float tottim) { - this.tottim = tottim; - } - public float getAngl() { - return angl; - } - public void setAngl(float angl) { - this.angl = angl; - } - public float[] getTsuv() { - return tsuv; - } - public void setTsuv(float[] tsuv) { - this.tsuv = tsuv; - } - public int getSize() { - return size; - } - public void setSize(int size) { - this.size = size; - } - - } - - //From our own caveNsharp.c - void populateSndgData(NsharpLibrary.CaveSndgParms snDataArray[], int arraySize, float winDir, float winSpd); - void get_lpvaluesData(NsharpLibrary._lplvalues pParcel); - void populateSndgTestData() ; - void get_surface(FloatByReference pressure, FloatByReference temp, FloatByReference dewpt); - void get_surfaceWind(FloatByReference windSp, FloatByReference windDir); - //void get_top(FloatByReference pressure, FloatByReference temp, FloatByReference dewpt); - void get_storm(FloatByReference speed, FloatByReference direction); - void set_storm(float speed, float direction); - void cave_visual1 ( float lower, float upper, float pres, float temp, float dwpt , NsharpLibrary.StormSlinkyStr stmSlinky); - float cave_bulk_rich ( float lplpres, float bplus,FloatByReference brnshear ); - //void printSfcInfo(); - //void showSndgData(); - //From basic.h - - float i_temp(float pres); - - float i_dwpt(float pres); - - float i_hght(float pres); - - float i_vtmp(float pres); - - float i_wdir(float pres); - - float i_wspd(float pres); - - float i_wndu(float pres); - - float i_wndv(float pres); - - float i_pres(float hght); - - float i_omeg(float pres); - - int sfc(); - - float top_pres(); - - int qc(float value); - - @java.lang.Deprecated - Pointer qc2(float value, Pointer label, short prec); - - Pointer qc2(float value, ByteBuffer label, short prec); - - float ftom(float value); - - float mtof(float value); - - float ftoc(float value); - - float ctof(float value); - - float agl(float height); - - float msl(float height); - - float kt_to_mps(float spd); - - float virtemp(float pres, float temp, float dwpt); - - //* - //* from skparams.h - // - - //@Mangling({"_Z9bulk_rich7_parcelPf", "?bulk_rich@@YAM7_parcelPAM@Z"}) - //@java.lang.Deprecated - float bulk_rich(NsharpLibrary._parcel.ByValue pcl, FloatByReference brnshear); - - //@Mangling({"_Z10cnvtv_tempPff", "?cnvtv_temp@@YAMPAMM@Z"}) - //@java.lang.Deprecated - float cnvtv_temp(FloatByReference param, float mincinh); - - /*flag - Parcel selection. */ - /* -1 = Use Previous Selection */ - /* 1 = Observed sfc parcel */ - /* 2 = Fcst sfc parcel */ - /* 3 = Mean mixlyr parcel */ - /* 4 = Most unstable parcel */ - /* 5 = User defined parcel */ - /* */ - /* pres - Pressure(mb) of user defined parcel. */ - /* - void define_parcel(short flag, float pres); - - //@Mangling({"_Z7delta_tPf", "?delta_t@@YAMPAM@Z"}) - //@java.lang.Deprecated - float delta_t(FloatByReference param); - - //@Mangling({"_Z3ehiff", "?ehi@@YAMMM@Z"}) - float ehi(float cape, float hel); - - //@Mangling({"_Z10grab_levelf", "?grab_level@@YAXM@Z"}) - int grab_level(float pres); - - //@Mangling({"_Z7k_indexPf", "?k_index@@YAMPAM@Z"}) - //@java.lang.Deprecated - float k_index(FloatByReference param); - - //@Mangling({"_Z10lapse_ratePfff", "?lapse_rate@@YAMPAMMM@Z"}) - //@java.lang.Deprecated - float lapse_rate(FloatByReference param, float lower, float upper); - - //@Mangling({"_Z7low_invPfPf", "?low_inv@@YAXPAMPAM@Z"}) - //@java.lang.Deprecated - void low_inv(FloatByReference inv_mb, FloatByReference inv_dC); - - //@Mangling({"_Z8max_tempPff", "?max_temp@@YAMPAMM@Z"}) - //@java.lang.Deprecated - float max_temp(FloatByReference param, float mixlyr); - - //@Mangling({"_Z9mean_dwptPfff", "?mean_dwpt@@YAMPAMMM@Z"}) - //@java.lang.Deprecated - float mean_dwpt(FloatByReference param, float lower, float upper); - - //@Mangling({"_Z13mean_mixratioPfff", "?mean_mixratio@@YAMPAMMM@Z"}) - //@java.lang.Deprecated - float mean_mixratio(FloatByReference param, float lower, float upper); - - //@Mangling({"_Z11mean_relhumPfff", "?mean_relhum@@YAMPAMMM@Z"}) - //@java.lang.Deprecated - float mean_relhum(FloatByReference param, float lower, float upper); - - //@Mangling({"_Z10mean_thetaPfff", "?mean_theta@@YAMPAMMM@Z"}) - //@java.lang.Deprecated - float mean_theta(FloatByReference param, float lower, float upper); - - //@Mangling({"_Z11Mean_WBtempPfff", "?Mean_WBtemp@@YAMPAMMM@Z"}) - //@java.lang.Deprecated - float Mean_WBtemp(FloatByReference param, float lower, float upper); - - //@Mangling({"_Z10mix_heightPfPfPfPfPfPfPfi", "?mix_height@@YAXPAMPAMPAMPAMPAMPAMPAMH@Z"}) - //@java.lang.Deprecated - void mix_height(FloatByReference mh_mb, FloatByReference mh_drct, FloatByReference mh_sped, FloatByReference mh_dC, FloatByReference mh_lr, FloatByReference mh_drct_max, FloatByReference mh_sped_max, short flag); - - //@Mangling({"_Z14old_cnvtv_tempPf", "?old_cnvtv_temp@@YAMPAM@Z"}) - //@java.lang.Deprecated - float old_cnvtv_temp(FloatByReference param); - - //@Mangling({"_Z6parcelfffffP7_parcel", "?parcel@@YAMMMMMMPA7_parcel@Z"}) - float parcel(float lower, float upper, float pres, float temp, float dwpt, NsharpLibrary._parcel pcl); - - //@Mangling({"_Z7parcelxfffffP7_parcel", "?parcelx@@YAMMMMMMPA7_parcel@Z"}) - float parcelx(float lower, float upper, float pres, float temp, float dwpt, NsharpLibrary._parcel pcl); - - //@Mangling({"_Z12precip_waterPfff", "?precip_water@@YAMPAMMM@Z"}) - //@java.lang.Deprecated - float precip_water(FloatByReference param, float lower, float upper); - - //@Mangling({"_Z10Rogash_QPFPf", "?Rogash_QPF@@YAMPAM@Z"}) - //@java.lang.Deprecated - float Rogash_QPF(FloatByReference param); - - //@Mangling({"_Z11sweat_indexPf", "?sweat_index@@YAMPAM@Z"}) - //@java.lang.Deprecated - float sweat_index(FloatByReference param); - - //@Mangling({"_Z8temp_lvlfPf", "?temp_lvl@@YAMMPAM@Z"}) - //@java.lang.Deprecated - float temp_lvl(float temp, FloatByReference param); - - //@Mangling({"_Z11ThetaE_diffPf", "?ThetaE_diff@@YAMPAM@Z"}) - //@java.lang.Deprecated - float ThetaE_diff(FloatByReference param); - - //@Mangling({"_Z12top_moistlyrPf", "?top_moistlyr@@YAMPAM@Z"}) - //@java.lang.Deprecated - float top_moistlyr(FloatByReference param); - - //@Mangling({"_Z8t_totalsPfPfPf", "?t_totals@@YAMPAMPAMPAM@Z"}) - //@java.lang.Deprecated - float t_totals(FloatByReference param, FloatByReference ct, FloatByReference vt); - - //@Mangling({"_Z10unstbl_lvlPfff", "?unstbl_lvl@@YAMPAMMM@Z"}) - //@java.lang.Deprecated - float unstbl_lvl(FloatByReference param, float lower, float upper); - - //@Mangling({"_Z8vert_totPf", "?vert_tot@@YAMPAM@Z"}) - //@java.lang.Deprecated - float vert_tot(FloatByReference param); - - //@Mangling({"_Z6wb_lvlfPf", "?wb_lvl@@YAMMPAM@Z"}) - //@java.lang.Deprecated - float wb_lvl(float temp, FloatByReference param); - - //from wind.h - float helicity ( float lower, float upper, float sdir, float sspd, - FloatByReference phel, FloatByReference nhel ); - void sr_wind ( float pbot, float ptop, float stdir, float stspd, - FloatByReference mnu, FloatByReference mnv, FloatByReference wdir, FloatByReference wspd ); - void mean_wind ( float pbot, float ptop, FloatByReference mnu, FloatByReference mnv, - FloatByReference wdir, FloatByReference wspd ); - void wind_shear ( float pbot, float ptop, FloatByReference shu, FloatByReference shv, - FloatByReference sdir, FloatByReference smag ); - float ucomp( float wdir, float wspd ); - float vcomp( float wdir, float wspd ); - - //from thermo.h - float thetae ( float pres, float temp, float dwpt ); - void drylift ( float p1, float t1, float td1, FloatByReference p2, FloatByReference t2 ); - float wetlift ( float pres, float temp, float pres2 ); - float wetbulb ( float pres, float temp, float dwpt ); - //from xwvid.c - short vert_coords ( float hgt, float maxhgt ); - } */ - } diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/META-INF/MANIFEST.MF b/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/META-INF/MANIFEST.MF index 2b3245f475..67da06bc1d 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/META-INF/MANIFEST.MF +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/META-INF/MANIFEST.MF @@ -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, diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/src/gov/noaa/nws/ncep/viz/rsc/ncgrid/Activator.java b/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/src/gov/noaa/nws/ncep/viz/rsc/ncgrid/Activator.java index d3bd0d4fc0..77865b29e9 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/src/gov/noaa/nws/ncep/viz/rsc/ncgrid/Activator.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/src/gov/noaa/nws/ncep/viz/rsc/ncgrid/Activator.java @@ -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"); diff --git a/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/datagrid.java b/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/datagrid.java index 6c61a1d2b8..df9a5ba92d 100644 --- a/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/datagrid.java +++ b/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/datagrid.java @@ -1,34 +1,85 @@ +/** + * + * + * This java class performs the NSHARP NsharpNative functions. + * This code has been developed by the NCEP-SIB for use in the AWIPS2 system. + * + *
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#     Engineer    Description
+ * -------      -------     --------    -----------
+ * ??/??/???    ?                       Initial coding
+ * 05/08/2014   3108        bkowal      Updated structure classes for the JNA upgrade.
+ * 
+ *
+ * 
+ * + * @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[][] 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(); + super(); } - 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 !"); - this.temp = temp; - if (lat.length != this.lat.length) - throw new java.lang.IllegalArgumentException("Wrong array size !"); - this.lat = lat; - if (lon.length != this.lon.length) - throw new java.lang.IllegalArgumentException("Wrong array size !"); - this.lon = lon; - this.numx = numx; - this.numy = 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 !"); + this.temp = temp; + if (lat.length != this.lat.length) + throw new java.lang.IllegalArgumentException("Wrong array size !"); + this.lat = lat; + if (lon.length != this.lon.length) + throw new java.lang.IllegalArgumentException("Wrong array size !"); + this.lon = lon; + 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 { + } + + @Override + protected List getFieldOrder() { + return Arrays.asList(new String[] { "temp", "lat", "lon", "numx", + "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 {} } diff --git a/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/dis_vars.java b/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/dis_vars.java index 5b31f35e23..b4a38f62b8 100644 --- a/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/dis_vars.java +++ b/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/dis_vars.java @@ -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. + * + *
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#     Engineer    Description
+ * -------      -------     --------    -----------
+ * ??/??/???    ?                       Initial coding
+ * 05/08/2014   3108        bkowal      Updated structure classes for the JNA upgrade.
+ * 
+ *
+ * 
+ * + * @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(); + super(); } + /** - * @param xrectl Output number of lines
- * @param xrecte Output number of elems + * @param xrectl + * Output number of lines
+ * @param xrecte + * Output number of elems */ public dis_vars(double xrectl, double xrecte) { - super(); - this.xrectl = xrectl; - this.xrecte = 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 { + } + + @Override + protected List getFieldOrder() { + return Arrays.asList(new String[] { "xrectl", "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 {} } diff --git a/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/irdata.java b/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/irdata.java index 4e0ac48b7a..af5d92f1b7 100644 --- a/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/irdata.java +++ b/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/irdata.java @@ -1,65 +1,159 @@ +/** + * + * + * This java class performs the NSHARP NsharpNative functions. + * This code has been developed by the NCEP-SIB for use in the AWIPS2 system. + * + *
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#     Engineer    Description
+ * -------      -------     --------    -----------
+ * ??/??/???    ?                       Initial coding
+ * 05/08/2014   3108        bkowal      Updated structure classes for the JNA upgrade.
+ * 
+ *
+ * 
+ * + * @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 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 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" }); + } } diff --git a/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/odtdata.java b/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/odtdata.java index 90ec2fd3f4..7df61deef7 100644 --- a/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/odtdata.java +++ b/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/odtdata.java @@ -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. + * + *
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#     Engineer    Description
+ * -------      -------     --------    -----------
+ * ??/??/???    ?                       Initial coding
+ * 05/08/2014   3108        bkowal      Updated structure classes for the JNA upgrade.
+ * 
+ *
+ * 
+ * + * @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 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 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 { + } + + @Override + protected List getFieldOrder() { + return Arrays.asList(new String[] { "IR", "nextrec" }); + } } diff --git a/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/remap_vars.java b/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/remap_vars.java index 2e81d4a88d..7d46b614ea 100644 --- a/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/remap_vars.java +++ b/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/remap_vars.java @@ -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. + * + *
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#     Engineer    Description
+ * -------      -------     --------    -----------
+ * ??/??/???    ?                       Initial coding
+ * 05/08/2014   3108        bkowal      Updated structure classes for the JNA upgrade.
+ * 
+ *
+ * 
+ * + * @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(); + 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 { + } + + @Override + protected List getFieldOrder() { + return Arrays.asList(new String[] { "in_bfw", "out_bfw", "nspl", + "nspe", "slb", "dlb", "ncl", "nce", "in_fd", "out_fd" }); } - 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 {} } diff --git a/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/ringdata.java b/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/ringdata.java index abcffc5fe3..e2febed1d2 100644 --- a/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/ringdata.java +++ b/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/ringdata.java @@ -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. + * + *
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#     Engineer    Description
+ * -------      -------     --------    -----------
+ * ??/??/???    ?                       Initial coding
+ * 05/08/2014   3108        bkowal      Updated structure classes for the JNA upgrade.
+ * 
+ *
+ * 
+ * + * @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 dist; + public float angle; + public float temp; + public ringdata.ByReference nextrec; + public ringdata() { - super(); + super(); } - public ringdata(float dist, float angle, float temp, ringdata.ByReference nextrec) { - super(); - this.dist = dist; - this.angle = angle; - this.temp = temp; - this.nextrec = 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 { + } + + @Override + protected List getFieldOrder() { + return Arrays + .asList(new String[] { "dist", "angle", "temp", "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 {} } diff --git a/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/tiff_header.java b/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/tiff_header.java index b8f6995b20..91115b9016 100644 --- a/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/tiff_header.java +++ b/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/tiff_header.java @@ -1,32 +1,82 @@ +/** + * + * + * This java class performs the NSHARP NsharpNative functions. + * This code has been developed by the NCEP-SIB for use in the AWIPS2 system. + * + *
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#     Engineer    Description
+ * -------      -------     --------    -----------
+ * ??/??/???    ?                       Initial coding
+ * 05/08/2014   3108        bkowal      Updated structure classes for the JNA upgrade.
+ * 
+ *
+ * 
+ * + * @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(); + super(); } + /** - * @param order Byte order
- * @param version Version
- * @param point Pointer + * @param order + * Byte order
+ * @param version + * Version
+ * @param point + * Pointer */ public tiff_header(int order, int version, int point) { - super(); - this.order = order; - this.version = version; - this.point = point; + super(); + this.order = order; + 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 { + } + + @Override + protected List getFieldOrder() { + return Arrays.asList(new String[] { "order", "version", "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 {} } diff --git a/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/tiff_record.java b/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/tiff_record.java index 4d6acde3f3..317acbbd69 100644 --- a/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/tiff_record.java +++ b/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/tiff_record.java @@ -1,36 +1,88 @@ +/** + * + * + * This java class performs the NSHARP NsharpNative functions. + * This code has been developed by the NCEP-SIB for use in the AWIPS2 system. + * + *
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#     Engineer    Description
+ * -------      -------     --------    -----------
+ * ??/??/???    ?                       Initial coding
+ * 05/08/2014   3108        bkowal      Updated structure classes for the JNA upgrade.
+ * 
+ *
+ * 
+ * + * @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(); + super(); } + /** - * @param tag TIFF tag
- * @param type Data type
- * @param length Length
- * @param voff Pointer or value + * @param tag + * TIFF tag
+ * @param type + * Data type
+ * @param length + * Length
+ * @param voff + * Pointer or value */ public tiff_record(int tag, int type, int length, int voff) { - super(); - this.tag = tag; - this.type = type; - this.length = length; - this.voff = voff; + super(); + this.tag = tag; + this.type = type; + 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 { + } + + @Override + protected List getFieldOrder() { + return Arrays.asList(new String[] { "tag", "type", "length", "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 {} } diff --git a/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/tiff_vars.java b/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/tiff_vars.java index 34e43c67ef..ed61ec01eb 100644 --- a/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/tiff_vars.java +++ b/ncep/gov.noaa.nws.ncep.viz.tools/src/gov/noaa/nws/ncep/viz/tools/aodt/natives/tiff_vars.java @@ -1,40 +1,96 @@ +/** + * + * + * This java class performs the NSHARP NsharpNative functions. + * This code has been developed by the NCEP-SIB for use in the AWIPS2 system. + * + *
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#     Engineer    Description
+ * -------      -------     --------    -----------
+ * ??/??/???    ?                       Initial coding
+ * 05/08/2014   3108        bkowal      Updated structure classes for the JNA upgrade.
+ * 
+ *
+ * 
+ * + * @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 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[]) { - super(); - this.nbits = nbits; - this.photo = photo; - this.unit = unit; - this.in_lines = in_lines; - this.in_elems = in_elems; - this.out_lines = out_lines; - this.out_elems = out_elems; - if (ratx.length != this.ratx.length) - throw new java.lang.IllegalArgumentException("Wrong array size !"); - this.ratx = ratx; - if (raty.length != this.raty.length) - 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 {} +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[]) { + super(); + this.nbits = nbits; + this.photo = photo; + this.unit = unit; + this.in_lines = in_lines; + this.in_elems = in_elems; + this.out_lines = out_lines; + this.out_elems = out_elems; + if (ratx.length != this.ratx.length) + throw new java.lang.IllegalArgumentException("Wrong array size !"); + this.ratx = ratx; + if (raty.length != this.raty.length) + 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 { + } + + @Override + protected List getFieldOrder() { + return Arrays.asList(new String[] { "nbits", "photo", "unit", + "in_lines", "in_elems", "out_lines", "out_elems", "ratx", + "raty" }); + } } diff --git a/tests/.classpath b/tests/.classpath index a9b0fefae7..8ac824597b 100644 --- a/tests/.classpath +++ b/tests/.classpath @@ -162,6 +162,7 @@ - + + diff --git a/tests/manual/com/raytheon/uf/edex/plugin/hpe/util/HpeLabelGeneratorTest.java b/tests/manual/com/raytheon/uf/edex/plugin/hpe/util/HpeLabelGeneratorTest.java new file mode 100644 index 0000000000..6f22553d9b --- /dev/null +++ b/tests/manual/com/raytheon/uf/edex/plugin/hpe/util/HpeLabelGeneratorTest.java @@ -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. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Mar 26, 2014    3026    mpduff      Initial creation
+ * 
+ * 
+ * + * @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> meanDataMap = new TreeMap>(); + + private final SortedMap> localDataMap = new TreeMap>(); + + @Before + public void setup() throws Exception { + setCalendar(); + createBiasDynRecords(); + List 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 getRadarList() { + List radarList = new ArrayList(); + 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 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()); + } + + 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()); + } + } +}