Re: Other DataTypes


> I wish to know is there any other datatypes we can use in VisAD
> besides "RealType"? "RealType" will eat up a lot of memory when my
> data is huge. Is it possible to have something like "ByteType" or
> "IntegerType" to handle the mass data which is byte or integer type?
> (for memory saving purposes).

The issue here is range values inside of FlatFields.  For
example in an image FlatField with MathType:

  ((line, element) -> radiance)

you'd like to store the radiances in bytes rather than
floats.  You can do this by passing an appropriate 

  Set[] range_sets

argument to the FlatField constructor.  This Set[] array has
a Set for each RealType in the range.  In this case just one
for radiance.  If the range Set for a RealType has no more
than 255 samples, then values of that RealType are stored in
bytes (the limit is 255, since there must be an extra code
for missing data).  This could be a Linear1DSet for evenly
spaced samples, or a Gridded1DSet for unevenly spaced samples.
The actual sample values are set by:

  FlatField.setSamples(float[][] values)

These float values are encoded according to the range Sets.
If a float value falls outside the range covered by its range
Set, then it is encoded as missing.

If the range Set for a RealType has no more than 65535
samples, then its values are stored in shorts.

The default range Set is FloatSet, which means just store
floats.  A range Set can also be a DoubleSet, which means
store doubles.  In that case you'd call:

   FlatField.setSamples(double[][] values)

Note also that storing ints does not save space over saving
floats - both are 4 bytes.

Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738