Re: UnionSet and Animation

Hi Jay,

> > Don't construct a FlatField. Just the FieldImpl, then put
> > your Gridded3DSets into it one at a time via the setSample()
> > method of FieldIMpl.
> I tried this with the following line of code:
> sequence.setSample(0,gsp[0]);
>
> But I get the error:
> Exception in thread "main" visad.TypeException: FieldImpl.setSample: bad 
> range type
>         at visad.FieldImpl.setSample(FieldImpl.java:617)
>
> Other related code:
>   RealType[] time = {RealType.Time};
>  RealTupleType time_type = new RealTupleType(time);
>  RealTupleType xyz = new RealTupleType(x, y, z);
>  Gridded3DSet[] gsp = new Gridded3DSet[1];
>  FunctionType time_samples = new FunctionType(time_type,xyz);
>   DateTime base = new DateTime(1999, 122, 57060);
>  double start = base.getValue();
>  Set time_set = new Linear1DSet(time_type, start, start + 1.0, ntimes1);
>  FieldImpl sequence = new FieldImpl(time_samples, time_set);
>
> Have I made a mistake in creating the FieldImpl? My mathtype should be
> (time->Set(x,y,z))

Yes, that's the problem. Use this for time_samples:

  FunctionType time_samples
    new FunctionType(time_type, new SetType(xyz));

Then:

  sequence.setSample(0,gsp[0]);

should work. Of course, you'll want to call it 'ntimes1'
times with something like:

  for (int i=0; i<ntimes1; i++) {
    . . .
    gsp[i] = new Gridded3DSet(...)
    sequence.setSample(i ,gsp[i]);
  }

Good luck,
Bill