# Re: Program to visualize layers

```Hi Ugo,

> . . . When one thinks of surfaces at some Z value, it doesn't
> necessarily have to be a mapping like ((X, Y) -> Z). In fact,
> strictly spreaking it isn't, because we eventualy have some, say,
> surface attribute A that's is a mapping ((X, Y, Z) -> A).

Well, if your data describe a topographical surface, such as
the Earth's surface, then you have a unique Z value as a function
of X and Y and the MathType is ((X, Y) -> Z) to reflect that
function dependency.  If you add a surface attribute A, the
MathType becomes ((X, Y) -> (Z, A)) where both Z and A are
functions of X and Y.

> . . . That is, in our examples surface water run-off is a
> function of space. That's why I tried doing it with a  Linear3DSet.
> And as I said, I left it with a 2D set because it worked.

Another possibility is a surface where Z is not a unique function
of X and Y.  Such a surface can be defined with by a Set with
domain dimension = 3 and manifold dimension = 2.  This is supported
for both GriddedSets and IrregularSets.  You can use such Sets as
the domain sets of Fields, in order to have dependent values on
the surfaces.  For example, the Field could have MathType
((X, Y, Z) -> A) and have a domain Set that defines a surface
embedded in (X, Y, Z) space.

However, if Z is a function of X and Y (which is the case for
the Earth's surface except in the region of over-hanging cliffs)
then you are much better off using the MathType ((X, Y) -> (Z, A))
because it expresses all the functional dependencies in the data.

> We also have quite a few missing points, which break the
> continuous surface when we set them to NaN.  Unfortunately our
> domain is far from being rectangular. We are basically dealing
> with river catchments.

If your domain at least has rectangular topology (and
non-rectangular geometry) then you should use GriddedSets.  If you
have non-rectangular topology, then you should use IrregularSets.
Perhaps this can eliminate or reduce the need for missing points
(using a Linear3DSet and filling with missing values will generate
lots of missing points and data that are difficult to depict).

Please let me know if there is a reason why you cannot use the
MathType ((X, Y) -> (Z, A)) [or ((X, Y) -> (Z, A1, A2, ...)) ]
with a Gridded or Irregular domain set.

By the way, I want to clarify my statement in response to Mohamad
that 'In a sense, the Set is the iterator'.  A Set describes
a finite set of values in R^N (i.e., N-dimensional real space
where N = domain dimension).  The Set method:

public float[][] indexToValue(int[] index)

takes an array of indices into that set and returns the
corresponding array of locations in R^N.  It can be used as
an iterator as follows:

for (int i=0; i<set.getLength(); i++) {
float[][] value = set.indexToValue(new int[] {i});
// value, value, value, ..., value[N-1]
// describe the location of the i-th sample in R^N
}

Note that the index argument to indexToValue may contain only
a single value, may contain each index from 0 to set.getLength()-1,
or may contain the same value repeated (this commonly occurs during
remapping operations, when multiple destination samples come from
the same source sample).

Cheers,
Bill

----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
whibbard@xxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html

```
• 1999 messages navigation, sorted by:
• Search the `visad` archives: