[visad] Gridded2DSet Error

Hello all,

I am using gridded 2D set but,
I got an error : " *Gridded2DSet: samples do not form a valid grid*"
on the line of constructor of *Gridded2DSet.*

*I have tried changing lengthX and lengthY passed as parameter but I dont
know why error is coming.*

       RealType x = RealType.getRealType("x");
        RealType y = RealType.getRealType("y");

        RealTupleType xy = new RealTupleType(x,y);
        RealType value = RealType.getRealType("rh1");

        int yCoordinates= 182;
        int xCoordinates= 4230;
        int count = xCoordinates*yCoordinates; // (182*4230)= 769860


        double latarray[]=new double[count];
        double lonarray[]=new double[count];
        double rh1array[]=new double[count];

//FILL ALL THE ARRAYS ABOVE.

       float[][] samples = new float[2][count];
       int i,j,k=0;
       for ( j=0; j<yCoordinates; j++)
       {
            for ( i=0; i<xCoordinates; i++)
            {
                    samples[0][k] = (float) ((latarray[i]/100)-40);
                    samples[1][k] = (float)((lonarray[i]/100));
                     k++;
            }
       }
       System.out.println("COUNT ::: "+k); //769860
       System.out.println("1.1...........");
   // Irregular2DSet iset = new
Irregular2DSet(xy,samples,null,null,null,null);

 *Gridded2DSet gset= new
Gridded2DSet(xy,samples,xCoordinates,yCoordinates);*
...

Anyone please, guide me how to set grid coordinates to make it work.
My samples are irregular  and I want 2D image type result.


-- 
Thank you.
Devanshi U. Prajapati
LJIET(MCA)
  • 2014 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: