NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Hi Mike, Try something like this: float zplane = ... // the z value of the plane // first compute the x and y extents of the data // to get bounds for a Set in the z plane float xmin = Float.MAX_VALUE; float xmax = Float.MIN_VALUE; float ymin = Float.MAX_VALUE; float ymax = Float.MIN_VALUE; for (int i=0; i<MAX; i++) { if (threeDsamples[0][i] < xmin) xmin = threeDsamples[0][i]; if (threeDsamples[0][i] > xmax) xmax = threeDsamples[0][i]; if (threeDsamples[1][i] < ymin) ymin = threeDsamples[1][i]; if (threeDsamples[1][i] > ymax) ymax = threeDsamples[1][i]; } // create the samples for the Set float[][] plane = new float[3][NUM * NUM]; int k = 0; for (int i=0; i<NUM; i++) { for (int j=0; j<NUM; j++) { plane[0][k] = xmin + (xmax - xmin) * i / (NUM - 1.0f); plane[1][k] = ymin + (ymax - ymin) * j / (NUM - 1.0f); plane[2][k++] = zplane; } } // construct a Gridded3DSet with manifold dimension = 2 // whose N * N samples lie on a plane at z = zplane Gridded3DSet plane_set new Gridded3DSet(grid_type.getDomain(), plane, NUM, NUM); // resample the FlatField to plane_set FlatField fplane = f.reample(plane_set, Data.WEIGHTED_AVERAGE, Data.NO_ERRORS); // now construct a Gridded2DSet in purely (x, y) float[][] plane2 = {plane[0], plane[1]}; RealTupleType xy = new RealTupleType(x, y}; Gridded2DSet xy_set = new Gridded2DSet(xy, plane2, NUM, NUM); FuntionType xy_grid_type = new FunctionType(xy, w); FlatField fxy = new FlatField(xy_grid_type, xy_set); // copy the range values from fplane to fxy fxy.setSamples(fplane.getValues()); // now display fxy with MathType ((x, y) -> w) // and resampling values from the original FlatField on // the plane z = zplane x.setData(fxy); // instead of setData(f); I haven't compiled or run this code, so there may be a few bugs but the basic idea is right, I think. Please let me know if you have problems. Cheers, Bill ---------------------------------------------------------- Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI 53706 hibbard@xxxxxxxxxxxxxxxxx 608-263-4427 fax: 608-263-6738 http://www.ssec.wisc.edu/~billh/vis.html
visad
archives: