Re: Using VisAD with oceanographic data

Hi Mike,

> I want to visualise data from a coastal ocean model. For starters I am looking
> at the depth map. So I have depth as a function of (latitude,longitude). First
> I tried a Linear2DSet with the depth ScalarMap set as Display.RGB. This worked
> fine giving (with the right ColorTable) a grading of colour from blue in the
> deep water through green to red in the shallow. However the land (represented
> in the data as zero depth) just appears red i.e. with no distinction from the
> shallow coastal water. I would like the land to be something distinct, like
> black. I also tried setting the depths over the land to a large negative value
> but this just biassed the autoscaling of the colour map so I got a land/sea
> mask with no detail in the sea part.

This is probably the best approach. You should be able to set
the land to some unique depth (not occuring in your bathymetry)
and then explicitly set an appropriate color lookup table for
the ScalarMap of depth to RGB, as in:

  ColorControl control = (ColorControl) RGBMap.getControl();
  float[][] table = new float[3][table_length];
  for (int i=0; i<table_length; i++) {
    table[0][i] = ... // red for i, between 0.0f and 1.0f
    table[1][i] = ... // green for i
    table[2][i] = ... // blue for i

Create a table that has a distinctive color for your unique
land depth.

You can also call:

  RGBMap.setRange(low, hi);

to over-ride the depth range set by auto-scaling.

Another approach would be to set land depth values to missing
(i.e., Float.NaN). They should be colored black or transparent,
depending on whether you disable texture mapping.

> Next I tried Gridded2DSet and Irregular2DSet, by compressing the depth data to
> remove land points and passing in a latlong[2][nactive] array of latitudes and
> longitudes for the active (sea) points. This gave some black areas where the
> land should be BUT there appears to be some interpolation going on so that 
> land
> areas between to sea areas get filled in with some mess^H^H^H^H, sorry,
> interpolated data points. I also noticed this went very slowly, maybe due to
> this interpolation.
> What is the best way of doing this ?

If you let VisAD implicitly create a topology for your Irregular2DSet,
it will find a convex topology that runs triangles across all your
points of land. To avoid this, you'd need to construct your own
topology as a DelaunayCustom and pass it to the appropriate Irregular2DSet
constructor signature.

> Can I turn off the interpolation for the Gridded2DSet/Irregular2DSet ?

Interpolation is inevitable, at least when you can zoom into the
display. What you really want with an Irregular2DSet is more control
of the interpolation.

> Can I apply a land/sea mask to the Linear2DSet ?

Setting land depths to missing (Float.NaN) sort of
does this.

> Is the vistutor.jar file OK ? (I have an old copy but I got an error when I
> tried to unpack the latest version)

I'll leave this question to Ugo, the author of our great tutorial.

> And why is there no sound file for the guy playing the bagpipes ?

Come to think of it, I've never heard Steve play. Perhaps he
can post a sound file?

Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738

  • 2002 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: