Re: visad.TypeException

"Nash'at Ahmad" wrote:
> I am trying to write an application using visad which reads a datafile
> and displays it in a JInternalFrame. The first time display works fine
> but when I clear the internal frame and try to display a second time 
> I get the following exception:
> visad.TypeException: ScalarType: name already used

On the first pass through, you create a bunch of RealTypes.
On the second pass, you're again trying to create them.

VisAD only allows a given type to be created once.

Instead of doing:

    latitude     = new RealType("latitude");
    longitude    = new RealType("longitude");
    domain_tuple = new RealTupleType(latitude, longitude);
    altitude     = new RealType("altitude", SI.meter, null);

you should do:

    latitude     = RealType.getRealType("latitude");
    longitude    = RealType.getRealType("longitude");
    domain_tuple = RealType.getRealTupleType(latitude, longitude);
    altitude     = RealType.getRealType("altitude", SI.meter, null);