Issue #1058 fix reprojection of wind vectors

Former-commit-id: eee0d925ec [formerly 283781ba03] [formerly c25c08c8e7] [formerly 09c412d754 [formerly c25c08c8e7 [formerly 315965383123120bffe1faa1d63fdfb7b633bc97]]]
Former-commit-id: 09c412d754
Former-commit-id: fbb7642d733d90a42019f35984b47984ce3bdc89 [formerly ea551d3866]
Former-commit-id: 6207cd7310
This commit is contained in:
Ben Steffensmeier 2012-08-14 13:44:21 -05:00
parent 47e3a26d29
commit 1a351fbb0c

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();