convectprob plugins moved from awips2-cimss repo

This commit is contained in:
mjames-upc 2017-10-01 10:44:05 -06:00
parent f8cb0cf6f5
commit 91a7cb2daa
37 changed files with 2321 additions and 0 deletions

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>edu.wisc.ssec.cimss.viz.convectprob.feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1 @@
bin.includes = feature.xml

View file

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="edu.wisc.ssec.cimss.viz.convectprob.feature"
label="Convectprob CAVE Feature"
version="1.0.0.qualifier"
provider-name="CIMSS/SSEC">
<description url="http://www.example.com/description">
[Enter Feature Description here.]
</description>
<copyright url="http://www.example.com/copyright">
[Enter Copyright Description here.]
</copyright>
<license url="http://www.example.com/license">
[Enter License Description here.]
</license>
<requires>
<import feature="com.raytheon.uf.viz.common.core.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.core.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.cots.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.d2d.core.feature" version="1.0.0.qualifier"/>
</requires>
<plugin
id="edu.wisc.ssec.cimss.common.dataplugin.convectprob"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="edu.wisc.ssec.cimss.viz.convectprob"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>edu.wisc.ssec.cimss.viz.convectprob</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,39 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: NOAA/CIMSS Prob Severe (viz.convectprob)
Bundle-SymbolicName: edu.wisc.ssec.cimss.viz.convectprob;singleton:=true
Bundle-Version: 1.16.4.qualifier
Require-Bundle: org.eclipse.ui,
org.geotools,
com.raytheon.uf.common.datastorage,
com.raytheon.uf.viz.core,
edu.wisc.ssec.cimss.common.dataplugin.convectprob
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: com.raytheon.uf.common.colormap,
com.raytheon.uf.common.colormap.prefs,
com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.geospatial,
com.raytheon.uf.common.status,
com.raytheon.uf.common.time,
com.raytheon.uf.viz.core,
com.raytheon.uf.viz.core.drawables,
com.raytheon.uf.viz.core.exception,
com.raytheon.uf.viz.core.map,
com.raytheon.uf.viz.core.procedures,
com.raytheon.uf.viz.core.rsc,
com.raytheon.uf.viz.core.rsc.capabilities,
com.raytheon.uf.viz.core.status,
com.raytheon.uf.viz.d2d.core,
com.raytheon.uf.viz.productbrowser,
com.raytheon.viz.ui,
com.raytheon.viz.ui.editor,
com.vividsolutions.jts.geom,
org.eclipse.core.runtime,
org.eclipse.swt.graphics,
org.eclipse.ui.plugin,
org.opengis.referencing.crs,
org.osgi.framework
Export-Package: edu.wisc.ssec.cimss.viz.convectprob,
edu.wisc.ssec.cimss.viz.convectprob.rsc
Bundle-Vendor: CIMSS/SSEC

View file

@ -0,0 +1,6 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
localization/

View file

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
Affiliate_Name:________Cooperative Institute for Meteorological Satellite Studies
Affiliate_Address:_____1225 W. Dayton St.
_______________________Madison, WI 53706
-->
<bundle>
<displayList>
<displays xsi:type="d2DMapRenderableDisplay" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties loadWithoutData="false">
<capabilities>
<capability xsi:type="colorMapCapability">
<colorMapParameters colorMapName="prob_severe"/>
</capability>
<capability xsi:type="colorableCapability" colorAsString="#FFFFFF"/>
</capabilities>
<resourceType>PLAN_VIEW</resourceType>
</loadProperties>
<properties isSystemResource="false" isBlinking="false" isMapLayer="false" isHoverOn="false" isVisible="true">
</properties>
<resourceData xsi:type="convectProbResourceData"
isUpdatingOnMetadataOnly="false" isRequeryNecessaryOnTimeMatch="true" retrieveData="true"
showObjectId="false">
<metadataMap>
<mapping key="pluginName">
<constraint constraintValue="convectprob" constraintType="EQUALS"/>
</mapping>
</metadataMap>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>

View file

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
This_software_product_contains_export-restricted_data_whose
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
an_export_license_or_other_authorization.
Contractor_Name:________Raytheon_Company
Contractor_Address:_____6825_Pine_Street,_Suite_340
________________________Mail_Stop_B8
________________________Omaha,_NE_68106
________________________402.291.0100
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<?eclipse version="3.2"?>
<plugin>
<extension
point="com.raytheon.uf.viz.core.resource">
<resource
class="edu.wisc.ssec.cimss.viz.convectprob.rsc.ConvectProbResource"
name="ConvectProb"
recordClass="edu.wisc.ssec.cimss.common.dataplugin.convectprob.ConvectProbRecord"
renderingOrderId="PLOT"
resourceType="PLAN_VIEW"/>
</extension>
<extension
point="com.raytheon.uf.viz.productbrowser.dataDefinition">
<dataDefinition
name="convectProbProductBrowserDataDefinition"
class="edu.wisc.ssec.cimss.viz.convectprob.ConvectProbProductBrowserDataDefinition" >
</dataDefinition>
</extension>
</plugin>

View file

@ -0,0 +1,102 @@
package edu.wisc.ssec.cimss.viz.convectprob;
import java.util.ArrayList;
import java.util.List;
import com.raytheon.viz.ui.BundleProductLoader;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.procedures.Bundle;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.ResourceType;
import com.raytheon.uf.viz.productbrowser.AbstractProductBrowserDataDefinition;
import com.raytheon.uf.viz.productbrowser.ProductBrowserLabel;
import com.raytheon.uf.viz.productbrowser.ProductBrowserPreference;
import edu.wisc.ssec.cimss.viz.convectprob.rsc.ConvectProbResourceData;
/**
* NOAA/CIMSS Prob Severe Model Product Browser Data Definition
*
* Defines product browser access to NOAA/CIMSS Prob Severe Model data
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 27, 2014 DCS 15298 jgerth Initial Creation.
*
* </pre
*
* @author Jordan Gerth
* @version 1.0
*
*/
public class ConvectProbProductBrowserDataDefinition extends
AbstractProductBrowserDataDefinition<ConvectProbResourceData> {
IUFStatusHandler statusHandler = UFStatus.getHandler(ConvectProbProductBrowserDataDefinition.class);
/**
* Constructor defining new instance of this class
*/
public ConvectProbProductBrowserDataDefinition() {
displayName = "Prob Severe";
loadProperties = new LoadProperties();
}
/**
* @see com.raytheon.uf.viz.productbrowser.AbstractProductBrowserDataDefinition#getResourceData()
*/
@Override
public ConvectProbResourceData getResourceData() {
return new ConvectProbResourceData();
}
/**
* @see com.raytheon.uf.viz.productbrowser.AbstractProductBrowserDataDefinition#populateData(java.lang.String[])
*/
@Override
public List<ProductBrowserLabel> populateData(String[] selection) {
List<ProductBrowserLabel> labels = new ArrayList<ProductBrowserLabel>();
ProductBrowserLabel label = new ProductBrowserLabel("NOAA/CIMSS Prob Severe Model", "Probability of Severe");
label.setProduct(true);
labels.add(label);
return labels;
}
/**
* @see com.raytheon.uf.viz.productbrowser.AbstractProductBrowserDataDefinition#buildProductList(java.util.List)
*/
@Override
public List<String> buildProductList(List<String> historyList) {
return historyList;
}
/**
* @see com.raytheon.uf.viz.productbrowser.AbstractProductBrowserDataDefinition#constructResource(java.lang.String[], com.raytheon.uf.viz.core.rsc.ResourceType)
*/
@Override
public void constructResource(String[] selection, ResourceType type) {
try {
Bundle b = Bundle.unmarshalBundle(PathManagerFactory.getPathManager().getStaticFile("bundles/ConvectProb.xml"));
new BundleProductLoader(EditorUtil.getActiveVizContainer(),b).run();
} catch (VizException e1) {
statusHandler.handle(Priority.PROBLEM, "Could not create resource for NOAA/CIMSS Prob Severe Model data", e1);
}
}
/**
* @see com.raytheon.uf.viz.productbrowser.AbstractProductBrowserDataDefinition#configurePreferences()
*/
@Override
public List<ProductBrowserPreference> configurePreferences() {
return super.configurePreferences();
}
}

View file

