Re: Program to visualize layers: revisited

Hi Ugo,
> . . .
> I'd like to have L "surfaces" (here NOT the Earth's surface
> only, but rather to be understood as layers, that is, soil
> layers, for example).  Each of these surfaces has an attribute,
> so that's what I meant with the "2": for every layer there
> is a depth and a correspondig attribute.  These layers are
> not at some constant depth level.
> . . .
Thanks for the information - now I understand and it should be
possible to solve your problem.  I am posting this to the list
since there are others with similar data and (I hope) this
email has useful information for working with such data.
Here are four choices for MathType and mappings depending on how
you want your data displayed.
1. Use a MathType like:
  (level -> ( (X-Axis, Y-Axis) -> (Elevation, Overlay) ) )
with the mappings:
  X-Axis -> XAxis
  Y-Axis -> YAxis
  Elevation -> ZAxis
  Overlay -> RGB
  level -> SelectRange   (or level -> SelectValue)
plus maybe a ConstantMap to Display.Alpha.
This would display each layer as a colored surface, and allow
you to select which layers are displayed.  If you map layer to
SelectValue, you can only see one layer at a time.  If you map
layer to SelectRange, you can see a range of layers at once.
You might also want a ConstantMap to Display.Alpha to make the
layers semi-transparent.
Note that the data object with MathType:
  (level -> ( (X-Axis, Y-Axis) -> (Elevation, Overlay) ) )
would be a FieldImpl, and each sample would be a FlatField with
MathType ( (X-Axis, Y-Axis) -> (Elevation, Overlay) ), just like
the 'ff' data object in DEMViewer.
2. Modify the above approach, by putting the surface data in a
separate data objectw with MathType:
  ( (X-Axis, Y-Axis) -> (Elevation, Overlay) )
This would allow the surface data to be independently selected
for display in combination with a selected underground layer, or
with a selected range of underground layers.  You would probably
implement selection of the surface with a JButton, making the
surface disappear by a setData(null) on the surface
DataReference, and make the surface re-appear by a setData(ff)
on the surface DataReference.
3. If you want to see 3-D iso-surfaces of underground attribute
values, then you'd use the MathType:
  ( (X-Axis, Y-Axis, level) -> Overlay )
This is a FlatField, but you would use a Gridded3DSet for its
domain Set, rather than a Linear3DSet.  The Gridded3DSet
constructor takes an array samples[3][number_of_grid_points]
of grid point locations.  The samples[0][*] values are the
X-Axis coordinates and the samples[1][*] values are the Y-Axis
coordinates - these would probably just be a regular lattice.
But the samples[2][*] values would be the heights of the layers.
The samples values for row = x, column = y and layer = z would be:
  samples[0][x + LengthX * (y + LengthY * z)] = x
  samples[1][x + LengthX * (y + LengthY * z)] = y
  samples[2][x + LengthX * (y + LengthY * z)]
    Elevation of layer z at row = x and column = y
This will make a 'curvy' 3-D grid.  Hopefully, because the
grid follows your layers, you don't need too many grid levels.
By the way, how many layers do you have (in a typical data set)?
Then you would look at iso-surfaces with the following mappings:
  X-Axis -> XAxis
  Y-Axis -> YAxis
  level -> ZAxis
  Overlay -> IsoContour
If you do have a large number of layers, you may run out of
memory.  Just to make sure you've got it right, you could
resample to a smaller LengthX, LengthY and number of layers.
Or you can add swap space and increase -mxNNNm.  We will try
to find ways to reduce memory use soon.
Given a FlatField with MathType:
  ( (X-Axis, Y-Axis, level) -> Overlay )
you could also use the FlatField.resample() to extract planar
slices for visualization.  The Set argument to resample would
be a rectangular array of sample locations lying on the plane
and resample would return a FlatField whose visualization
should be a colored plane (with proper mappings).
4. If iso-surfaces just cannot work because of memory use, another
approach is to use the MathType:
  (level -> ( (X-Axis, Y-Axis) -> (Elevation, Overlay) ) )
described in 1. above, but to use the mappings:
  X-Axis -> XAxis
  Y-Axis -> YAxis
  Elevation -> ZAxis
  Overlay -> IsoContour
This will display a set of contour lines on each layer.  You might
also add the mapping 'Overlay -> RGB' to color the contours so it
is easier to associate contours on different layers.  This approach
has the advantage of showing where the layers are, as well as the
I think this is a very interesting problem and am sure we can find
a way for VisAD to work well for you.  So please keep me posted on
your progress and any problems you have.
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
whibbard@xxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738