Re: Saving VisAD Data objects

Steve designed and*Node and I see
that he has addressed that part of the question.
A FlatField generally has a type like:
  ( (nameD1, nameD2, ..., nameDN) -> (nameR1, nameR2, ..., nameRM) )
and you could view this as N + M named columns of records, where the
first N columns (nameD1, ..., nameDN) are a key (D stands for domain
and R stands for range, denoting functional dependency).
A complex hierarchical type like:
  ( ( (A, B) -> (C, (D -> E) ) ), (G -> (H -> I) ) )
can always be flattened into the FlatField form but possibly with
great inefficiency.  Of course, for FITS files you only need to
flaten to a Tuple of FlatFields; in which case the type above
flattens to:
  ( ( (A, B, D) -> (C, E) ), ( (G, H) -> I) )
Of course, the great thing about Forms is that their methods can
always throw Exceptions if they don't like their input - no one
Form is assumed to do everything.  In particular, there are many
VisAD Data objects that cannot be reasonably saved to FITS or
other file formats.
_From a practical point of view for an initial pass at defining
the save method in FitsForm, I'd save each FlatField as a
FITS image or table (I'm not sure how an extended image differs
from an image), and just make a file with many images and
It would be useful to know what FITS custom is regarding time
sequences of images.  Should:
  (time -> ( (line, element) -> radiance) )
be flattened to:
  ( (time, line, element) -> radiance)   ?
Note that the Form does the inverse
'un-flatten' in its open method.
One other thing.  In your recurse method I'd try to avoid:
  d[obj.getColumnIndex()][obj.getRowIndex()] = real.getValue();
which is making three method calls to set a value in an array.
If you map FlatFields to FITS images and tables, you can extract
the values from the FlatField as arrays and then shuffle them
into the arrays for the images or table without any method calls.
By the way, what Sun really said about Java 3D and jdk1.2beta3
is that they would be released some time between 13 March 98
(today) and 24 March 98.  So it could happen any time now.
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
whibbard@xxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738