Merge branch 'master_14.2.1' into master_14.2.2

Former-commit-id: 518167e0bb [formerly 529059851a] [formerly 20fef0f15b] [formerly 518167e0bb [formerly 529059851a] [formerly 20fef0f15b] [formerly 79c7ec7ae9 [formerly 20fef0f15b [formerly 92976dff4bbc7ed3c73600f061b5d8ba58dbeb35]]]]
Former-commit-id: 79c7ec7ae9
Former-commit-id: 824e1f6d14 [formerly 20c27a479d] [formerly 05c5a8903cdbc8d381e7bf1456acac3943c3855e [formerly 538b02e42b]]
Former-commit-id: 969a16a0dd7b9f15428b7ccd55f960f38e507c9a [formerly c58835a7e3]
Former-commit-id: c99b4f3027
This commit is contained in:
Brian.Dyke 2014-04-08 13:05:12 -04:00
commit 44ef143788
7 changed files with 106 additions and 92 deletions

View file

@ -26,14 +26,15 @@ import java.util.Set;
import com.raytheon.uf.viz.cloudheight.rsc.CloudHeightResource;
import com.raytheon.uf.viz.cloudheight.rsc.CloudHeightResourceData;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
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.AbstractResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource.ResourceStatus;
import com.raytheon.uf.viz.core.rsc.IInitListener;
import com.raytheon.uf.viz.core.rsc.IResourceGroup;
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;
@ -53,9 +54,10 @@ import com.raytheon.viz.ui.perspectives.IRenderableDisplayCustomizer;
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 31, 2013 2190 mschenke Initial creation
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Jul 31, 2013 2190 mschenke Initial creation
* Mar 20, 2014 2932 bsteffen Better support of blended resources.
*
* </pre>
*
@ -198,8 +200,22 @@ public class D2DPopupSkewTDisplayCustomizer implements
}
private boolean isCompatibleResource(ResourcePair rp) {
return COMPATIBLE_CLASSES.contains(rp.getResourceData().getClass())
&& CloudHeightResource.isValidContributor(rp.getResource());
AbstractResourceData resourceData = rp.getResourceData();
if (resourceData != null) {
if (COMPATIBLE_CLASSES
.contains(rp.getResourceData().getClass())) {
return CloudHeightResource.isValidContributor(rp
.getResource());
} else if (resourceData instanceof IResourceGroup) {
IResourceGroup group = (IResourceGroup) resourceData;
for (ResourcePair internalPair : group.getResourceList()) {
if (isCompatibleResource(internalPair)) {
return true;
}
}
}
}
return false;
}
private synchronized void addResources(IDescriptor descriptor) {

View file

@ -26,6 +26,7 @@ gov.noaa.nws.ncep.viz.rsc.idft
gov.noaa.nws.ncep.viz.rsc.intlsig
gov.noaa.nws.ncep.viz.rsc.lightning
gov.noaa.nws.ncep.viz.rsc.mosaic
gov.noaa.nws.ncep.viz.rsc.ncgrid
gov.noaa.nws.ncep.viz.rsc.ncscat
gov.noaa.nws.ncep.viz.rsc.nonconvsigmet
gov.noaa.nws.ncep.viz.rsc.plotdata

View file

@ -75,6 +75,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Oct 14, 2013 2361 njensen Removed IDecoderGettable
* Dec 10, 2013 2616 mpduff Added stationId to the unique constraint
* jan 22, 2014 2713 dhladky Calendar conversion.
* Mar 21, 2014 2939 dhladky Fixed mismatches in HDF5, DB records.
*
* </pre>
*
@ -85,7 +86,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@Entity
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "madisseq")
@Table(name = "madis", uniqueConstraints = { @UniqueConstraint(columnNames = {
"location", "stationId", "refTime", "provider", "subProvider", "restriction" }) })
"latitude", "longitude", "stationId", "refTime", "provider", "subProvider", "restriction" }) })
@org.hibernate.annotations.Table(appliesTo = "madis", indexes = { @Index(name = "madis_wfsQueryIndex", columnNames = {
"refTime", "location" }), })
@DynamicSerialize
@ -121,7 +122,7 @@ public class MadisRecord extends PersistablePluginDataObject implements
@Column
@DataURI(position = 4)
private int restriction;
/** A string denoting the time of observation */
@DynamicSerializeElement
@Transient
@ -349,7 +350,7 @@ public class MadisRecord extends PersistablePluginDataObject implements
@DynamicSerializeElement
@Embedded
private PointDataView pointDataView;
public static final String PLUGIN_NAME = "madis";
public static final String STATION_ID = "stationId";
@ -453,6 +454,19 @@ public class MadisRecord extends PersistablePluginDataObject implements
public static final String RESTRICTION = "RESTRICTION";
}
/**
* URI constructor
* @param string
*/
public MadisRecord(String string) {
super();
}
//empty constructor
public MadisRecord() {
}
/**
* Get the pointdata view
@ -1086,4 +1100,14 @@ public class MadisRecord extends PersistablePluginDataObject implements
public String getPluginName() {
return PLUGIN_NAME;
}
/**
* Allow overwrite of MADIS records
* MADIS records are frequently updated for even the same temporal
* record. QC value changes will cause record re-submissions.
* @return
*/
public boolean getAllowOverWrite() {
return true;
}
}

