AW: Gidded2DSet

Hi Tom,

thanks for your help!

So...
---
                // Create the grid
                float[][] grid = new float[2][xCoordinates.length *
yCoordinates.length];
                int count = 0;

                for (int j=0; j<yCoordinates.length; j++) {
                        for (int i=0; i<xCoordinates.length; i++) {

                                grid[0][count] = xCoordinates[i];
                                grid[1][count] = yCoordinates[j];       
                                count++;
                        }
                }

                Gridded2DSet set = null;

                set = new Gridded2DSet(this.cubeTuple,
                                        grid,
                                        xCoordinates.length,
                                        yCoordinates.length);
---
... does the job.


And...
---
                for (int i=0; i<xCoordinates.length; i++) {
                        for (int j=0; j<yCoordinates.length; j++) {

                                grid[0][count] = xCoordinates[i];
                                grid[1][count] = yCoordinates[j];       
                                count++;
                        }
                }
---
... does not.



Best wishes,
Eugen









-----Ursprüngliche Nachricht-----
Von: Tom Rink [mailto:rink@xxxxxxxxxxxxx]
Gesendet: Montag, 13. Februar 2006 16:44
An: STAAB, Eugen
Cc: visad@xxxxxxxxxxxxxxxx
Betreff: Re: Gidded2DSet


Hi Eugen,

The first dimension in your float[2][3*4] array should be the
fastest varying dimension (VisAD convention), so this should
work if you invert the [3*4] arrays.

Tom

STAAB, Eugen wrote:

>Hi there,
>
>are only quadratic Gridded2DSets allowed?
>Or: Why is a Gridded2DSet with the following coordinates not valid?
>
>new float[]{0,6,9}   // X-Coordinates
>new float[]{0,7,8,9} // Y-Coordinates
>
>Which makes up the following float[2][3*4] Array of Coordinates:
>[[0.0, 0.0, 0.0, 0.0, 6.0, 6.0, 6.0, 6.0, 9.0, 9.0, 9.0, 9.0],
>[0.0, 7.0, 8.0, 9.0, 0.0, 7.0, 8.0, 9.0, 0.0, 7.0, 8.0, 9.0]]
>
>
>A VisadException Exception is thrown in the Samples consistency test 
>of the Gridded2DSet class, line 171 ("Gridded2DSet: samples do not form a
>valid grid (0,0)").
>
>The values of the variables at the point of the thrown expection are:
>
>i= 0
>j= 0
>
>xpos= -42.0
>
>w1= -42.0
>w2= 12.0
>w3= 54.0
>w4= 0.0
>v00= float[2]  (id=38)
>       [0]= 0.0
>       [1]= 0.0
>v10= float[2]  (id=39)
>       [0]= 0.0
>       [1]= 7.0
>v01= float[2]  (id=40)
>       [0]= 0.0
>       [1]= 9.0
>v11= float[2]  (id=41)
>       [0]= 6.0
>       [1]= 0.0
>
>So, w2, w3 and w4 would cause the exception to be thrown.
>Is this intended?
>
>
>Thanks for your help!
>
>
>Best wishes,
>Eugen
>
>  
>


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