Merge branch 'master_14.4.1' into field_14.4.1

Change-Id: I855933b8c46cd835ff872a098e74f36201cf6ecb

Former-commit-id: 9c17244d9c [formerly 90d3fcece6] [formerly 9c17244d9c [formerly 90d3fcece6] [formerly 62642d62bc [formerly 4df76b701f4a85fd0c55f0dd9fd351d1768bd92e]]]
Former-commit-id: 62642d62bc
Former-commit-id: e883e41912 [formerly a4938264a7]
Former-commit-id: 066f2a5ecb
This commit is contained in:
Ana Rivera 2015-02-20 14:04:10 +00:00
commit 613232a4dc
7009 changed files with 434 additions and 1384251 deletions

View file

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

@ -1,28 +0,0 @@
<?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

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

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

View file

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

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

@ -1,259 +0,0 @@
<?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

@ -1,17 +0,0 @@
<?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

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

View file

@ -1,34 +0,0 @@
<?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

@ -1,13 +0,0 @@
<?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

@ -1,28 +0,0 @@
<?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

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

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

View file

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

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

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

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

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

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

View file

@ -1,23 +0,0 @@
<?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

@ -1,17 +0,0 @@
<?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

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

View file

@ -1,41 +0,0 @@
<?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

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

@ -1,28 +0,0 @@
<?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

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

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

View file

@ -1,36 +0,0 @@
<?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

@ -1,39 +0,0 @@
<?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

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

