Re: missing points break up surface

Hi Ugo,
Your problem is actually somewhat tricky, sorry to say.
A connected surface display is generated using the topology
of the Field's domain Set: the topology specifies which
samples are neighbors that should be connected together to
form little triangles or quads.  Missing values delete points
from the topology, so the little triangles and quads cannot
be formed.  I have experimented in the past with algorithms
that try to only draw those triangles or quads for which all
vertices are valid (non-missing) but this can be very
misleading, as some non-missing points are then not visible.
Although it is not very pretty, rendering as isolated points
is the most reliable way to show exacty which points are
Of course, you'd like to find a work around, and there are
a few possibilities:
1. Render as isolated points, but use the following code
to make the points larger:
  GraphicsModeControl mode = display1.getGraphicsModeControl();
With the right size, the large points almost look like a
2. Reconstruct an irregular topology using the non-missing
points, as follows:
  float[][] set_samples = domainSet.getSamples();
  // count non-missing samples
  int len = 0;
  for (int i=0; i<LengthX*LengthY; i++) {
    if (samples[0][i] == samples[0][i]) len++; // not missing
  FlatField new_ff = null;
  if (len > 0) {
    float[][] new_set_samples = new float[2][len];
    double[][] new_samples = new double[2][len];
    for (int i=0; i<LengthX*LengthY; i++) {
      if (samples[0][i] == samples[0][i]) {
        new_set_samples[0][i] = set_samples[0][i];
        new_set_samples[1][i] = set_samples[1][i];
        new_samples[0][i] = samples[0][i];
        new_samples[1][i] = samples[1][i];
    Set new_domainSet = new Irregular2DSet( Domain, new_set_samples );
    new_ff = new FlatField( overfunc, new_domainSet );
  // now new_ff can be used in place of ff
  // if all points are missing, new_ff == null
This will draw a surface that just spans across the missing points.
Users will see no indication of where the missing points are, but
in some cases they may not want to.
3. If you want to color the missing points black, then you have
to estimate the elevation of the surface at the missing points.  One
way to do this is to resample the new_ff Field to your original Set,
by adding the following code to my code above:
  FlatField re_ff = (FlatField) new_ff.resample(domainSet,
                      Data.WEIGHTED_AVERAGE, Data.NO_ERRORS);
  double[][] re_samples = re_ff.getValues();
  for (int i=0; i<LengthX*LengthY; i++) {
    if (samples[0][i] != samples[0][i]) {
      samples[0][i] = re_samples[0][i];
      samples[1][i] = temperature_mapped_to_black;
  ff.setSamples( samples );
If there are lots of missing points, then ff will still have
missing points (since the irregular topology of the domain set
of new_ff will not "cover" the domain of ff).
So you may want to try a more robust way of estimating elevations
at missing points.  We have an old Fortran (!) function for doing
this at:
and there are other algorithms.
Sorry that I don't have a more definitive answer for you.  What
you want involves estimating values for missing values, and this
is just a deep issue.
Since I don't have your data or ArcGridReader I was not able to test
my code examples, so there may be a few bugs.  Please let me know if
you have problems or further questions.
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
whibbard@xxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738

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