Strange Results for Resampled Irregular3DSet

Hello,

the last thing I need for my application is the use of a set of
not-evenly-spaced data. I thought, it should work by creating a
Irregular3DSet and resampling it to a Linear3DSet (like it is done in Curtis
Rueden's IrregularRenderTest.java). 

There a two pictures attached to this mail. One showing the data of the
Irregular3DSet before being resampled. The other picture shows the resampled
data. 
Is this the foreseen result? Should maybe the Irregular3DSet be used in a
different manner?

My approach was the following:

===============

// First construct a irregular 3D set with given coordinates...


RealType x = RealType.getRealType("x");
RealType y = RealType.getRealType("y");
RealType z = RealType.getRealType("z");
RealTupleType xyz = new RealTupleType(x, y, z);

int xDim = 3;
int yDim = 3;
int zDim = 8;
   
int count = xDim*yDim*zDim;

// Create coordinates
int i = 0;
   
float[] testX = new float[] {0,3,10}; // X coordinates
float[] testY = new float[] {0,3,10}; // Y coordinates
float[] testZ = new float[] {0,1.5F,3,4.5F,6,7.5F,9,10}; // Z coordinates
   
for (float zc : testZ) {
 for (float yc : testY) {
  for (float xc : testX) {
    samples[0][tre] = xc;
    samples[1][tre] = yc;
    samples[2][tre] = zc;
    i++;
  }
 }
}

Irregular3DSet iset = new Irregular3DSet(xyz, samples);



// ...then to create a field for the Irregular3DSet...

FunctionType ftype = new FunctionType(xyz, value);
FlatField field = new FlatField(ftype, iset);
   
float[][] values = new float[1][count];
for (int i=0; i<count; i++) {
 values[0][i] = ... // Some temperature values
}


// ...then to resample the irregular Data to regular Data...

int size = 60;

Linear3DSet set = new Linear3DSet(xyz,
      0, 10, size, 0, 10, size, 0, 10, size);
   
FlatField field2 = new FlatField(ftype, set);

field2 = (FlatField)
      field.resample(set, Data.WEIGHTED_AVERAGE, Data.NO_ERRORS);


// ...and finally to add the data to the display...

DataReferenceImpl ref = new DataReferenceImpl("ref");
ref.setData(field2);
// [...]    
display.addReference(ref);



===============


Thanks a lot for any suggestion!


Best wishes,
Eugen


   
 <<VisAD_Irregular3DSet_Resampled.jpg>>  <<VisAD_Irregular3DSet.jpg>> 

Attachment: VisAD_Irregular3DSet_Resampled.jpg
Description: JPEG image

Attachment: VisAD_Irregular3DSet.jpg
Description: JPEG image

  • 2006 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: