From 82ee3e71043e30b97932312e6b1fec25400d2358 Mon Sep 17 00:00:00 2001 From: Nate Jensen Date: Thu, 20 Mar 2014 09:38:07 -0500 Subject: [PATCH 1/4] Issue #2919 fix windows error due to gempak library missing Former-commit-id: 5a2ba132d9e32ce8a018f35ba2524881e5276120 --- .../ThinClientPluginBlacklist.txt | 1 + .../viz/gempak/nativelib/LibraryLoader.java | 34 +++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/cave/com.raytheon.uf.viz.thinclient.cave/ThinClientPluginBlacklist.txt b/cave/com.raytheon.uf.viz.thinclient.cave/ThinClientPluginBlacklist.txt index 22c6b9395c..0927149bfb 100644 --- a/cave/com.raytheon.uf.viz.thinclient.cave/ThinClientPluginBlacklist.txt +++ b/cave/com.raytheon.uf.viz.thinclient.cave/ThinClientPluginBlacklist.txt @@ -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 diff --git a/ncep/gov.noaa.nws.ncep.viz.gempak.nativelib/src/gov/noaa/nws/ncep/viz/gempak/nativelib/LibraryLoader.java b/ncep/gov.noaa.nws.ncep.viz.gempak.nativelib/src/gov/noaa/nws/ncep/viz/gempak/nativelib/LibraryLoader.java index 3f68c6dcad..bf57595dd7 100644 --- a/ncep/gov.noaa.nws.ncep.viz.gempak.nativelib/src/gov/noaa/nws/ncep/viz/gempak/nativelib/LibraryLoader.java +++ b/ncep/gov.noaa.nws.ncep.viz.gempak.nativelib/src/gov/noaa/nws/ncep/viz/gempak/nativelib/LibraryLoader.java @@ -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 + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- -----------------------------------------
+ * --/--/----                         Initial Creation
+ * Mar 20, 2014  2919     njensen     Safety checks, better error messages
+ * 
+ * 
+ * + */ + 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); } } From effb0bfcd8a85700099cc153fda24ec69573eb91 Mon Sep 17 00:00:00 2001 From: Ben Steffensmeier Date: Thu, 20 Mar 2014 13:18:40 -0500 Subject: [PATCH 2/4] Issue #2932 improve compatibility of pop skewT and blended resources. Former-commit-id: 49ffd67e77fef3c76f712cdf0eaa9b5e8ecff737 --- .../D2DPopupSkewTDisplayCustomizer.java | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/cave/com.raytheon.uf.viz.d2d.ui.popupskewt/src/com/raytheon/uf/viz/d2d/ui/popupskewt/D2DPopupSkewTDisplayCustomizer.java b/cave/com.raytheon.uf.viz.d2d.ui.popupskewt/src/com/raytheon/uf/viz/d2d/ui/popupskewt/D2DPopupSkewTDisplayCustomizer.java index 8342e67e9e..0004f57cc1 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui.popupskewt/src/com/raytheon/uf/viz/d2d/ui/popupskewt/D2DPopupSkewTDisplayCustomizer.java +++ b/cave/com.raytheon.uf.viz.d2d.ui.popupskewt/src/com/raytheon/uf/viz/d2d/ui/popupskewt/D2DPopupSkewTDisplayCustomizer.java @@ -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. * * * @@ -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) { From 4db73e42a5d2282f689984f7e72bbb9776cbfcba Mon Sep 17 00:00:00 2001 From: Mike Duff Date: Mon, 24 Mar 2014 08:19:21 -0500 Subject: [PATCH 3/4] Issue #2941 - Sort data before returning Former-commit-id: 6c9ebb120761257af5e8d6ec08fa9634e5e55185 --- .../uf/edex/database/handlers/TimeQueryHandler.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/handlers/TimeQueryHandler.java b/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/handlers/TimeQueryHandler.java index 50c6ea480c..b8a15ad4b9 100644 --- a/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/handlers/TimeQueryHandler.java +++ b/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/handlers/TimeQueryHandler.java @@ -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. * * * @@ -180,6 +182,8 @@ public class TimeQueryHandler implements IRequestHandler { } } } + + Collections.sort(times); return times; } From 9f3c5dcc42dfaecb4f686a930e4ab623b0821416 Mon Sep 17 00:00:00 2001 From: Dave Hladky Date: Thu, 20 Mar 2014 15:13:35 -0500 Subject: [PATCH 4/4] Issue #2939 Madis data mismatches Change-Id: Iaee59a73c41419ebc45fc76f90bd26ba6370a3f2 Former-commit-id: 4105db3604440c6c01b99a11fdc0573e6934376c --- .../common/dataplugin/madis/MadisRecord.java | 30 +++++- .../res/spring/madis-ogc-registry.xml | 3 +- .../plugin/madis/MadisPointDataTransform.java | 96 ++++--------------- 3 files changed, 47 insertions(+), 82 deletions(-) diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.madis/src/com/raytheon/uf/common/dataplugin/madis/MadisRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.madis/src/com/raytheon/uf/common/dataplugin/madis/MadisRecord.java index dd37c4793a..4281638162 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.madis/src/com/raytheon/uf/common/dataplugin/madis/MadisRecord.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.madis/src/com/raytheon/uf/common/dataplugin/madis/MadisRecord.java @@ -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. * * * @@ -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; + } } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.madis.registry/res/spring/madis-ogc-registry.xml b/edexOsgi/com.raytheon.uf.edex.plugin.madis.registry/res/spring/madis-ogc-registry.xml index 310c40feb5..bd5a73824c 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.madis.registry/res/spring/madis-ogc-registry.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.madis.registry/res/spring/madis-ogc-registry.xml @@ -22,8 +22,7 @@ - + diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.madis/src/com/raytheon/uf/edex/plugin/madis/MadisPointDataTransform.java b/edexOsgi/com.raytheon.uf.edex.plugin.madis/src/com/raytheon/uf/edex/plugin/madis/MadisPointDataTransform.java index f18ab28ec8..a137bba29e 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.madis/src/com/raytheon/uf/edex/plugin/madis/MadisPointDataTransform.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.madis/src/com/raytheon/uf/edex/plugin/madis/MadisPointDataTransform.java @@ -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. * * * @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 pdvs = new HashMap(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) {