@ -0,0 +1,386 @@
package edu.wisc.ssec.cimss.viz.convectprob.rsc;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import org.eclipse.swt.graphics.RGB;
import com.raytheon.uf.common.colormap.Color;
import com.raytheon.uf.common.colormap.ColorMapException;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.datastorage.DataStoreFactory;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle;
import com.raytheon.uf.common.colormap.ColorMapLoader;
import com.raytheon.uf.viz.core.drawables.IWireframeShape;
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.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.capabilities.ColorMapCapability;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.Point;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.dataplugin.HDF5Util;
import edu.wisc.ssec.cimss.common.dataplugin.convectprob.ConvectProbRecord;
/**
* NOAA/CIMSS Prob Severe Model Visualization Resource
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 27, 2014 DCS 15298 lcronce Initial Creation.
* Jun 09, 2016 DR 18946 lcronce Update to plugin addressing
* paint error associated with
* null pointer exception.
* </pre
*
* @author Lee Cronce
* @version 1.0
*
*/
public class ConvectProbResource extends
AbstractVizResource<ConvectProbResourceData, MapDescriptor> {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(ConvectProbResource.class);
/**
* Class defining the attributes of the display frame
*
* This class holds cached shapes to avoid recalculating everything all
* the time
*/
private class DisplayFrame {
Collection<ConvectProbRecord> records = new ArrayList<ConvectProbRecord>();
}
// Place to store records that have not yet been processed
private Map<DataTime, Collection<ConvectProbRecord>> unprocessedRecords = new HashMap<DataTime, Collection<ConvectProbRecord>>();
private Map<DataTime, DisplayFrame> frames = new HashMap<DataTime, DisplayFrame>();
private DataTime displayedDataTime;
/**
* Constructor to define an instance of this resource
*
* @param ConvectProb plugin resource data
* @param Display load properties
*/
protected ConvectProbResource(ConvectProbResourceData resourceData,
LoadProperties loadProperties) {
super(resourceData, loadProperties);
resourceData.addChangeListener(new IResourceDataChanged() {
@Override
public void resourceChanged(ChangeType type, Object object) {
if (type == ChangeType.DATA_UPDATE) {
PluginDataObject[] pdo = (PluginDataObject[]) object;
for (PluginDataObject p : pdo) {
if (p instanceof ConvectProbRecord) {
addRecord((ConvectProbRecord) p);
}
}
}
issueRefresh();
}
});
this.dataTimes = new ArrayList<DataTime>();
}
/**
* @see com.raytheon.uf.viz.core.rsc.AbstractVizResource#disposeInternal()
*/
@Override
protected void disposeInternal() {
clearDisplayFrames();
}
protected void clearDisplayFrames() {
synchronized (frames) {
if (!frames.isEmpty()){
frames.clear();
}
}
}
/**
* @see com.raytheon.uf.viz.core.rsc.AbstractVizResource#getDataTimes()
*/
@Override
public DataTime[] getDataTimes() {
if (this.dataTimes == null) {
return new DataTime[0];
}
synchronized (dataTimes) {
return this.dataTimes.toArray(new DataTime[0]);
}
}
/**
* @see com.raytheon.uf.viz.core.rsc.AbstractVizResource#initInternal(com.raytheon.uf.viz.core.IGraphicsTarget)
*/
@Override
protected void initInternal(IGraphicsTarget target) throws VizException {
// Create colormap parameters
ColorMapParameters colorMapParams = getCapability(
ColorMapCapability.class).getColorMapParameters();
if (colorMapParams == null) {
colorMapParams = new ColorMapParameters();
}
String name = "Grid/gridded data";
if (colorMapParams.getColorMap() == null) {
if (colorMapParams.getColorMapName() != null)
name = colorMapParams.getColorMapName();
try {
colorMapParams.setColorMap(ColorMapLoader.loadColorMap(name));
} catch (ColorMapException e) {
statusHandler.handle(Priority.ERROR, "Error loading specified colormap: " + name, e);
}
}
colorMapParams.setColorMapMax(100.0f);
colorMapParams.setColorMapMin(0.0f);
float[] cbi = {0.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.0f};
colorMapParams.setColorBarIntervals(cbi);
}
/**
* @see com.raytheon.uf.viz.core.rsc.AbstractVizResource#inspect(com.raytheon.uf.common.geospatial.ReferencedCoordinate)
*/
@Override
public String inspect(ReferencedCoordinate coord) throws VizException {
DisplayFrame frame = null;
synchronized (frames) {
frame = frames.get(this.displayedDataTime);
}
if (frame == null) {
return "";
}
StringBuilder sample = new StringBuilder();
Coordinate latLon = new Coordinate();
try {
latLon = coord.asLatLon();
} catch (Exception e1) {
statusHandler.handle(Priority.ERROR, "Error converting ReferencedCoordinate to Lat/Lon", e1);
}
GeometryFactory geom = new GeometryFactory();
Point point = geom.createPoint(latLon);
for (ConvectProbRecord record : frame.records) {
// Check if we have an area we are rendering
if (record != null && resourceData.isDisplayShape()) {
try {
Geometry[] pg = record.getPolyGeoms();
for (int i=0; i < pg.length; i++) {
if (pg[i].contains(point)) {
sample.append("SVR PROB: "+Integer.toString(record.getProbabilities()[i])+"%");
sample.append("\n- Env MUCAPE: "+record.getMucapes()[i]);
sample.append("\n- Env EBShear: "+record.getEbshears()[i]);
sample.append("\n- MRMS MESH: "+record.getMeshes()[i]);
sample.append("\n- Norm Vert Growth Rate (Max): "+record.getRcemisses()[i]);
sample.append("\n- Glaciation Rate (Max): "+record.getRcicecfs()[i]);
if (resourceData.isShowObjectId()) {
sample.append("\n- Object ID: "+record.getObjectids()[i]);
}
return sample.toString();
}
}
} catch (Exception e) {
statusHandler.handle(Priority.ERROR, "Error interogating convectprob data", e);
}
}
}
return "";
}
/**
* Process all records for the displayedDataTime
*
* @param target
* @param paintProps
* @throws VizException
*/
private void updateRecords(IGraphicsTarget target,
PaintProperties paintProps) throws VizException {
DisplayFrame frame = null;
synchronized (frames) {
frame = frames.get(this.displayedDataTime);
if (frame == null) {
frame = new DisplayFrame();
frames.put(this.displayedDataTime, frame);
}
}
// Add all the new Records
Collection<ConvectProbRecord> newRecords = null;
synchronized (unprocessedRecords) {
newRecords = unprocessedRecords.get(this.displayedDataTime);
}
for (ConvectProbRecord record : newRecords) {
// If we need to draw anything for this record then keep it
if (record != null && resourceData.isDisplayShape()) {
frame.records.add(record);
}
}
newRecords.clear();
// Update each record
for (ConvectProbRecord record : frame.records) {
File f = HDF5Util.findHDF5Location(record);
IDataStore ds = DataStoreFactory.getDataStore(f);
record.retrieveFromDataStore(ds);
}
}
/**
* @see com.raytheon.uf.viz.core.rsc.AbstractVizResource#paintInternal(com.raytheon.uf.viz.core.IGraphicsTarget, com.raytheon.uf.viz.core.drawables.PaintProperties)
*/
@Override
protected void paintInternal(IGraphicsTarget target,
PaintProperties paintProps) throws VizException {
// Create colormap parameters
ColorMapParameters colorMapParams = getCapability(
ColorMapCapability.class).getColorMapParameters();
this.displayedDataTime = paintProps.getDataTime();
// First check to see if we need to process new data
Collection<ConvectProbRecord> unprocessed = null;
synchronized (unprocessedRecords) {
unprocessed = unprocessedRecords.get(this.displayedDataTime);
}
if (unprocessed != null && unprocessed.size() > 0) {
updateRecords(target, paintProps);
}
// Hopefully we now have some data to display, if not bail
DisplayFrame frame = null;
synchronized (frames) {
frame = frames.get(this.displayedDataTime);
}
if (frame == null) {
this.displayedDataTime = null;
return;
}
if (frame.records != null) {
boolean drawShape = false;
Color color;
float a, thick;
RGB shapeColor = new RGB(255, 255, 255);
for (ConvectProbRecord rec : frame.records) {
if (rec != null && rec.getPolyGeoms() != null) {
Geometry[] polyGeoms = rec.getPolyGeoms();
int[] probabilities = rec.getProbabilities();
for (int j=0; j < 101; j++) {
IWireframeShape iwfs = target.createWireframeShape(false, descriptor);
drawShape = false;
for (int i=0; i < polyGeoms.length; i++) {
if (probabilities[i] == j) {
iwfs.addLineSegment(polyGeoms[i].getCoordinates());
drawShape = true;
}
}
if (drawShape) {
color = colorMapParams.getColorByValue((float) j);
shapeColor.red = (int) (color.getRed() * 255);
shapeColor.green = (int) (color.getGreen() * 255);
shapeColor.blue = (int) (color.getBlue() * 255);
a = color.getAlpha() * paintProps.getAlpha();
thick = 7.0f;
if (j < 50) {
thick = 4.0f;
}
target.drawWireframeShape(iwfs, shapeColor, thick, LineStyle.SOLID, a);
iwfs.dispose();
}
}
}
}
}
}
/**
* Adds a new record to this resource
*
* @param new ConvectProb record
*/
protected void addRecord(ConvectProbRecord obj) {
DataTime dataTime = obj.getDataTime();
if (dataTime != null) {
Collection<ConvectProbRecord> records = null;
boolean brandNew = false;
synchronized (unprocessedRecords) {
records = unprocessedRecords.get(dataTime);
if (records == null) {
records = new LinkedHashSet<ConvectProbRecord>();
unprocessedRecords.put(dataTime, records);
brandNew = true;
}
}
if (brandNew) {
synchronized (dataTimes) {
this.dataTimes.add(dataTime);
Collections.sort(this.dataTimes);
}
}
records.add(obj);
}
}
/**
* @see com.raytheon.uf.viz.core.rsc.AbstractVizResource#getName()
*/
@Override
public String getName() {
return "NOAA/CIMSS Prob Severe Model (%)";
}
/**
* @see com.raytheon.uf.viz.core.rsc.AbstractVizResource#remove(com.raytheon.uf.common.time.DataTime)
*/
@Override
public void remove(DataTime time) {
super.remove(time);
Collection<ConvectProbRecord> notNeeded = null;
synchronized (unprocessedRecords) {
notNeeded = unprocessedRecords.remove(time);
}
if (notNeeded != null) {
notNeeded.clear();
}
DisplayFrame notNeededFrame;
synchronized (frames) {
notNeededFrame = frames.remove(time);
}
if (notNeededFrame != null) {
notNeededFrame.records.clear();
}
}
}

View file

@ -0,0 +1,130 @@
package edu.wisc.ssec.cimss.viz.convectprob.rsc;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import edu.wisc.ssec.cimss.common.dataplugin.convectprob.ConvectProbRecord;
/**
* NOAA/CIMSS Prob Severe Model Visualization Resource Data
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 27, 2014 DCS 15298 lcronce Initial Creation.
*
* </pre
*
* @author Lee Cronce
* @version 1.0
*
*/
@XmlAccessorType(XmlAccessType.NONE)
public class ConvectProbResourceData extends AbstractRequestableResourceData {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ConvectProbResourceData.class);
// This flag determines if we draw polygons
@XmlAttribute
private boolean displayShape = true;
// This flag determines if object IDs are output to screen during inspect
@XmlAttribute
private boolean showObjectId = false;
/**
* @see com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (!super.equals(obj)) {
return false;
}
if (obj instanceof ConvectProbResourceData == false) {
return false;
}
ConvectProbResourceData other = (ConvectProbResourceData) obj;
if (other.displayShape != this.displayShape) {
return false;
}
if (other.showObjectId != this.showObjectId) {
return true;
}
return true;
}
/**
* @see com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData#constructResource(com.raytheon.uf.viz.core.rsc.LoadProperties, com.raytheon.uf.common.dataplugin.PluginDataObject[])
*/
@Override
protected AbstractVizResource<?, ?> constructResource(
LoadProperties loadProperties, PluginDataObject[] objects)
throws VizException {
ConvectProbResource rsc = new ConvectProbResource(this, loadProperties);
for (PluginDataObject o : objects) {
if (o instanceof ConvectProbRecord) {
ConvectProbRecord rec = (ConvectProbRecord) o;
rsc.addRecord(rec);
} else {
statusHandler.handle(Priority.PROBLEM,
"Received wrong type of data. Got: " + o.getClass()
+ " Expected: " + ConvectProbRecord.class);
}
}
return rsc;
}
/**
* Flag to see if shape should be displayed
*
* @return boolean
*/
public boolean isDisplayShape() {
return displayShape;
}
/**
* Set flag for displaying shape
*
* @param boolean
*/
public void setDisplayShape(boolean displayShape) {
this.displayShape = displayShape;
}
/**
* Flag to see if object ID should be displayed
*
* @return boolean
*/
public boolean isShowObjectId() {
return showObjectId;
}
/**
* Set flag for displaying shape
*
* @param boolean
*/
public void setShowObjectId(boolean showObjectId) {
this.showObjectId = showObjectId;
}
}

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>edu.wisc.ssec.cimss.common.dataplugin.convectprob</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,18 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: NOAA/CIMSS Prob Severe (dataplugin.convectprob)
Bundle-SymbolicName: edu.wisc.ssec.cimss.common.dataplugin.convectprob
Bundle-Version: 1.14.4.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: edu.wisc.ssec.cimss.common.dataplugin.convectprob,
edu.wisc.ssec.cimss.common.dataplugin.convectprob.impl
Require-Bundle: com.raytheon.uf.common.serialization,
com.raytheon.edex.common,
javax.persistence,
javax.measure,
com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.datastorage,
com.raytheon.uf.common.status
Import-Package: com.raytheon.uf.edex.decodertools.core,
com.raytheon.uf.edex.decodertools.time
Bundle-Vendor: CIMSS/SSEC

View file

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

View file

