Re: UnionSet and Animation

Hello Jay,

The range of the field is not a single Gridded3DSet, it is a tuple. So instead of creating a single Gridded3DSet, and calling setSample once, you need to create each tuple individually, and call setSample once per timestep.

Try something like this:

RealTuple[] rta = new RealTuple[6];
rta[0] = new RealTuple(xyz, new double[] {291.0d, 24.0d, 255.0d});
rta[1] = new RealTuple(xyz, new double[] {190.0d, 92.0d, 217.0d});
rta[2...5] = ....

for (int i = 0; i < ntimes1; i++) {
  anim.setSample(i, rta[i]);
}


(note: haven't compiled or checked the above... hope it helps)

Cheers,

James


Jay Patel wrote:
Hi,

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))

Thanks,
Jay