Gridding Data with Conditional Z Values in Surfer

You may have data where some of the Z values have conditions attached to them (<0.01 for example); 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 Grids | Calculate | Residuals and Grids | Calculate | Math by following 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).

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

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

Surfer: XYZ data in the worksheet window with conditional values
Create a new column and enter just the conditional value as a number
without the argument.

  1. Open Surfer or go to File | New | Plot  Document from within Surfer to open a new plot window.
  2. Grid the known XYZ data by going to Home | Grid Data | Grid Data.
  3. In the Grid Data dialog:
    1. Click Browse, select the data file of XYZ points and click Open.
    2. Select the appropriate X, Y and Z columns. Use the original Z column with conditional values.
    3. Choose the gridding method and parameters you wish.
    4. Note the values in the Grid Line Geometry section on the Output page.
    5. Click Finish. All the known points in the data file are gridded, the points with conditions in the Z column are ignored.

Surfer: contour map overlaid with point values
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.

  1. Click Grids | Calculate | Residuals, and in the Grid Residuals dialog:
    1. Click Browse in the Input Grid field, select the grid file just created and click Open.
    2. Click Browse in the XYZ Data field, select the data file you used to create the grid and click Open.
    3. Select the appropriate X and Y columns.
    4. Choose the column with only the numeric conditional values as the Z column
    5. Select a column to save the residuals in and click OK.

Surfer calculating residuals from input data
Calculate the residuals between the conditional value
and the Z value in the grid file, storing the results in a
new column.

  1. 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.

SUrfer: worksheet data with calculated residuals
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.

  1. 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.
  2. Select the Residuals column by clicking on the column header letter.
  3. Click Data | Data | Transform.
  4. 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.

Surfer: tranforming data values in worksheet
Convert all the negative residuals to 0 using Data | Data | Transform.

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

Surfer's Find and Replace Dialog.png
Populate all the empty cells in the
Residuals column with 0.

  1. 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.

Surfer: worksheet with residual values
All the values are 0 except the positive residuals.

  1. Click File | Save to save the data file, and File | Close to close the worksheet.
  2. Now we want to create the correcting grid based on the residual data. Click Home | Grid Data | Grid Data.
  3. In the Grid Data dialog:
    1. Click Browse, select the data file of XYZ points and click Open.
    2. Select the appropriate X, Y and Z columns. For the Z column, choose the new Residuals column.
    3. Choose Inverse Distance to a Power as the Gridding Method and click Skip to End. This will most closely honor the correcting residual values and still produce a nice looking map.
    4. On the Output page, click Browse in the Copy geometry from field, select the original grid file, and click Open.
    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 Finish.

    Surfer: contour map of residual values
    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.

  4. Go to Grids | Calculate | Math.
  5. 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 18 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.
  6. Plot the newly created GRD as a contour layer.

Surfer: contour map of residual values

Surfer: displaying residual values
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.

Updated September 3, 2020

Was this article helpful?
4 out of 5 found this helpful

Comments

0 comments

Please sign in to leave a comment.