@ -1,424 +0,0 @@
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.List;
import java.util.Map;
import org.eclipse.swt.graphics.RGB;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
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.
*
* </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>();
IWireframeShape shape;
protected void dispose() {
if (this.shape != null) {
this.shape.dispose();
this.shape = null;
}
}
protected void createShapes(IGraphicsTarget target) {
dispose();
shape = target.createWireframeShape(false, descriptor);
}
}
// 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() {
// Make sure we ditch all the shapes before we go
disposeFrames();
}
/**
* Disposes of all frames of visualization
*/
private void disposeFrames() {
synchronized (frames) {
for (DisplayFrame frame : frames.values()) {
frame.dispose();
}
}
}
/**
* @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 (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 (resourceData.isDisplayShape()) {
frame.records.add(record);
}
}
newRecords.clear();
// Get some new shapes
frame.createShapes(target);
// 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 && frame.shape != null) {
boolean drawShape = false;
Color color;
float a, thick;
RGB shapeColor = new RGB(255, 255, 255);
for (ConvectProbRecord rec : frame.records) {
if (rec.getPolyGeoms() != null) {
Geometry[] polyGeoms = rec.getPolyGeoms();
int[] probabilities = rec.getProbabilities();
for (int j=0; j < 101; j++) {
frame.shape.reset();
drawShape = false;
for (int i=0; i < polyGeoms.length; i++) {
if (probabilities[i] == j) {
frame.shape.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(frame.shape, shapeColor, thick, LineStyle.SOLID, a);
}
}
}
}
}
}
/**
* 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#project(org.opengis.referencing.crs.CoordinateReferenceSystem)
*/
@Override
public void project(CoordinateReferenceSystem crs) throws VizException {
synchronized (frames) {
disposeFrames();
// add as unprocessed to make sure frames created
for (DataTime time : frames.keySet()) {
DisplayFrame frame = frames.get(time);
if (frame != null) {
List<ConvectProbRecord> copyList = new ArrayList<ConvectProbRecord>(
frame.records);
synchronized (unprocessedRecords) {
unprocessedRecords.put(time, copyList);
}
}
}
}
}
/**
* @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 frame = null;
synchronized (frames) {
frame = frames.remove(time);
}
if (frame != null) {
frame.dispose();
}
}
}

View file

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

@ -37,13 +37,16 @@ import com.raytheon.rcm.config.RadarConfig;
* 2009-04-22 #1693 D. Friedman Initial checkin
* ...
* 2014-02-03 DR 14762 D. Friedman Add Category enum
* 2015-02-11 DR 17092 D. Friedman Handle NDM cronOTRs.xml updates.
* </pre>
*
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class ConfigEvent {
public static enum Category { GLOBAL_CONFIG, RADAR_CONFIG, PROD_DISTRIBUTION, NATIONAL_RPS_LISTS }
public static enum Category {
GLOBAL_CONFIG, RADAR_CONFIG, PROD_DISTRIBUTION, NATIONAL_RPS_LISTS, CRON_OTRS
}
private String radarID; // null indicates global configuration change.
private RadarConfig oldConfig;

View file

@ -27,6 +27,7 @@ import org.quartz.impl.StdSchedulerFactory;
import com.raytheon.rcm.config.Configuration;
import com.raytheon.rcm.config.RadarConfig;
import com.raytheon.rcm.config.Util;
import com.raytheon.rcm.event.ConfigEvent;
import com.raytheon.rcm.event.OtrEvent;
import com.raytheon.rcm.event.RadarEventAdapter;
import com.raytheon.rcm.event.RadarEventListener;
@ -37,6 +38,19 @@ import com.raytheon.rcm.request.Request;
import com.raytheon.rcm.server.Log;
import com.raytheon.rcm.server.RadarServer;
/**
* Represents the standard configuration model of the AWIPS 2 RadarServer.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* ...
* 2015-02-11 DR 17092 D. Friedman Handle NDM cronOTRs.xml updates.
* </pre>
*
*/
public class RequestScheduler extends RadarEventAdapter {
// Quartz job detail properties
@ -46,8 +60,6 @@ public class RequestScheduler extends RadarEventAdapter {
private RadarServer radarServer;
private OTRManager otrManager;
private CronOTRConfiguration cronConfig;
private Scheduler scheduler;
private Random random = new Random();
@ -70,16 +82,29 @@ public class RequestScheduler extends RadarEventAdapter {
OTRManager.class.getSimpleName());
return;
}
loadConfiguration();
}
private synchronized void loadConfiguration() {
if (scheduler != null) {
try {
scheduler.shutdown();
} catch (SchedulerException e) {
Log.errorf("Error stopping cron-OTR scheduler: %s", e);
}
}
try {
scheduler = StdSchedulerFactory.getDefaultScheduler();
scheduler.start();
} catch (SchedulerException e) {
Log.errorf("Failed to start cron-OTR scheduler: %s", e);
Log.errorf("Failed to start cron-OTR scheduler: %s", e);
scheduler = null;
}
if (scheduler != null) {
CronOTRConfiguration cronConfig = null;
InputStream ins = null;
try {
ins = radarServer.getConfiguration().getDropInData("cronOTRs.xml");
@ -91,7 +116,7 @@ public class RequestScheduler extends RadarEventAdapter {
} catch (Exception e) {
Log.errorf("Error loading cron-OTR configuration: %s", e);
}
if (cronConfig != null) {
int jobIndex = 1; // Used to generate unique JobDetail names
for (CronOTR cronOTR : cronConfig.cronOTRList) {
@ -104,7 +129,7 @@ public class RequestScheduler extends RadarEventAdapter {
cronOTR.getCron(), e);
continue;
}
JobDetail jd = new JobDetail(name, null, CronOTRJob.class);
JobDataMap jdm = jd.getJobDataMap();
jdm.put(SCHEDULER, this);
@ -112,10 +137,10 @@ public class RequestScheduler extends RadarEventAdapter {
try {
scheduler.scheduleJob(jd, trigger);
} catch (Exception e) {
Log.errorf("Error schedule cron \"%s\": %s",
Log.errorf("Error scheduling cron \"%s\": %s",
cronOTR.getCron(), e);
}
jobIndex++;
}
}
@ -179,7 +204,13 @@ public class RequestScheduler extends RadarEventAdapter {
runCron(cronOTR);
}
public void handleConfigEvent(ConfigEvent event) {
if (event.getCategory() == ConfigEvent.Category.CRON_OTRS) {
loadConfiguration();
}
}
/**
* This class declared public only so that it can be instantiated by
* Quartz.

View file

@ -40,6 +40,8 @@ import com.raytheon.rcm.config.LinkType;
import com.raytheon.rcm.config.RadarConfig;
import com.raytheon.rcm.config.StandardProductDistInfoDB;
import com.raytheon.rcm.config.awips1.Awips1ConfigProvider;
import com.raytheon.rcm.event.ConfigEvent;
import com.raytheon.rcm.event.RadarEventListener;
import com.raytheon.rcm.server.Log;
@ -54,6 +56,7 @@ import com.raytheon.rcm.server.Log;
* ------------ ---------- ----------- --------------------------
* ...
* 2014-02-03 DR 14762 D. Friedman Handle updated NDM config files.
* 2015-02-11 DR 17092 D. Friedman Handle NDM cronOTRs.xml updates.
* </pre>
*
*/
@ -62,6 +65,7 @@ public class StandardConfigProvider implements ConfigurationProvider {
private static String WSR_88D_PROD_LIST_NAME = "prodList.txt";
private static String TDWR__PROD_LIST_NAME = "tdwrProdList.txt";
private static String WMO_SITE_INFO_NAME = "wmoSiteInfo.txt";
private static String CRON_OTRS_NAME = "cronOTRs.xml";
private static JAXBContext jaxbContext;
private static Unmarshaller u;
@ -266,6 +270,12 @@ public class StandardConfigProvider implements ConfigurationProvider {
loadProdListDB();
} else if (WMO_SITE_INFO_NAME.equals(name)) {
updateRegionCode();
} else if (CRON_OTRS_NAME.equals(name)) {
RadarEventListener target = config.getConfigurationEventTarget();
if (target != null) {
ConfigEvent ev = new ConfigEvent(ConfigEvent.Category.CRON_OTRS);
target.handleConfigEvent(ev);
}
} else if (Pattern.matches("^rps-.*OP.*$", name)) {
config.notifyNationalRpsLists();
} else {

View file

@ -59,7 +59,7 @@
<contribute xsi:type="command"
commandId="com.raytheon.viz.awipstools.lapstools"
menuText="LAPS tools..." />
menuText="LAPS tools..." id="lapsTools" />
<contribute xsi:type="bundleItem" file="bundles/tools/Points.xml"
menuText="Points" id="pointsTool" timeQuery="false" />

View file

@ -165,7 +165,6 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* for the local time zones for each segment.
* 01/28/2015 #4018 randerso Code cleanup.
* 02/04/2014 17039 ryu Removed menu item related to the HighlighFramingCodes feature.
*
* </pre>
*
* @author lvenable

View file

@ -792,27 +792,6 @@ public class StyledTextComp extends Composite {
}
}
/**
* Handle the key event when a key is released.
*
* @param ke
* Key event.
*/
private void handleKeyRelease(KeyEvent ke) {
int offset = textEditorST.getCaretOffset();
StyleRange[] srArray = textEditorST.getStyleRanges(true);
for (int i = 0; i < srArray.length; i++) {
if ((srArray[i].start <= offset)
&& (offset <= (srArray[i].start + srArray[i].length))) {
if (srArray[i].foreground == frameColor) {
inFramingCode(srArray[i]);
}
}
}
}
/**
* Check if there is selected text and if there is locked text in the
* selected text.
@ -920,33 +899,6 @@ public class StyledTextComp extends Composite {
}
}
/**
* Handle the mouse up event
*
* @param e
* Event fired.
*/
private void handleMouseUp(Event e) {
if (e.button == 1) {
int offset = textEditorST.getCaretOffset();
StyleRange[] sr = textEditorST.getStyleRanges(true);
for (int i = 0; i < sr.length; i++) {
if ((sr[i].start <= offset)
&& (offset <= (sr[i].start + sr[i].length))) {
if (sr[i].foreground == frameColor) {
inFramingCode(sr[i]);
}
}
}
}
}
public void setFramingCodeState(boolean highlight) {
this.highlight = highlight;
}
/**
* Cut the selected text if the selection does not contain locked text.
*/

View file

@ -37,8 +37,6 @@ import javax.measure.unit.NonSI;
import javax.measure.unit.Unit;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.operation.TransformException;
@ -132,7 +130,7 @@ public class PointPrecipPlotResource extends
private Hashtable<String, Stn> pdataMap;
private final DailyQcUtils dqc = DailyQcUtils.getInstance();
static int prevPcpnDay;
/**
@ -174,8 +172,6 @@ public class PointPrecipPlotResource extends
strTree = new STRtree();
gageData = dqc.new Station();
if (!station.isEmpty()) {
if (!dqc.precip_stations.isEmpty()) {
int i = 0;
for (ListIterator<Station> it = dqc.precip_stations.listIterator(); it
@ -191,7 +187,8 @@ public class PointPrecipPlotResource extends
kv.append(":");
kv.append(pm);
dataMap.put(kv.toString(), gageData);
pdataMap.put(kv.toString(), DailyQcUtils.pdata[DailyQcUtils.pcpn_day].stn[i]);
pdataMap.put(kv.toString(),
DailyQcUtils.pdata[DailyQcUtils.pcpn_day].stn[i]);
/* Create a small envelope around the point */
Coordinate p1 = new Coordinate(xy.x + .02, xy.y + .02);
@ -336,7 +333,8 @@ public class PointPrecipPlotResource extends
}
for (m = 0; m < tsmax; m++) {
if (station.parm.substring(3, 5).equalsIgnoreCase(ts[m].abr)
if (station.parm.substring(3, 5)
.equalsIgnoreCase(dqc.ts[m].abr)
&& (DailyQcUtils.dflag[m + 1] == 1)) {
break;
}
@ -349,9 +347,9 @@ public class PointPrecipPlotResource extends
for (m = 0; m < 9; m++) {
if ((m == pdataMap.get(key).frain[time_pos].qual)
&& (qflag[m] == 1)) {
&& (dqc.qflag[m] == 1)) {
break;
} else if ((m == 7) && (qflag[7] == 1)
} else if ((m == 7) && (dqc.qflag[7] == 1)
&& (pdataMap.get(key).frain[time_pos].data == -99)
&& (pdataMap.get(key).frain[time_pos].qual == -99)) {
break;

View file

@ -20,7 +20,7 @@
##
export INIT_MEM=512 # in Meg
export MAX_MEM=896 # in Meg
export MAX_MEM=1280 # in Meg
export EDEX_DEBUG_PORT=5006
export EDEX_JMX_PORT=1617

View file

@ -19,7 +19,7 @@
# further licensing information.
##
export INIT_MEM=256 # in Meg
export MAX_MEM=1792 # in Meg
export MAX_MEM=1856 # in Meg
export METADATA_POOL_MAX=25
export EDEX_DEBUG_PORT=5008

View file

@ -19,7 +19,7 @@
# further licensing information.
##
export INIT_MEM=128 # in Meg
export MAX_MEM=512 # in Meg
export MAX_MEM=544 # in Meg
export METADATA_POOL_MAX=10
export EDEX_DEBUG_PORT=5007

View file

@ -20,9 +20,9 @@
##
export INIT_MEM=128 # in Meg
if [ "$EDEX_ARCH" == "64-bit" ]; then
export MAX_MEM=2048 # in Meg
export MAX_MEM=2144 # in Meg
else
export MAX_MEM=1280 # in Meg
export MAX_MEM=1376 # in Meg
fi
export SERIALIZE_POOL_MAX_SIZE=24
export SERIALIZE_STREAM_INIT_SIZE_MB=2

View file

@ -32,6 +32,10 @@
<constructor-arg value="wmoSiteInfo.txt" />
<constructor-arg ref="radarServerNdmListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="cronOTRs.xml" />
<constructor-arg ref="radarServerNdmListener" />
</bean>
<camelContext id="rpgenvdata-camel" xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler">

View file

@ -266,6 +266,7 @@ insert into afoslookup (origin, ccc) values ('KJEF','STL');
insert into afoslookup (origin, ccc) values ('KJFK','NYC');
insert into afoslookup (origin, ccc) values ('KJKL','SDF');
insert into afoslookup (origin, ccc) values ('KKCI','MKC');
insert into afoslookup (origin, ccc) values ('KKEY','MIA');
insert into afoslookup (origin, ccc) values ('KKRF','MKC');
insert into afoslookup (origin, ccc) values ('KLAF','IND');
insert into afoslookup (origin, ccc) values ('KLAN','ARB');

View file

@ -150,19 +150,16 @@ public final class RunReportAlarmSrv {
private static void saveProductToTextDb(final String productText,
final String productId) throws Exception {
TextDB textdb = new TextDB();
long statusCode = textdb.writeProduct(productId, productText, true,
long insertTime = textdb.writeProduct(productId, productText, true,
null);
// Set the current time and send product alarm alert.
Date d = new Date(System.currentTimeMillis());
d.setTime(statusCode);
AlarmAlertUtil.sendProductAlarmAlert(productId,
String.valueOf(d.getTime()),
true);
if (statusCode != Long.MIN_VALUE) {
statusHandler.info("Product successfully sent");
if (insertTime != Long.MIN_VALUE) {
// Set the write time and send product alarm alert.
Date d = new Date();
d.setTime(insertTime);
AlarmAlertUtil.sendProductAlarmAlert(productId, d, true);
statusHandler.info("Saved product to textdb successfully.");
} else {
statusHandler.error("Product send error detected.");
statusHandler.error("Error detected saving product to textdb.");
}
}
}

View file

@ -54,6 +54,7 @@
<property name="gfe.suite.home" value="${install.dir}" />
<property name="gfe.suite.bin" value="${install.dir}/bin" />
<property name="gfe.suite.hti" value="${install.dir}/hti" />
<property name="gfe.suite.nwps" value="${install.dir}/nwps" />
<!-- Create the copy filter -->
<!-- filter set -->
@ -68,8 +69,10 @@
<echo message="deploy.client=${deploy.client}" />
<mkdir dir="${gfe.suite.bin}"/>
<mkdir dir="${gfe.suite.hti}"/>
<mkdir dir="${gfe.suite.nwps}"/>
<antcall target="-deploy.cli.common"/>
<antcall target="-deploy.hti"/>
<antcall target="-deploy.nwps"/>
<antcall target="-deploy.svcBackup"/>
<!-- <antcall target="-deploy.cli.client"/> -->
<antcall target="-set.permissions"/>
@ -101,6 +104,16 @@
</copy>
</target>
<target name="-deploy.nwps"
description="Deploys NWPS software to a specific directory">
<!-- copy the CLI tools to the deploy directory -->
<echo message="Copying in NWPS files" />
<copy todir="${gfe.suite.nwps}" overwrite="true">
<fileset dir="${basedir}/nwps"/>
<filterset refid="installer.filter.set"/>
</copy>
</target>
<target name="-deploy.svcBackup" if="deploy.svcBackup"
description="Deploys service backup scripts to a specific directory">
<echo message="Copying in service backup scripts" />

View file

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gov.noaa.gsd.viz.ensemble.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

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

View file

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="gov.noaa.gsd.viz.ensemble.feature"
label="Ensemble Tool Feature"
version="1.0.0.qualifier"
provider-name="GSD">
<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="gov.noaa.gsd.viz.ensemble"
download-size="0"
install-size="0"
version="0.0.0"/>
</feature>

View file

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

View file

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gov.noaa.gsd.viz.ensemble</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

@ -1,36 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Ensemble-Tool
Bundle-SymbolicName: gov.noaa.gsd.viz.ensemble; singleton:=true
Bundle-Version: 1.14.0401.qualifier
Bundle-Activator: gov.noaa.gsd.viz.ensemble.Activator
Bundle-Vendor: NOAA-ESL-GSD
Eclipse-RegisterBuddy: com.raytheon.uf.viz.core.rsc
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
com.raytheon.viz.grid,
com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174",
javax.measure;bundle-version="1.0.0",
com.raytheon.uf.common.parameter,
com.raytheon.viz.core.contours,
com.raytheon.uf.common.colormap;bundle-version="1.12.1174",
com.raytheon.viz.core.graphing;bundle-version="1.12.1174",
com.raytheon.uf.common.dataplugin.level,
com.raytheon.uf.viz.d2d.core,
com.raytheon.uf.common.style;bundle-version="1.0.0",
com.raytheon.uf.common.numeric;bundle-version="1.14.0",
com.raytheon.viz.core,
com.raytheon.viz.ui,
com.raytheon.uf.common.comm;bundle-version="1.12.1174",
com.raytheon.uf.viz.xy.timeseries;bundle-version="1.13.0",
com.raytheon.uf.viz.core.rsc,
com.raytheon.uf.viz.xy;bundle-version="1.12.1174",
com.raytheon.uf.viz.d2d.xy.adapters;bundle-version="1.14.0",
com.raytheon.viz.volumebrowser;bundle-version="1.13.0",
com.raytheon.uf.common.derivparam;bundle-version="1.14.0",
com.raytheon.uf.common.inventory;bundle-version="1.14.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Export-Package: gov.noaa.gsd.viz.ensemble.display.control.load,
gov.noaa.gsd.viz.ensemble.navigator.ui.layer

View file

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 952 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 523 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 560 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 B

View file

@ -1,26 +0,0 @@
<?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.
-->
<vbSourceList>
<!-- GFS Ensemble -->
<vbSource key="GEFS" name="GFS Ensemble" category="Ensemble" views="PLANVIEW TIMESERIES" />
<!-- SREF Ensemble -->
<vbSource key="SREF212" name="SREF Ensemble" category="Ensemble" views="PLANVIEW TIMESERIES"/>
</vbSourceList>

View file

@ -1,80 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.commands">
<command
id="gov.noaa.gsd.viz.ensemble.activate.layer"
name="Ensemble Tool">
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="gov.noaa.gsd.viz.ensemble.navigator.action.EnsembleToolLayerManagerAction"
commandId="gov.noaa.gsd.viz.ensemble.activate.layer">
</handler>
</extension>
<extension
point="org.eclipse.ui.menus">
<!--
<menuContribution
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
<toolbar id="ensemblesToolbar">
<visibleWhen>
<reference
definitionId="com.raytheon.uf.viz.d2d.ui.inD2DActionSet">
</reference>
</visibleWhen>
<command
commandId="gov.noaa.gsd.viz.ensemble.activate.layer"
icon="icons/EnsembleTool.gif"
id="gov.noaa.gsd.viz.ensemble.tool.viewer"
label="Ensemble Tool"
style="push"
tooltip="Ensemble Tool">
</command>
<separator
name="gov.noaa.gsd.viz.ensemble.separator_post"
visible="true">
</separator>
</toolbar>
</menuContribution>
-->
<menuContribution
allPopups="false"
locationURI="menu:tools">
<command
commandId="gov.noaa.gsd.viz.ensemble.activate.layer"
style="push">
</command>
</menuContribution>
</extension>
<extension
point="org.eclipse.ui.views">
<view
allowMultiple="false"
class="gov.noaa.gsd.viz.ensemble.navigator.ui.viewer.EnsembleToolViewer"
fastViewWidthRatio="0.26"
icon="icons/ensemble-tool-3.gif"
id="gov.noaa.gsd.viz.ensemble.tool.viewer"
name="Ensemble Tool"
restorable="false">
</view>
</extension>
<extension
point="com.raytheon.viz.ui.displayCustomizer">
<displayCustomizer
customizer="gov.noaa.gsd.viz.ensemble.display.control.EnsembleToolDisplayCustomizer"
perspective="D2D">
</displayCustomizer>
</extension>
</plugin>

View file

@ -1,83 +0,0 @@
package gov.noaa.gsd.viz.ensemble;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 10, 2014 5056 polster Initial creation
*
* </pre>
*
* @author jing
* @author polster
* @version 1.0
*/
public class Activator extends AbstractUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "gov.noaa.gsd.viz.ensemble"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
/**
* The constructor
*/
public Activator() {
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
* )
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
* )
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
/**
* Returns an image descriptor for the image file at the given plug-in
* relative path
*
* @param path
* the path
* @return the image descriptor
*/
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
}

View file

@ -1,70 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.calculate;
/**
* Calculate mean - std dev for different display types. The algorithm is
* referred to ALPS ensemble.
*
* @author jing
* @version 1.0
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 1, 2014 5056 jing Initial creation
*
*
*
* </pre>
*/
public class AvgM1StddevCalculator extends EnsembleCalculator {
public AvgM1StddevCalculator() {
super(Calculation.AVG_MINUS_STD_DEV);
}
/**
* Do the "mean - std dev" calculation.
*
* (non-Javadoc)
*
* @see gov.noaa.gsd.viz.ensemble.display.calculate.EnsembleCalculator#calculatePoint(float[],
* int)
*/
@Override
protected float calculatePoint(float[] workValue, int length) {
int count = 0;
float result = Float.NaN;
float sum = 0;
float scr0 = 0;
/**
* Prepare the sum, sum by sum, and how many data available.
*/
for (int i = 0; i < length; i++) {
if (Float.isNaN(workValue[i])) {
continue;
}
count++;
sum += workValue[i];
scr0 = workValue[i] * workValue[i];
}
if (count == 0) {
return result;
}
/**
* What is the "mean - std dev".
*/
sum /= count;
scr0 = scr0 / count - sum * sum;
result = (scr0 > 0) ? (float) (sum - Math.sqrt(scr0)) : sum;
return result;
}
}

View file

@ -1,61 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.calculate;
/**
* Calculate "mean + std dev" for different display types. The algorithm is
* referred to ALPS ensemble.
*
* @author jing
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 2, 2014 5056 jing Initial creation
*
* </pre>
*/
public class AvgP1StddevCalculator extends EnsembleCalculator {
public AvgP1StddevCalculator() {
super(Calculation.AVG_PLUS_STD_DEV);
}
/**
* Do the "mean - std dev" calculation. (non-Javadoc)
*
* @see gov.noaa.gsd.viz.ensemble.display.calculate.EnsembleCalculator#calculatePoint(float[],
* int)
*/
@Override
protected float calculatePoint(float[] workValue, int length) {
int count = 0;
float result = Float.NaN;
float sum = 0;
float scr0 = 0;
/**
* Prepare the sum, sum by sum, and how many data available.
*/
for (int i = 0; i < length; i++) {
if (Float.isNaN(workValue[i])) {
continue;
}
count++;
sum += workValue[i];
scr0 = workValue[i] * workValue[i];
}
if (count == 0)
return result;
/**
* What is the "mean + std dev".
*/
sum /= count;
scr0 = scr0 / count - sum * sum;
result = (scr0 > 0) ? (float) (sum + Math.sqrt(scr0)) : sum;
return result;
}
}

View file

@ -1,49 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.calculate;
/**
* Define the calculation types as constants used in ensemble display and GUI.
*
* @author polster
* @version 1.0
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* July 1, 2014 5056 polster Initial creation
*
* </pre>
*
*/
public enum Calculation {
AVG_MINUS_STD_DEV("Avg - 1 Std dev"), //
AVG_PLUS_STD_DEV("Avg + 1 Std dev"), //
COMBINED_ENS_REL_FREQ("Combined ERF"), //
DIFFERENCE("Diff"), //
ENSEMBLE_RELATIVE_FREQUENCY("Ens Rel Freq"), //
HISTOGRAM_SAMPLING("Sampling"), //
HISTOGRAM_TEXT("Histogram Sampling"), //
MAX("Max"), //
MEAN("Mean"), //
MIN("Min"), //
MEDIAN("Median"), //
MODE("Mode"), //
NONE("<undefined>"), //
RANGE("Range"), //
SUMMATION("Sum"), //
STANDARD_DEVIATION("Std dev"), //
TRIPLET_ENS_REL_FREQ("Triplet ERF"); //
private String title;
private Calculation(String t) {
title = t;
}
public String getTitle() {
return title;
}
}

View file

@ -1,214 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.calculate;
import java.util.Arrays;
/**
* Value of Relative Frequency of an ensemble set. The range values for the
* calculation, such as minimum, maximum... are in the GUI, should be passed in.
* The definition of the minimum, maximum is the condition, "minimum < maximum"
* as the input for the REF. The concept is from AWIPS I ALPS ensemble GUI.
*
* In the current Ensemble Tool, the GUI use Range, which is passed in and
* converted into the "minimum < maximum" condition.
*
* @author jing
* @version 1.0
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 2, 2014 5056 jing Initial creation
*
* </pre>
*/
public class ERFCalculator extends EnsembleCalculator {
/**
* None value flag
*/
public final static double MAX_OR_MIN_NO_VALUE = -999999.0;
/**
* Minimum value of the condition from GUI
*/
private double min = 0.25;
/**
* Maximum value of the condition from GUI
*/
private double max = 0.0;
// Segregation Strategies can be default, altSREF, ekdmos25, ekdmos10
private String SegregationStrategies = "default";
/**
* Range description
*/
private String rangeDescription = null;
/**
* Range from GUI
*/
private Range range = null;
/**
* Set the Range description.
*
* @param rd
* - Range description
*/
private void setRangeDescription(String rd) {
rangeDescription = rd;
}
/**
* Get the Range description.
*
* @return - the Range description.
*/
public String getRangeDescription() {
return rangeDescription;
}
/**
* Initial the ERF calculator by processing the ERF condition.
*
* @param r
* - rang to be pass in when constructing the object
*/
public ERFCalculator(Range r) {
// Set the Calculation flag
super(Calculation.RANGE);
range = r;
double minValue = Double.MIN_VALUE;
double maxValue = Double.MAX_VALUE;
// Convert the range to the minimum and maximum.
if ((r.getRangeType() == RangeType.INNER_RANGE)
|| (r.getRangeType() == RangeType.OUTER_RANGE)) {
minValue = r.getLowerRangeThreshold();
maxValue = r.getUpperRangeThreshold();
} else if (r.getRangeType() == RangeType.ABOVE_THRESHOLD) {
minValue = MAX_OR_MIN_NO_VALUE;
maxValue = r.getThreshold();
} else if (r.getRangeType() == RangeType.BELOW_THRESHOLD) {
minValue = r.getThreshold();
maxValue = MAX_OR_MIN_NO_VALUE;
}
min = minValue;
max = maxValue;
// Processing the condition for ERF
if (this.min == MAX_OR_MIN_NO_VALUE && this.max == MAX_OR_MIN_NO_VALUE) {
setRangeDescription("ERF Median ");
} else if (this.min != MAX_OR_MIN_NO_VALUE
&& this.max == MAX_OR_MIN_NO_VALUE) {
setRangeDescription("ERF >" + this.min);
} else if (this.min == MAX_OR_MIN_NO_VALUE
&& this.max != MAX_OR_MIN_NO_VALUE) {
setRangeDescription("ERF <" + this.max);
} else if (this.min != MAX_OR_MIN_NO_VALUE
&& this.max != MAX_OR_MIN_NO_VALUE) {
setRangeDescription("ERF >" + this.min + " & <" + this.max);
}
}
public Range getRange() {
return range;
}
/**
* Do ERF calculation for one point.
*
* (non-Javadoc)
*
* @see gov.noaa.gsd.viz.ensemble.display.calculate.EnsembleCalculator#calculatePoint(float[],
* int)
*/
@Override
protected float calculatePoint(float[] workValue, int length) {
float[] poitValues = new float[length];
int totalNum = 0;
// Sum of the data set
for (int i = 0; i < length; i++) {
if (!Float.isNaN(workValue[i])) {
poitValues[totalNum] = workValue[i];
totalNum++;
}
}
// What is the ERF of this point
// Do nothing if no data
if (totalNum == 0) {
return Float.NaN;
}
// How many data match with the conditions?
int matchedNum = 0;
float median = 0;
if (this.min == MAX_OR_MIN_NO_VALUE && this.max == MAX_OR_MIN_NO_VALUE) {
median = getMedian(poitValues);
}
for (int k = 0; k < totalNum; k++) {
if (this.min == MAX_OR_MIN_NO_VALUE
&& this.max == MAX_OR_MIN_NO_VALUE
&& median == poitValues[k]) {
// Most close to mean
setRangeDescription("ERF Median ");
} else if (this.min != MAX_OR_MIN_NO_VALUE
&& this.max == MAX_OR_MIN_NO_VALUE
&& poitValues[k] > this.min) {
matchedNum++;
} else if (this.min == MAX_OR_MIN_NO_VALUE
&& this.max != MAX_OR_MIN_NO_VALUE
&& poitValues[k] < this.max) {
matchedNum++;
} else if (this.min != MAX_OR_MIN_NO_VALUE
&& this.max != MAX_OR_MIN_NO_VALUE
&& poitValues[k] > this.min && poitValues[k] < this.max) {
matchedNum++;
}
}
// ERF of this point in %
float erf = (Float) (matchedNum * 1.0f / totalNum);
erf = (float) Math.round(erf * 100);
return erf;
}
/**
* Calculate the median of a data set.
*
* @param a
* - A data set as the input data.
* @return
*/
private float getMedian(float[] a) {
float[] b = new float[a.length];
System.arraycopy(a, 0, b, 0, b.length);
Arrays.sort(b);
if (a.length % 2 == 0) {
return (b[(b.length / 2) - 1] + b[b.length / 2]) / 2.0f;
} else {
return b[b.length / 2];
}
}
}

View file

@ -1,462 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.calculate;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.geotools.coverage.grid.GridEnvelope2D;
import org.geotools.coverage.grid.GridGeometry2D;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.operation.TransformException;
import com.raytheon.uf.common.geospatial.data.GeographicDataSource;
import com.raytheon.uf.common.geospatial.interpolation.BilinearInterpolation;
import com.raytheon.uf.common.numeric.buffer.FloatBufferWrapper;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.viz.core.graphing.xy.XYData;
import com.raytheon.viz.core.graphing.xy.XYDataList;
import com.raytheon.viz.grid.rsc.general.GeneralGridData;
import com.raytheon.viz.grid.rsc.general.GridMemoryManager;
/**
* Ensemble calculator for loaded products, which is the base class to process
* and prepare the data for calculating of different display types. The input
* data is one frame data of all ensemble members(generic members, can be any
* loaded same level and same unit product data). The output data is calculation
* result, like mean, mode, max and so on.. The derived classes implements the
* real calculations with interfaces calculatePoint(). Currently implemented
* display types are the plan view and time series, others like time-high,
* cross-section... will be implemented in next Version. Each type is with its
* own data format. plan view is grid and time series is xy points. So the data
* processing is different.
*
* @author jing
* @version 1.0
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 5, 2014 5056 jing Initial creation
*
* </pre>
*/
public abstract class EnsembleCalculator {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(EnsembleCalculator.class);
/**
* What's calculation, like MEAM, ERF, MAX... Is used by GUI
*/
protected Calculation calculationType;
/**
* The display type id load mode, like plan view, time series... Is used by
* ensemble displaying
*/
protected DisplayType displayType;
/**
* Define the display type.
*/
public enum DisplayType {
PLANVIEW, TIMESERIES
}
public EnsembleCalculator(Calculation c, DisplayType displayType) {
calculationType = c;
this.displayType = displayType;
}
/**
* @param c
* : What's calculation
*/
public EnsembleCalculator(Calculation c) {
calculationType = c;
}
public EnsembleCalculator() {
}
public DisplayType getDisplayType() {
return displayType;
}
public void setDisplayType(DisplayType displayType) {
this.displayType = displayType;
}
public String getName() {
return calculationType.getTitle();
}
public Calculation getCalculation() {
return calculationType;
}
/**
* Calculate grid data for plan view display. The input data may with
* different geometries, need do the geometry matching process before
* calculating to make all member grids are in same domain. This makes
* calculation easier and faster, but may cost more memory in some cases.
* Calculating with different geometries is no extra memory cost, but is
* very complicated and slow. The calculation result data is added into the
* grid data monitor.
*
* @param inputData
* - loaded grid data of all members in one frame
* @return - Calculation result grid data
*/
public List<GeneralGridData> calculate(List<List<GeneralGridData>> inputData) {
if (inputData == null || inputData.size() == 0
|| inputData.get(0) == null || inputData.get(0).size() == 0)
return null;
GridGeometry2D geometry = matchGeometry(inputData);
/**
* Suppose the grid data is in same domain and unit, therefore the grid
* size of the result is same as any input member.
*
*/
GeneralGridData[] resaultGridData = new GeneralGridData[inputData
.get(0).size()];
for (int k = 0; k < inputData.get(0).size(); k++) {// List
int imax = inputData.size();
if (inputData.get(0).get(0).isVector()) {
/**
* Vector grid data case Is not used in current implementation
*/
// Get U component data
GeographicDataSource[] dataU = new GeographicDataSource[imax];
for (int i = 0; i < imax; i++) {
dataU[i] = inputData.get(i).get(k).getUComponent();
}
// Get V component data
GeographicDataSource[] dataV = new GeographicDataSource[imax];
for (int i = 0; i < imax; i++) {
dataV[i] = inputData.get(i).get(k).getVComponent();
}
// Do Calculation
GeneralGridData resultData = GeneralGridData
.createVectorDataUV(geometry,
doGridCalculation(dataU, imax, geometry),
doGridCalculation(dataV, imax, geometry),
inputData.get(0).get(0).getDataUnit());
// To be monitored by GridMemoryManager
resultData = GridMemoryManager.getInstance().manage(resultData);
resaultGridData[k] = resultData;
} else {
/**
* Generic grid data case
*/
// Get the grid data
GeographicDataSource[] data = new GeographicDataSource[imax];
for (int i = 0; i < imax; i++) {// ArrayList
data[i] = inputData.get(i).get(k).getScalarData();
}
// Do Calculation
GeneralGridData resultData = GeneralGridData.createScalarData(
geometry, doGridCalculation(data, imax, geometry),
inputData.get(0).get(0).getDataUnit());
// To be monitored by GridMemoryManager
resultData = GridMemoryManager.getInstance().manage(resultData);
resaultGridData[k] = resultData;
}
}
return Arrays.asList(resaultGridData);
}
/**
* Do a grid calculation with members' data. loop through each xy point, get
* all member data and calculate the data set.
*
* @param data
* - member grids
* @param imax
* - How many members
* @param geometry
* - the geometry of the grids
* @return - the grid buffer of the calculation result
*/
protected FloatBufferWrapper doGridCalculation(GeographicDataSource[] data,
int imax, GridGeometry2D geometry) {
if (data == null || imax < 1)
return null;
GridEnvelope2D gridRange = geometry.getGridRange2D();
int numGridPoints = gridRange.width * gridRange.height;
int sizeInBytes = numGridPoints * 4;
float[] result = new float[gridRange.width * gridRange.height];
float[] workValue = new float[imax];
// loop through each xy poit of the grids
for (int y = 0; y < gridRange.height; y++) {
for (int x = 0; x < gridRange.width; x++) {
int countJ = 0;
// Read out all available member data at same location
for (int i = 0; i < imax; i++)
if (!Float.isNaN((float) (data[i].getDataValue(x, y))))
workValue[countJ++] = (float) (data[i].getDataValue(x,
y));
// Do real calculation at this location
result[y * gridRange.width + x] = calculatePoint(workValue,
countJ);
}
}
ByteBuffer directBuffer = ByteBuffer.allocateDirect(sizeInBytes);
directBuffer.order(ByteOrder.nativeOrder());
FloatBuffer dataBuffer = directBuffer.asFloatBuffer();
dataBuffer.put(result);
dataBuffer.position(0);
FloatBufferWrapper wrapper = new FloatBufferWrapper(dataBuffer,
gridRange);
return wrapper;
}
/**
* Make all member grid data with same geometry. Currently, we use the
* geometry of the input member with biggest domain.
*
* @param inputData
* - loaded grid data of all members in one frame
* @return-
*/
private GridGeometry2D matchGeometry(List<List<GeneralGridData>> inputData) {
/**
* Search the biggest one as main geometry, if the members are with
* different geometries. Go through each grid and do re-projection if
* its geometry is different then the main geometry.
*/
// Look for a geometry with most coverage
GridGeometry2D geometry = inputData.get(0).get(0).getGridGeometry();
int maxSize = 0;
for (int k = 0; k < inputData.get(0).size(); k++) {
int imax = inputData.size();
int gridSize = 0;
for (int i = 0; i < imax; i++) {
gridSize = inputData.get(i).get(k).getScalarData()
.getGridGeometry().getGridRange2D().height
* inputData.get(i).get(k).getScalarData()
.getGridGeometry().getGridRange2D().width;
if (gridSize <= 1)
continue;
if (maxSize < gridSize) {
maxSize = gridSize;
geometry = inputData.get(i).get(k).getGridGeometry();
}
}
}
if (maxSize < 0 || geometry == null)
return null;
// Make sure all data with same geometry by re-projecting
BilinearInterpolation bilinear = new BilinearInterpolation();
bilinear.setMissingThreshold(1.0f);
for (int k = 0; k < inputData.get(0).size(); k++) {
int imax = inputData.size();
for (int i = 0; i < imax; i++) {
if (geometry.equals(inputData.get(i).get(k).getGridGeometry()) == true) {
// do nothing for same geometry
} else {
// Do re-projection
try {
inputData.get(i).set(
k,
(inputData.get(i).get(k).reproject(geometry,
bilinear)));
} catch (FactoryException | TransformException e) {
statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
}
}
return geometry;
}
/**
* Calculation for time series display. Actually it prepares the data. The
* data processing deals special cases like miss data and time match. Use
* valid time when doing time match. Suppose all members are with same point
* data XYDataList but y can be NaN. Now, We consider the same product
* different size case that each member maybe with different number of
* values on the X axis. For different products case, calculate at all valid
* times with available data.
*
* @param inputData
* - xy point data sets of time series resource members
* @return- xy - the calculated point data set.
*/
public XYDataList calculateTimeSeries(List<XYDataList> inputData) {
XYDataList result = new XYDataList();
if (inputData == null || inputData.isEmpty())
return result;
// Prepare data by using all X axis values, matching time.
ArrayList<Object> xlist = new ArrayList<Object>();
for (XYDataList xyList : inputData) {
ArrayList<XYData> data = xyList.getData();
for (int j = 0; j < xyList.getData().size(); j++) {
if (data.get(j).getX() != null && data.get(j).getY() != null
&& !xlist.contains(data.get(j).getX())) {
boolean matched = false;
for (int k = 0; k < xlist.size(); k++) {
// Remove different object with same valid time
if (((DataTime) xlist.get(k)).getValidTime()
.getTimeInMillis() == ((DataTime) (data.get(j)
.getX())).getValidTime().getTimeInMillis()) {
matched = true;
break;
}
}
if (!matched) {
xlist.add(data.get(j).getX());
}
}
}
}
if (xlist.isEmpty())
return result;
// Sort times
Object[] xValues = xlist.toArray(new Object[xlist.size()]);
// Arrays.sort(xValues); doesn't works
// Temporary solution for sort it, to support Datatime only
Object temp;
for (int i = 0; i < xValues.length; i++) {
for (int j = i + 1; j < xValues.length; j++) {
if (((DataTime) xValues[i]).getValidTime().compareTo(
((DataTime) xValues[j]).getValidTime()) > 0) {
temp = xValues[i];
xValues[i] = xValues[j];
xValues[j] = temp;
}
}
}
// Calculate all points.
result.setData((ArrayList<XYData>) doTimeSeriesCalculation(inputData,
xValues));
return result;
}
/**
* Loop through each time/x point, do calculating for time series display.
*
* @param inputData
* - xy point data sets of time series resource members
* @param xValues
* - time/x values for calculated resource.
* @return- The calculated xy data set.
*/
protected List<XYData> doTimeSeriesCalculation(List<XYDataList> inputData,
Object[] xValues) {
ArrayList<XYData> dataList = new ArrayList<XYData>();
// Calculate for all point
for (int i = 0; i < xValues.length; i++) {
// Calculate for one x point. Look for y data of this x point first.
ArrayList<Float> yValues = new ArrayList<Float>();
for (XYDataList xyList : inputData) {
ArrayList<XYData> data = xyList.getData();
for (int j = 0; j < xyList.getData().size(); j++) {
if (data.get(j).getX() == null
&& data.get(j).getY() == null)
continue;
if (xValues[i].equals(data.get(j).getX())) {
yValues.add(Float.parseFloat(data.get(j).getY()
.toString()));
break;
}
}
}
if (yValues.isEmpty())
continue;
// Put the y values in the work buffer and do calculate the point.
float[] workValue = new float[yValues.size()];
for (int k = 0; k < yValues.size(); k++)
workValue[k] = (float) yValues.get(k);
XYData xy = new XYData(xValues[i], calculatePoint(workValue,
yValues.size()));
dataList.add(xy);
}
return dataList;
}
/**
* Do real calculation for one data set, This interface is implemented in
* the derived classes.
*
* @param workValue
* - inputed data set as a work buffer
* @param length
* - how many data in the work buffer.
* @return- calculated result.
*/
abstract protected float calculatePoint(float[] workValue, int length);
}

View file

@ -1,47 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.calculate;
/**
* Calculate maximum for different display types.
*
* @author jing
* @version 1.0
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 1, 2014 5056 jing Initial creation
*
* </pre>
*/
public class MaxCalculator extends EnsembleCalculator {
public MaxCalculator() {
super(Calculation.MAX);
}
/*
* (non-Javadoc)
*
* @see
* gov.noaa.gsd.viz.ensemble.display.calculate.EnsembleCalculator#calculatePoint
* (float[], int)
*/
@Override
protected float calculatePoint(float[] workValue, int length) {
float max = Float.NaN;
for (int i = 0; i < length; i++) {
if (Float.isNaN(max)) {
max = workValue[i];
continue;
}
if (max < workValue[i])
max = workValue[i];
}
return max;
}
}

View file

@ -1,55 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.calculate;
/**
* Calculate mean for different display types.
*
* @author jing
* @version 1.0
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 1, 2014 5056 jing Initial creation
*
* </pre>
*/
public class MeanCalculator extends EnsembleCalculator {
public MeanCalculator() {
super(Calculation.MEAN);
}
/*
* (non-Javadoc)
*
* @see
* gov.noaa.gsd.viz.ensemble.display.calculate.EnsembleCalculator#calculatePoint
* (float[], int)
*/
@Override
protected float calculatePoint(float[] workValue, int length) {
float mean = Float.NaN;
int count = 0;
for (int i = 0; i < length; i++) {
if (Float.isNaN(workValue[i]))
continue;
count++;
if (Float.isNaN(mean)) {
mean = workValue[i];
continue;
}
mean += workValue[i];
}
if (!Float.isNaN(mean) && count > 0)
mean = mean / count;
return mean;
}
}

View file

@ -1,66 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.calculate;
/**
* Calculate median for different display types.
*
* The algorithm is referred to ALPS ensemble.
*
* @author jing
* @version 1.0
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 1, 2014 5056 jing Initial creation
*
* </pre>
*/
public class MedianCalculator extends EnsembleCalculator {
public MedianCalculator() {
super(Calculation.MEDIAN);
}
/*
* (non-Javadoc)
*
* @see
* gov.noaa.gsd.viz.ensemble.display.calculate.EnsembleCalculator#calculatePoint
* (float[], int)
*/
@Override
protected float calculatePoint(float[] workValue, int length) {
float[] workValue2 = new float[length];
int length2 = 0;
for (int i = 0; i < length; i++) {
if (Float.isNaN(workValue[i]))
continue;
workValue2[length2++] = workValue[i];
}
if (length2 < 1)
return Float.NaN;
if (length2 == 1)
return workValue2[0];
int ni = length2 - 1;
float tempValue;
for (int i = 0; i < ni; i++) {
for (int k = i + 1; k < ni; k++) {
if (workValue[i] < workValue[k])
continue;
tempValue = workValue[i];
workValue[i] = workValue[k];
workValue[k] = tempValue;
}
}
if (length % 2 == 0) {
return (workValue[(length / 2) - 1] + workValue[length / 2]) / 2.0f;
}
return workValue[length / 2];
}
}

View file

@ -1,47 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.calculate;
/**
* Calculate minimum for different display types.
*
* @author jing
* @version 1.0
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 1, 2014 5056 jing Initial creation
*
* </pre>
*/
public class MinCalculator extends EnsembleCalculator {
public MinCalculator() {
super(Calculation.MIN);
}
/*
* (non-Javadoc)
*
* @see
* gov.noaa.gsd.viz.ensemble.display.calculate.EnsembleCalculator#calculatePoint
* (float[], int)
*/
@Override
protected float calculatePoint(float[] workValue, int length) {
float min = Float.NaN;
for (int i = 0; i < length; i++) {
if (Float.isNaN(min)) {
min = workValue[i];
continue;
}
if (min > workValue[i])
min = workValue[i];
}
return min;
}
}

View file

@ -1,82 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.calculate;
/**
* Calculate mode for different display types. The algorithm is referred to ALPS
* ensemble developed by James Ramer. It's good for some products in AWIPS, but
* isn't generic. We are checking on other algorithms such as in GEMPAK, to
* determine the final one in later release.
*
* @author jing
* @version 1.0
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 1, 2014 5056 jing Initial creation
*
* </pre>
*/
public class ModeCalculator extends EnsembleCalculator {
public ModeCalculator() {
super(Calculation.MODE);
}
@Override
protected float calculatePoint(float[] workValue, int length) {
float mode = Float.NaN;
float vmax = Float.MIN_VALUE;
float vmin = Float.MAX_VALUE;
int nok = 0;
for (int i = 0; i < length; i++) {
if (Float.isNaN(workValue[i]))
continue;
nok++;
if (workValue[i] > vmax)
vmax = workValue[i];
if (workValue[i] < vmin)
vmin = workValue[i];
}
if (nok == 0)
return mode;
if (vmax <= vmin)
return vmax;
short[] counts = new short[144];
float vstep = (vmax - vmin) / 11;
vmin -= vstep;
vstep /= 11;
int nmax = 0, icen;
for (int j = 0; j < length; j++) {
if (Float.isNaN(workValue[j]))
continue;
icen = (int) ((workValue[j] - vmin) / vstep);
for (int i = icen - 5; i <= icen + 5; i++) {
counts[i]++;
if (counts[i] > nmax)
nmax = counts[i];
}
}
int i1b, i2b;
i1b = i2b = 0;
for (int i1 = 0; i1 < 144; i1++) {
if (counts[i1] < nmax)
continue;
for (int i2 = i1 + 1; counts[i1] >= nmax; i2++) {
if (i2 - i1 < i2b - i1b)
continue;
i2b = i2;
i1b = i1;
}
}
mode = (float) ((i2b + i1b) * 0.5 * vstep + vmin);
return mode;
}
}

View file

@ -1,72 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.calculate;
/**
* The Range is used to pass information between GUI and display in the
* interactive ensemble calculations.
*
*
* @author polster
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* July 1, 2014 5056 polster Initial creation
*
* </pre>
*
*/
public class Range {
private double lowerThreshold = Integer.MIN_VALUE;
private double higherThreshold = Integer.MAX_VALUE;
private double onlyThreshold = Double.MIN_NORMAL;
private RangeType rangeType = RangeType.NONE;
public Range(RangeType rt) {
rangeType = rt;
}
public void setRange(double lowerValue, double higherValue)
throws IllegalArgumentException {
if (lowerValue >= higherValue) {
throw new IllegalArgumentException(
"Low value must be less than high value.");
}
lowerThreshold = lowerValue;
higherThreshold = higherValue;
}
public RangeType getRangeType() {
return rangeType;
}
public double getLowerRangeThreshold() {
return lowerThreshold;
}
public double getUpperRangeThreshold() {
return higherThreshold;
}
public void setThreshold(double t) throws IllegalArgumentException {
if ((rangeType == RangeType.ABOVE_THRESHOLD)
|| (rangeType == RangeType.BELOW_THRESHOLD)) {
onlyThreshold = t;
} else {
throw new IllegalArgumentException(
"RangeType requires two arguments.");
}
}
public double getThreshold() {
return onlyThreshold;
}
}

View file

@ -1,67 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.calculate;
/**
* Calculate range.
*
* @author jing
* @version 1.0
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 1, 2014 5056 jing Initial creation
*
* </pre>
*
*/
public class RangeCalculator extends EnsembleCalculator {
public RangeCalculator() {
super(Calculation.RANGE);
}
/*
* (non-Javadoc)
*
* @see
* gov.noaa.gsd.viz.ensemble.display.calculate.EnsembleCalculator#calculatePoint
* (float[], int)
*/
@Override
protected float calculatePoint(float[] workValue, int length) {
if (workValue == null || length < 1)
return Float.NaN;
float range = Float.NaN;
float min = Float.NaN;
float max = Float.NaN;
for (int i = 0; i < length; i++) {
if (Float.isNaN(workValue[i]))
continue;
if (Float.isNaN(max) && Float.isNaN(min)) {
max = min = workValue[i];
continue;
}
if (max < workValue[i])
max = workValue[i];
if (min > workValue[i])
min = workValue[i];
}
if (Float.isNaN(max) || Float.isNaN(min)) {
range = Float.NaN;
} else {
range = max - min;
}
return range;
}
}

View file

@ -1,26 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.calculate;
/**
* Define the range types which are the interactive calculation conditions.
*
* @author polster
* @version 1.0
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* July 1, 2014 5056 polster Initial creation
*
* </pre>
*
*/
public enum RangeType {
NONE, // no value
INNER_RANGE, // low-value <= x && high-value >= x
OUTER_RANGE, // low-value >= x || high-value <= x
ABOVE_THRESHOLD, // x >= value
BELOW_THRESHOLD; // x <= value
}

View file

@ -1,64 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.calculate;
/**
* Calculate STDDEV for different display types. The algorithm is referred to
* ALPS ensemble.
*
* @author jing
* @version 1.0
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 1, 2014 5056 jing Initial creation
*
* </pre>
*/
public class StddevCalculator extends EnsembleCalculator {
public StddevCalculator() {
super(Calculation.STANDARD_DEVIATION);
}
/*
* (non-Javadoc)
*
* @see
* gov.noaa.gsd.viz.ensemble.display.calculate.EnsembleCalculator#calculatePoint
* (float[], int)
*/
@Override
protected float calculatePoint(float[] workValue, int length) {
if (workValue == null || length < 1)
return Float.NaN;
float stddev;
int countJ = 0;
float sum = 0;
float scr0 = 0;
for (int i = 0; i < length; i++) {
if (!Float.isNaN(workValue[i])) {
countJ++;
sum += workValue[i];
scr0 += workValue[i] * workValue[i];
}
}
if (countJ == 0) {
stddev = Float.NaN;
} else {
sum /= countJ;
scr0 = scr0 / countJ - sum * sum;
stddev = scr0 > 0 ? (float) Math.sqrt(scr0) : 0;
}
return stddev;
}
}

View file

@ -1,48 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.calculate;
/**
* Calculate sum.
*
* @author jing
* @version 1.0
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 1, 2014 5056 jing Initial creation
*
* </pre>
*/
public class SumCalculator extends EnsembleCalculator {
public SumCalculator() {
super(Calculation.SUMMATION);
}
/*
* (non-Javadoc)
*
* @see
* gov.noaa.gsd.viz.ensemble.display.calculate.EnsembleCalculator#calculatePoint
* (float[], int)
*/
@Override
protected float calculatePoint(float[] workValue, int length) {
if (workValue == null || length < 1)
return Float.NaN;
float sum = 0;
for (int i = 0; i < length; i++) {
// This solution is for same GridGeometry grids
if (!Float.isNaN(workValue[i]))
sum += workValue[i];
}
return sum;
}
}

View file

@ -1,113 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.common;
import gov.noaa.gsd.viz.ensemble.display.calculate.Calculation;
/**
* Force implementers of derived concrete classes to provide the metadata
* getters for all the common meteorological components of a resource.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 17, 2014 5056 polster Initial creation
*
* </pre>
*
* @author jing
* @author polster
* @version 1.0
*/
public abstract class AbstractLegendComponentsProvider {
public AbstractLegendComponentsProvider() {
}
// this will be a root name e.g. for an ensemble group
abstract public String getGroupName();
// this will be unique between resources within a group
// or it will be identical to the getGroupName() method.
abstract public String getUniqueName();
abstract public String getModel();
abstract public String getLocation();
abstract public String getLevel();
abstract public String getParameter();
abstract public String getUnits();
abstract public String getDataTime();
abstract public String getType();
abstract public String getEnsembleId();
abstract public String getEnsembleIdRaw();
abstract public String getStationId();
abstract public Calculation getCalculation();
/*
* An abstract place to put the SREF prettifier.
*/
protected String srefPerturbationPrettyfied(String pert) {
String niceName = "<undef>";
if (pert == null) {
return niceName;
}
String pertPrefix = pert.replaceAll("[0-9]", "");
String pertNumStr = pert.replaceAll("[^0-9]", "");
int pertNumber = Integer.parseInt(pertNumStr);
if ((pertNumber >= 1) && (pertNumber <= 7)) {
if (pertPrefix.startsWith("ctll")) {
niceName = "nmm ctrl-1";
} else if (pertPrefix.startsWith("n")) {
niceName = "nmm n-" + pertNumber;
} else if (pertPrefix.startsWith("p")) {
niceName = "nmm p-" + pertNumber;
}
}
if ((pertNumber >= 8) && (pertNumber <= 14)) {
if (pertPrefix.startsWith("ctll")) {
niceName = "nmb ctrl-1";
} else if (pertPrefix.startsWith("n")) {
niceName = "nmb n-" + (pertNumber - 7);
} else if (pertPrefix.startsWith("p")) {
niceName = "nmb p-" + (pertNumber - 7);
}
}
if ((pertNumber >= 15) && (pertNumber <= 21)) {
if (pertPrefix.startsWith("ctll")) {
niceName = "em ctrl-1";
} else if (pertPrefix.startsWith("n")) {
niceName = "em n-" + (pertNumber - 14);
} else if (pertPrefix.startsWith("p")) {
niceName = "em p-" + (pertNumber - 14);
}
}
niceName = String.format("%-10s", niceName);
return niceName;
}
}

View file

@ -1,149 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.common;
import gov.noaa.gsd.viz.ensemble.display.calculate.Calculation;
import gov.noaa.gsd.viz.ensemble.display.calculate.ERFCalculator;
import gov.noaa.gsd.viz.ensemble.display.calculate.Range;
import gov.noaa.gsd.viz.ensemble.display.rsc.GeneratedEnsembleGridResource;
import gov.noaa.gsd.viz.ensemble.display.rsc.GeneratedEnsembleGridResourceData;
import gov.noaa.gsd.viz.ensemble.util.Utilities;
import java.util.StringTokenizer;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
/**
* Concrete resolution of accessors of generated grid resource attributes.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 17, 2014 5056 polster Initial creation
*
* </pre>
*
* @author polster
* @author jing
* @version 1.0
*/
public class GeneratedGridResourceHolder extends GenericResourceHolder {
GeneratedEnsembleGridResource<?> currRsc = null;
protected GeneratedGridResourceHolder(AbstractVizResource<?, ?> rsc,
boolean isSelected) {
super(rsc, isSelected);
currRsc = (GeneratedEnsembleGridResource<?>) rsc;
}
@Override
public String getModel() {
return "";
}
@Override
public String getLevel() {
String level;
if ((currRsc.getName() == null) || (currRsc.getName().length() == 0)) {
level = "<level missing>";
} else {
StringTokenizer st = new StringTokenizer(currRsc.getName());
level = st.nextToken();
}
return level;
}
@Override
public String getParameter() {
String parameter;
if ((currRsc.getName() == null) || (currRsc.getName().length() == 0)) {
parameter = "<parameter missing>";
} else {
StringTokenizer st = new StringTokenizer(currRsc.getName());
st.nextToken();
st.nextToken();
parameter = st.nextToken();
}
return parameter;
}
@Override
public String getDataTime() {
return "";
}
@Override
public String getUnits() {
return "";
}
@Override
public Calculation getCalculation() {
return currRsc.getCalculation();
}
public String getGroupName() {
return getUniqueName();
}
public String getUniqueName() {
String s = currRsc.getName();
String nodeLabel = Utilities.removeExtraSpaces(s);
return nodeLabel;
}
@Override
public String getLocation() {
return "";
}
@Override
public String getType() {
return "";
}
@Override
public String getEnsembleId() {
return "";
}
@Override
public String getEnsembleIdRaw() {
return "";
}
@Override
public String getStationId() {
return "";
}
@Override
public int hashCode() {
return getUniqueName().hashCode();
}
public Range getRange() {
Range r = null;
if (GeneratedEnsembleGridResourceData.class.isAssignableFrom(currRsc
.getResourceData().getClass())) {
GeneratedEnsembleGridResourceData grd = (GeneratedEnsembleGridResourceData) currRsc
.getResourceData();
if (ERFCalculator.class.isAssignableFrom(grd.getCalculator()
.getClass())) {
ERFCalculator erf = (ERFCalculator) grd.getCalculator();
r = erf.getRange();
}
grd.getCalculator();
}
return r;
}
}

View file

@ -1,73 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.common;
import gov.noaa.gsd.viz.ensemble.display.calculate.Calculation;
import gov.noaa.gsd.viz.ensemble.display.rsc.timeseries.GeneratedTimeSeriesResource;
import gov.noaa.gsd.viz.ensemble.util.Utilities;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
/**
* Concrete resolution of accessors of typical time series resource attributes.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 17, 2014 5056 polster Initial creation
*
* </pre>
*
* @author polster
* @author jing
* @version 1.0
*/
public class GeneratedTimeSeriesResourceHolder extends TimeSeriesResourceHolder {
GeneratedTimeSeriesResource<?> currRsc = null;
protected GeneratedTimeSeriesResourceHolder(AbstractVizResource<?, ?> rsc,
boolean isSelected) {
super(rsc, isSelected);
currRsc = (GeneratedTimeSeriesResource<?>) rsc;
}
@Override
public String getModel() {
return "";
}
@Override
public String getEnsembleId() {
return "";
}
@Override
public Calculation getCalculation() {
return currRsc.getCalculation();
}
@Override
public String getParameter() {
String p = "";
if (currRsc.getParameterName() != null) {
p = currRsc.getParameterName();
if (p.compareTo("Height") == 0) {
p = "Hgt";
}
}
return p;
}
@Override
public String getUniqueName() {
String s = currRsc.getName();
String nodeLabel = Utilities.removeExtraSpaces(s);
return nodeLabel;
}
}

View file

@ -1,124 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.common;
import gov.noaa.gsd.viz.ensemble.display.rsc.GeneratedEnsembleGridResource;
import gov.noaa.gsd.viz.ensemble.display.rsc.histogram.HistogramResource;
import gov.noaa.gsd.viz.ensemble.display.rsc.timeseries.GeneratedTimeSeriesResource;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.xy.timeseries.rsc.TimeSeriesResource;
import com.raytheon.viz.grid.rsc.GridNameGenerator;
/**
* This class represents the abstract container which encapulates an
* AbstractVizResource (that happens to be associated with the Ensemble Tool).
* It provides a poor-man's approach at defining how to parse and extract common
* resource metadata, an interface that doesn't already exist in the viz
* resource class. Similar approaches have been attempted in other resource data
* classes (e.g. getMetaDataMap) but were not necessarily reusable. This class
* exists to attempt to fill an unusual void in the hierarchy of an
* AbstractVizResource as there is no convenient way to extract commonly known
* meteorological metadata information from the resource (needs verification).
*
* This abstact class forces derived classes to define the equals() and hashCode
* methods, among other notable getters.
*
* In order to create a class of this type call the factory method (see
* createResourceHolder).
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 17, 2014 5056 polster Initial creation
*
* </pre>
*
* @author polster
* @author jing
* @version 1.0
*/
public abstract class GenericResourceHolder extends
AbstractLegendComponentsProvider {
AbstractVizResource<?, ?> rsc;
boolean isSelected = false; // either selected or unselected
boolean isGenerated = false; // either generated or a basic (normally
// loaded) resource
public static GenericResourceHolder createResourceHolder(
AbstractVizResource<?, ?> rsc, boolean isSelected) {
GenericResourceHolder genericRsc = null;
if (GeneratedEnsembleGridResource.class
.isAssignableFrom(rsc.getClass())) {
genericRsc = new GeneratedGridResourceHolder(rsc, isSelected);
} else if (GeneratedTimeSeriesResource.class.isAssignableFrom(rsc
.getClass())) {
genericRsc = new GeneratedTimeSeriesResourceHolder(rsc, isSelected);
} else if ((rsc instanceof AbstractVizResource<?, ?>)
&& (rsc instanceof GridNameGenerator.IGridNameResource)) {
genericRsc = new GridResourceHolder(rsc, isSelected);
} else if (TimeSeriesResource.class.isAssignableFrom(rsc.getClass())) {
genericRsc = new TimeSeriesResourceHolder(rsc, isSelected);
} else if (HistogramResource.class.isAssignableFrom(rsc.getClass())) {
genericRsc = new HistogramGridResourceHolder(rsc, isSelected);
}
return genericRsc;
}
@Override
public boolean equals(Object o) {
boolean equals = false;
if (o instanceof GenericResourceHolder) {
GenericResourceHolder gr = (GenericResourceHolder) o;
equals = this.getUniqueName().equals(gr.getUniqueName());
} else {
equals = false;
}
return equals;
}
public abstract int hashCode();
protected GenericResourceHolder() {
}
protected GenericResourceHolder(AbstractVizResource<?, ?> rsc,
boolean isSelected) {
this.rsc = rsc;
this.isSelected = isSelected;
}
public AbstractVizResource<?, ?> getRsc() {
return rsc;
}
public void setRsc(AbstractVizResource<?, ?> rsc) {
this.rsc = rsc;
}
public boolean isSelected() {
return isSelected;
}
public void setSelected(boolean isSelected) {
this.isSelected = isSelected;
}
public boolean isGenerated() {
return isGenerated;
}
public void setGenerated(boolean isEnsGenerated) {
this.isGenerated = isEnsGenerated;
}
}

View file

@ -1,191 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.common;
import gov.noaa.gsd.viz.ensemble.display.calculate.Calculation;
import gov.noaa.gsd.viz.ensemble.util.Utilities;
import com.raytheon.uf.common.dataplugin.level.Level;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMapping;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.viz.grid.rsc.GridNameGenerator;
import com.raytheon.viz.grid.rsc.GridNameGenerator.IGridNameResource;
import com.raytheon.viz.grid.rsc.GridNameGenerator.LegendParameters;
/**
* Concrete resolution of accessors of typical grid resource attributes.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 17, 2014 5056 polster Initial creation
*
* </pre>
*
* @author polster
* @author jing
* @version 1.0
*/
public class GridResourceHolder extends GenericResourceHolder {
GridNameGenerator.IGridNameResource currRsc = null;
protected GridResourceHolder(AbstractVizResource<?, ?> rsc,
boolean isSelected) {
super(rsc, isSelected);
currRsc = (GridNameGenerator.IGridNameResource) rsc;
}
@Override
public String getModel() {
String model;
if (currRsc.getLegendParameters() == null) {
model = "<model missing>";
} else {
model = currRsc.getLegendParameters().model;
}
return model;
}
@Override
public String getLevel() {
String level;
if (currRsc.getLegendParameters() == null) {
level = "<level missing>";
} else {
level = lookupPlane(currRsc.getLegendParameters().level);
}
return level;
}
@Override
public String getParameter() {
String parameter;
if (currRsc.getLegendParameters() == null) {
parameter = "<param missing>";
} else {
parameter = currRsc.getLegendParameters().parameter;
}
return parameter;
}
@Override
public String getDataTime() {
String datatime;
if ((currRsc.getLegendParameters() == null)
|| (currRsc.getLegendParameters().dataTime == null)) {
datatime = "<datatime missing>";
} else {
LegendParameters legendParams = ((IGridNameResource) rsc)
.getLegendParameters();
datatime = legendParams.dataTime.getLegendString();
}
return datatime;
}
@Override
public String getUnits() {
String units;
if (currRsc.getLegendParameters() == null) {
units = "<units missing>";
} else {
units = currRsc.getLegendParameters().unit;
}
return units;
}
@Override
public String getType() {
String type;
if (currRsc.getLegendParameters() == null) {
type = "<type missing>";
} else {
type = currRsc.getLegendParameters().type;
}
return type;
}
@Override
public String getEnsembleId() {
String ensId = "<ensemble id missing>";
if ((currRsc.getLegendParameters() != null) && (getModel() != null)) {
ensId = currRsc.getLegendParameters().ensembleId;
if ((ensId != null) && (getModel().indexOf("SREF") >= 0)) {
ensId = srefPerturbationPrettyfied(ensId);
}
}
return ensId;
}
@Override
public String getEnsembleIdRaw() {
String ensId = "";
if ((currRsc.getLegendParameters() != null) && (getModel() != null)) {
ensId = currRsc.getLegendParameters().ensembleId;
}
return ensId;
}
private String lookupPlane(Level level) {
LevelMapping mapping = LevelMappingFactory.getInstance(
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getLevelMappingForLevel(level);
if (mapping == null) {
return level.getMasterLevel().getName();
}
return mapping.getDisplayName();
}
public String getGroupName() {
String sb = String.format("%s %s %s %s", getModel(), getLevel(),
getParameter(), getUnits() != null
&& getUnits().equals("") == false ? "(" + getUnits()
+ ")" : "");
return sb;
}
public String getUniqueName() {
String sb = String
.format("%s %s %s %s %s",
getModel(),
getLevel(),
getParameter(),
getUnits() != null && getUnits().equals("") == false ? "("
+ getUnits() + ")"
: "",
getEnsembleId() != null
&& getEnsembleId().equals("") == false ? getEnsembleId()
: "");
String nodeLabel = Utilities.removeExtraSpaces(sb.toString());
return nodeLabel;
}
@Override
public String getLocation() {
return "";
}
@Override
public String getStationId() {
return "";
}
@Override
public Calculation getCalculation() {
return null;
}
@Override
public int hashCode() {
return getUniqueName().hashCode();
}
}

View file

@ -1,136 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.common;
import gov.noaa.gsd.viz.ensemble.display.calculate.Calculation;
import gov.noaa.gsd.viz.ensemble.display.rsc.histogram.HistogramResource;
import gov.noaa.gsd.viz.ensemble.util.Utilities;
import java.util.StringTokenizer;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
/**
* Concrete resolution of accessors of histogram resource attributes.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 17, 2014 5056 jing Initial creation
*
* </pre>
*
* @author jing
* @author polster
* @version 1.0
*/
public class HistogramGridResourceHolder extends GenericResourceHolder {
private HistogramResource<?> currRsc = null;
protected HistogramGridResourceHolder(AbstractVizResource<?, ?> rsc,
boolean isSelected) {
super(rsc, isSelected);
currRsc = (HistogramResource<?>) rsc;
}
@Override
public String getModel() {
String model = "";
return model;
}
@Override
public String getLevel() {
String level;
if ((currRsc.getName() == null) || (currRsc.getName().length() == 0)) {
level = "<level missing>";
} else {
StringTokenizer st = new StringTokenizer(currRsc.getName());
level = st.nextToken();
}
return level;
}
@Override
public String getParameter() {
String parameter = "";
return parameter;
}
@Override
public String getDataTime() {
String datatime = "";
return datatime;
}
@Override
public String getUnits() {
String units = "";
if ((currRsc.getName() == null) || (currRsc.getName().length() == 0)) {
units = "<level missing>";
} else {
StringTokenizer st = new StringTokenizer(currRsc.getName());
st.nextToken();
units = st.nextToken();
}
return units;
}
@Override
public Calculation getCalculation() {
// return "color histogram";
if (((HistogramResource<?>) this.rsc).getMode() == HistogramResource.DisplayMode.SAMPLING)
return Calculation.HISTOGRAM_SAMPLING;
else
return Calculation.HISTOGRAM_TEXT;
}
public String getGroupName() {
return getUniqueName();
}
public String getUniqueName() {
String s = currRsc.getName();
String nodeLabel = Utilities.removeExtraSpaces(s);
return nodeLabel;
}
@Override
public String getLocation() {
return "";
}
@Override
public String getType() {
return "";
}
@Override
public String getEnsembleId() {
return "";
}
@Override
public String getEnsembleIdRaw() {
return "";
}
@Override
public String getStationId() {
return "";
}
@Override
public int hashCode() {
return getUniqueName().hashCode();
}
}

View file

@ -1,575 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.common;
import gov.noaa.gsd.viz.ensemble.display.control.EnsembleResourceManager;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.xy.timeseries.display.TimeSeriesDescriptor;
import com.raytheon.uf.viz.xy.timeseries.rsc.TimeSeriesResource;
import com.raytheon.viz.ui.editor.AbstractEditor;
/**
* Access and operate the Ensemble Tool resources. Any resources contained in
* this list class will be associated with an editor and is assumed to be
* controlled by the Ensemble Tool.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 17, 2014 5056 jing Initial creation
*
* </pre>
*
* @author jing
* @author polster
* @version 1.0
*/
public class NavigatorResourceList {
private List<GenericResourceHolder> ensembleToolResources;
private AbstractEditor theEditor;
// contains which ensemble resource is currently used as
// the calculation resource ...
String calculationEnsembleName = null;
public NavigatorResourceList(AbstractEditor editor) {
ensembleToolResources = new CopyOnWriteArrayList<GenericResourceHolder>();
theEditor = editor;
}
public boolean add(GenericResourceHolder emr) {
if (!containsResource(emr)) {
ensembleToolResources.add(emr);
return true;
}
return false;
}
public boolean remove(GenericResourceHolder emr) {
boolean removed = false;
for (GenericResourceHolder gr : ensembleToolResources) {
if (gr == emr) {
ensembleToolResources.remove(gr);
removed = true;
}
}
return removed;
}
public boolean remove(AbstractVizResource<?, ?> rcs) {
boolean removed = false;
for (GenericResourceHolder gr : ensembleToolResources) {
if (gr.getRsc() == rcs) {
ensembleToolResources.remove(gr);
removed = true;
}
}
return removed;
}
public void clear() {
ensembleToolResources.clear();
}
public List<GenericResourceHolder> getResourceHolders() {
return ensembleToolResources;
}
public boolean containsResource(GenericResourceHolder rsc) {
for (GenericResourceHolder emr : ensembleToolResources) {
if (emr.equals(rsc)) {
return true;
}
}
return false;
}
public boolean containsResource(AbstractVizResource<?, ?> rsc) {
for (GenericResourceHolder emr : ensembleToolResources) {
if ((emr.getRsc() == rsc) || (emr.getRsc().equals(rsc))) {
return true;
}
}
return false;
}
/**
* All resources
*
* @return
*/
public List<GenericResourceHolder> getAllRscsAsList() {
List<GenericResourceHolder> rscs = new CopyOnWriteArrayList<GenericResourceHolder>();
for (GenericResourceHolder emr : ensembleToolResources) {
rscs.add(emr);
}
return rscs;
}
/**
* Get all loaded and generated resources as GenericResourceHolder
* instances.
*/
public Map<String, List<GenericResourceHolder>> getAllRscsAsMap() {
Map<String, List<GenericResourceHolder>> rscMap = new ConcurrentHashMap<String, List<GenericResourceHolder>>();
EnsembleResourceManager.getInstance().syncRegisteredResource(theEditor);
List<GenericResourceHolder> rscs = EnsembleResourceManager
.getInstance().getResourceList(theEditor).getUserLoadedRscs();
String currRscName = null;
// let's loop through and find the group names
// and store them in a set of strings (no duplicates
// allowed) so sub-members such as perturbations will
// only be counted once.
Set<String> rscGroupNames = new HashSet<String>();
for (GenericResourceHolder rsc : rscs) {
currRscName = rsc.getGroupName();
if (!rscGroupNames.contains(currRscName)) {
rscGroupNames.add(currRscName);
}
}
Iterator<String> iter = rscGroupNames.iterator();
while (iter.hasNext()) {
String currRsc = iter.next();
List<GenericResourceHolder> members = findAssociatedMembers(currRsc);
if (!members.isEmpty()) {
rscMap.put(currRsc, members);
}
}
// Generated resource add on
rscs = EnsembleResourceManager.instance.getResourceList(theEditor)
.getUserGeneratedRscs();
for (GenericResourceHolder rsc : rscs) {
currRscName = rsc.getUniqueName();
if ((currRscName == null) || (currRscName.length() == 0)) {
currRscName = rsc.getRsc().getName();
}
List<GenericResourceHolder> members = new CopyOnWriteArrayList<GenericResourceHolder>();
members.add(rsc);
rscMap.put(currRscName, members);
}
return rscMap;
}
/**
* Get all loaded and generated resources as GenericResourceHolder
* instances.
*/
public Map<String, List<GenericResourceHolder>> getAllRscsAsMap(
Map<String, List<GenericResourceHolder>> rscMap) {
rscMap.clear();
EnsembleResourceManager.getInstance().syncRegisteredResource(theEditor);
List<GenericResourceHolder> rscs = EnsembleResourceManager.instance
.getResourceList(theEditor).getUserLoadedRscs();
String currRscName = null;
// let's loop through and find the group names
// and store them in a set of strings (no duplicates
// allowed) so sub-members such as perturbations will
// only be counted once.
Set<String> rscGroupNames = new HashSet<String>();
for (GenericResourceHolder rsc : rscs) {
currRscName = rsc.getGroupName();
if (!rscGroupNames.contains(currRscName)) {
rscGroupNames.add(currRscName);
}
}
Iterator<String> iter = rscGroupNames.iterator();
while (iter.hasNext()) {
String currRsc = iter.next();
List<GenericResourceHolder> members = findAssociatedMembers(currRsc);
if (!members.isEmpty()) {
rscMap.put(currRsc, members);
}
}
// Generated resource add on
rscs = EnsembleResourceManager.instance.getResourceList(theEditor)
.getUserGeneratedRscs();
for (GenericResourceHolder rsc : rscs) {
currRscName = rsc.getUniqueName();
if ((currRscName == null) || (currRscName.length() == 0)) {
currRscName = rsc.getRsc().getName();
}
List<GenericResourceHolder> members = new CopyOnWriteArrayList<GenericResourceHolder>();
members.add(rsc);
rscMap.put(currRscName, members);
}
return rscMap;
}
private List<GenericResourceHolder> findAssociatedMembers(
String resourceGroupName) {
List<GenericResourceHolder> rscs = EnsembleResourceManager.instance
.getResourceList(theEditor).getUserLoadedRscs();
List<GenericResourceHolder> members = new CopyOnWriteArrayList<GenericResourceHolder>();
for (GenericResourceHolder rsc : rscs) {
if (rsc.getUniqueName().startsWith(resourceGroupName)) {
members.add(rsc);
}
}
return members;
}
/**
* All resources for an editor that were not generated.
*
* @return
*/
public List<GenericResourceHolder> getUserLoadedRscs() {
EnsembleResourceManager.getInstance().syncRegisteredResource(theEditor);
List<GenericResourceHolder> rscs = new CopyOnWriteArrayList<GenericResourceHolder>();
for (GenericResourceHolder emr : ensembleToolResources) {
if (!emr.isGenerated()) {
rscs.add(emr);
}
}
return rscs;
}
/**
* All loaded resources of an ensemble model using its unique name (e.g
* "SREF 500MB").
*
* @return
*/
public List<GenericResourceHolder> getUserLoadedRscs(
String uniqueResourceName) {
if (uniqueResourceName == null)
return null;
EnsembleResourceManager.getInstance().syncRegisteredResource(theEditor);
List<GenericResourceHolder> rscs = new CopyOnWriteArrayList<GenericResourceHolder>();
for (GenericResourceHolder emr : ensembleToolResources) {
if (!emr.isGenerated) {
String fullName = emr.getGroupName();
if (fullName.equals(uniqueResourceName)) {
rscs.add(emr);
}
}
}
return rscs;
}
/**
* All loaded resources for ensemble.
*
* @param descriptor
* : the descriptor of the resource
* @param selected
* :if it's selected.
* @return
*/
public Map<String, List<GenericResourceHolder>> getUserLoadedRscs(
IDescriptor descriptor, boolean selected) {
EnsembleResourceManager.getInstance().syncRegisteredResource(theEditor);
Map<String, List<GenericResourceHolder>> rscMap = new ConcurrentHashMap<String, List<GenericResourceHolder>>();
for (GenericResourceHolder emr : ensembleToolResources) {
if (!emr.isGenerated
&& emr.isSelected == selected
&& emr.getRsc().getDescriptor().getClass() == descriptor
.getClass()) { // same type descriptor like Map
if (emr.getRsc().getName() == null
|| emr.getRsc().getName().equals(""))
continue;
String model = emr.getModel();
addResource2Map(rscMap, model, emr);
}
}
return rscMap;
}
/**
* All loaded resources for ensemble.
*
* @param descriptor
* :the descriptor of the resource
* @param selected
* :if it's selected.
* @param level
* :level of the resource.
* @param unit
* : unit of the resource.
* @return
*/
public Map<String, List<GenericResourceHolder>> getUserLoadedRscs(
IDescriptor descriptor, boolean selected, String level, String unit) {
EnsembleResourceManager.getInstance().syncRegisteredResource(theEditor);
Map<String, List<GenericResourceHolder>> rscMap = new ConcurrentHashMap<String, List<GenericResourceHolder>>();
for (GenericResourceHolder emr : ensembleToolResources) {
if (descriptor instanceof IMapDescriptor
&& emr.getRsc().getDescriptor() instanceof IMapDescriptor) {
if (!emr.isGenerated
&& emr.isSelected == selected
&& level.equals(emr.getLevel())
&& unit.equals(emr.getUnits())
// same type descriptor like Map
&& emr.getRsc().getDescriptor().getClass() == descriptor
.getClass()) {
// Model name is the first string
if (emr.getRsc().getName() == null
|| emr.getRsc().getName().equals(""))
continue;
String model = emr.getModel();
addResource2Map(rscMap, model, emr);
}
} else if (descriptor instanceof TimeSeriesDescriptor
&& emr.getRsc().getDescriptor() instanceof TimeSeriesDescriptor) {
if (!emr.isGenerated
&& emr.isSelected == selected
&& level.equals(((TimeSeriesResource) (emr.getRsc()))
.getResourceData().getLevelKey())
&& unit.equals(((TimeSeriesResource) (emr.getRsc()))
.getUnits())
&& emr.getRsc().getDescriptor().getClass() == descriptor
.getClass()) { // same type descriptor like Map
// Model name is the first string
if (emr.getRsc().getName() == null
|| emr.getRsc().getName().equals(""))
continue;
String model = emr.getModel();
addResource2Map(rscMap, model, emr);
}
}
}
return rscMap;
}
/**
* All loaded resources for ensemble.
*
* @param descriptor
* :the descriptor of the resource
* @param selected
* :if it's selected.
* @param unit
* : unit of the resource.
* @return
*/
public Map<String, List<GenericResourceHolder>> getUserLoadedRscs(
IDescriptor descriptor, boolean selected, String unit) {
EnsembleResourceManager.getInstance().syncRegisteredResource(theEditor);
Map<String, List<GenericResourceHolder>> rscMap = new ConcurrentHashMap<String, List<GenericResourceHolder>>();
for (GenericResourceHolder emr : ensembleToolResources) {
if (!emr.isGenerated
&& emr.isSelected == selected
&& unit.equals(emr.getUnits())
// same type descriptor like Map
&& emr.getRsc().getDescriptor().getClass() == descriptor
.getClass()) {
if (emr.getRsc().getName() == null
|| emr.getRsc().getName().equals(""))
continue;
String model = emr.getModel();
addResource2Map(rscMap, model, emr);
}
}
return rscMap;
}
/**
* All generated resources by ensemble display
*
* @return
*/
public List<GenericResourceHolder> getUserGeneratedRscs() {
List<GenericResourceHolder> rscs = new CopyOnWriteArrayList<GenericResourceHolder>();
for (GenericResourceHolder emr : ensembleToolResources) {
if (emr.isGenerated) {
rscs.add(emr);
}
}
return rscs;
}
public List<GenericResourceHolder> getUserGeneratedRscs(boolean selected) {
List<GenericResourceHolder> rscs = new CopyOnWriteArrayList<GenericResourceHolder>();
for (GenericResourceHolder emr : ensembleToolResources) {
if (!emr.isGenerated && emr.isSelected == selected) {
rscs.add(emr);
}
}
return rscs;
}
/**
*
* @param rscMap
* @param model
* @param gr
*/
private void addResource2Map(
Map<String, List<GenericResourceHolder>> rscMap, String model,
GenericResourceHolder gr) {
if (rscMap.containsKey(model)) {
rscMap.get(model).add(gr);
} else {
List<GenericResourceHolder> rscList = new CopyOnWriteArrayList<GenericResourceHolder>();
rscList.add(gr);
rscMap.put(model, rscList);
}
}
private final static String TIME_BASIS_EMPTY_STR = "<no associated time>";
public boolean isEmpty() {
return ensembleToolResources.isEmpty();
}
public static boolean isTimeEmpty(String timeBasisLegend) {
return ((timeBasisLegend == null) || (timeBasisLegend.length() == 0) || (timeBasisLegend
.compareTo(TIME_BASIS_EMPTY_STR) == 0));
}
// Currently get the first resource loaded to get time from
public String getTimeBasisLegendTime() {
EnsembleResourceManager.getInstance().syncRegisteredResource(theEditor);
// for now this is the first resource name loaded into this editor
String timeBasisLegendTime = null;
if (ensembleToolResources.isEmpty()) {
timeBasisLegendTime = TIME_BASIS_EMPTY_STR;
} else {
GenericResourceHolder g = ensembleToolResources.get(0);
timeBasisLegendTime = g.getDataTime();
}
return timeBasisLegendTime;
}
public String getTimeBasisResourceName() {
EnsembleResourceManager.getInstance().syncRegisteredResource(theEditor);
// for now this is the first resource name loaded into this editor
String timeBasisResourceName = null;
if (ensembleToolResources.isEmpty()) {
timeBasisResourceName = "";
} else {
GenericResourceHolder g = ensembleToolResources.get(0);
timeBasisResourceName = g.getGroupName();
}
return timeBasisResourceName;
}
synchronized public void setEnsembleCalculationResource(String rscGroupName) {
calculationEnsembleName = rscGroupName;
}
synchronized public String getEnsembleCalculationResource() {
return calculationEnsembleName;
}
// only update if the calculationEnsembleName is not already
// set ... this will guarantee that only the first actual ensemble
// resource will get set as the ensemble calculation resource.
public void updateEnsembleCalculationResource() {
if (calculationEnsembleName != null) {
return;
} else {
Map<String, List<GenericResourceHolder>> resourceMap = getAllRscsAsMap();
List<GenericResourceHolder> resources = null;
Set<String> keys = resourceMap.keySet();
Iterator<String> keyNames = keys.iterator();
String currKey = null;
while (keyNames.hasNext()) {
currKey = keyNames.next();
resources = resourceMap.get(currKey);
// ensemble resource found
if (resources.size() > 1) {
calculationEnsembleName = currKey;
break;
}
}
}
}
public Map<String, List<GenericResourceHolder>> getCalculationLoadedRscs(
IDescriptor descriptor, boolean selected) {
EnsembleResourceManager.getInstance().syncRegisteredResource(theEditor);
Map<String, List<GenericResourceHolder>> rscMap = new ConcurrentHashMap<String, List<GenericResourceHolder>>();
for (GenericResourceHolder emr : ensembleToolResources) {
if (!emr.isGenerated
&& emr.isSelected == selected
&& emr.getGroupName().equals(calculationEnsembleName)
// same type descriptor like Map
&& emr.getRsc().getDescriptor().getClass() == descriptor
.getClass()) {
if (emr.getRsc().getName() == null
|| emr.getRsc().getName().equals(""))
continue;
String model = emr.getModel();
addResource2Map(rscMap, model, emr);
}
}
return rscMap;
}
}

View file

@ -1,222 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.common;
import gov.noaa.gsd.viz.ensemble.display.calculate.Calculation;
import gov.noaa.gsd.viz.ensemble.util.Utilities;
import com.raytheon.uf.common.style.level.SingleLevel;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.d2d.xy.adapters.timeseries.GridTimeSeriesAdapter;
import com.raytheon.uf.viz.xy.timeseries.adapter.AbstractTimeSeriesAdapter;
import com.raytheon.uf.viz.xy.timeseries.rsc.TimeSeriesResource;
import com.vividsolutions.jts.geom.Coordinate;
/**
* Concrete resolution of accessors of time series resource attributes.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 17, 2014 5056 polster Initial creation
*
* </pre>
*
* @author polster
* @author jing
* @version 1.0
*/
public class TimeSeriesResourceHolder extends GenericResourceHolder {
TimeSeriesResource currRsc = null;
protected TimeSeriesResourceHolder(AbstractVizResource<?, ?> rsc,
boolean isSelected) {
super(rsc, isSelected);
currRsc = (TimeSeriesResource) rsc;
}
@Override
public String getModel() {
String model;
if ((currRsc.getResourceData() == null)
|| (currRsc.getResourceData().getSource() == null)) {
model = "<Could not obtain model name>";
} else {
model = currRsc.getResourceData().getSource();
}
return model;
}
@Override
public String getLocation() {
String latlon = "";
if ((currRsc.getResourceData() != null)
&& (currRsc.getResourceData().getCoordinate() != null)) {
Coordinate c = currRsc.getResourceData().getCoordinate();
String ns = c.y >= 0 ? "N" : "S";
String ew = c.x >= 0 ? "E" : "W";
latlon = String.format("pt%s %d%s %d%s", currRsc.getResourceData()
.getPointLetter(), Math.round(Math.abs(c.y)), ns, Math
.round(Math.abs(c.x)), ew);
}
return latlon;
}
@Override
// don't return a level if this is a height time series -- see
// TimeSeriesResource::getName()
public String getLevel() {
String levelKey = currRsc.getResourceData().getLevelKey();
String levelUnit = levelKey.replaceAll("[^a-zA-Z]", "");
boolean isHeight = levelUnit.equalsIgnoreCase("mb")
|| levelUnit.equalsIgnoreCase("agl")
|| levelUnit.contains("Agl");
if (currRsc.getAdapter() != null) {
if (!isHeight) {
SingleLevel level = currRsc.getAdapter().getLevel();
levelKey = (int) level.getValue() + level.getTypeString();
} else {
levelKey = "";
}
} else {
levelKey = "";
}
return levelKey;
}
@Override
public String getUnits() {
String units = currRsc.getUnits();
if (units == null) {
units = "";
}
return units;
}
@Override
public String getParameter() {
String p = "";
if (currRsc.getAdapter() != null) {
p = currRsc.getAdapter().getParameterName();
if (p == null)
p = "";
if (p.compareTo("Height") == 0) {
p = "Hgt";
}
}
return p;
}
@Override
public String getEnsembleId() {
String ensId = "<undef perturbation>";
if (currRsc.getAdapter() instanceof GridTimeSeriesAdapter) {
try {
AbstractTimeSeriesAdapter<?> adapter = currRsc.getAdapter();
if ((((GridTimeSeriesAdapter) adapter) != null)
&& ((((GridTimeSeriesAdapter) adapter)
.getArbitraryRecord()) != null)
&& ((((GridTimeSeriesAdapter) adapter)
.getArbitraryRecord().getInfo()) != null)) {
if (((GridTimeSeriesAdapter) adapter)
.getArbitraryRecord().getInfo()
.getEnsembleId() != null) {
ensId = ((GridTimeSeriesAdapter) adapter)
.getArbitraryRecord().getInfo()
.getEnsembleId();
} else {
ensId = currRsc.getName();
}
if ((getModel() != null)
&& ((ensId != null) && (getModel().indexOf("SREF") >= 0))) {
ensId = srefPerturbationPrettyfied(ensId);
}
}
} catch (Exception e) {
return ensId;
}
}
return ensId;
}
@Override
public String getEnsembleIdRaw() {
return "";
}
@Override
public String getStationId() {
String stnID = "";
if (currRsc.getResourceData().getMetadataMap()
.get("location.stationId") != null) {
stnID = currRsc.getResourceData().getMetadataMap()
.get("location.stationId").getConstraintValue();
}
return stnID;
}
public String getGroupName() {
String sb = String.format("%s %s %s %s %s", getModel(), getLevel(),
getParameter(), getLocation(), getUnits() != null
&& getUnits().equals("") == false ? "(" + getUnits()
+ ")" : "");
String nodeLabel = Utilities.removeExtraSpaces(sb);
return nodeLabel;
}
public String getUniqueName() {
String sb = String
.format("%s %s %s %s %s %s",
getModel(),
getLevel(),
getParameter(),
getLocation(),
getUnits() != null && getUnits().equals("") == false ? "("
+ getUnits() + ")"
: "",
getEnsembleId() != null
&& getEnsembleId().equals("") == false ? getEnsembleId()
: "");
String nodeLabel = Utilities.removeExtraSpaces(sb);
return nodeLabel;
}
@Override
public String getDataTime() {
return "";
}
@Override
public String getType() {
return "";
}
@Override
public Calculation getCalculation() {
return null;
}
@Override
public int hashCode() {
return getUniqueName().hashCode();
}
}

View file

@ -1,220 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.common;
import gov.noaa.gsd.viz.ensemble.display.rsc.GeneratedEnsembleGridResource;
import java.util.ArrayList;
import java.util.List;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.ResourceList;
import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability;
import com.raytheon.viz.grid.rsc.general.AbstractGridResource;
import com.raytheon.viz.grid.rsc.general.D2DGridResource;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.editor.AbstractEditor;
/**
* Utilities for the ensemble display.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 9, 2014 5056 jing Initial creation
*
* </pre>
*
* @author jing
* @version 1.0
*/
public class Utilities {
private Utilities() {
super();
}
/*
* All ensemble resources of all ensemble model products.
*/
public static List<D2DGridResource> getResourcesEnsembleModels() {
ArrayList<D2DGridResource> ensembleResources = new ArrayList<D2DGridResource>();
// check all resources
IMapDescriptor desc = (IMapDescriptor) (getEditor()
.getActiveDisplayPane().getDescriptor());
ResourceList rscList = desc.getResourceList();
for (ResourcePair rp : rscList) {
AbstractVizResource<?, ?> rsc = rp.getResource();
if (!(rsc instanceof AbstractGridResource))
continue;
if (rsc instanceof GeneratedEnsembleGridResource)
continue;
if (!isResourceEnsemble((D2DGridResource) rsc))
continue;
D2DGridResource ensembleResource = ((D2DGridResource) rsc);
ensembleResources.add(ensembleResource);
}
return ensembleResources;
}
/*
* All ensemble resources of one ensemble model products.
*/
public static List<D2DGridResource> getResourcesEnsembleModel(String model) {
ArrayList<D2DGridResource> ensembleResources = new ArrayList<D2DGridResource>();
// check all resources
IMapDescriptor desc = (IMapDescriptor) (getEditor()
.getActiveDisplayPane().getDescriptor());
ResourceList rscList = desc.getResourceList();
for (ResourcePair rp : rscList) {
AbstractVizResource<?, ?> rsc = rp.getResource();
if (!(rsc instanceof AbstractGridResource))
continue;
if (rsc instanceof GeneratedEnsembleGridResource)
continue;
if (!isResourceEnsemble((D2DGridResource) rsc))
continue;
if (!((D2DGridResource) rsc).getLegendParameters().model
.equals(model))
continue;
D2DGridResource ensembleResource = ((D2DGridResource) rsc);
ensembleResources.add(ensembleResource);
}
return ensembleResources;
}
/*
* All resources of different models same time.
*/
// get density base on the number of a ensemble products
public static double getEnsembleDensityRsc(AbstractGridResource<?> rsc) {
if (!isResourceEnsemble((D2DGridResource) rsc)) {
return ((D2DGridResource) rsc).getCapability(
DensityCapability.class).getDensity();
}
// this rsc belong to which products
String model = ((D2DGridResource) rsc).getLegendParameters().model;
// How many member of the model
List<String> members = Utilities.getEnsembleMembers(model);
if (members == null)
return ((D2DGridResource) rsc).getCapability(
DensityCapability.class).getDensity();
// Which density is better, temp. table to assign densities
double density = .33;
if (members.size() < 10) {
density = 2.0;
} else if (members.size() < 20) {
density = 1.5;
} else if (members.size() < 40) {
density = 1.0;
} else if (members.size() < 60) {
density = .75;
} else if (members.size() < 80) {
density = .5;
}
return density;
}
// Get loaded ensemble models. This function will be used by other without
// have a object
public static List<String> getEnsembleModels() {
ArrayList<String> models = new ArrayList<String>();
// check all resources
IDescriptor desc = (getEditor().getActiveDisplayPane().getDescriptor());
ResourceList rscList = desc.getResourceList();
for (ResourcePair rp : rscList) {
AbstractVizResource<?, ?> rsc = rp.getResource();
if (!(rsc instanceof AbstractGridResource))
continue;
if (rsc instanceof GeneratedEnsembleGridResource)
continue;
if (!isResourceEnsemble((D2DGridResource) rsc))
continue;
String model = ((D2DGridResource) rsc).getLegendParameters().model;
if (models.contains(model))
continue;
models.add(model);
}
return models;
}
// Get ensemble members of a model. This function will be used by other
// without have a object
public static List<String> getEnsembleMembers(String model) {
ArrayList<String> members = new ArrayList<String>();
// check all resources
IMapDescriptor desc = (IMapDescriptor) (getEditor()
.getActiveDisplayPane().getDescriptor());
ResourceList rscList = desc.getResourceList();
for (ResourcePair rp : rscList) {
AbstractVizResource<?, ?> rsc = rp.getResource();
if (!(rsc instanceof AbstractGridResource))
continue;
if (rsc instanceof GeneratedEnsembleGridResource)
continue;
if (!isResourceEnsemble((D2DGridResource) rsc))
continue;
if (!((D2DGridResource) rsc).getLegendParameters().model
.equals(model))
continue;
String member = ((D2DGridResource) rsc).getLegendParameters().ensembleId;
if (members.contains(member))
continue;
members.add(member);
}
return members;
}
// If it is a contour ensemble resource
public static boolean isResourceEnsemble(D2DGridResource rsc) {
// What display type?
// AbstractGriddedDisplay gridDisplay=
// (AbstractGriddedDisplay) rsc.getDescriptor().getRenderableDisplay();
if (!rsc.getDisplayType().equals(DisplayType.CONTOUR))
return false;
// Is it ensemble grid? Just use the getLegendParameters().ensembleId
// now
// Should check on grid data records later
if (rsc.getLegendParameters().ensembleId == null
|| rsc.getLegendParameters().ensembleId.isEmpty())
return false;
return true;
}
/**
* Get the current Editor.
*
* @return
*/
private static AbstractEditor getEditor() {
AbstractEditor editor = (AbstractEditor) EditorUtil.getActiveEditor();
return editor;
}
}

View file

@ -1,547 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.control;
import gov.noaa.gsd.viz.ensemble.display.common.GenericResourceHolder;
import gov.noaa.gsd.viz.ensemble.display.common.NavigatorResourceList;
import gov.noaa.gsd.viz.ensemble.display.rsc.histogram.HistogramResource;
import gov.noaa.gsd.viz.ensemble.navigator.ui.layer.EnsembleToolManager;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.IDisposeListener;
import com.raytheon.uf.viz.core.rsc.ResourceList;
import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability;
import com.raytheon.uf.viz.xy.timeseries.rsc.TimeSeriesResource;
import com.raytheon.viz.grid.rsc.general.AbstractGridResource;
import com.raytheon.viz.ui.editor.AbstractEditor;
/**
* Handle all ensemble products member resources, reference to any loaded grid
* product may be treated as ensemble member, and ensemble calculation result
* resources. This is the key architectural support class connecting the
* ensemble display, GUI and D2D core. It tracks and the status of the handled
* resources, controls them, keeps the ensemble tool works with D2D core display
* synchronously. All registered resources are in the ensembleToolResourcesMap.
*
*
* @author jing
* @author polster
* @version 1.0
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb, 2014 5056 jing Initial creation
*
* </pre>
*/
public class EnsembleResourceManager implements IDisposeListener {
private final static double DEFAULT_DENSITY = 0.15;
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(EnsembleResourceManager.class);
/**
* The ensemble marked resource list holds the loaded and generated
* resources and flags, is used by ensemble display, GUI and calculation.
*/
private ConcurrentHashMap<AbstractEditor, NavigatorResourceList> ensembleToolResourcesMap;
/**
* The instance of the manager, a singleton.
*/
public static EnsembleResourceManager instance = null;
/**
* The listeners to any resource, GUI... change event Register to any bus or
* event list for to catch interesting events
*/
private EnsembleResourceManager() {
ensembleToolResourcesMap = new ConcurrentHashMap<AbstractEditor, NavigatorResourceList>();
}
/**
* Get the resource manager.
*
* @return
*/
public static EnsembleResourceManager getInstance() {
if (instance == null) {
instance = new EnsembleResourceManager();
}
return instance;
}
/**
* call this, for example, at EnsembleToolManager initialization time when a
* new tool layer is created but there are no resources yet added to it.
*
* @param editor
* - The product is loaded into which editor/window.
*/
public void registerToolLayer(AbstractEditor editor) {
if (ensembleToolResourcesMap.get(editor) == null) {
ensembleToolResourcesMap.put(editor, new NavigatorResourceList(
editor));
}
}
/**
* Get the resources in an editor.
*
* @param editor
* - The product is loaded into which editor/window.
* @return - list of resources.
*/
public NavigatorResourceList getResourceList(AbstractEditor editor) {
NavigatorResourceList list = null;
if (editor != null) {
list = ensembleToolResourcesMap.get(editor);
}
return list;
}
/**
* Clean the resources in an editor.
*
* @param editor
* - The product is loaded into which editor/window.
*/
public void clearResourceList(AbstractEditor editor) {
ensembleToolResourcesMap.get(editor).clear();
}
/**
* Register a loaded model product in ensemble status
*
* @param rsc
* - the loaded product resource
* @param guiUpdate
* - if need update GUI
*/
public synchronized void registerResource(AbstractVizResource<?, ?> rsc,
AbstractEditor editor, boolean guiUpdate) {
if ((rsc == null) || (!isToolLayerReady()))
return;
// if this is the first resource ever registered using this editor
// then create the resource list and map it to the editor ...
if (ensembleToolResourcesMap.get(editor) == null) {
ensembleToolResourcesMap.put(editor, new NavigatorResourceList(
editor));
if (!EnsembleToolManager.getInstance().hasToolLayer(editor)) {
EnsembleToolManager.getInstance().addToolLayer(editor);
}
}
// no duplicates
if (rsc == null
|| (ensembleToolResourcesMap.get(editor).containsResource(rsc))) {
return;
}
// TODO: Must refactor so we don't use setSystemResource(boolean)
// method.
rsc.getProperties().setSystemResource(true);
rsc.registerListener((IDisposeListener) this);
// Set to default density for all loaded resources if can
// But it may be unmatched with current display. Fix it later
if (rsc.getCapability(DensityCapability.class) != null) {
DensityCapability densityCapability = (DensityCapability) rsc
.getCapability(DensityCapability.class);
densityCapability.setDensity(DEFAULT_DENSITY);
}
GenericResourceHolder ensToolResource = GenericResourceHolder
.createResourceHolder(rsc, true);
ensToolResource.setGenerated(false);
ensembleToolResourcesMap.get(editor).add(ensToolResource);
syncRegisteredResource(editor);
if (guiUpdate) {
notifyClientListChanged();
// now update the calculation ensemble resource, if not already
// set ... there can only be one, and it will be the first
// ensemble resource loaded into this editor ...
ensembleToolResourcesMap.get(editor)
.updateEnsembleCalculationResource();
}
}
/**
* Remove a resource from the tracking list.
*
* @param gr
* - the tracked resource.
* @param editor
* - loaded editor.
* @param notifyGUI
* - if update the GUI.
*/
public synchronized void unregisterResource(GenericResourceHolder gr,
AbstractEditor editor, boolean notifyGUI) {
if (gr == null
|| ensembleToolResourcesMap.get(editor).getResourceHolders()
.isEmpty())
return;
ensembleToolResourcesMap.get(editor).remove(gr);
gr.getRsc().unregisterListener((IDisposeListener) this);
syncRegisteredResource(editor);
// if requested, notify client the known loaded resources have changed
if (notifyGUI) {
notifyClientListChanged();
}
}
/**
* Register Ensemble generated resource. after creating or deleting a
* ensemble generated resource.
*
* @param rsc
* - the generated resource by calculation.
*/
public synchronized void registerGenerated(AbstractVizResource<?, ?> rsc,
AbstractEditor editor) {
if ((rsc == null) || (!isToolLayerReady()))
return;
// This may be the first resource ever registered using this editor. If
// so, then create the resource list and associate it with the editor
// using the map ...
if (ensembleToolResourcesMap.get(editor) == null) {
ensembleToolResourcesMap.put(editor, new NavigatorResourceList(
editor));
}
// Only one instance of a generated resource is saved. If a duplicate is
// created then have it overwrite the existing one.
for (GenericResourceHolder gr : ensembleToolResourcesMap.get(editor)
.getUserGeneratedRscs()) {
// Remove any resource in this list, since it was unloaded/ isn't
// existing.
if (!gr.getRsc().getDescriptor().getResourceList()
.containsRsc(gr.getRsc())) {
ensembleToolResourcesMap.get(editor).remove(gr);
} else if (rsc.getClass().cast(rsc).getName()
.equals(gr.getRsc().getClass().cast(gr.getRsc()).getName())) {
// Same generated resource name, unload old one
ensembleToolResourcesMap.get(editor).remove(gr);
gr.getRsc().getDescriptor().getResourceList()
.removeRsc(gr.getRsc());
}
}
// Set to default density for all loaded resources if can
// But it may be unmatched with current display. Fix it later
// TODO: why are we testing for this for tool layer ready yet again?
// Set resource as a system resource so we don't show the legend
// in the main map, because we will display it in the ensemble
// navigator view.
if (isToolLayerReady()) {
// TODO: Must refactor so we don't use setSystemResource(boolean)
// method.
rsc.getProperties().setSystemResource(true);
rsc.registerListener((IDisposeListener) this);
}
GenericResourceHolder ensToolResource = GenericResourceHolder
.createResourceHolder(rsc, true);
ensToolResource.setGenerated(true);
ensembleToolResourcesMap.get(editor).add(ensToolResource);
syncRegisteredResource(editor);
// notify any client?
notifyClientListChanged();
}
/**
* Remove a generated resource from the tracking list.
*
* @param gr
* - the tracked resource.
* @param editor
* - loaded editor.
* @param notifyGUI
* - if update the GUI.
*/
public synchronized void unregisterGenerated(GenericResourceHolder gr,
AbstractEditor editor, boolean notifyGUI) {
if (gr == null
|| ensembleToolResourcesMap.get(editor).getResourceHolders()
.isEmpty())
return;
ensembleToolResourcesMap.get(editor).remove(gr);
gr.getRsc().unregisterListener((IDisposeListener) this);
// notify client the generated resource change?
syncRegisteredResource(editor);
// if requested, notify client the known loaded resources have changed
if (notifyGUI) {
notifyClientListChanged();
}
}
/**
* Get the resource name string
*
* @param editor
* - resource editor
* @return- resource name
*/
public String getTimeBasisResourceName(AbstractEditor editor) {
return getResourceList(editor).getTimeBasisResourceName();
}
/**
* Get the resource legend time
*
* @param editorr
* - resource editor
* @return- legend time
*/
public String getTimeBasisLegendTime(AbstractEditor editor) {
String s = "";
if ((editor != null) && (getResourceList(editor) != null)) {
s = getResourceList(editor).getTimeBasisLegendTime();
}
return s;
}
/**
* Handle ENS GUI change
*
* @param editor
*/
public void updateFrameChanges(AbstractEditor editor) {
syncRegisteredResource(editor);
// update generated ensemble Resource if need
updateGenerated(editor);
}
/**
* Synchronous the registered resource list within editor(s) and GUI.
* --verify if the resources in the list are existing. --Remove any resource
* in this list, if it was unloaded. --notify GUI if there is any change.
*/
public void syncRegisteredResource(AbstractEditor editor) {
if (ensembleToolResourcesMap.get(editor) == null) {
return;
}
if (ensembleToolResourcesMap.get(editor).getAllRscsAsList() == null
|| ensembleToolResourcesMap.get(editor).getAllRscsAsList()
.isEmpty())
return;
for (GenericResourceHolder gr : ensembleToolResourcesMap.get(editor)
.getAllRscsAsList()) {
// verify if the resources in the list are existing.
if (!gr.getRsc().getDescriptor().getResourceList()
.containsRsc(gr.getRsc())) {
// Remove any resource in this list, since it was unloaded/
// isn't existing.
ensembleToolResourcesMap.get(editor).remove(gr);
// notify GUI if there is any change.
notifyClientListChanged();
} else {
// don't show legend if Tool Layer is editable
if (isToolLayerReady()) {
gr.getRsc().getProperties().setSystemResource(true);
}
// Marks to unselected if the resource is not visible
// set resource selection to true.
if (gr.getRsc().getProperties().isVisible()) {
gr.setSelected(true);
} else {
gr.setSelected(false);
}
}
}
}
/**
* * check for all ensemble interested resources if they are out of control
* by the ensemble resource manager. Current interested resources are
* AbstractGridResource ETimeSeriesResouece, HistogramResource
*
* @param editor
* @return
*/
public ResourceList searchUnryncRegisteredResource(AbstractEditor editor) {
ResourceList unRegisteredResources = new ResourceList();
// The registered resources for this editor in the manager
List<GenericResourceHolder> resourceList = ensembleToolResourcesMap
.get(editor).getAllRscsAsList();
IDescriptor desc = (editor.getActiveDisplayPane().getDescriptor());
ResourceList rscList = desc.getResourceList();
for (ResourcePair rp : rscList) {
AbstractVizResource<?, ?> rsc = rp.getResource();
if ((rsc instanceof AbstractGridResource)
|| (rsc instanceof TimeSeriesResource)
|| (rsc instanceof HistogramResource)) {
boolean isRegistered = false;
for (GenericResourceHolder rcsHolder : resourceList) {
if (rcsHolder.getRsc() == rsc) {
isRegistered = true;
}
}
if (!isRegistered) {
unRegisteredResources.add(rp);
}
}
}
return unRegisteredResources;
}
/**
* check if the ensemble GUI is reday
*
* @return
*/
public boolean isToolLayerReady() {
return EnsembleToolManager.getInstance().isReady();
}
/**
* Check generated resources update data and display if need
*
* @param editor
*/
public void updateGenerated(AbstractEditor editor) {
if (ensembleToolResourcesMap.get(editor) == null) {
return;
}
if (ensembleToolResourcesMap.get(editor).getUserGeneratedRscs() == null
|| ensembleToolResourcesMap.get(editor).getUserGeneratedRscs()
.isEmpty())
return;
// Check each resource if need update
for (GenericResourceHolder rsc : ensembleToolResourcesMap.get(editor)
.getUserGeneratedRscs()) {
// TODO
}
}
/**
* post process in this level
*
* @param editor
*/
public void disposal(AbstractEditor editor) {
clearResourceList(editor);
saveResourceList(editor);
// notify client
notifyClientListChanged();
}
/**
* Marked ResourceList change event should be sent to client by the event
* bus. The client can be GUI, calculator, etc, ...
*/
private void notifyClientListChanged() {
if (isToolLayerReady()) {
EnsembleToolManager.getInstance().refreshView();
}
}
/**
* Save the registered resource list into a file
*
* @param editor
*/
private void saveResourceList(AbstractEditor editor) {
clearResourceList(editor);
// notify client
notifyClientListChanged();
}
/**
* post process for other interfaces
*
*/
@Override
public void disposed(AbstractVizResource<?, ?> rsc) {
// TODO Find editor for resource ...
// TODO ResourceManager.getInstance().unregisterResource(rsc);
notifyClientListChanged();
}
/**
* Set ensemble calculation resource name.
*
* @param editor
* @param rscGroupName
*/
public void setEnsembleCalculationResourceName(AbstractEditor editor,
String rscGroupName) {
if (ensembleToolResourcesMap.get(editor) != null) {
ensembleToolResourcesMap.get(editor)
.setEnsembleCalculationResource(rscGroupName);
}
}
/**
* Get ensemble calculation resource name.
*
* @param editor
* @return
*/
public String getEnsembleCalculationResourceName(AbstractEditor editor) {
String name = "";
if (ensembleToolResourcesMap.get(editor) != null) {
name = ensembleToolResourcesMap.get(editor)
.getEnsembleCalculationResource();
}
return name;
}
}

View file

@ -1,329 +0,0 @@
package gov.noaa.gsd.viz.ensemble.display.control;
import gov.noaa.gsd.viz.ensemble.navigator.ui.layer.EnsembleToolManager;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
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.IInitListener;
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.xy.timeseries.rsc.TimeSeriesResource;
import com.raytheon.viz.grid.rsc.general.GridResource;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.editor.AbstractEditor;
import com.raytheon.viz.ui.perspectives.IRenderableDisplayCustomizer;
/**
* The ensemble tool renderable display customizer classes contain the event
* handlers that keeps track of when new displays are created or removed, and
* listens also for when resources get added or removed from those displays.
*
* TODO: We need verify whether we need only keep track of displays that are
* created when the ensemble tool is "on". This is problematic for the very
* first display because the ensemble tool would like to "know" of that display
* but is not "on" by default. So how do we know that the new display is the
* very first display created (i.e. initial "Map" editor display).
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 9, 2014 5056 epolster jing Initial creation
*
* </pre>
*
* @author polster
* @author jing
* @version 1.0
*/
public class EnsembleToolDisplayCustomizer implements
IRenderableDisplayCustomizer {
private final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(EnsembleToolDisplayCustomizer.class);
static final private List<ResourcePair> batchedPairs = new CopyOnWriteArrayList<ResourcePair>();
/** List of listeners we have for renderable displays */
private final List<EnsembleToolRscLoadListener> listeners = new ArrayList<EnsembleToolRscLoadListener>();
@Override
public void customizeDisplay(IRenderableDisplay display) {
// TODO: if (EnsembleToolManager.getInstance().isReady()) {
boolean add = true;
for (EnsembleToolRscLoadListener listener : listeners) {
if (display == listener.getDisplay()) {
add = false;
break;
}
}
if (add) {
listeners.add(new EnsembleToolRscLoadListener(display));
}
if (EnsembleToolManager.getInstance().isReady()) {
EnsembleToolManager.getInstance().prepareForNewEditor();
}
}
@Override
public void uncustomizeDisplay(IRenderableDisplay display) {
// TODO: if (EnsembleToolManager.getInstance().isReady()) {
EnsembleToolRscLoadListener toRemove = null;
for (EnsembleToolRscLoadListener listener : listeners) {
if (listener.getDisplay() == display) {
toRemove = listener;
break;
}
}
if (toRemove != null) {
toRemove.dispose();
listeners.remove(toRemove);
}
}
private static class EnsembleToolRscLoadListener implements AddListener,
RemoveListener, IInitListener {
/*
* For batching purposes, keep track of the amount of time spent between
* requests
*/
private static long LAST_TIME = 0;
/*
* Maximum wait period for batching; this value was chosen as the
* minimum necessary wait time for a two-ensemble load (e.g. 500MB and
* 850MB Heights). By waiting this long, both full products sets will
* get batched into one load (at least on a typically performant
* machine).
*/
private final int ALLOW_FOR_BUNCHED_REQUESTS_PERIOD = 1800;
// thread which acts upon batched requests
private Thread forceReset = null;
// the display we are listening to
private final IRenderableDisplay display;
public EnsembleToolRscLoadListener(IRenderableDisplay display) {
this.display = display;
IDescriptor descriptor = display.getDescriptor();
ResourceList list = descriptor.getResourceList();
list.addPostAddListener(this);
list.addPostRemoveListener(this);
}
public void dispose() {
ResourceList list = display.getDescriptor().getResourceList();
list.removePostAddListener(this);
list.removePostRemoveListener(this);
}
/**
* Notice a resource has been removed. (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener#notifyRemove
* (com.raytheon.uf.viz.core.drawables.ResourcePair) TODO: This
* approach will be improved in an upcoming DR
*/
@Override
public synchronized void notifyRemove(ResourcePair rp)
throws VizException {
/**
* Pass,if the resource is not interested by ensemble tool
*
*/
if (!isCompatibleResource(rp)) {
return;
}
/**
* Remove it from the resource manager and update GUI Should notice
* GUI
*/
if (getEditor() != null) {
EnsembleResourceManager.getInstance().syncRegisteredResource(
getEditor());
}
}
/**
* Notice a resource has been added. (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.ResourceList.AddListener#notifyAdd(com
* .raytheon .uf.viz.core.drawables.ResourcePair)
*/
@Override
public void notifyAdd(ResourcePair rp) throws VizException {
/**
* Return if the resource is not interested by ensemble tool
*
*/
if (!isCompatibleResource(rp)) {
return;
}
// add the resource pair to the staging list ...
rp.getResource().registerListener((IInitListener) this);
synchronized (batchedPairs) {
batchedPairs.add(rp);
}
}
/**
* Pass a resource into the ensemble resource manager.
*
* @param resourcePairs
*/
private void addBatchedResourcesToManager() {
Iterator<ResourcePair> pairsIter = batchedPairs.iterator();
ResourcePair rp = null;
while (pairsIter.hasNext()) {
rp = pairsIter.next();
if (pairsIter.hasNext()) {
EnsembleResourceManager.getInstance().registerResource(
rp.getResource(), getEditor(), false);
} else {
EnsembleResourceManager.getInstance().registerResource(
rp.getResource(), getEditor(), true);
}
}
synchronized (batchedPairs) {
batchedPairs.clear();
}
}
/**
* Get the current Editor.
*
* @return
*/
private static AbstractEditor getEditor() {
AbstractEditor editor = (AbstractEditor) EditorUtil
.getActiveEditor();
return editor;
}
private boolean isCompatibleResource(ResourcePair rp) {
AbstractVizResource<?, ?> resource = rp.getResource();
if ((resource != null)
&& ((resource instanceof GridResource) || (resource instanceof TimeSeriesResource))) {
return true;
}
return 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) {
/*
* ensemble resources can come in a bunch ... wait for some time to
* pass to batch them ...
*/
if (((LAST_TIME == 0) || ((System.currentTimeMillis() - LAST_TIME) > ALLOW_FOR_BUNCHED_REQUESTS_PERIOD))) {
/*
* TODO: this thread may be superstitious yet is being left here
* until we can verify it is not needed. The very first time any
* resource is inited we sleep for small period to allow other
* similar threads (e.g. in other plug-ins) to have priority in
* acting on the resource.
*/
if (LAST_TIME == 0) {
// poor man's object.wait() for the very first time through
try {
Thread.sleep(50);
} catch (InterruptedException e) {
// ignore
}
}
/**
* Register the resource in to the resource manager
*/
if (forceReset != null) {
synchronized (forceReset) {
// restart the timer for another interval to pass
// before forcing a "final" refresh
if (forceReset.isAlive()) {
forceReset.interrupt();
}
forceReset = null;
forceReset = new Thread(new ForceRefreshIfNecessary(
ALLOW_FOR_BUNCHED_REQUESTS_PERIOD));
forceReset.start();
}
} else {
forceReset = new Thread(new ForceRefreshIfNecessary(
ALLOW_FOR_BUNCHED_REQUESTS_PERIOD));
forceReset.start();
}
} else {
LAST_TIME = System.currentTimeMillis();
}
}
private class ForceRefreshIfNecessary implements Runnable {
int waitForReset = 0;
ForceRefreshIfNecessary(int waitTime) {
waitForReset = waitTime;
}
@Override
public void run() {
try {
Thread.sleep(waitForReset);
addBatchedResourcesToManager();
} catch (InterruptedException e) {
/* ignore */
}
}
}
/**
* Get the IRenderableDisplay
*
* @return the display
*/
public IRenderableDisplay getDisplay() {
return display;
}
}
}

Some files were not shown because too many files have changed in this diff Show more