Issue #1058 fix reprojection of wind vectors

Former-commit-id: ba9d0b25b5 [formerly ba9d0b25b5 [formerly 8fdc9841f9033720aa0ceb6389e7b1403d75a2d5]]
Former-commit-id: 9c727d2e33
Former-commit-id: e65832b2bf
This commit is contained in:
Ben Steffensmeier 2012-08-14 13:44:21 -05:00 committed by Steve Harris
parent 18c572c983
commit 5112b6ce69

View file

@ -73,7 +73,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 9, 2011 bsteffen Initial creation * Mar 9, 2011 bsteffen Initial creation
* 06/19/2012 14988 D. Friedman Reproject based on conformality * 06/19/2012 14988 D. Friedman Reproject based on conformality
* *
* </pre> * </pre>
* *
@ -124,7 +124,7 @@ public class D2DGribGridResource extends GribGridResource<GridResourceData>
@Override @Override
public GridGeometry2D getGridGeometry() { public GridGeometry2D getGridGeometry() {
if (reprojectionInterpolation == null) { if (reprojectionInterpolation == null) {
return gribModel.getLocation().getGridGeometry(); return super.getGridGeometry();
} else { } else {
return GridGeometry2D.wrap(reprojectionInterpolation return GridGeometry2D.wrap(reprojectionInterpolation
.getTargetGeometry()); .getTargetGeometry());
@ -156,13 +156,13 @@ public class D2DGribGridResource extends GribGridResource<GridResourceData>
Interpolation interp = new BilinearInterpolation(); Interpolation interp = new BilinearInterpolation();
if (data.isVector()) { if (data.isVector()) {
DataSource source = new FloatBufferWrapper( DataSource source = new FloatBufferWrapper(
data.getUComponent(), getGridGeometry()); data.getUComponent(), super.getGridGeometry());
FloatArrayWrapper dest = new FloatArrayWrapper( FloatArrayWrapper dest = new FloatArrayWrapper(
reprojectionInterpolation.getTargetGeometry()); reprojectionInterpolation.getTargetGeometry());
float[] udata = reprojectionInterpolation.reprojectedGrid( float[] udata = reprojectionInterpolation.reprojectedGrid(
interp, source, dest).getArray(); interp, source, dest).getArray();
source = new FloatBufferWrapper(data.getVComponent(), source = new FloatBufferWrapper(data.getVComponent(),
getGridGeometry()); super.getGridGeometry());
dest = new FloatArrayWrapper( dest = new FloatArrayWrapper(
reprojectionInterpolation.getTargetGeometry()); reprojectionInterpolation.getTargetGeometry());
float[] vdata = reprojectionInterpolation.reprojectedGrid( float[] vdata = reprojectionInterpolation.reprojectedGrid(
@ -211,7 +211,7 @@ public class D2DGribGridResource extends GribGridResource<GridResourceData>
} else { } else {
DataSource source = new FloatBufferWrapper( DataSource source = new FloatBufferWrapper(
data.getScalarData(), getGridGeometry()); data.getScalarData(), super.getGridGeometry());
FloatArrayWrapper dest = new FloatArrayWrapper( FloatArrayWrapper dest = new FloatArrayWrapper(
reprojectionInterpolation.getTargetGeometry()); reprojectionInterpolation.getTargetGeometry());
float[] fdata = reprojectionInterpolation.reprojectedGrid( float[] fdata = reprojectionInterpolation.reprojectedGrid(
@ -278,9 +278,10 @@ public class D2DGribGridResource extends GribGridResource<GridResourceData>
if (location != null && location.getSpacingUnit().equals("degree")) { if (location != null && location.getSpacingUnit().equals("degree")) {
double dx = location.getDx(); double dx = location.getDx();
Integer nx = location.getNx(); Integer nx = location.getNx();
//if (dx * nx >= 360) { // Test changed for DR 14988 to the following // if (dx * nx >= 360) { // Test changed for DR 14988 to the
// following
if (! ConformalityUtil.testConformality(location.getGridGeometry(),
if (!ConformalityUtil.testConformality(location.getGridGeometry(),
descriptor.getGridGeometry())) { descriptor.getGridGeometry())) {
try { try {
GridGeometry2D sourceGeometry = location.getGridGeometry(); GridGeometry2D sourceGeometry = location.getGridGeometry();