GSLIB BUG

This page describes a bug in the GSLIB program GAMV for calculating directional sample variograms in 3 dimensional space with irregularly spaced data. The bug is that GAMV actually excludes a significant number of eligible data points from the calculation of Gamma(h) for dipping separation vectors h. The steeper the dip angle, the greater the number of eligible data points excluded. Thus, the number of pairs used to calculate Gamma(h) for dipping directional sample variograms may be significantly less than the available number of pairs. In other words, GAMV simply does not use all of the available data when calculating dipping directional sample variograms.This is a rather subtle bug and perhaps this is the reason why this bug has not been detected over the years. The following diagram is provided to help understand how GAMV excludes eligible data points.

The problem occurs when GAMV loops through all of the data for the purposes of identifying pairs of data within the specified azimuth and dip directions. In the diagram above, the example shown is set to calculate a directional sample variogram at an azimuth of 45 degrees. The angular tolerance on the azimuth is plus minus 45 degrees. The angular tolerance on the dip angle and bandwidths are not shown because they do not contribute to the problem. The GAMV algorithm is as follows:

  1. GAMV begins an outer loop through all of the data. It anchors the tail of the separation vector on each data point. For example, in the figure above, the tail of the red separation vector is anchored at the data point (0,0,0).
  2. GAMV begins a second inner loop. It anchors the head of the separation vector at each data point. For example in the figure above the head of the red separation vector is anchored at the data point located at (12,3,0).
  3. GAMV calculates the lag interval between the current pair of data points. It excludes the data point at the head of the separation vector if the separation distance exceeds the maximum lag distance.
  4. GAMV checks to see if the azimuth of the separation vector is within the required sample variogram azimuth plus or minus the tolerance angles. In the example above the azimuth of the separation vector between (0,0,0) and (12,3,0) is within the sample variogram azimuth plus or minus the tolerance angle. But examine the separation vector between (0,0,0) and the point at (1, -1, -10). This separation vector is outside the sample variogram azimuth plus or minus the tolerance angle. Thus, when the inner loop gets around to anchoring the head of the separation vector on this data point, it is automatically EXCLUDED from the possibility of being paired with the data point at (0,0,0). Now, this may be an error (bug) because.......
  5. Next, GAMV excludes the point at the head of the separation vector if the horizontal bandwidth limits are exceeded.
  6. Next GAMV checks the vertical or dip angle against the sample variogram dip direction plus or minus the tolerance angle. The problem is that some of the eligible points may have already been excluded by the check in Step 4. For example, suppose the sample variogram direction is at an azimuth of 45 degrees as shown, but dipping at 80 degrees from the horizontal. Then obviously, the data point at (1, -1, -10) is within the tolerance angle (45 degrees) of the sample variogram direction and should be paired with the point at (0,0,0). However, this will not happen since (1,-1,-10) has been excluded or bypassed in Step 4.

One remedy for this bug is to apply all three direction cosines (the x, y, and z direction cosines) when checking the direction of the separation vector against the required sample variogram direction. (Another recommended strategy is to use SAGE2001. You will find SAGE2001 finds many more pairs (and thus provides more stable sample variograms) for dipping directional sample variograms.)