Follow

Gridding Data with Conditional Z Values in Surfer

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 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 plot window.
  2. Grid the known XYZ data by going to Home | Grid Data | Grid Data, selecting the data file of XYZ points and clicking Open.
  3. 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.

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. Go to Grids | Calculate | Residuals, select the grid file just created and click Open.
  2. Select the data file you used to create the grid and click Open.
  3. 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.

Surfer calculatinresiduals 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. 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.

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. Select the Residuals column by clicking on the column header letter.
  2. Go to Data | Data | Transform.
  3. 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. Go to 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: find and replace data values in the worksheet
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. Go to 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. Go to Home | Grid Data | Grid Data, select the data file and click Open.
  3. 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.

    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 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.
  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 on the Surfer support forums.

Updated September 11, 2017

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.