From 52842bed9669b73fd4f6c4bf02b5ddcf57b16c76 Mon Sep 17 00:00:00 2001 From: Ben Steffensmeier Date: Mon, 17 Feb 2014 12:08:02 -0600 Subject: [PATCH] Issue #2661 Fix Helicity, Derivative, and all XY displays of vectors. Former-commit-id: 386b6a2499f45db013ffadc12712edba1049ba0a [formerly 2cf496ca84c73d3c2e5487017e52e801f56a6e82] [formerly 937b3071d4e8164c6c00b75ed46aa1810aae39ef] [formerly 386b6a2499f45db013ffadc12712edba1049ba0a [formerly 2cf496ca84c73d3c2e5487017e52e801f56a6e82] [formerly 937b3071d4e8164c6c00b75ed46aa1810aae39ef] [formerly ca901378015b9d3827f6cf7e3493892f156db241 [formerly 937b3071d4e8164c6c00b75ed46aa1810aae39ef [formerly 3f7342fc4f280180af46290b9afc7a047e16ce4a]]]] Former-commit-id: ca901378015b9d3827f6cf7e3493892f156db241 Former-commit-id: 028bfc35f62a6874a9bb79cffb5dcbd3f28d315f [formerly fb5b367ecccaacdc66e1b32afd07739ebe73b946] [formerly a03c7a16df951c26dd80622d531ce31fa0468d4d [formerly 0f6f60a132a705bec7ae67ebd00cbec0ee92dfe5]] Former-commit-id: a78a80a74c0fd4582b22dd78f96fea8968d00e02 [formerly 47c3c6845ba286d7f03fad2486418946728a7d63] Former-commit-id: e0c97ad98671680a367bcb382d2d47ed810b97ea --- .../META-INF/MANIFEST.MF | 59 ++++++-------- .../uf/viz/d2d/xy/adapters/Activator.java | 38 --------- .../adapters/crosssection/GridCSAdapter.java | 23 +++--- .../timeseries/GridTimeSeriesAdapter.java | 77 +++++++++---------- .../PointDataTimeSeriesAdapter.java | 34 ++++---- .../varheight/GridVarHeightAdapter.java | 35 +++++---- .../varheight/PointDataVarHeightAdapter.java | 36 +++++---- .../derivedParameters/functions/Derivative.py | 6 +- .../derivedParameters/functions/Heli.py | 3 +- .../derivedParameters/functions/VertCirc.py | 2 +- .../data/DerivedRequestableData.java | 11 +-- .../META-INF/MANIFEST.MF | 8 +- .../xy/crosssection/CrossSectionRotation.java | 38 ++++----- .../rsc/CrossSectionContourResource.java | 18 ++--- .../rsc/CrossSectionVectorResource.java | 38 ++++----- 15 files changed, 183 insertions(+), 243 deletions(-) delete mode 100644 cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/Activator.java diff --git a/cave/com.raytheon.uf.viz.d2d.xy.adapters/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.d2d.xy.adapters/META-INF/MANIFEST.MF index 3e92d9edce..21fd8fcd28 100644 --- a/cave/com.raytheon.uf.viz.d2d.xy.adapters/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.d2d.xy.adapters/META-INF/MANIFEST.MF @@ -1,46 +1,31 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Name: Adapters +Bundle-Name: D2D Graph Adapters Bundle-SymbolicName: com.raytheon.uf.viz.d2d.xy.adapters;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-Activator: com.raytheon.uf.viz.d2d.xy.adapters.Activator +Bundle-Version: 1.14.0.qualifier Bundle-Vendor: RAYTHEON -Eclipse-RegisterBuddy: com.raytheon.viz.core, com.raytheon.uf.viz.core -Eclipse-BuddyPolicy: ext, global -Require-Bundle: org.eclipse.core.runtime, - com.raytheon.uf.viz.xy.crosssection;bundle-version="1.0.0", - com.raytheon.uf.viz.xy.varheight;bundle-version="1.12.1174", - com.raytheon.uf.viz.core;bundle-version="1.12.1174", - com.raytheon.uf.viz.xy;bundle-version="1.12.1174", - com.raytheon.viz.core;bundle-version="1.12.1174", - com.raytheon.viz.core.graphing;bundle-version="1.12.1174", - com.raytheon.uf.viz.xy.timeseries;bundle-version="1.12.1174", - javax.measure;bundle-version="1.0.0", - com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174", - com.raytheon.uf.common.comm;bundle-version="1.12.1174", - com.raytheon.uf.common.style;bundle-version="1.0.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Import-Package: com.raytheon.uf.common.dataplugin, - com.raytheon.uf.common.dataplugin.grid, - com.raytheon.uf.common.dataplugin.grid.util, - com.raytheon.uf.common.dataplugin.radar, - com.raytheon.uf.common.dataplugin.radar.util, - com.raytheon.uf.common.dataquery.requests, - com.raytheon.uf.common.datastorage, - com.raytheon.uf.common.datastorage.records, +Bundle-ActivationPolicy: lazy +Require-Bundle: com.raytheon.uf.viz.core;bundle-version="1.14.0", + com.raytheon.uf.viz.xy, + com.raytheon.viz.core.graphing, + com.raytheon.uf.viz.xy.crosssection;bundle-version="1.14.0", + com.raytheon.uf.viz.xy.varheight;bundle-version="1.13.0", + com.raytheon.uf.viz.xy.timeseries;bundle-version="1.13.0", com.raytheon.uf.common.geospatial, - com.raytheon.uf.common.gridcoverage, - com.raytheon.uf.common.parameter, - com.raytheon.uf.common.pointdata, - com.raytheon.uf.common.status, - com.raytheon.uf.common.time, - com.raytheon.uf.viz.objectiveanalysis.rsc, + com.raytheon.uf.common.dataplugin, + com.raytheon.uf.common.dataplugin.grid;bundle-version="1.13.0", + com.raytheon.uf.common.pointdata;bundle-version="1.13.0", + com.raytheon.uf.viz.objectiveanalysis, com.raytheon.viz.grid, - com.raytheon.viz.grid.inv, - com.raytheon.viz.radar.util, - org.eclipse.swt.graphics -Export-Package: com.raytheon.uf.viz.d2d.xy.adapters, - com.raytheon.uf.viz.d2d.xy.adapters.crosssection, + com.raytheon.viz.radar, + com.raytheon.uf.common.datastorage, + com.raytheon.uf.common.time, + com.raytheon.uf.common.style, + com.raytheon.uf.common.comm, + javax.measure, + org.eclipse.swt;bundle-version="3.8.0" +Import-Package: com.raytheon.viz.core.map +Export-Package: com.raytheon.uf.viz.d2d.xy.adapters.crosssection, com.raytheon.uf.viz.d2d.xy.adapters.timeseries, com.raytheon.uf.viz.d2d.xy.adapters.varheight -Bundle-ActivationPolicy: lazy diff --git a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/Activator.java b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/Activator.java deleted file mode 100644 index c42a872b84..0000000000 --- a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/Activator.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.raytheon.uf.viz.d2d.xy.adapters; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; - -public class Activator implements BundleActivator { - - // The plug-in ID - public static final String PLUGIN_ID = "com.raytheon.uf.viz.d2d.xy.adapters"; - - private static BundleContext context; - - static BundleContext getContext() { - return context; - } - - /* - * (non-Javadoc) - * - * @see - * org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext - * ) - */ - public void start(BundleContext bundleContext) throws Exception { - Activator.context = bundleContext; - } - - /* - * (non-Javadoc) - * - * @see - * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext bundleContext) throws Exception { - Activator.context = null; - } - -} diff --git a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/crosssection/GridCSAdapter.java b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/crosssection/GridCSAdapter.java index e3e90181ec..bd265171b0 100644 --- a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/crosssection/GridCSAdapter.java +++ b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/crosssection/GridCSAdapter.java @@ -63,15 +63,17 @@ import com.vividsolutions.jts.geom.Coordinate; *
  * 
  * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Nov 23, 2009            mschenke     Initial creation