@ -0,0 +1,344 @@
package edu.wisc.ssec.cimss.common.dataplugin.convectprob;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;
import org.hibernate.annotations.Index;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.common.datastorage.records.IntegerDataRecord;
import com.raytheon.uf.common.datastorage.records.StringDataRecord;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.io.WKTReader;
import edu.wisc.ssec.cimss.common.dataplugin.convectprob.impl.ShapeObject;
/**
* NOAA/CIMSS Prob Severe Model Data Record Definition
*
* Data record that stores attributes of NOAA/CIMSS Prob Severe Model shapes
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 27, 2014 DCS 15298 lcronce Initial Creation.
*
* </pre
*
* @author Lee Cronce
* @version 1.0
*
*/
@Entity
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "convectprobseq")
@Table(name = ConvectProbRecord.PLUGIN_NAME, uniqueConstraints = { @UniqueConstraint(columnNames = { "refTime" }) })
/*
* Both refTime and forecastTime are included in the refTimeIndex since
* forecastTime is unlikely to be used.
*/
@org.hibernate.annotations.Table(appliesTo = ConvectProbRecord.PLUGIN_NAME, indexes = { @Index(name = "convectprob_refTimeIndex", columnNames = {
"refTime", "forecastTime" }) })
@DynamicSerialize
public class ConvectProbRecord extends PersistablePluginDataObject implements
IPersistable {
/** Serializable id * */
private static final long serialVersionUID = 1L;
public static final String PLUGIN_NAME = "convectprob";
// Data store data item names
@Transient
private static final String[] DATA_NAMES = { "types", "probabilities", "mucapes", "ebshears", "meshes", "rcemisses", "rcicecfs", "polygons", "objectids" };
private final static transient IUFStatusHandler statusHandler = UFStatus.getHandler(ConvectProbRecord.class);
@Transient
private String[] types = null;
@Transient
private int[] probabilities = null;
@Transient
private String[] mucapes = null;
@Transient
private String[] ebshears = null;
@Transient
private String[] meshes = null;
@Transient
private String[] rcemisses = null;
@Transient
private String[] rcicecfs = null;
@Transient
private String[] polygons = null;
@Transient
private String[] objectids = null;
@Transient
private Object[] dataArrays = null;
@Transient
private int insertIndex = 0;
// Used to track
@Transient
long persistTime = 0L;
/**
* Required empty constructor.
*/
public ConvectProbRecord() {
}
/**
* Constructs a data record from a dataURI
*
* @param data URI
*/
public ConvectProbRecord(String uri) {
super(uri);
}
/**
* Constructs a convectprob record with a
* given amount of shapes
*
* @param size of arrays based on number of shapes
*/
public ConvectProbRecord(int arraysSize) {
types = new String[arraysSize];
probabilities = new int[arraysSize];
mucapes = new String[arraysSize];
ebshears = new String[arraysSize];
meshes = new String[arraysSize];
rcemisses = new String[arraysSize];
rcicecfs = new String[arraysSize];
polygons = new String[arraysSize];
objectids = new String[arraysSize];
dataArrays = new Object[] { types, probabilities, mucapes, ebshears, meshes, rcemisses, rcicecfs, polygons, objectids };
insertIndex = 0;
}
/**
* Adds a convectprob shape to the record collection.
*
* @param shape to add
*/
public void addShape(ShapeObject shape) {
try {
types[insertIndex] = shape.getType();
probabilities[insertIndex] = shape.getProbability();
mucapes[insertIndex] = shape.getMucape();
ebshears[insertIndex] = shape.getEbshear();
meshes[insertIndex] = shape.getMesh();
rcemisses[insertIndex] = shape.getRcemiss();
rcicecfs[insertIndex] = shape.getRcicecf();
polygons[insertIndex] = shape.getPolygon();
objectids[insertIndex] = shape.getObjectid();
insertIndex++;
} catch (Exception e) {
statusHandler.error("insertIndex is out of bounds: " + Integer.toString(insertIndex), e);
}
}
/**
* Retrieve names of data contained in data record
*
* @return string array of data record field names
*/
public String[] getDataNames() {
return DATA_NAMES;
}
/**
* Retrieve data contained within the data record
*
* @return array of data objects stored in record
*/
public Object[] getDataArrays() {
return dataArrays;
}
/**
* Set data to be contained within the data record
*
* @param array of data objects to be set
*/
public void setDataArrays(Object[] dataArrays) {
this.dataArrays = dataArrays;
}
/**
* Retrieves the shape types
*
* @return shape types
*/
public String[] getTypes() {
return types;
}
/**
* Retrieves the shape probabilities
*
* @return shape probabilities of severe
*/
public int[] getProbabilities() {
return probabilities;
}
/**
*Retrieves the MUCAPE associated with shapes
*
* @return shape MUCAPEs
*/
public String[] getMucapes() {
return mucapes;
}
/**
* Retrieves the EB shear associated with shapes
*
* @return shape EB Shears
*/
public String[] getEbshears() {
return ebshears;
}
/**
* Retrieves the MESH associated with the shapes
*
* @return shape MESHes
*/
public String[] getMeshes() {
return meshes;
}
/**
* Retrieves the emissivities associated with the shapes
*
* @return shape top of troposphere emissivities
*/
public String[] getRcemisses() {
return rcemisses;
}
/**
* Retrieves the ice cloud fractions associated with the shapes
*
* @return rates of change of ice cloud fraction
*/
public String[] getRcicecfs() {
return rcicecfs;
}
/**
* Retrieves the shape polygons
*
* @return polygons defining the data record shapes
*/
public String[] getPolygons() {
return polygons;
}
/**
* Retrieves the shape objectids
*
* @return objectids specifying the objectids of the shapes
*/
public String[] getObjectids() {
return objectids;
}
/**
* Creating Geometry objects from String representation
* of shape polygons
*
* @return Geometry objects of shape polygons
*/
public Geometry[] getPolyGeoms() {
Geometry[] polyGeoms = new Geometry[polygons.length];
WKTReader reader = new WKTReader();
int i = 0;
for (String poly : polygons) {
try {
polyGeoms[i] = reader.read(poly);
i++;
} catch (Exception e) {
statusHandler.error("Well Known Text reader could not read selected text: " + poly, e);
}
}
return polyGeoms;
}
/**
* Sets the data arrays from the store.
*
* @param dataStore
*/
public void retrieveFromDataStore(IDataStore dataStore) {
try {
IDataRecord[] dataRec = dataStore.retrieve(getDataURI());
dataArrays = new Object[dataRec.length];
for (int i = 0; i < dataRec.length; i++) {
if (dataRec[i].getName().equals("types")) {
types = ((StringDataRecord) dataRec[i]).getStringData();
dataArrays[i] = types;
} else if (dataRec[i].getName().equals("probabilities")) {
probabilities = ((IntegerDataRecord) dataRec[i]).getIntData();
dataArrays[i] = probabilities;
} else if (dataRec[i].getName().equals("mucapes")) {
mucapes = ((StringDataRecord) dataRec[i]).getStringData();
dataArrays[i] = mucapes;
} else if (dataRec[i].getName().equals("ebshears")) {
ebshears = ((StringDataRecord) dataRec[i]).getStringData();
dataArrays[i] = ebshears;
} else if (dataRec[i].getName().equals("meshes")) {
meshes = ((StringDataRecord) dataRec[i]).getStringData();
dataArrays[i] = meshes;
} else if (dataRec[i].getName().equals("rcemisses")) {
rcemisses = ((StringDataRecord) dataRec[i]).getStringData();
dataArrays[i] = rcemisses;
} else if (dataRec[i].getName().equals("rcicecfs")) {
rcicecfs = ((StringDataRecord) dataRec[i]).getStringData();
dataArrays[i] = rcicecfs;
} else if (dataRec[i].getName().equals("polygons")) {
polygons = ((StringDataRecord) dataRec[i]).getStringData();
dataArrays[i] = polygons;
} else if (dataRec[i].getName().equals("objectids")) {
objectids = ((StringDataRecord) dataRec[i]).getStringData();
dataArrays[i] = objectids;
}
}
setDataArrays(dataArrays);
} catch (Exception e) {
statusHandler.error("Error retrieving data from the convectprob data store", e);
}
}
/**
* @see com.raytheon.uf.common.dataplugin.PluginDataObject#getPluginName()
*/
@Override
public String getPluginName() {
return PLUGIN_NAME;
}
}

View file

@ -0,0 +1,208 @@
package edu.wisc.ssec.cimss.common.dataplugin.convectprob.impl;
/**
* NOAA/CIMSS Prob Severe Model Shape Object Definition
*
* Data object that defines attributes of a NOAA/CIMSS Prob Severe Model shape
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 27, 2014 DCS 15298 lcronce Initial Creation.
*
* </pre
*
* @author Lee Cronce
* @version 1.0
*
*/
public class ShapeObject {
private String type;
private int probability;
private String mucape;
private String ebshear;
private String mesh;
private String rcemiss;
private String rcicecf;
private String polygon;
private String objectid;
/**
* Default empty constructor
*/
public ShapeObject() {
}
/**
* Retrieve type of a shape
*
* @return shape type
*/
public String getType() {
return type;
}
/**
* Retrieve shape probability of severe
*
* @return shape probability of severe
*/
public int getProbability() {
return probability;
}
/**
* Retrieve MUCAPE associated with a shape
*
* @return shape MUCAPE
*/
public String getMucape() {
return mucape;
}
/**
* Retrieve EB Shear associated with a shape
*
* @return shape EB Shear
*/
public String getEbshear() {
return ebshear;
}
/**
* Retrieve MESH associated with a shape
*
* @return shape MESH
*/
public String getMesh() {
return mesh;
}
/**
* Retrieve rate of change of emissivity of a shape
*
* @return shape emissivity rate of change
*/
public String getRcemiss() {
return rcemiss;
}
/**
* Retrieve rate of change of ice cloud fraction of a shape
*
* @return shape ice cloud fraction rate of change
*/
public String getRcicecf() {
return rcicecf;
}
/**
* Retrieve the polygon defining a shape
*
* @return shape polygon
*/
public String getPolygon() {
return polygon;
}
/**
* Retried the object ID of a shape
*
* @return shape objectID
*/
public String getObjectid() {
return objectid;
}
/**
* Set type of a shape
*
* @param shape type
*/
public void setType(String type) {
this.type = type;
}
/**
* Set shape probability of severe
*
* @param shape probability of severe
*/
public void setProbability(int probability) {
this.probability = probability;
}
/**
* Set MUCAPE associated with a shape
*
* @param shape MUCAPE
*/
public void setMucape(String mucape) {
this.mucape = mucape;
}
/**
* Set EB Shear associated with a shape
*
* @param shape EB Shear
*/
public void setEbshear(String ebshear) {
this.ebshear = ebshear;
}
/**
* Set MESH associated with a shape
*
* @param shape MESH
*/
public void setMesh(String mesh) {
this.mesh = mesh;
}
/**
* Set rate of change of emissivity of a shape
*
* @param shape emissivity rate of change
*/
public void setRcemiss(String rcemiss) {
this.rcemiss = rcemiss;
}
/**
* Set rate of change of ice cloud fraction of a shape
*
* @param shape ice cloud fraction rate of change
*/
public void setRcicecf(String rcicecf) {
this.rcicecf = rcicecf;
}
/**
* Set the polygon defining a shape
*
* @param shape polygon
*/
public void setPolygon(String polygon) {
this.polygon = polygon;
}
/**
* Set the object ID of a shape
*
* @param shape objectID
*/
public void setObjectid(String objectid) {
this.objectid = objectid;
}
}

View file

@ -0,0 +1,259 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<colorMap xmlns:ns2="http://www.example.org/productType">
<color r="0.3529412" g="0.3529412" b="0.3529412" a="1.0"/>
<color r="0.35686275" g="0.35686275" b="0.35686275" a="1.0"/>
<color r="0.36078432" g="0.36078432" b="0.36078432" a="1.0"/>
<color r="0.36862746" g="0.36862746" b="0.36862746" a="1.0"/>
<color r="0.37254903" g="0.37254903" b="0.37254903" a="1.0"/>
<color r="0.3764706" g="0.3764706" b="0.3764706" a="1.0"/>
<color r="0.38039216" g="0.38039216" b="0.38039216" a="1.0"/>
<color r="0.3882353" g="0.3882353" b="0.3882353" a="1.0"/>
<color r="0.39215687" g="0.39215687" b="0.39215687" a="1.0"/>
<color r="0.39607844" g="0.39607844" b="0.39607844" a="1.0"/>
<color r="0.4" g="0.4" b="0.4" a="1.0"/>
<color r="0.40784314" g="0.40784314" b="0.40784314" a="1.0"/>
<color r="0.4117647" g="0.4117647" b="0.4117647" a="1.0"/>
<color r="0.41568628" g="0.41568628" b="0.41568628" a="1.0"/>
<color r="0.41960785" g="0.41960785" b="0.41960785" a="1.0"/>
<color r="0.42745098" g="0.42745098" b="0.42745098" a="1.0"/>
<color r="0.43137255" g="0.43137255" b="0.43137255" a="1.0"/>
<color r="0.43529412" g="0.43529412" b="0.43529412" a="1.0"/>
<color r="0.4392157" g="0.4392157" b="0.4392157" a="1.0"/>
<color r="0.44705883" g="0.44705883" b="0.44705883" a="1.0"/>
<color r="0.4509804" g="0.4509804" b="0.4509804" a="1.0"/>
<color r="0.45490196" g="0.45490196" b="0.45490196" a="1.0"/>
<color r="0.45882353" g="0.45882353" b="0.45882353" a="1.0"/>
<color r="0.4627451" g="0.4627451" b="0.4627451" a="1.0"/>
<color r="0.47058824" g="0.47058824" b="0.47058824" a="1.0"/>
<color r="0.4745098" g="0.4745098" b="0.4745098" a="1.0"/>
<color r="0.48235294" g="0.48235294" b="0.48235294" a="1.0"/>
<color r="0.4745098" g="0.47843137" b="0.49411765" a="1.0"/>
<color r="0.46666667" g="0.47843137" b="0.5019608" a="1.0"/>
<color r="0.45882353" g="0.4745098" b="0.5137255" a="1.0"/>
<color r="0.4509804" g="0.47058824" b="0.52156866" a="1.0"/>
<color r="0.44313726" g="0.46666667" b="0.53333336" a="1.0"/>
<color r="0.43529412" g="0.46666667" b="0.5411765" a="1.0"/>
<color r="0.42745098" g="0.4627451" b="0.5529412" a="1.0"/>
<color r="0.41960785" g="0.45882353" b="0.5647059" a="1.0"/>
<color r="0.4117647" g="0.45490196" b="0.57254905" a="1.0"/>
<color r="0.40392157" g="0.45490196" b="0.58431375" a="1.0"/>
<color r="0.39607844" g="0.4509804" b="0.5921569" a="1.0"/>
<color r="0.3882353" g="0.44705883" b="0.6039216" a="1.0"/>
<color r="0.38039216" g="0.44705883" b="0.6156863" a="1.0"/>
<color r="0.37254903" g="0.44313726" b="0.62352943" a="1.0"/>
<color r="0.3647059" g="0.4392157" b="0.63529414" a="1.0"/>
<color r="0.35686275" g="0.43529412" b="0.6431373" a="1.0"/>
<color r="0.34901962" g="0.43529412" b="0.654902" a="1.0"/>
<color r="0.34117648" g="0.43137255" b="0.6627451" a="1.0"/>
<color r="0.33333334" g="0.42745098" b="0.6745098" a="1.0"/>
<color r="0.3254902" g="0.42352942" b="0.6862745" a="1.0"/>
<color r="0.31764707" g="0.42352942" b="0.69411767" a="1.0"/>
<color r="0.30980393" g="0.41960785" b="0.7058824" a="1.0"/>
<color r="0.3019608" g="0.41568628" b="0.7137255" a="1.0"/>
<color r="0.29411766" g="0.41568628" b="0.7254902" a="1.0"/>
<color r="0.28627452" g="0.4117647" b="0.7372549" a="1.0"/>
<color r="0.2784314" g="0.40784314" b="0.74509805" a="1.0"/>
<color r="0.27058825" g="0.40392157" b="0.75686276" a="1.0"/>
<color r="0.2627451" g="0.40392157" b="0.7647059" a="1.0"/>
<color r="0.25490198" g="0.4" b="0.7764706" a="1.0"/>
<color r="0.24705882" g="0.39607844" b="0.78431374" a="1.0"/>
<color r="0.23921569" g="0.39215687" b="0.79607844" a="1.0"/>
<color r="0.23137255" g="0.39215687" b="0.80784315" a="1.0"/>
<color r="0.22352941" g="0.3882353" b="0.8156863" a="1.0"/>
<color r="0.21568628" g="0.38431373" b="0.827451" a="1.0"/>
<color r="0.20784314" g="0.38039216" b="0.8352941" a="1.0"/>
<color r="0.2" g="0.38039216" b="0.84705883" a="1.0"/>
<color r="0.19215687" g="0.3764706" b="0.85882354" a="1.0"/>
<color r="0.18431373" g="0.37254903" b="0.8666667" a="1.0"/>
<color r="0.1764706" g="0.37254903" b="0.8784314" a="1.0"/>
<color r="0.16862746" g="0.36862746" b="0.8862745" a="1.0"/>
<color r="0.16078432" g="0.3647059" b="0.8980392" a="1.0"/>
<color r="0.15294118" g="0.36078432" b="0.90588236" a="1.0"/>
<color r="0.14509805" g="0.36078432" b="0.91764706" a="1.0"/>
<color r="0.13725491" g="0.35686275" b="0.92941177" a="1.0"/>
<color r="0.12941177" g="0.3529412" b="0.9372549" a="1.0"/>
<color r="0.12156863" g="0.34901962" b="0.9490196" a="1.0"/>
<color r="0.11372549" g="0.34901962" b="0.95686275" a="1.0"/>
<color r="0.105882354" g="0.34509805" b="0.96862745" a="1.0"/>
<color r="0.09803922" g="0.34117648" b="0.9764706" a="1.0"/>
<color r="0.09019608" g="0.34117648" b="0.9882353" a="1.0"/>
<color r="0.078431375" g="0.33333334" b="0.99607843" a="1.0"/>
<color r="0.09411765" g="0.34509805" b="0.99607843" a="1.0"/>
<color r="0.105882354" g="0.35686275" b="0.99607843" a="1.0"/>
<color r="0.12156863" g="0.37254903" b="0.99607843" a="1.0"/>
<color r="0.13333334" g="0.38431373" b="0.99215686" a="1.0"/>
<color r="0.14901961" g="0.39607844" b="0.99215686" a="1.0"/>
<color r="0.16078432" g="0.40784314" b="0.99215686" a="1.0"/>
<color r="0.1764706" g="0.41960785" b="0.99215686" a="1.0"/>
<color r="0.1882353" g="0.43137255" b="0.99215686" a="1.0"/>
<color r="0.20392157" g="0.44705883" b="0.99215686" a="1.0"/>
<color r="0.21568628" g="0.45882353" b="0.9882353" a="1.0"/>
<color r="0.23137255" g="0.47058824" b="0.9882353" a="1.0"/>
<color r="0.24705882" g="0.48235294" b="0.9882353" a="1.0"/>
<color r="0.25882354" g="0.49411765" b="0.9882353" a="1.0"/>
<color r="0.27450982" g="0.5058824" b="0.9882353" a="1.0"/>
<color r="0.28627452" g="0.52156866" b="0.9882353" a="1.0"/>
<color r="0.3019608" g="0.53333336" b="0.9843137" a="1.0"/>
<color r="0.3137255" g="0.54509807" b="0.9843137" a="1.0"/>
<color r="0.32941177" g="0.5568628" b="0.9843137" a="1.0"/>
<color r="0.34117648" g="0.5686275" b="0.9843137" a="1.0"/>
<color r="0.35686275" g="0.5803922" b="0.9843137" a="1.0"/>
<color r="0.36862746" g="0.59607846" b="0.9843137" a="1.0"/>
<color r="0.38431373" g="0.60784316" b="0.9843137" a="1.0"/>
<color r="0.4" g="0.61960787" b="0.98039216" a="1.0"/>
<color r="0.4117647" g="0.6313726" b="0.98039216" a="1.0"/>
<color r="0.42745098" g="0.6431373" b="0.98039216" a="1.0"/>
<color r="0.4392157" g="0.654902" b="0.98039216" a="1.0"/>
<color r="0.45490196" g="0.67058825" b="0.98039216" a="1.0"/>
<color r="0.46666667" g="0.68235296" b="0.98039216" a="1.0"/>
<color r="0.48235294" g="0.69411767" b="0.9764706" a="1.0"/>
<color r="0.49411765" g="0.7058824" b="0.9764706" a="1.0"/>
<color r="0.50980395" g="0.7176471" b="0.9764706" a="1.0"/>
<color r="0.5254902" g="0.73333335" b="0.9764706" a="1.0"/>
<color r="0.5372549" g="0.74509805" b="0.9764706" a="1.0"/>
<color r="0.5529412" g="0.75686276" b="0.9764706" a="1.0"/>
<color r="0.5647059" g="0.76862746" b="0.972549" a="1.0"/>
<color r="0.5803922" g="0.78039217" b="0.972549" a="1.0"/>
<color r="0.5921569" g="0.7921569" b="0.972549" a="1.0"/>
<color r="0.60784316" g="0.80784315" b="0.972549" a="1.0"/>
<color r="0.61960787" g="0.81960785" b="0.972549" a="1.0"/>
<color r="0.63529414" g="0.83137256" b="0.972549" a="1.0"/>
<color r="0.64705884" g="0.84313726" b="0.972549" a="1.0"/>
<color r="0.6627451" g="0.85490197" b="0.96862745" a="1.0"/>
<color r="0.6784314" g="0.8666667" b="0.96862745" a="1.0"/>
<color r="0.6901961" g="0.88235295" b="0.96862745" a="1.0"/>
<color r="0.7058824" g="0.89411765" b="0.96862745" a="1.0"/>
<color r="0.7176471" g="0.90588236" b="0.96862745" a="1.0"/>
<color r="0.73333335" g="0.91764706" b="0.96862745" a="1.0"/>
<color r="0.74509805" g="0.92941177" b="0.9647059" a="1.0"/>
<color r="0.7607843" g="0.9411765" b="0.9647059" a="1.0"/>
<color r="0.77254903" g="0.95686275" b="0.9647059" a="1.0"/>
<color r="0.78431374" g="0.9647059" b="0.9647059" a="1.0"/>
<color r="0.7882353" g="0.95686275" b="0.9647059" a="1.0"/>
<color r="0.7882353" g="0.94509804" b="0.9647059" a="1.0"/>
<color r="0.7921569" g="0.9372549" b="0.9647059" a="1.0"/>
<color r="0.7921569" g="0.9254902" b="0.9647059" a="1.0"/>
<color r="0.79607844" g="0.91764706" b="0.9647059" a="1.0"/>
<color r="0.79607844" g="0.90588236" b="0.9647059" a="1.0"/>
<color r="0.8" g="0.8980392" b="0.9647059" a="1.0"/>
<color r="0.8" g="0.8901961" b="0.9647059" a="1.0"/>
<color r="0.8039216" g="0.8784314" b="0.9647059" a="1.0"/>
<color r="0.8039216" g="0.87058824" b="0.9647059" a="1.0"/>
<color r="0.80784315" g="0.85882354" b="0.96862745" a="1.0"/>
<color r="0.8117647" g="0.8509804" b="0.96862745" a="1.0"/>
<color r="0.8117647" g="0.8392157" b="0.96862745" a="1.0"/>
<color r="0.8156863" g="0.83137256" b="0.96862745" a="1.0"/>
<color r="0.8156863" g="0.8235294" b="0.96862745" a="1.0"/>
<color r="0.81960785" g="0.8117647" b="0.96862745" a="1.0"/>
<color r="0.81960785" g="0.8039216" b="0.96862745" a="1.0"/>
<color r="0.8235294" g="0.7921569" b="0.96862745" a="1.0"/>
<color r="0.8235294" g="0.78431374" b="0.96862745" a="1.0"/>
<color r="0.827451" g="0.7764706" b="0.96862745" a="1.0"/>
<color r="0.827451" g="0.7647059" b="0.96862745" a="1.0"/>
<color r="0.83137256" g="0.75686276" b="0.96862745" a="1.0"/>
<color r="0.83137256" g="0.74509805" b="0.96862745" a="1.0"/>
<color r="0.8352941" g="0.7372549" b="0.96862745" a="1.0"/>
<color r="0.8392157" g="0.7254902" b="0.96862745" a="1.0"/>
<color r="0.8392157" g="0.7176471" b="0.96862745" a="1.0"/>
<color r="0.84313726" g="0.70980394" b="0.96862745" a="1.0"/>
<color r="0.84313726" g="0.69803923" b="0.96862745" a="1.0"/>
<color r="0.84705883" g="0.6901961" b="0.96862745" a="1.0"/>
<color r="0.84705883" g="0.6784314" b="0.96862745" a="1.0"/>
<color r="0.8509804" g="0.67058825" b="0.972549" a="1.0"/>
<color r="0.8509804" g="0.65882355" b="0.972549" a="1.0"/>
<color r="0.85490197" g="0.6509804" b="0.972549" a="1.0"/>
<color r="0.85490197" g="0.6431373" b="0.972549" a="1.0"/>
<color r="0.85882354" g="0.6313726" b="0.972549" a="1.0"/>
<color r="0.8627451" g="0.62352943" b="0.972549" a="1.0"/>
<color r="0.8627451" g="0.6117647" b="0.972549" a="1.0"/>
<color r="0.8666667" g="0.6039216" b="0.972549" a="1.0"/>
<color r="0.8666667" g="0.5921569" b="0.972549" a="1.0"/>
<color r="0.87058824" g="0.58431375" b="0.972549" a="1.0"/>
<color r="0.87058824" g="0.5764706" b="0.972549" a="1.0"/>
<color r="0.8745098" g="0.5647059" b="0.972549" a="1.0"/>
<color r="0.8745098" g="0.5568628" b="0.972549" a="1.0"/>
<color r="0.8784314" g="0.54509807" b="0.972549" a="1.0"/>
<color r="0.8784314" g="0.5372549" b="0.972549" a="1.0"/>
<color r="0.88235295" g="0.5294118" b="0.972549" a="1.0"/>
<color r="0.88235295" g="0.5176471" b="0.972549" a="1.0"/>
<color r="0.8862745" g="0.50980395" b="0.972549" a="1.0"/>
<color r="0.8901961" g="0.49803922" b="0.972549" a="1.0"/>
<color r="0.8901961" g="0.49019608" b="0.972549" a="1.0"/>
<color r="0.89411765" g="0.47843137" b="0.9764706" a="1.0"/>
<color r="0.89411765" g="0.47058824" b="0.9764706" a="1.0"/>
<color r="0.8980392" g="0.4627451" b="0.9764706" a="1.0"/>
<color r="0.8980392" g="0.4509804" b="0.9764706" a="1.0"/>
<color r="0.9019608" g="0.44313726" b="0.9764706" a="1.0"/>
<color r="0.9019608" g="0.43137255" b="0.9764706" a="1.0"/>
<color r="0.90588236" g="0.42352942" b="0.9764706" a="1.0"/>
<color r="0.90588236" g="0.4117647" b="0.9764706" a="1.0"/>
<color r="0.9098039" g="0.40392157" b="0.9764706" a="1.0"/>
<color r="0.9137255" g="0.39607844" b="0.9764706" a="1.0"/>
<color r="0.9137255" g="0.38431373" b="0.9764706" a="1.0"/>
<color r="0.91764706" g="0.3764706" b="0.9764706" a="1.0"/>
<color r="0.91764706" g="0.3647059" b="0.9764706" a="1.0"/>
<color r="0.92156863" g="0.35686275" b="0.9764706" a="1.0"/>
<color r="0.92156863" g="0.34509805" b="0.9764706" a="1.0"/>
<color r="0.9254902" g="0.3372549" b="0.9764706" a="1.0"/>
<color r="0.9254902" g="0.32941177" b="0.9764706" a="1.0"/>
<color r="0.92941177" g="0.31764707" b="0.9764706" a="1.0"/>
<color r="0.92941177" g="0.30980393" b="0.9764706" a="1.0"/>
<color r="0.93333334" g="0.29803923" b="0.9764706" a="1.0"/>
<color r="0.93333334" g="0.2901961" b="0.9764706" a="1.0"/>
<color r="0.9372549" g="0.2784314" b="0.98039216" a="1.0"/>
<color r="0.9411765" g="0.27058825" b="0.98039216" a="1.0"/>
<color r="0.9411765" g="0.2627451" b="0.98039216" a="1.0"/>
<color r="0.94509804" g="0.2509804" b="0.98039216" a="1.0"/>
<color r="0.94509804" g="0.24313726" b="0.98039216" a="1.0"/>
<color r="0.9490196" g="0.23137255" b="0.98039216" a="1.0"/>
<color r="0.9490196" g="0.22352941" b="0.98039216" a="1.0"/>
<color r="0.9529412" g="0.21568628" b="0.98039216" a="1.0"/>
<color r="0.9529412" g="0.20392157" b="0.98039216" a="1.0"/>
<color r="0.95686275" g="0.19607843" b="0.98039216" a="1.0"/>
<color r="0.95686275" g="0.18431373" b="0.98039216" a="1.0"/>
<color r="0.9607843" g="0.1764706" b="0.98039216" a="1.0"/>
<color r="0.9647059" g="0.16470589" b="0.98039216" a="1.0"/>
<color r="0.9647059" g="0.15686275" b="0.98039216" a="1.0"/>
<color r="0.96862745" g="0.14901961" b="0.98039216" a="1.0"/>
<color r="0.96862745" g="0.13725491" b="0.98039216" a="1.0"/>
<color r="0.972549" g="0.12941177" b="0.98039216" a="1.0"/>
<color r="0.972549" g="0.11764706" b="0.98039216" a="1.0"/>
<color r="0.9764706" g="0.10980392" b="0.98039216" a="1.0"/>
<color r="0.9764706" g="0.09803922" b="0.98039216" a="1.0"/>
<color r="0.98039216" g="0.09019608" b="0.9843137" a="1.0"/>
<color r="0.98039216" g="0.08235294" b="0.9843137" a="1.0"/>
<color r="0.9843137" g="0.07058824" b="0.9843137" a="1.0"/>
<color r="0.9843137" g="0.0627451" b="0.9843137" a="1.0"/>
<color r="0.9882353" g="0.050980393" b="0.9843137" a="1.0"/>
<color r="0.99215686" g="0.043137256" b="0.9843137" a="1.0"/>
<color r="0.99215686" g="0.03137255" b="0.9843137" a="1.0"/>
<color r="0.99607843" g="0.023529412" b="0.9843137" a="1.0"/>
<color r="0.99607843" g="0.015686275" b="0.9843137" a="1.0"/>
<color r="1.0" g="0.003921569" b="0.9843137" a="1.0"/>
<color r="1.0" g="0.0" b="0.9843137" a="1.0"/>
<color r="0.99607843" g="0.019607844" b="0.9843137" a="1.0"/>
<color r="0.99607843" g="0.019607844" b="0.9843137" a="1.0"/>
<color r="0.99607843" g="0.019607844" b="0.9843137" a="1.0"/>
<color r="0.99607843" g="0.019607844" b="0.9843137" a="1.0"/>
<color r="0.99607843" g="0.015686275" b="0.9843137" a="1.0"/>
<color r="0.99607843" g="0.015686275" b="0.9843137" a="1.0"/>
<color r="0.99607843" g="0.015686275" b="0.9843137" a="1.0"/>
<color r="0.99607843" g="0.015686275" b="0.9843137" a="1.0"/>
<color r="0.99607843" g="0.015686275" b="0.9843137" a="1.0"/>
<color r="0.99607843" g="0.011764706" b="0.9843137" a="1.0"/>
<color r="0.99607843" g="0.011764706" b="0.9843137" a="1.0"/>
<color r="0.99607843" g="0.011764706" b="0.9843137" a="1.0"/>
<color r="0.99607843" g="0.011764706" b="0.9843137" a="1.0"/>
<color r="1.0" g="0.011764706" b="0.9843137" a="1.0"/>
<color r="1.0" g="0.007843138" b="0.9843137" a="1.0"/>
<color r="1.0" g="0.007843138" b="0.9843137" a="1.0"/>
<color r="1.0" g="0.007843138" b="0.9843137" a="1.0"/>
<color r="1.0" g="0.007843138" b="0.9843137" a="1.0"/>
<color r="1.0" g="0.003921569" b="0.9843137" a="1.0"/>
<color r="1.0" g="0.003921569" b="0.9843137" a="1.0"/>
<color r="1.0" g="0.003921569" b="0.9843137" a="1.0"/>
<color r="1.0" g="0.003921569" b="0.9843137" a="1.0"/>
<color r="1.0" g="0.003921569" b="0.9843137" a="1.0"/>
<color r="1.0" g="0.0" b="0.9843137" a="1.0"/>
<color r="1.0" g="0.0" b="0.9843137" a="1.0"/>
</colorMap>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>edu.wisc.ssec.cimss.edex.convectprob.feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1 @@
bin.includes = feature.xml

