logo

1 303 279 1021

Loading

Live Chat

All Issues

Golden Software Newsletter

Our newsletters are filled with interesting technical tips, news of how people are using Surfer, Grapher, Voxler, MapViewer, Didger and Strater, and (of course!) great illustrations.

Subscribe to Our Newsletter

Issue 66

Gridding Data with Conditional Z Values in Surfer 10

You may have data where some of the Z values have conditions attached to them, meaning that for some of the data you know the Z value is greater than or less than some number, but you do not know the actual Z value itself. Interpolation in Surfer cannot use conditional arguments for the Z values, but you can apply these conditions after the grid file is created to be sure the final grid meets all the conditions.

For example, you might have well data and wish to interpolate the water surface at depth, where the Z value is the depth of the water surface. In some wells, the depth to this surface is known. In other wells it might be unknown, but the minimum depths are known (e.g. the water surface depth is at least 25m, so Z>25).

In some cases, you may be able to simply use the minimum depths as the Z value for that point. You could grid the data and create your map. In other cases, you might not want to use the minimum depths as the Z value because the minimum depth value could be very different from the correct value for those points and you may not want the incorrect Z values influencing the interpolation of the known points. In these cases you can grid the known data and adjust the grid file so that it meets the criteria for the unknown conditional data. To apply the conditions to the grid file, you can use a combination of Grid | Residuals and Grid | Math. Follow these steps:

 

  1. These steps assume you have a data file of X, Y and Z data, where the known Z values are entered numerically (i.e. 25) and the unknown Z values are entered with a condition (i.e. >25).

  2. Create a data file of XYZ data, including the
    conditional data. There are four points in this data
    file with conditional Z values.

  3. Either in the Surfer worksheet or in Excel, create a separate column where the conditional values are entered as a number but without the conditional argument (<,<=, =>, > , etc).

  4. Create a new column and enter just the conditional value as a number
    without the argument.

  5. Open Surfer or go to File | New | Plot from within Surfer to open a plot window.
  6. Grid the known XYZ data by going to Grid | Data, selecting the data file of XYZ points and clicking Open.
  7. In the Grid Data dialog:
    1. Select the appropriate X, Y and Z columns. Use the Water Depth column (the known values) as your Z column.
    2. Choose the gridding method and parameters you wish.
    3. Note the values in the Grid Line Geometry section
    4. Click OK. All the known points in the data file are gridded, the points with conditions in the Z column are ignored.

  8. When just the known points are gridded, the point
    locations with the conditional Z values may not meet the
    conditional criteria. In this case, the conditions of three
    of the four points are not met.

  9. Go to Grid | Residuals, select the grid file just created and click Open.
  10. Select the data file you used to create the grid and click Open.
  11. In the Grid Residuals dialog, select the appropriate X and Y columns. Choose the Conditional Values as the Z column, and select a column to save the residuals in.

  12. Calculate the residuals between the conditional value
    and the Z value in the grid file, storing the results in a
    new column.

  13. Click OK. The data file with the residuals column opens in the Surfer worksheet. Most likely, some of the residuals will be positive and some will be negative.

  14. The difference between the conditional value and the Z value in the grid file are
    entered in Column F. The
    Residuals are the difference between the Z value in the data
    file (the conditional value) and the interpolated Z value for that location in the grid
    file. If the residual value is negative, then that means that the interpolated Z value is
    greater than the Z value in the data file. If the residual value is positive, then the
    interpolated Z value is less than the Z value in the data file.

  15. Since the conditional data in our data file are all minimum values, we want the residuals to be negative (we want the interpolated value to be greater than the data value). Only one of the residuals in this example is already negative, so that is the only “good” residual value. The next step is to convert the “good” residuals to 0 and populate the empty cells with 0. Select the Residuals column by clicking on the column header letter.
  16. Go to Data | Transform.
  17. In the Transform dialog, enter the function F= IF (F<0, 0, F) (where F is the column letter of the Residuals column), you may need to change the First row value to 2.

  18. Convert all the negative residuals to 0 using Data | Transform.

  19. Click OK. Now all the negative values are converted to 0.
  20. Next we want to fill in all the empty cells with 0. Click in a cell in the Residuals column
  21. Go to Edit | Replace, leave the Find field empty, enter 0 for Replace with, and select The column where the active cell is for In.

  22. Populate all the empty cells in the
    Residuals column with 0.

  23. Click Replace All and then Close. Now all the values are 0 except the positive residuals. The remaining positive residual values represent the difference between the Z value in the grid file and the minimum Z value requested. We want to add these values to the interpolated data in the grid file.

  24. All the values are 0 except the positive residuals.

  25. Go to File | Save to save the data file, and File | Close to close the worksheet.
  26. Now we want to create the correcting grid based on the residual data. Go to Grid | Data, select the data file and click Open.
  27. In the Grid Data dialog:
    1. Select the appropriate X and Y columns.
    2. For the Z column, choose to grid the new Residuals column.
    3. Choose Inverse Distance to a Power as the gridding method. This will most closely honor the correcting residual values and still produce a nice looking map.
    4. Enter the same Grid Line Geometry options as the original grid file noted in Step 5 above.
    5. Change the Output Grid File to a new name by clicking on the yellow open folder icon, giving the file a new name or location and clicking Save.
    6. Click OK.


    This residual map shows the distribution of the positive
    residual data. This data will be added to the original
    map so that all points meet their conditions.

  28. Go to Grid | Math.
  29. In the Grid Math dialog:
    1. Click the Add Grids button.
    2. Select the original grid created in Step 5 above, hold the Ctrl button down, select the correcting grid created in Step 19 above, and click Open. Both grids are added.
    3. Enter the function A+B to add the correcting grid to the original grid.
    4. Change the Output Grid File if desired by clicking on the yellow open folder icon, giving the file a new name or location and clicking Save.
    5. Click OK. This is the final grid with the conditions met.
  30. Plot the newly created GRD as a contour layer.




Add the positive residuals grid file to the original grid file
to create the final grid, where all conditional points meet
their conditions.



Acknowledgements go to Sergei Beda on the Surfer support forums.

 

Trusted by over 10,000 Companies and Schools

Subscribe to Our Newsletter

Enter your email address below to receive email notifications of product updates and our newsletter, filled with helpful technical tips and case studies.