Re: Height of data is not displayed correctly

Hi Julia,

I have data sets where most values are very low with only a few but very high peaks (up to 10^10). Sometimes it happens that in the 3D display the peaks do not seem to be displayed according to their actual height but much lower. With the axes scaled according to the max value this is obvious. The red peaks in the attached screenshot should be several 1000 units high but they are displayed only as high as 10 to 15.

What do I have to change for them to be displayed correctly?

I wrote a little application to test this (below), but I can't seem to duplicate your problem.

If you could send some example code to demonstrate this issue, it would be very helpful.



import java.awt.BorderLayout;
import javax.swing.*;
import visad.*;
import visad.java3d.*;
import visad.util.Util;

public class PeaksTest {

 public static void main(String[] args) throws Exception {
   System.out.println("Constructing field...");
   int size = 16;
   float[][] samples = new float[1][size * size];
   for (int y=0; y<size; y++) {
     for (int x=0; x<size; x++) {
       int ndx = y * size + x;
       if (100 * Math.random() < 5) {
         // 5% are spikes
         samples[0][ndx] = (float) (1e5 * Math.random() + 1e5);
         System.out.println("Spike at " + x + "," + y +
           ": " + samples[0][ndx]);
       else {
         // 95% are small
         samples[0][ndx] = (float) (10 * Math.random() + 1);
   RealType x = RealType.getRealType("x");
   RealType y = RealType.getRealType("y");
   RealType value = RealType.getRealType("value");
   RealTupleType xy = new RealTupleType(x, y);
   FunctionType type = new FunctionType(xy, value);
   Integer2DSet set = new Integer2DSet(xy, size, size);
   FlatField field = new FlatField(type, set);
   field.setSamples(samples, false);

   System.out.println("Building display...");
   DisplayImplJ3D display = new DisplayImplJ3D("display");
   DataReferenceImpl ref = new DataReferenceImpl("ref");
   display.addMap(new ScalarMap(x, Display.XAxis));
   display.addMap(new ScalarMap(y, Display.YAxis));
   display.addMap(new ScalarMap(value, Display.RGB));
   display.addMap(new ScalarMap(value, Display.ZAxis));

   JFrame frame = new JFrame("Peaks Test");
   JPanel p = new JPanel();
   p.setLayout(new BorderLayout());