View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="edu.wisc.ssec.cimss.edex.convectprob.feature"
label="Convectprob EDEX Feature"
version="1.0.0.qualifier"
provider-name="CIMSS/SSEC">
<description url="http://www.example.com/description">
[Enter Feature Description here.]
</description>
<copyright url="http://www.example.com/copyright">
[Enter Copyright Description here.]
</copyright>
<license url="http://www.example.com/license">
[Enter License Description here.]
</license>
<plugin
id="edu.wisc.ssec.cimss.common.dataplugin.convectprob"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="edu.wisc.ssec.cimss.edex.plugin.convectprob"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="/com.raytheon.edex.common"/>
<classpathentry kind="src" path="/edu.wisc.ssec.cimss.common.dataplugin.convectprob"/>
<classpathentry kind="src" path="/com.raytheon.uf.common.dataplugin"/>
<classpathentry kind="src" path="/com.raytheon.uf.common.time"/>
<classpathentry kind="src" path="/org.geotools"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.raytheon.uf.edex.core"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>edu.wisc.ssec.cimss.edex.plugin.convectprob</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,16 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: NOAA/CIMSS Prob Severe (plugin.convectprob)
Bundle-SymbolicName: edu.wisc.ssec.cimss.edex.plugin.convectprob
Bundle-Version: 1.14.4.qualifier
Bundle-Vendor: CIMSS/SSEC
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: com.raytheon.uf.edex.decodertools;bundle-version="1.0.0",
javax.persistence,
com.raytheon.uf.common.status;bundle-version="1.12.1174"
Import-Package: com.raytheon.uf.common.datastorage,
com.raytheon.uf.common.datastorage.records,
com.raytheon.uf.edex.database.plugin,
edu.wisc.ssec.cimss.common.dataplugin.convectprob,
edu.wisc.ssec.cimss.common.dataplugin.convectprob.impl

View file

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

View file

@ -0,0 +1,22 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
<bean id="convectprobPluginName" class="java.lang.String">
<constructor-arg type="java.lang.String" value="convectprob" />
</bean>
<bean id="convectprobProperties" class="com.raytheon.uf.common.dataplugin.PluginProperties"
depends-on="convectprobPluginName">
<property name="pluginName" ref="convectprobPluginName" />
<property name="pluginFQN" value="edu.wisc.ssec.cimss.common.dataplugin.convectprob" />
<property name="dao" value="edu.wisc.ssec.cimss.edex.plugin.convectprob.dao.ConvectProbDao" />
<property name="record" value="edu.wisc.ssec.cimss.common.dataplugin.convectprob.ConvectProbRecord" />
</bean>
<bean id="convectprobRegistered" factory-bean="pluginRegistry" factory-method="register">
<constructor-arg value="convectprob"/>
<constructor-arg ref="convectprobProperties"/>
</bean>
</beans>

View file

@ -0,0 +1,39 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="convectprobDecoder"
class="edu.wisc.ssec.cimss.edex.plugin.convectprob.ConvectProbDecoder" />
<bean id="convectprobDistRegistry" factory-bean="distributionSrv"
factory-method="register">
<constructor-arg value="convectprob" />
<constructor-arg value="jms-durable:queue:Ingest.convectprob"/>
</bean>
<camelContext id="convectprob-camel"
xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler"
autoStartup="false">
<!-- Begin convectprob routes -->
<route id="convectprobIngestRoute">
<from uri="jms-durable:queue:Ingest.convectprob"/>
<setHeader headerName="pluginName">
<constant>convectprob</constant>
</setHeader>
<doTry>
<pipeline>
<bean ref="stringToFile" />
<bean ref="convectprobDecoder" method="decode" />
<to uri="direct-vm:persistIndexAlert" />
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>
<to uri="log:convectprob?level=ERROR"/>
</doCatch>
</doTry>
</route>
</camelContext>
</beans>

View file

@ -0,0 +1,115 @@
package edu.wisc.ssec.cimss.edex.plugin.convectprob;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import com.raytheon.edex.plugin.AbstractDecoder;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
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.common.time.util.TimeUtil;
import edu.wisc.ssec.cimss.common.dataplugin.convectprob.ConvectProbRecord;
import edu.wisc.ssec.cimss.common.dataplugin.convectprob.impl.ShapeObject;
import edu.wisc.ssec.cimss.edex.plugin.convectprob.impl.ConvectProbParser;
/**
* NOAA/CIMSS Prob Severe Model Data Decoder
*
* Data decoder that reads shapefile records of NOAA/CIMSS Prob Severe Model
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 27, 2014 DCS 15298 lcronce Initial Creation.
*
* </pre
*
* @author Lee Cronce
* @version 1.0
*
*/
public class ConvectProbDecoder extends AbstractDecoder {
private final IUFStatusHandler statusHandler = UFStatus.getHandler(ConvectProbDecoder.class);
private String traceId = null;
/**
* Default empty constructor
*/
public ConvectProbDecoder() {
}
/**
* Creates the data object that will be persisted to the database and
* hdf5 repository
*
* @param File object passed by EDEX
* @return PluginDataObject[] object of shape data
* @throws Throwable
*/
public PluginDataObject[] decode(File file) throws Throwable {
ArrayList<ShapeObject> shapes = new ArrayList<ShapeObject>();
ConvectProbParser parser = new ConvectProbParser(file);
ShapeObject token;
while (parser.hasNext()) {
token = parser.next();
try {
if (token != null) {
shapes.add(token);
}
} catch (Exception e) {
statusHandler.error("Problem creating new convectprob object from file" + file.getName(), e);
return new PluginDataObject[0];
}
}
ConvectProbRecord record = null;
if (shapes.size() > 0) {
record = new ConvectProbRecord(shapes.size());
for (ShapeObject shape : shapes) {
record.addShape(shape);
}
} else {
return new PluginDataObject[0];
}
String validTime = parser.getValidTime();
if (validTime != null) {
Calendar c = TimeUtil.newCalendar();
record.setInsertTime(c);
try {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss");
record.setDataTime(new DataTime(dateFormat.parse(validTime)));
} catch (Exception e) {
statusHandler.error("Problem defining valid convectprob file time information using: " + validTime, e);
return new PluginDataObject[0];
}
} else {
return new PluginDataObject[0];
}
if (record != null) {
record.setTraceId(traceId);
}
return new PluginDataObject[] { record };
}
/**
* Set a trace identifier for the source data.
*
* @param traceId
* A unique identifier associated with the input data.
*/
public void setTraceId(String traceId) {
this.traceId = traceId;
}
}

View file

@ -0,0 +1,60 @@
package edu.wisc.ssec.cimss.edex.plugin.convectprob.dao;
import edu.wisc.ssec.cimss.common.dataplugin.convectprob.ConvectProbRecord;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.datastorage.DataStoreFactory;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.edex.database.plugin.PluginDao;
/**
* NOAA/CIMSS Prob Severe Model Data Acquisition Object
*
* Defines access to persisted data from NOAA/CIMSS Prob Severe Model
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 27, 2014 DCS 15298 jgerth Initial Creation.
*
* </pre
*
* @author Jordan Gerth
* @version 1.0
*
*/
public class ConvectProbDao extends PluginDao {
/**
* ConvectProbDao constructor
* @param Plugin name
* @throws PluginException
*/
public ConvectProbDao(String pluginName) throws PluginException {
super(pluginName);
}
/**
* Copy data from a Persistable object into a given DataStore container.
* @param dataStore DataStore instance to receive the Persistable data.
* @param obj The Persistable object to be stored.
* @throws Exception Any general exception thrown in this method.
*/
protected IDataStore populateDataStore(IDataStore dataStore,
IPersistable obj) throws Exception {
ConvectProbRecord cpRec = (ConvectProbRecord) obj;
for (int i = 0; i < cpRec.getDataArrays().length; i++) {
IDataRecord record = DataStoreFactory.createStorageRecord(
cpRec.getDataNames()[i], cpRec.getDataURI(), cpRec.getDataArrays()[i]);
record.setCorrelationObject(cpRec);
dataStore.addDataRecord(record);
}
return dataStore;
}
}

View file

@ -0,0 +1,242 @@
package edu.wisc.ssec.cimss.edex.plugin.convectprob.impl;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import edu.wisc.ssec.cimss.common.dataplugin.convectprob.impl.ShapeObject;
/**
* NOAA/CIMSS Prob Severe Model Data Parser
*
* Data parser that parses shapefile records of NOAA/CIMSS Prob Severe Model
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 27, 2014 DCS 15298 lcronce Initial Creation.
*
* </pre
*
* @author Lee Cronce
* @version 1.0
*
*/
public class ConvectProbParser {
private final IUFStatusHandler statusHandler = UFStatus.getHandler(ConvectProbParser.class);
int currentShape = -1;
private List<ShapeObject> shapes;
private String validTime;
private List<String> fileLines;
/**
* Default empty constructor
*/
public ConvectProbParser() {
}
/**
* Calls setData method for defining shape data
*
* @param File object passed on from EDEX
*/
public ConvectProbParser(File file) {
setData(file);
}
/**
* Calls findShapes method to define shape data
*
* @param File object passed on from EDEX
*/
private void setData(File file) {
currentShape = -1;
fileLines = separateLines(file);
validTime = findTime(fileLines, file);
shapes = findShapes(fileLines);
if((shapes != null) && (shapes.size() > 0)) {
currentShape = 0;
}
}
/**
* Returns convectprob data file valid time reference
*
* @return String object defining valid time reference
*/
public String getValidTime() {
return validTime;
}
/**
* Determines if parser contains any more reports
*
* @return Boolean object defining "Does this parser contain any more reports?"
*/
public boolean hasNext() {
boolean next = (shapes != null);
if(next) {
next = ((currentShape >= 0) && (currentShape < shapes.size()));
}
if(!next) {
shapes = null;
currentShape = -1;
}
return next;
}
/**
* Gets the next available report and returns a null reference if no
* more reports are available.
*
* @return Next available shape object
*/
public ShapeObject next() {
ShapeObject shape = null;
if(currentShape < 0) {
return shape;
}
if(currentShape >= shapes.size()) {
shapes = null;
currentShape = -1;
} else {
shape = shapes.get(currentShape++);
}
return shape;
}
/**
* Parses out the data from the passed file object
*
* @param ArrayList of String type containing individual lines of a convectprob data file
* @return String object containing convectprob data valid time
*/
private String findTime(List<String> fileLines, File file) {
String validTime = null;
if (fileLines != null) {
try {
String vTime = fileLines.get(0);
if (!vTime.substring(0,5).equals("Valid")) {
if (file.getName().substring(0,4).equals("SSEC")) {
validTime = file.getName().substring(23,38);
} else {
validTime = null;
}
} else{
validTime = vTime.split(" ")[1];
}
} catch (Exception e) {
statusHandler.error("Problem acquiring convectprob data valid date and time", e);
}
}
return validTime;
}
/**
* Parses out the data from the passed file object
*
* @param File object passed on from EDEX
* @return ArrayList containing the shape data
*/
private List<ShapeObject> findShapes(List<String> fileLines) {
List<ShapeObject> shapes = new ArrayList<ShapeObject>();
if (fileLines != null) {
for (String line : fileLines) {
if (!line.substring(0,5).equals("Valid")) {
try {
ShapeObject shape = new ShapeObject();
String[] shapeAttributes = line.split(":");
String type = shapeAttributes[0];
shape.setType(type);
int probability = Integer.parseInt(shapeAttributes[1].replaceAll("\\D", ""));
shape.setProbability(probability);
String mucape = shapeAttributes[2];
shape.setMucape(mucape);
String ebshear = shapeAttributes[3];
shape.setEbshear(ebshear);
String mesh = shapeAttributes[4];
shape.setMesh(mesh);
String rcemiss = shapeAttributes[5];
shape.setRcemiss(rcemiss);
String rcicecf = shapeAttributes[6];
shape.setRcicecf(rcicecf);
String[] points = shapeAttributes[7].split(",");
float[] latitudes = new float[points.length/2];
float[] longitudes = new float[points.length/2];
for (int i=0; i < points.length; i++) {
if ((i == 0) || ((i%2) == 0)) {
latitudes[i/2] = Float.parseFloat(points[i]);
} else {
longitudes[(i-1)/2] = Float.parseFloat(points[i]);
}
}
StringBuffer strbuf = new StringBuffer();
strbuf.append("POLYGON((");
for (int j=0; j < latitudes.length; j++) {
strbuf.append(Float.toString(longitudes[j]));
strbuf.append(" ");
strbuf.append(Float.toString(latitudes[j]));
if (j < latitudes.length-1) {
strbuf.append(",");
strbuf.append(" ");
}
}
strbuf.append("))");
shape.setPolygon(strbuf.toString());
String objectid = shapeAttributes[8];
shape.setObjectid(objectid);
if (latitudes.length >= 4 || longitudes.length >= 4) {
shapes.add(shape);
}
} catch (Exception e) {
statusHandler.error("Problem defining convectprob shape object from read line: " + line, e);
}
}
}
}
return shapes;
}
/**
* Separates out lines of data from the input data file
*
* @param File passed on by EDEX
* @return ArrayList of lines of data from data file
*/
private List<String> separateLines(File file) {
List<String> fileLines = null;
try {
if (file != null) {
BufferedReader reader = new BufferedReader(new FileReader(file));
fileLines = new ArrayList<String>();
String line;
while ((line = reader.readLine()) != null) {
fileLines.add(line);
}
reader.close();
}
} catch (Exception e) {
statusHandler.error("Problem with reading lines of the convectprob input file: " + file.getName(), e);
}
return fileLines;
}
}

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
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.
-->
<requestPatterns xmlns:ns2="group">
<regex>^SSEC_AWIPS_CONVECTPROB_*</regex>
</requestPatterns>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<purgeRuleSet>
<defaultRule>
<versionsToKeep>60</versionsToKeep>
</defaultRule>
</purgeRuleSet>