- * Feb 04, 2011 7953       bkowal       Fill values will now be placed
- *                                      in the data array for anything
- *                                      below 300MB for RUC80.
- * Oct 2, 2012  DR 15259  M.Porricelli  Allow plotting when 3 levels
- *                                      available (DGEX)
- * Sep  9, 2013 2277       mschenke     Got rid of ScriptCreator references
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ------------ ----------------------------------------
+ * Nov 23, 2009           mschenke     Initial creation
+ * Feb 04, 2011  7953     bkowal       Fill values will now be placed in the 
+ *                                     data array for anything below 300MB for 
+ *                                     RUC80.
+ * Oct 02, 2012  15259    M.Porricelli Allow plotting when 3 levels available
+ *                                     (DGEX)
+ * Sep 09, 2013  2277     mschenke     Got rid of ScriptCreator references
+ * Feb 17, 2014  2661     bsteffen     Remove unnecessary output.
+ * 
  * 
  * 
* @@ -368,9 +370,6 @@ public class GridCSAdapter extends AbstractCrossSectionAdapter { yRecords.add((GridRecord) pdo); } this.yRecords.put(time, yRecords); - if (yRecords.isEmpty()) { - System.out.println("No Y Data"); - } return yRecords; } } diff --git a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/GridTimeSeriesAdapter.java b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/GridTimeSeriesAdapter.java index 5dbec9006b..5b0bba4aca 100644 --- a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/GridTimeSeriesAdapter.java +++ b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/GridTimeSeriesAdapter.java @@ -28,7 +28,6 @@ import java.util.Map; import java.util.Set; import java.util.WeakHashMap; -import javax.measure.converter.UnitConverter; import javax.measure.unit.Unit; import com.raytheon.uf.common.dataplugin.PluginDataObject; @@ -36,6 +35,7 @@ import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.dataplugin.grid.util.GridLevelTranslator; import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.datastorage.Request; +import com.raytheon.uf.common.datastorage.records.FloatDataRecord; import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.geospatial.ISpatialObject; import com.raytheon.uf.common.geospatial.MapUtil; @@ -46,6 +46,7 @@ import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.style.level.SingleLevel; import com.raytheon.uf.common.time.DataTime; +import com.raytheon.uf.viz.core.datastructure.CubeUtil; import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.rsc.DisplayType; @@ -61,9 +62,10 @@ import com.raytheon.viz.core.graphing.xy.XYWindImageData; *
  * 
  * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * May 7, 2010            bsteffen     Initial creation
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * May 07, 2010           bsteffen    Initial creation
+ * Feb 17, 2014  2661     bsteffen    Use only u,v for vectors.
  * 
  * 
