Issue #2661 Fix Helicity, Derivative, and all XY displays of vectors.

Former-commit-id: 386b6a2499 [formerly 2cf496ca84] [formerly 937b3071d4] [formerly 386b6a2499 [formerly 2cf496ca84] [formerly 937b3071d4] [formerly ca90137801 [formerly 937b3071d4 [formerly 3f7342fc4f280180af46290b9afc7a047e16ce4a]]]]
Former-commit-id: ca90137801
Former-commit-id: 028bfc35f6 [formerly fb5b367ecc] [formerly a03c7a16df951c26dd80622d531ce31fa0468d4d [formerly 0f6f60a132]]
Former-commit-id: a78a80a74c0fd4582b22dd78f96fea8968d00e02 [formerly 47c3c6845b]
Former-commit-id: e0c97ad986
This commit is contained in:
Ben Steffensmeier 2014-02-17 12:08:02 -06:00
parent 0b4b1850e6
commit 52842bed96
15 changed files with 183 additions and 243 deletions

View file

@ -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

View file

@ -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;
}
}

View file

@ -63,15 +63,17 @@ import com.vividsolutions.jts.geom.Coordinate;
* <pre>
*
* 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.
*
*
* </pre>
*
@ -368,9 +370,6 @@ public class GridCSAdapter extends AbstractCrossSectionAdapter<GridRecord> {
yRecords.add((GridRecord) pdo);
}
this.yRecords.put(time, yRecords);
if (yRecords.isEmpty()) {
System.out.println("No Y Data");
}
return yRecords;
}
}

View file

@ -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;
* <pre>
*
* 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.
*
* </pre>
*
@ -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) {

View file

@ -69,11 +69,12 @@ import com.vividsolutions.jts.geom.Coordinate;
* <pre>
*
* 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.
*
* </pre>
*
@ -131,7 +132,6 @@ public class PointDataTimeSeriesAdapter extends
String parameter = resourceData.getYParameter().code;
boolean isIcon = displayType == DisplayType.ICON;
Map<String, RequestConstraint> constraints = new HashMap<String, RequestConstraint>(
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<XYData> data = new ArrayList<XYData>();
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));
}
}

View file

@ -62,10 +62,11 @@ import com.raytheon.viz.grid.inv.GridInventory;
* <pre>
*
* 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.
*
* </pre>
*
@ -89,10 +90,10 @@ public class GridVarHeightAdapter extends AbstractVarHeightAdapter<GridRecord> {
@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<GridRecord> {
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<GridRecord> {
for (DataTime key : keys) {
Set<GridRecord> 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<GridRecord> {
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];

View file

@ -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;
* <pre>
*
* 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.
*
* </pre>
*
@ -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()) {

View file

@ -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)

View file

@ -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]

View file

@ -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 )

View file

@ -82,15 +82,10 @@ public class DerivedRequestableData extends AbstractRequestableData {
List<IDataRecord> 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);

View file

@ -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

View file

@ -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.
*
* <pre>
*
* 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.
*
*
* </pre>
*
* @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<Coordinate> linePoints, List<float[]> 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);
}
}

View file

@ -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;
*
* <pre>
* 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.
*
* </pre>
*
* @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<float[]> 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 {

View file

@ -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;
* <pre>
*
* 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.
*
* </pre>
*
* @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) {