# Re: Which "Set"?

```Hi Kevin,

You can combine ((r, e) -> h) and ((r, e, h) -> s) into one
field with MathType:

((r, e) -> (h, s))

You could compute this as a FlatField over some sampling that
covers the range of r and e values at an appropriate resolution.

When the user fixes an e0 value, construct a Gridded2DSet with
manifold dimension = 1, over domain (r, e). Basically, this
would be a set of (r, e0) for a sequence of r values. Then
resample your FlatField ((r, e) -> (h, s)) to this Gridded2DSet,
and display the FlatField returned by this call to resample().

With ScalarMaps h -> YAxis and s -> XAxis, you'll get a scatter
diagram. Given that h and s are both dependent variables with
no simple functional dependency between them, in general this
must be a scatter diagram rather than a line graph. If you have
prior knowledge that there is some simple graph relation between
them, you can extract their values from the resampled FlatField
and construct a FlatField with MathType (h -> s) or (s -> h)
and appropriate topology.

Note in your code 'new Irregular1DSet(h, h_vals )' can be a
Gridded1DSet as long as the h_vals array is sorted (can be
either ascending or descending).

Good luck,
Bill

On Wed, 23 Jul 2003, Kevin Manross wrote:

> I have a rather convoluted relationship between the following variables
>
> independent: range r
> dependent: height h, slantRange s
> "quasi-independent" elevation e (user input)
>
>
> h = f(r, e) or in VisAD notation: ( (r, e) -> h )
>
> s = g(r, e, h), i.e. ( (r,e,h) -> s)
> [so technically, s = g(r, e, f(r, e)) or ( (r, e, (r, e)) -> s )]
>
>
> If you are still following this...
>
> I am using r as any 1D Set and e is user input.
>
> I want to plot h (YAxis) vs. s (XAxis).
>
> When the user changes e, I want to recalculate h and s and update the
> 2-Dimensional output (a curve)
>
> Currently I am able to do everything but update h using the following:
>
>      r = RealType.getRealType("R", SI.meter, null);
>      (^^^ Just realized that I don't use this, but instead I use:)
>      r_set = new Linear1DSet(0.0, 400.0, LENGTH);
>
>      h = RealType.getRealType("Height", SI.meter, null);
>      s = RealType.getRealType("SlantRange", SI.meter, null);
>      double e;
>      float[][] h_vals = new float[1][LENGTH];
>      float[][] s_vals = new float[1][LENGTH];
>      (h_vals and s_vals are calculated by r_set)
>
>
>      func_h_s = new FunctionType(h, s);
>      h_setI = new Irregular1DSet(h, h_vals );
>      vals_ff_I = new FlatField(func_h_s, h_setI);
>      vals_ff_I.setSamples(s_vals);
>
>      xMap = new ScalarMap(s, Display.XAxis);
>      yMap = new ScalarMap(h, Display.YAxis);
>
>
> These are snippets from my code that hopefully shows he relationship.  I
> can provide more if it would help clear up what I am trying to do.
>
> Should I arrange my data into Tuples?  Should I use a 2D set - and if I
> do, can I plot it as a curve? (the examples in the tutorial seem to show
> most things in a 2D set as contours of one type or another)
>
> Thank you very much for your help!!
>
> -kevin.
>
> --
> +------------------------------------------------------------+
> Kevin L. Manross      [KD5MYD]               (405)-366-0557
> CIMMS Research Associate               kevin.manross@xxxxxxxx
> [NSSL-WRDD/SWATN]         http://www.cimms.ou.edu/~kmanross
>
> "My opinions are my own and not representative of CIMMS, NSSL,
>   NOAA or any affiliates"
> +------------------------------------------------------------+
>
>

```