* @@ -281,53 +283,38 @@ public class GridTimeSeriesAdapter extends } Request request = Request.buildPointRequest(index); - boolean isVectorData = false; - boolean isIcon = displayType == DisplayType.ICON; for (GridRecord rec : gribs) { - IDataRecord[] records = cache.get(rec); if (records == null) { records = DataCubeContainer.getDataRecord(rec, request, null); cache.put(rec, records); } - double specificValue = Double.NaN; - double vectorDirection = Double.NaN; - - // received a (wind) vector result - if (records.length > 1) { - float[] vectorDirections = (float[]) records[1].getDataObject(); - vectorDirection = vectorDirections[0]; - isVectorData = true; - } - - float[] d = (float[]) records[0].getDataObject(); - specificValue = d[0]; - if (specificValue <= -999999) { - continue; - } + + DataTime time = rec.getDataTime(); XYData dataPoint = null; + + if(records.length == 2){ + double u = getValue(records[0]); + double v = getValue(records[1]); + double speed = Math.hypot(u, v); + double dir = Math.toDegrees(Math.atan2(-u, -v)); - // do I need to convert? - if (!rec.getLevel().equals(preferredLevel)) { - Unit dataUnit = levelUnitMap.get(rec.getLevel()); - if (!dataUnit.equals(preferredUnit)) { - // convert - UnitConverter conv = dataUnit.getConverterTo(preferredUnit); - specificValue = conv.convert(specificValue); + if (!Double.isNaN(speed)) { + dataPoint = new XYWindImageData(time, speed, + speed, dir); + } + }else{ + double value = getValue(records[0]); + if (Double.isNaN(value)) { + continue; + } else if (isIcon) { + dataPoint = new XYIconImageData(time, + value, (int) value); + } else { + dataPoint = new XYData(time, value); } - } - - // create appropriate XYData class - if (isVectorData) { - dataPoint = new XYWindImageData(rec.getDataTime(), - specificValue, specificValue, vectorDirection); - } else if (isIcon) { - dataPoint = new XYIconImageData(rec.getDataTime(), - specificValue, (int) specificValue); - } else { - dataPoint = new XYData(rec.getDataTime(), specificValue); } data.add(dataPoint); @@ -339,6 +326,16 @@ public class GridTimeSeriesAdapter extends return list; } + private double getValue(IDataRecord record) { + FloatDataRecord floatRecord = (FloatDataRecord) record; + float value = floatRecord.getFloatData()[0]; + if (value < CubeUtil.MISSING) { + return Double.NaN; + } else { + return value; + } + } + @Override public void remove(DataTime time) { synchronized (recordsByTime) { diff --git a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/PointDataTimeSeriesAdapter.java b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/PointDataTimeSeriesAdapter.java index a6a8222e56..03443fa3ec 100644 --- a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/PointDataTimeSeriesAdapter.java +++ b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/PointDataTimeSeriesAdapter.java @@ -69,11 +69,12 @@ import com.vividsolutions.jts.geom.Coordinate; *
  * 
  * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * May 07, 2010            bsteffen    Initial creation
- * May 09, 2013 1869       bsteffen    Modified D2D time series of point data to
- *                                     work without dataURI.
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * May 07, 2010           bsteffen    Initial creation
+ * May 09, 2013  1869     bsteffen    Modified D2D time series of point data to
+ *                                    work without dataURI.
+ * Feb 17, 2014  2661     bsteffen    Use only u,v for vectors.
  * 
  * 
* @@ -131,7 +132,6 @@ public class PointDataTimeSeriesAdapter extends String parameter = resourceData.getYParameter().code; - boolean isIcon = displayType == DisplayType.ICON; Map constraints = new HashMap( resourceData.getMetadataMap()); String[] parameters = null; @@ -152,28 +152,32 @@ public class PointDataTimeSeriesAdapter extends PointDataContainer pdc = DataCubeContainer.getPointData( recordsToLoad[0].getPluginName(), parameters, resourceData.getLevelKey(), constraints); + + boolean isWind = pdc.getParameters().contains(parameter + "[1]"); + boolean isIcon = displayType == DisplayType.ICON; + ArrayList data = new ArrayList(); for (int uriCounter = 0; uriCounter < pdc.getAllocatedSz(); uriCounter++) { PointDataView pdv = pdc.readRandom(uriCounter); DataTime x = getDataTime(pdv, refTimeOnly); Number y = pdv.getNumber(parameter); - if (x == null) { + if (x == null || y.intValue() < -9000) { continue; } // the parameter is a (wind) vector - if (pdc.getParameters().contains(parameter + "[1]")) { + if (isWind) { + double u = y.doubleValue(); + double v = pdv.getNumber(parameter + "[1]").doubleValue(); + double speed = Math.hypot(u, v); + double dir = Math.toDegrees(Math.atan2(-u, -v)); + + data.add(new XYWindImageData(x, speed, speed, dir)); - if (y.intValue() != -9999) { - double windSpeed = y.doubleValue(); - double windDirection = pdv.getNumber(parameter + "[1]") - .doubleValue(); - data.add(new XYWindImageData(x, y, windSpeed, windDirection)); - } } else if (isIcon) { data.add(new XYIconImageData(x, y, y.intValue())); - } else if (y.intValue() > -9000) { + } else { data.add(new XYData(x, y)); } } diff --git a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/varheight/GridVarHeightAdapter.java b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/varheight/GridVarHeightAdapter.java index f6b2d78c5f..5f9ecab1ac 100644 --- a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/varheight/GridVarHeightAdapter.java +++ b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/varheight/GridVarHeightAdapter.java @@ -62,10 +62,11 @@ import com.raytheon.viz.grid.inv.GridInventory; *
  * 
  * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * May  7, 2010            bsteffen    Initial creation
- * Sep  9, 2013  2277      mschenke    Got rid of ScriptCreator references
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * May  7, 2010           bsteffen    Initial creation
+ * Sep  9, 2013  2277     mschenke    Got rid of ScriptCreator references
+ * Feb 17, 2014  2661     bsteffen    Use only u,v for vectors.
  * 
  * 
* @@ -89,10 +90,10 @@ public class GridVarHeightAdapter extends AbstractVarHeightAdapter { @Override public String getParameterName() { synchronized (records) { - String name = ((GridRecord) records.iterator().next()) + String name = records.iterator().next() .getParameter().getName(); if (name == null || name.isEmpty()) { - name = ((GridRecord) records.iterator().next()).getParameter() + name = records.iterator().next().getParameter() .getAbbreviation(); } return name; @@ -112,7 +113,7 @@ public class GridVarHeightAdapter extends AbstractVarHeightAdapter { if (records == null || records.size() == 0) { return null; } - return ((GridRecord) records.iterator().next()).getParameter() + return records.iterator().next().getParameter() .getUnit(); } @@ -134,7 +135,7 @@ public class GridVarHeightAdapter extends AbstractVarHeightAdapter { for (DataTime key : keys) { Set aRecord = yRecordMap.get(key); if (!aRecord.isEmpty()) { - return ((GridRecord) aRecord.iterator().next()).getParameter() + return aRecord.iterator().next().getParameter() .getUnit(); } } @@ -248,13 +249,17 @@ public class GridVarHeightAdapter extends AbstractVarHeightAdapter { IDataRecord[] results = ((IDataRecord[]) xRecord.getMessageData()); if (results == null) { continue; - } else if (results.length == 4) { - FloatDataRecord speedRec = (FloatDataRecord) results[0]; - FloatDataRecord dirRec = (FloatDataRecord) results[1]; - float speed = InterpUtils.getInterpolatedData(xRect, xPoint.x, - xPoint.y, speedRec.getFloatData()); - float dir = InterpUtils.getInterpolatedData(xRect, xPoint.x, - xPoint.y, dirRec.getFloatData()); + } else if (results.length == 2) { + FloatDataRecord uRec = (FloatDataRecord) results[0]; + FloatDataRecord vRec = (FloatDataRecord) results[1]; + float u = InterpUtils.getInterpolatedData(xRect, xPoint.x, + xPoint.y, uRec.getFloatData()); + float v = InterpUtils.getInterpolatedData(xRect, xPoint.x, + xPoint.y, vRec.getFloatData()); + + double speed = Math.hypot(u, v); + double dir = Math.toDegrees(Math.atan2(-u, -v)); + dataList.add(new XYWindImageData(speed, yVal, speed, dir)); } else { FloatDataRecord xRec = (FloatDataRecord) results[0]; diff --git a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/varheight/PointDataVarHeightAdapter.java b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/varheight/PointDataVarHeightAdapter.java index d0e61748c8..d06e727fb7 100644 --- a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/varheight/PointDataVarHeightAdapter.java +++ b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/varheight/PointDataVarHeightAdapter.java @@ -35,6 +35,7 @@ import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime.FLAG; import com.raytheon.uf.common.time.TimeRange; import com.raytheon.uf.common.time.util.TimeUtil; +import com.raytheon.uf.viz.core.datastructure.CubeUtil; import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.xy.varheight.adapter.AbstractVarHeightAdapter; @@ -48,11 +49,12 @@ import com.raytheon.viz.core.graphing.xy.XYWindImageData; *
  * 
  * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * May 07, 2010            bsteffen    Initial creation
- * May 13, 2013 1869       bsteffen    Modified D2D height Graphs to work
- *                                     without dataURI column.
+ * Date          Ticket#    Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * May 07, 2010           bsteffen    Initial creation
+ * May 13, 2013  1869     bsteffen    Modified D2D height Graphs to work
+ *                                    without dataURI column.
+ * Feb 17, 2014  2661     bsteffen    Use only u,v for vectors.
  * 
  * 
* @@ -145,27 +147,29 @@ public class PointDataVarHeightAdapter extends Number[] y = pdv.getNumberAllLevels(heightScale.getParameter()); // array and checks for wind direction - Number[] windDir = null; - boolean hasWind1Unit = false; + Number[] windV = null; if (pdc.getParameters().contains(parameter + "[1]")) { - hasWind1Unit = true; - windDir = pdv.getNumberAllLevels(parameter + "[1]"); + windV = pdv.getNumberAllLevels(parameter + "[1]"); } // look for valid data points for (int i = 0; i < x.length; i++) { - if (y[i].intValue() > -9998 && x[i].intValue() > -9998) { + if (y[i].intValue() > CubeUtil.MISSING + && x[i].intValue() > CubeUtil.MISSING) { if (y[i].doubleValue() >= min && y[i].doubleValue() <= max) { - if (hasWind1Unit) { - double windSpeed = x[i].doubleValue(); - double windDirection = windDir[i].doubleValue(); - list.add(new XYWindImageData(x[i], y[i], windSpeed, - windDirection)); + if (windV != null) { + double u = x[i].doubleValue(); + double v = windV[i].doubleValue(); + + double speed = Math.hypot(u, v); + double dir = Math.toDegrees(Math.atan2(-u, -v)); + + list.add(new XYWindImageData(speed, y[i], speed, + dir)); } else { list.add(new XYData(x[i], y[i])); } } - } else { } } if (!list.isEmpty()) { diff --git a/cave/com.raytheon.uf.viz.derivparam.python/localization/derivedParameters/functions/Derivative.py b/cave/com.raytheon.uf.viz.derivparam.python/localization/derivedParameters/functions/Derivative.py index 61c045d51e..75c4bc6075 100644 --- a/cave/com.raytheon.uf.viz.derivparam.python/localization/derivedParameters/functions/Derivative.py +++ b/cave/com.raytheon.uf.viz.derivparam.python/localization/derivedParameters/functions/Derivative.py @@ -43,10 +43,8 @@ def execute(A0, A1, B0, B1): if isinstance(A0, tuple): # Do derivitive of components of the vector - u0 = A0[2] - v0 = A0[3] - u1 = A1[2] - v1 = A1[3] + u0,v0 = A0 + u1,v1 = A1 uDeriv = execute(u0, u1, B0, B1) vDeriv = execute(v0, v1, B0, B1) return Vector.componentsTo(uDeriv, vDeriv) diff --git a/cave/com.raytheon.uf.viz.derivparam.python/localization/derivedParameters/functions/Heli.py b/cave/com.raytheon.uf.viz.derivparam.python/localization/derivedParameters/functions/Heli.py index 855eef14aa..1f9d2f2754 100644 --- a/cave/com.raytheon.uf.viz.derivparam.python/localization/derivedParameters/functions/Heli.py +++ b/cave/com.raytheon.uf.viz.derivparam.python/localization/derivedParameters/functions/Heli.py @@ -20,8 +20,7 @@ def execute(uStk, vStk, RM5): - umot = RM5[2] - vmot = RM5[3] + umot,vmot = RM5 u1 = uStk[0] v1 = vStk[0] u2 = uStk[-1] diff --git a/cave/com.raytheon.uf.viz.derivparam.python/localization/derivedParameters/functions/VertCirc.py b/cave/com.raytheon.uf.viz.derivparam.python/localization/derivedParameters/functions/VertCirc.py index 1c69e95bce..c8408145eb 100644 --- a/cave/com.raytheon.uf.viz.derivparam.python/localization/derivedParameters/functions/VertCirc.py +++ b/cave/com.raytheon.uf.viz.derivparam.python/localization/derivedParameters/functions/VertCirc.py @@ -22,4 +22,4 @@ def execute(wind, pvv): """ Combine wind with PVV to prepare the data for Cross Section to do Vertical Circulation Calculations """ - return (pvv, wind[1], wind[2], wind[3] ) + return (wind[0], wind[1], pvv ) diff --git a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/data/DerivedRequestableData.java b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/data/DerivedRequestableData.java index 4c7cff2725..43e556e222 100644 --- a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/data/DerivedRequestableData.java +++ b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/data/DerivedRequestableData.java @@ -82,15 +82,10 @@ public class DerivedRequestableData extends AbstractRequestableData { List finalResult = DerivedParameterGenerator .calculate(request); if (finalResult != null && !finalResult.isEmpty()) { - if (finalResult.size() == 2 || finalResult.size() == 1) { - for (IDataRecord rec : finalResult) { - rec.setName(request.getParameterAbbreviation()); - } - return finalResult.toArray(new IDataRecord[0]); - } else { - throw new VizException( - "Error processing derived parameter, expecting scalar or vector data. Vector data must return u and v components."); + for (IDataRecord rec : finalResult) { + rec.setName(request.getParameterAbbreviation()); } + return finalResult.toArray(new IDataRecord[0]); } } catch (ExecutionException e) { throw new VizException("Error executing Derived Parameter.", e); diff --git a/cave/com.raytheon.uf.viz.xy.crosssection/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.xy.crosssection/META-INF/MANIFEST.MF index 6dffb89e81..933fb198d7 100644 --- a/cave/com.raytheon.uf.viz.xy.crosssection/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.xy.crosssection/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: CrossSection Bundle-SymbolicName: com.raytheon.uf.viz.xy.crosssection;singleton:=true -Bundle-Version: 1.0.1.qualifier +Bundle-Version: 1.14.0.qualifier Bundle-Vendor: RAYTHEON Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy @@ -12,15 +12,15 @@ Require-Bundle: com.raytheon.uf.common.colormap, com.raytheon.uf.common.style, com.raytheon.uf.common.topo, com.raytheon.uf.common.wxmath, - com.raytheon.uf.viz.core, + com.raytheon.uf.viz.core;bundle-version="1.14.0", com.raytheon.uf.viz.d2d.core, com.raytheon.uf.viz.d2d.ui, com.raytheon.uf.viz.xy, com.raytheon.viz.core.contours, com.raytheon.viz.core.graphing, javax.measure, - org.eclipse.core.runtime, - org.eclipse.ui + org.eclipse.core.runtime;bundle-version="3.8.0", + org.eclipse.ui;bundle-version="3.8.0" Import-Package: com.raytheon.viz.core.imagery, com.raytheon.viz.core.map, com.raytheon.viz.core.rsc.jts diff --git a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/CrossSectionRotation.java b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/CrossSectionRotation.java index 8e536c7c02..fb201b0da7 100644 --- a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/CrossSectionRotation.java +++ b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/CrossSectionRotation.java @@ -37,22 +37,23 @@ import com.raytheon.viz.core.slice.request.HeightScale; import com.vividsolutions.jts.geom.Coordinate; /** - * TODO Add Description + * Method for calculating wind relative to the baseline. * *
  * 
  * SOFTWARE HISTORY
  * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 1, 2011            bsteffen     Initial creation
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * Dec 01, 2011           bsteffen    Initial creation
+ * Feb 17, 2014  2661     bsteffen    Use only u,v for vectors.
+ * 
  * 
  * 
* * @author bsteffen * @version 1.0 */ - public class CrossSectionRotation { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(CrossSectionRotation.class); @@ -61,7 +62,7 @@ public class CrossSectionRotation { List linePoints, List floatData, int lineLengthInMeters, HeightScale heightScale, CoordinateReferenceSystem dataCRS) { - if (floatData.size() < 4) { + if (floatData.size() < 2) { return floatData; } RotationMode mode = CrossSectionRotationsFile @@ -69,8 +70,8 @@ public class CrossSectionRotation { if (mode == RotationMode.VR_NO_ROTATION) { return floatData; } - float[] u = floatData.get(2); - float[] v = floatData.get(3); + float[] u = floatData.get(0); + float[] v = floatData.get(1); for (int i = 0; i < u.length; i += 1) { if (u[i] <= -9999) { u[i] = Float.NaN; @@ -133,44 +134,35 @@ public class CrossSectionRotation { return Arrays.asList(result); } case VR_VERT_CIRC: { + if (floatData.size() < 3) { + return floatData; + } float umult = 86400.0f / (lineLengthInMeters); float vmult = 86400.0f / ((heightScale.getDifference()) * 100); - float[] pvv = floatData.get(0); - float[] resultMag = result; + float[] pvv = floatData.get(2); float[] resultU = new float[result.length]; float[] resultV = new float[result.length]; - float[] resultDir = new float[result.length]; for (int j = 0; j < height; j++) { for (int i = 0; i < width; i++) { int idx = j * width + i; resultU[idx] = umult * ((u[idx] * cosRot[i]) + (v[idx] * sinRot[i])); resultV[idx] = vmult * pvv[idx]; - resultMag[idx] = (float) Math.hypot(resultU[idx], - resultV[idx]); - resultDir[idx] = (float) Math.atan2(resultU[idx], - resultV[idx]); } } - return Arrays.asList(resultMag, resultDir, resultU, resultV); + return Arrays.asList(resultU, resultV); } default: { - float[] resultMag = result; float[] resultU = new float[result.length]; float[] resultV = new float[result.length]; - float[] resultDir = new float[result.length]; for (int j = 0; j < height; j++) { for (int i = 0; i < width; i++) { int idx = j * width + i; resultU[idx] = (u[idx] * cosRot[i]) + (v[idx] * sinRot[i]); resultV[idx] = -(u[idx] * sinRot[i]) + (v[idx] * cosRot[i]); - resultMag[idx] = (float) Math.hypot(resultU[idx], - resultV[idx]); - resultDir[idx] = (float) Math.atan2(resultU[idx], - resultV[idx]); } } - return Arrays.asList(resultMag, resultDir, resultU, resultV); + return Arrays.asList(resultU, resultV); } } diff --git a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionContourResource.java b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionContourResource.java index ef8628df98..8fb74e0113 100644 --- a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionContourResource.java +++ b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionContourResource.java @@ -38,9 +38,9 @@ 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.style.ParamLevelMatchCriteria; +import com.raytheon.uf.common.style.StyleException; import com.raytheon.uf.common.style.StyleManager; import com.raytheon.uf.common.style.StyleRule; -import com.raytheon.uf.common.style.StyleException; import com.raytheon.uf.common.style.contour.ContourPreferences; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.IExtent; @@ -69,18 +69,18 @@ import com.vividsolutions.jts.geom.Envelope; * *
  * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 4, 2007             njensen     Initial creation
- * 02/17/09                njensen     Refactored to new rsc architecture
- * Feb 9, 2011  8244       bkowal      Enabled the magnification capability.
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * Dec 04, 2007           njensen     Initial creation
+ * Feb 17, 2009           njensen     Refactored to new rsc architecture
+ * Feb 09, 2011  8244     bkowal      Enabled the magnification capability.
+ * Feb 17, 2014  2661     bsteffen    Use only u,v for vectors.
  * 
  * 
* * @author njensen * @version 1.0 */ - public class CrossSectionContourResource extends AbstractCrossSectionResource implements IResourceDataChanged { private static final transient IUFStatusHandler statusHandler = UFStatus @@ -214,7 +214,7 @@ public class CrossSectionContourResource extends AbstractCrossSectionResource } } List dataList = sliceMap.get(currentTime); - GeneralGridGeometry geometry = (GeneralGridGeometry) this.geometry; + GeneralGridGeometry geometry = this.geometry; try { // Prepare math transforms MathTransform grid2crs = geometry @@ -292,7 +292,7 @@ public class CrossSectionContourResource extends AbstractCrossSectionResource } // worry about the viewed pane? Reduce data etc? if (getCapability(DisplayTypeCapability.class).getDisplayType() == DisplayType.STREAMLINE) { - dataList = Arrays.asList(dataList.get(2), dataList.get(3)); + dataList = Arrays.asList(dataList.get(0), dataList.get(1)); cgs[level] = ContourSupport.createContours(dataList, level, extent, density, geometry, target, contourPrefs); } else { diff --git a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionVectorResource.java b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionVectorResource.java index ae661904e9..74ef425d93 100644 --- a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionVectorResource.java +++ b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionVectorResource.java @@ -24,8 +24,10 @@ import java.util.ArrayList; import org.eclipse.swt.graphics.RGB; import org.opengis.referencing.operation.MathTransform; -import com.raytheon.uf.common.colormap.prefs.ColorMapParameters; import com.raytheon.uf.common.geospatial.ReferencedCoordinate; +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.style.ParamLevelMatchCriteria; import com.raytheon.uf.common.style.StyleException; import com.raytheon.uf.common.style.StyleManager; @@ -37,7 +39,6 @@ import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.rsc.DisplayType; import com.raytheon.uf.viz.core.rsc.LoadProperties; -import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability; import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability; import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability; import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability; @@ -54,20 +55,22 @@ import com.vividsolutions.jts.geom.Coordinate; *
  * 
  * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
+ * Date          Ticket#  Engineer    Description
  * ------------- -------- ----------- --------------------------
- * Jun 15, 2010            bsteffen     Initial creation
- * Feb 14, 2011 8244       bkowal       enabled magnification capability.
+ * Jun 15, 2010           bsteffen    Initial creation
+ * Feb 14, 2011  8244     bkowal      enabled magnification capability.
  * Sep 23, 2013  2363     bsteffen    Add more vector configuration options.
- * Dec 11, 2013 DR 16795   D. Friedman  Transform pixel coordinate in inspect
+ * Dec 11, 2013  16795    D. Friedman Transform pixel coordinate in inspect
+ * Feb 17, 2014  2661     bsteffen    Use only u,v for vectors.
  * 
  * 
* * @author bsteffen * @version 1.0 */ - public class CrossSectionVectorResource extends AbstractCrossSectionResource { + private static final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(AbstractCrossSectionResource.class); /* Unknown source, provides acceptable density. */ private static final int VECTOR_SPACING = 60; @@ -90,8 +93,10 @@ public class CrossSectionVectorResource extends AbstractCrossSectionResource { sr = StyleManager.getInstance().getStyleRule( StyleManager.StyleType.ARROW, match); } catch (StyleException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + statusHandler.handle( + Priority.INFO, + "Unable to load Style rule for: " + + resourceData.getParameter(), e); } if (sr != null) { prefs = sr.getPreferences(); @@ -110,8 +115,8 @@ public class CrossSectionVectorResource extends AbstractCrossSectionResource { if (sliceMap.get(time) == null) { return; } - float[] uData = sliceMap.get(time).get(2); - float[] vData = sliceMap.get(time).get(3); + float[] uData = sliceMap.get(time).get(0); + float[] vData = sliceMap.get(time).get(1); double density = getCapability(DensityCapability.class).getDensity(); RGB color = getCapability(ColorableCapability.class).getColor(); @@ -193,16 +198,11 @@ public class CrossSectionVectorResource extends AbstractCrossSectionResource { && y < geometry.getGridRange().getSpan(1) && sliceMap.get(time) != null) { int index = y * geometry.getGridRange().getSpan(0) + x; - float[] ufd = sliceMap.get(time).get(2); - float[] vfd = sliceMap.get(time).get(3); + float[] ufd = sliceMap.get(time).get(0); + float[] vfd = sliceMap.get(time).get(1); double val = Math.hypot(ufd[index], vfd[index]); - ColorMapParameters colorMapParams = getCapability( - ColorMapCapability.class).getColorMapParameters(); - if (colorMapParams != null) { - val = colorMapParams.getDataToDisplayConverter().convert( - val); - } + s = sampleFormat.format(val); } } catch (Exception e) {