NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: Here is a sample dataset

> and then ingested by the netCDF backend to VisAD, then it would appear
> as the following FlatField:
>
>     recnum -> (x, y, z, u, v, w)
>
> which is probably not what you want.  Undoubtably, you want a VisAD
> FlatField like the following:
>
>     (x, y, z) -> (u, v, w)
>
> Unfortunately, the "plain" netCDF conventions don't carry enough
> semantics with them to distinguish independent variables from dependent
> ones, which is why the first form of FlatField is created.
 
However, a FlatField with MathType:
 
    (recnum -> (x, y, z, u, v, w))
 
can still be displayed my mapping x -> XAxis, y -> YAxis,
z -> ZAxis, then perhaps u -> Flow1X, v -> Flow1Y, w -> Flow1Z
(this will make little vectors at each x, y, z location) or
some other set of mappings.
 
If you want to do something like contouring u, v and w values,
then you need a FlatField with MathType:
 
    (x, y, z) -> (u, v, w)
 
You could construct such a FlatField like this:
 
  FlatField field = ... // this has type (recnum -> (x, y, z, u, v, w))
  float[][] values = field.getFloats();
  RealTupleType range
    (RealTupleType) ((FunctionType) field.getType()).getRange();
  RealTupleType domain = new RealTupleType(
    (RealType) range.getComponent(0),
    (RealType) range.getComponent(1),
    (RealType) range.getComponent(2));
  RealTupleType new_range = new RealTupleType(
    (RealType) range.getComponent(3),
    (RealType) range.getComponent(4),
    (RealType) range.getComponent(5));
  float[][] samples = new float[3][];
  samples[0] = values[0];
  samples[1] = values[1];
  samples[2] = values[2];
  // WARNING: the Delaunay tetrahedralization used by this
  // Irregular3DSet constructor is slow for large numbers of samples
  Set set = new Irregular3DSet(domain, samples);
  FlatField new_field
    new FlatField(new FunctionType(domain, new_range), set);
  float[][] new_values = new float[3][];
  new_values[0] = values[3];
  new_values[1] = values[4];
  new_values[2] = values[5];
  new_field.setSamples(new_values);
 
There may be a few bugs in this, but its the general idea.
 
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:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: