Re: display of multiple data sets with frequent updates

Hi Hartmut,

> I am trying to use VisAD to visualize the output of a groundwater transport
> code. One of the displays that I want to implement shows histories, i.e.
> concentrations of a species at one node of the mesh over time.
> 
> Swing controls allow to switch between different models (with completely
> different data), and - within the selected model - between different nodes
> and species. Simulated data are always present, observed data may be
> present for some of the nodes and/or species. If observed data are present,
> their display may be switched on or off by the user. The simulated data
> should be displayed as a line, the observed data as points.
> 
> All these switches will be used a lot while this display is active, so the
> response should be fairly rapid.
> 
> I have implemented some aspects I described above with a cell - whenever a
> new node or species is chosen, doAction() will be called and the selected
> simulated data are displayed. Now I want to add the display of the observed
> data.
> 
> First, is it more efficient to use a cell implementation with resampling or
> should I do it like the SwitchDisplay example of the VisAD distribution?

I am a little unclear.  Completely clearing a DisplayImpl and
rebuilding it, as in examples/DisplaySwitch, should only be
necessary when you need to change ScalarMaps.  And resampling
is probably not needed here, unless you want to arithmetically
combine the model and observed data.

To switch between outputs of different models or different
species from the same model, you could simply call
DataReference.setData(new_data).

To add observed data to a display of model data, construct a
new DataReference, call its DataReference.setData(obs_data)
and pass the DataReference to DisplayImpl.addReference().  Then
to switch between different observed data, just call
DataReference.setData(new_data).  You can do this in a CellImpl,
or in the actionPerformed() callback method of a Swing GUI
component.

> Both simulated and observed data use the FunctionType (Time ->
> Concentration), where the samples of the concentration are different for
> every node and species. The observed data will typically have different
> sample points for the time than the simulated data. Can I use the same
> FunctionType for simulated and observed data, but different domains for the
> time when I create the two FlatFields?

Yes, no problem.  You can combine them in a DisplayImpl without
any resampling.

> Can I use the same maps (time on x, concentration on y) for both types of
> data with two different references or do I have to add another map for the
> observed data, if they are to be displayed?

Yes.

> If no observed data are to be displayed, what is the best way to switch
> this off? (remove the reference?)

You can simply call DataReference.setData(null) to turn a
data display off, but then you'll get a "data is null"
message at the bottom of the display (our philosophy is
that you either get a picture or an explanation).  You
can easily and quickly switch between on and off by making
you (Time -> Concentration) FlatField a range value of
a FieldImpl with MathType (dummy -> (Time -> Concentration))
where dummy has a domain Set = Integer1DSet(2), with one
range value = null and the other = your original
FlatField.  Then construct a ScalarMap dummy -> SelectValue.
Please see visad/jmet/ShowNCEPModel.java for an example of
this technique.

> How can I get the simulated data displayed as lines and the observed data
> as points?

See example P2_05.java in the VisAD Tutorial which does
exactly this.

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