View file

@ -21,6 +21,7 @@ package com.raytheon.uf.edex.database.handlers;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -47,7 +48,8 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 5, 2011 njensen Initial creation
* Apr 05, 2011 njensen Initial creation
* Mar 24, 2014 2941 mpduff Sort data before returning it.
*
* </pre>
*
@ -180,6 +182,8 @@ public class TimeQueryHandler implements IRequestHandler<TimeQueryRequest> {
}
}
}
Collections.sort(times);
return times;
}

View file

@ -22,8 +22,7 @@
<constructor-arg ref="madis-camel" />
</bean>
<bean id="madisSeparator" class="com.raytheon.uf.edex.plugin.madis.MadisSeparator"
depends-on="jmsIngestMadisConfig, jms-madis, madisThreadPool">
<bean id="madisSeparator" class="com.raytheon.uf.edex.plugin.madis.MadisSeparator">
<constructor-arg
value="jms-durable:queue:Ingest.madisSeparator" />
<!-- time in hours for orphan purging -->

View file

@ -47,6 +47,7 @@ import com.raytheon.uf.edex.pointdata.PointDataQuery;
* 28 Mar 2013 1746 dhladky Created
* 10 Jun 2013 1763 dhladky Updates for speed.
* 08 Jul 2013 2171 dhladky Removed dataURI
* 21 Mar 2014 2939 dhladky Fixed mismatches in HDF5, DB records.
* </pre>
*
* @author dhladky
@ -164,8 +165,10 @@ public class MadisPointDataTransform {
public static final String RESTRICTION = "restriction";
public static final String TIME_OBS = "timeObs";
public static final String ID = "id";
public static final String EQUAL = "=";
public static final String[] ALL_PARAMS = { DATASET, DEWPOINT,
DEWPOINT_QCD, DEWPOINT_QCA, DEWPOINT_QCR, RH, RH_QCD, RH_QCA,
@ -249,10 +252,7 @@ public class MadisPointDataTransform {
private PointDataView buildView(PointDataContainer container,
MadisRecord record) {
PointDataView pdv = container.append();
// I think this is inefficient but, PlotData for SVG reads
// the pointDataView so, the first 4 that are already in the
// DB have to be here.
pdv.setLong(TIME_OBS, record.getDataTime().getRefTime().getTime());
pdv.setString(PROVIDER, record.getProvider());
pdv.setString(SUB_PROVIDER, record.getSubProvider());
@ -310,75 +310,10 @@ public class MadisPointDataTransform {
pdv.setString(PRESSURE_QCD, record.getPressure_qcd().toString());
pdv.setInt(PRESSURE_QCA, record.getPressure_qca());
pdv.setInt(PRESSURE_QCR, record.getPressure_qcr());
return pdv;
}
/**
* Creates a MadisRecord from a PointDataContainer
*
* @param pdc
* @return
*/
public static MadisRecord toMadisRecord(MadisRecord mr) {
PointDataView pdv = mr.getPointDataView();
mr.setDataset(pdv.getInt(DATASET));
// dewpoint
mr.setDewpoint(pdv.getFloat(DEWPOINT));
mr.setDewpoint_qcd(QCD.fromString(pdv.getString(DEWPOINT_QCD)));
mr.setDewpoint_qca(pdv.getInt(DEWPOINT_QCA));
mr.setDewpoint_qcr(pdv.getInt(DEWPOINT_QCR));
// relative humidty
mr.setRh(pdv.getFloat(RH));
mr.setRh_qcd(QCD.fromString(pdv.getString(RH_QCD)));
mr.setRh_qca(pdv.getInt(RH_QCA));
mr.setRh_qcr(pdv.getInt(RH_QCR));
// altimeter setting
mr.setAltimeter(pdv.getFloat(ALTIMETER));
mr.setAltimeter_qcd(QCD.fromString(pdv.getString(ALTIMETER_QCD)));
mr.setAltimeter_qca(pdv.getInt(ALTIMETER_QCA));
mr.setAltimeter_qcr(pdv.getInt(ALTIMETER_QCR));
// temperature
mr.setTemperature(pdv.getFloat(TEMPERATURE));
mr.setTemperature_qcd(QCD.fromString(pdv.getString(TEMPERATURE_QCD)));
mr.setTemperature_qca(pdv.getInt(TEMPERATURE_QCA));
mr.setTemperature_qcr(pdv.getInt(TEMPERATURE_QCR));
// wind direction
mr.setWindDirection(pdv.getNumber(WINDDIRECTION).intValue());
mr.setWindDirection_qcd(QCD.fromString(pdv.getString(WINDDIRECTION_QCD)));
mr.setWindDirection_qca(pdv.getInt(WINDDIRECTION_QCA));
mr.setWindDirection_qcr(pdv.getInt(WINDDIRECTION_QCR));
// precip rate
mr.setPrecipRate(pdv.getFloat(PRECIPRATE));
mr.setPrecipRate_qcd(QCD.fromString(pdv.getString(PRECIPRATE_QCD)));
mr.setPrecipRate_qca(pdv.getInt(PRECIPRATE_QCA));
mr.setPrecipRate_qcr(pdv.getInt(PRECIPRATE_QCR));
// WINDSPEED
mr.setWindSpeed(pdv.getFloat(WINDSPEED));
mr.setWindSpeed_qcd(QCD.fromString(pdv.getString(WINDSPEED_QCD)));
mr.setWindSpeed_qca(pdv.getInt(WINDSPEED_QCA));
mr.setWindSpeed_qcr(pdv.getInt(WINDSPEED_QCR));
// Wind Gust
mr.setWindGust(pdv.getFloat(WINDGUST));
mr.setWindGust_qcd(QCD.fromString(pdv.getString(WINDGUST_QCD)));
mr.setWindGust_qca(pdv.getInt(WINDGUST_QCA));
mr.setWindGust_qcr(pdv.getInt(WINDGUST_QCR));
// Precipital Water
mr.setPrecipitalWater(pdv.getFloat(PRECIPITALWATER));
mr.setPrecipitalWater_qcd(QCD.fromString(pdv
.getString(PRECIPITALWATER_QCD)));
mr.setPrecipitalWater_qca(pdv.getInt(PRECIPITALWATER_QCA));
mr.setPrecipitalWater_qcr(pdv.getInt(PRECIPITALWATER_QCR));
// Pressure
mr.setPressure(pdv.getFloat(PRESSURE));
mr.setPressure_qcd(QCD.fromString(pdv.getString(PRESSURE_QCD)));
mr.setPressure_qca(pdv.getInt(PRESSURE_QCA));
mr.setPressure_qcr(pdv.getInt(PRESSURE_QCR));
return mr;
}
/**
* Creates a MadisRecord from a PointDataContainer
*
@ -458,7 +393,7 @@ public class MadisPointDataTransform {
try {
request = new PointDataQuery(MadisRecord.PLUGIN_NAME);
request.requestAllLevels();
request.addParameter(ID, ""+record.getId(), "=");
request.addParameter(ID, String.valueOf(record.getId()), EQUAL);
request.setParameters(ALL_PARAMS_LIST);
result = request.execute();
@ -483,9 +418,7 @@ public class MadisPointDataTransform {
* @return populated Madis record Array
* @throws PluginException
*/
// TODO I would like to make a PointDataInterface that could implement this
// and other methods that all of these
// will use.
public static PluginDataObject[] populatePointDataFields(
PluginDataObject[] records) {
@ -507,10 +440,19 @@ public class MadisPointDataTransform {
request.addParameter(ID, ids.toString(), IN);
request.setParameters(ALL_PARAMS_LIST);
result = request.execute();
// correlate up the PointDataViews with the correct records.
HashMap<Integer, PointDataView> pdvs = new HashMap<Integer, PointDataView>(records.length);
for (int i = 0; i < records.length; i++) {
PointDataView pdv = result.readRandom(i);
toMadisRecord((MadisRecord) records[i], pdv);
// correlate ID from record with ID from PDV
int id = pdv.getInt(ID);
pdvs.put(id, pdv);
}
for (int i = 0; i < records.length; i++) {
int id = records[i].getId();
records[i] = toMadisRecord((MadisRecord)records[i], pdvs.get(id));
}
if (result != null) {

View file

@ -1,5 +1,6 @@
package gov.noaa.nws.ncep.viz.gempak.nativelib;
import java.io.FileNotFoundException;
import java.net.URL;
import org.eclipse.core.runtime.FileLocator;
@ -10,20 +11,47 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
/**
* Utility to load a specific native library
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- ----------- -----------------------------------------
* --/--/---- Initial Creation
* Mar 20, 2014 2919 njensen Safety checks, better error messages
*
* </pre>
*
*/
public class LibraryLoader {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(LibraryLoader.class);
public static void load(String libName) {
URL url = null;
Path path = null;
try {
Bundle b = Activator.getDefault().getBundle();
url = FileLocator.find(b, new Path(System.mapLibraryName(libName)),
null);
path = new Path(System.mapLibraryName(libName));
url = FileLocator.find(b, path, null);
if (url == null) {
throw new FileNotFoundException("Unable to locate "
+ path.toString());
}
url = FileLocator.resolve(url);
System.load(url.getPath());
} catch (Exception e) {
String msg = "Could not Load native Library: " + url.getFile();
String msg = "Could not load native Library: ";
if (url != null) {
msg += url.getFile();
} else {
msg += path.toString();
}
statusHandler.handle(Priority.PROBLEM, msg, e);
}
}