Re: Problems to get data into VisAD

Hallo Bill,

sorry, but until now I have some things to do, so there was no time to answer.

Bill Hibbard wrote:

Hi Olav,

We would be very interested to see the complete message
printed by the NullPointerException, including the stack
dump with line numbers.
Here you can see the complete message.

java.lang.NullPointerException
       at visad.Gridded3DSet.makeIsoLines(Gridded3DSet.java:1695)
       at visad.ShadowType.makeContour(ShadowType.java:3525)
       at visad.java2d.ShadowTypeJ2D.makeContour(ShadowTypeJ2D.java:286)
at visad.ShadowFunctionOrSetType.doTransform(ShadowFunctionOrSetType.java:2058) at visad.java2d.ShadowFunctionOrSetTypeJ2D.doTransform(ShadowFunctionOrSetTypeJ2D.java:98) at visad.java2d.DefaultRendererJ2D.doTransform(DefaultRendererJ2D.java:101)
       at visad.java2d.RendererJ2D.doAction(RendererJ2D.java:140)
       at visad.DisplayImpl.doAction(DisplayImpl.java:1521)
       at visad.java2d.DisplayImplJ2D.doAction(DisplayImplJ2D.java:306)
       at visad.ActionImpl.run(ActionImpl.java:243)
       at visad.util.ThreadPool$ThreadMinnow.run(ThreadPool.java:95)

The ProductSet is the Cartesian product, so given four Sets
with domain dimension = 2, their ProductSet has domain
dimension = 8. But your MathType dimension = 2, so you get
the message.

If your Gridded2DSets do not overlap, then you want their
UnionSet.
Thank you for your explanation. I have switched to UnionSet. Still now I have a problem to get my data (e.g. temperature) into the FlatField. When I use this code

UnionSet finalSet = new UnionSet(reader.getCoordinateTuple (),domainSet);
FlatField val_ff = new FlatField (funcDomainTemperature, finalSet);

for(i=0; i<axis.size (); i++)
     {
        double[][] variableValues = (double[][])variable.get (i);
        int y = variableValues.length-1;
double[][] tempSamples = new double[1][variableValues[y].length];
        for(j = 0; j < variableValues[y].length; j++)
        {
           tempSamples[0][j] =  variableValues[y][j];
        }
val_ff.setSamples (tempSamples); }
I get the following message

visad.FieldException: setSamples: bad array length
       at visad.FlatField.setSamples(FlatField.java:697)
       at visad.FlatField.setSamples(FlatField.java:652)
at de.cle.visad.loader.TecPlotAdapterGraphicsTest01.main(TecPlotAdapterGraphicsTest01.java:130)

At the documentation I have found nothing about UnionSets and the setSample method.

If they do overlap, then the combined topology will not
be a simple union of gridded topologies, and you will
need to merge arrays of explicit locations for each grid
and pass the merged locations to an Irregular2DSet. You
can either compute the merged topology using a DelaunayCustom
object, or you can let Irregular2DSet compute it using a
Delaunay algorithm, which are slow.

Also, I would avoid using "Double" Set (e.g., Gridded2DDoubleSet),
unless your locations really do need double precision. We
use it for combined dates and times, but it shouldn't be
necessary for most spatial locations.

I hope somebody have an idea how I can solve my problems.

Thanks

Olav