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. Follow these steps:
- 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).
Create a data file of XYZ data, including the
conditional data. There are four points in this data
file with conditional Z values.
- 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).
Create a new column and enter just the conditional value as a number
without the argument.
- Open Surfer or go to File | New | Plot Document from within Surfer to open a plot window.
- Grid the known XYZ data by going to Home | Grid Data | Grid Data, selecting the data file of XYZ points and clicking Open.
- In the Grid Data dialog:
- Select the appropriate X, Y and Z columns. Use the Water Depth column (the known values) as your Z column.
- Choose the gridding method and parameters you wish.
- Note the values in the Grid Line Geometry section
- Click OK. All the known points in the data file are gridded, the points with conditions in the Z column are ignored.
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.
- Go to Grids | Calculate | Residuals, select the grid file just created and click Open.
- Select the data file you used to create the grid and click Open.
- 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.
Calculate the residuals between the conditional value
and the Z value in the grid file, storing the results in a
- 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.
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.
- 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.
- Go to Data | Data | Transform.
- 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.
Convert all the negative residuals to 0 using Data | Data | Transform.
- Click OK. Now all the negative values are converted to 0.
- Next we want to fill in all the empty cells with 0. Click in a cell in the Residuals column
- 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.
Populate all the empty cells in the Residuals column with 0.
- 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.
All the values are 0 except the positive residuals.
- Go to File | Save to save the data file, and File | Close to close the worksheet.
- 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.
- In the Grid Data dialog:
- Select the appropriate X and Y columns.
- For the Z column, choose to grid the new Residuals column.
- 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.
- Enter the same Grid Line Geometry options as the original grid file noted in Step 5 above.
- 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.
- 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.
- Go to Grids | Calculate | Math.
- In the Grid Math dialog:
- Click the Add Grids button.
- 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.
- Enter the function A+B to add the correcting grid to the original grid.
- 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.
- Click OK. This is the final grid with the conditions met.
- 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
Acknowledgements go to Sergei Beda on the Surfer support forums.