Re: FlatField.evaluate() returning missing

Hi Cicero,

There are several possible sources of the problem:

1. The flatSamples array is full of missing values.

2. createDomain() is creating domain Set samples that are
   not located where you are clicking on the screen (i.e.,
   not near the samples of your first Field)

3. The domain_tuple and func_dom_pix MathTypes you are
   using to construct your second Field are not the same
   as the MathTypes for your first Field, perhaps instead
   related by a CoordinateSystem, further confusing the
   location issue.

Of course, there may be a bug in VisAD, but resampling has
been thoroughly exercised and tested for Gridded2DSets.

You may want to experiment with visualizations of your
second Field, possibly overlaid with your first, so make
sure its what you expect.

Good luck,
Bill

On Fri, 2 Sep 2005, Cicero Augusto Wollmann [iso-8859-1] Zandoná wrote:

> Gretings VisAD users,
>
> I have some values stored in a FlatField and I use FlatField.evaluate()  to
> retrive the values it contains, like this:
>
> ------------------------
> //Inside the displayChanged() method of a DisplayListener
>
> VisADRay ray
> display.getDisplayRenderer().getMouseBehavior().findRay(displayEvent.getX(),
> displayEvent.getY());
>
> float[] lon = lonMap.inverseScaleValues(new float[] {(float)
> ray.position[0]});
> float[] lat = latMap.inverseScaleValues(new float[] {(float)
> ray.position[1]});
>
> RealTuple tuple = new RealTuple(new Real[] {
>             new Real(RealType.Longitude, lon[0]),
>                     new Real(RealType.Latitude, lat[0])
>         });
>
> double value = ((Real) vals_ff.evaluate(tuple)).getValue();
>
> ------------------------
>
> And this works fine for the first Field, but when I change the domain I have
> to create another field, and then the evaluate() method starts to return
> "missing" all the time. Here is the FlatField creation code:
>
> ---------------------------
>
> //This if only is true in the first time a new domain is neded
> if (domain_set==null || oldRange!=newRange){
>             domain_set = new Gridded2DSet(domain_tuple,
> createDomain(newRange), DIM, DIM);
>             vals_ff = new FlatField( func_dom_pix, domain_set);
>
>             if (radar_ref == null) {
>                 radar_ref = new DataReferenceImpl("radar_ref");
>                 display.addReference(radar_ref);
>             }
>
>             radar_ref.setData( vals_ff );
>  }
>
>  vals_ff.setSamples(flatSamples);
>
> -----------------------
>
> I dont think the createDomain() method is really important, but I can send it
> if you need. The worst thing is that the problem happens most of the time,
> not everytime. I will try to make a sample to demonstrate in the meantime.
> --
> ____________________
> Cicero A. W. Zandoná
>
> -------------------------------------------------------
>
>