Re: [visad] visad Digest, Vol 51, Issue 7

Hello sir ,

But how to decide the grid size ( where )??

In Constructor of irregularSet or while resampling the data??
I am still not getting proper grid size.
I have posted my program in reply just above my current post.
Hope you've got that mail with attachment.
Thank you...


On Wed, Apr 30, 2014 at 11:30 PM, <visad-request@xxxxxxxxxxxxxxxx> wrote:

> Send visad mailing list submissions to
>         visad@xxxxxxxxxxxxxxxx
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://mailman.unidata.ucar.edu/mailman/listinfo/visad
> or, via email, send a message with subject or body 'help' to
>         visad-request@xxxxxxxxxxxxxxxx
>
> You can reach the person managing the list at
>         visad-owner@xxxxxxxxxxxxxxxx
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of visad digest..."
>
>
> Today's Topics:
>
>    1. Re: Gridded2DSet Error (Curtis Rueden)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 30 Apr 2014 11:15:04 -0500
> From: Curtis Rueden <ctrueden@xxxxxxxx>
> To: Devanshi Prajapati <prajapati.devanshi@xxxxxxxxx>
> Cc: "visad@xxxxxxxxxxxxxxxx" <visad@xxxxxxxxxxxxxxxx>
> Subject: Re: [visad] Gridded2DSet Error
> Message-ID:
>         <CADN69ymDkMf_i_82Eo=N6Xv+pvN-PUYkd=
> 79bKqbanDYjFjKBw@xxxxxxxxxxxxxx>
> Content-Type: text/plain; charset="utf-8"
>
> Hi Devanshi,
>
> > Gridded2DSet: samples do not form a valid grid
>
> Each box of the grid must be convex and non-overlapping with other boxes,
> or you will see this message.
>
> If you need further assistance, please post a complete code example
> somewhere (I recommend as a project on GitHub), so that we can compile and
> run it, and hence help you debug further. Just posting a code fragment is
> not enough because you did not include your actual samples array. In
> general, I would advise doing everything you can to make it easy for us to
> help you.
>
> Regards,
> Curtis
>
>
> On Sun, Apr 20, 2014 at 2:21 AM, Devanshi Prajapati <
> prajapati.devanshi@xxxxxxxxx> wrote:
>
> > Okay, I have tried all constructors of GriddedSet, but same error is
> > coming.
> >
> > And now I am using Irregular2DSet :
> > But the display is BLANK, nothing appears.
> > So,kindly help me to find where I am wrong.
> > And what should be the size in Linear2Dset.
> >
> >   Irregular2DSet gset = new Irregular2DSet(xy, samples, null, null, null,
> > null, true);
> >  FunctionType ftype = new FunctionType(xy, value);
> >         FlatField field = new FlatField(ftype, gset);
> >         float[][] values = new float[1][count];
> >         for ( i=0; i<count; i++)
> >         {
> >             values[0][i] = (float) rh1array[i];
> >         }
> >         field.setSamples(values, false);
> >         System.out.println("3.........resample field to regular grid");
> >     // resample field to regular grid
> > int size=182;                         //4230,10,2,769860;
> >    Linear2DSet set = new Linear2DSet(xy,0, 3600, size, -40, 400, size);
> >     field = (FlatField) field.resampleDouble(set, Data.WEIGHTED_AVERAGE,
> > Data.NO_ERRORS);
> >
> >
> >       System.out.println("4........  create display");
> >     // create display
> >       DisplayImpl display=new DisplayImplJ2D("display");
> >          GraphicsModeControl dispGMC = (GraphicsModeControl)
> > display.getGraphicsModeControl();
> >     dispGMC.setScaleEnable(true);
> >
> >    // display.getGraphicsModeControl().setPointSize(5.0f);
> >     display.addMap(new ScalarMap(x, Display.XAxis));
> >     display.addMap(new ScalarMap(y, Display.YAxis));
> >     ScalarMap color = new ScalarMap(value, Display.RGBA);
> >     display.addMap(color);
> >
> >       System.out.println("5........ add data to display");
> >     // add data to display
> >     DataReferenceImpl ref = new DataReferenceImpl("ref");
> >     ref.setData(field);
> >     display.addReference(ref);
> >  System.out.println("6..............show display onscreen");
> >     // show display onscreen
> >     JFrame frame = new JFrame("Irregular rendering test");
> >    frame.getContentPane().add(display.getComponent());
> >     frame.setBounds(200, 200, 400, 400);
> >     frame.show();
> >       System.out.println("7....END MAIN");
> >
> >
> >
> >
> > On Sat, Apr 19, 2014 at 7:52 PM, Tom Rink <rink@xxxxxxxxxxxxx> wrote:
> >
> >>  Hi Devanshi,
> >>
> >> If the domain samples points are irregular you need to use the
> >> IrregularSet.  If the
> >> points are close to gridded, but with some localized irregularity you
> can
> >> try turning
> >> off the samples consistency check using the appropriate GriddedSet
> >> constructor.
> >>
> >> Tom
> >>
> >>
> >> On 4/18/14 2:23 PM, Devanshi Prajapati wrote:
> >>
> >> 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)
> >>
> >>
> >> _______________________________________________
> >> visad mailing listvisad@xxxxxxxxxxxxxxxx
> >> For list information, to unsubscribe, visit:
> http://www.unidata.ucar.edu/mailing_lists/
> >>
> >>
> >>
> >
> >
> > --
> > Devanshi U. Prajapati
> > LJIET(MCA)
> >
> > _______________________________________________
> > visad mailing list
> > visad@xxxxxxxxxxxxxxxx
> > For list information, to unsubscribe, visit:
> > http://www.unidata.ucar.edu/mailing_lists/
> >
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mailman.unidata.ucar.edu/mailing_lists/archives/visad/attachments/20140430/6b55f9a3/attachment.html
> >
>
> ------------------------------
>
> _______________________________________________
> visad mailing list
> visad@xxxxxxxxxxxxxxxx
> For list information, to unsubscribe, visit:
> http://www.unidata.ucar.edu/mailing_lists/
>
> End of visad Digest, Vol 51, Issue 7
> ************************************
>



-- 
Devanshi U. Prajapati
LJIET(MCA)