Re: Combining animations in spreadsheet

John,

>> I have data with a MathType like:
>> 
>> (Time -> ((lat, lon) -> value))
>> 
>> I would like to be able to do a combine on multiple cells like this in
>> order to produce animations.  When I do so I get the error:
>> 
>> could not evaluate function "combine"
>> 
>> Is there any way to make this work?

The "combine" function is probably not what you want, since it alters
the MathType of the result.  For example, two spreadsheet cells with
MathType ((x, y) -> (a, b, c)) would have MathType
((x, y) -> (a, b, c, a, b, c)) after being combined.

>It may be difficult to do this in the SpreadSheet, but the
>API gives you a number of ways to program it in a "custom"
>spread sheet.  Basically, create a new FieldImpl with the
>same MathType as your files, but whose domain Set is a
>Gridded1DSet with as many time steps as you have altoghether
>(it can be a Linear1DSet if the times are evenly spaced).
>Then do something like:
>
>  for (int i=0; i<ntimes; i++) {
>    FlatField time_step = field[i].getSample(0);
>    new_field.setSample(i, time_step);
>  }
>
>That is, take the single time step Filed from each file
>and merge them into the new FieldImpl.

Bill didn't mention that you can use the SpreadSheet to call
methods that you've written, to perform custom calculations.
Say you implement Bill's idea above, putting it into a method
with signature:
   public static Data animationMerge(Data[] d);

Then you can call the method using the SpreadSheet formula:
   link(ClassName.animationMerge(A1, B1));
where ClassName is the fully qualified class name containing
the method you wish to execute (e.g., java.lang.Math).  This
syntax would cause the SpreadSheet to pass the data from cells
A1 and B1 to your animationMerge method, then store the
resulting Data object into the cell with the formula.

Hope this helps,
Curtis


  • 1999 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: