Using the Grid Math Command to Eliminate Negative Values from a Grid File

Note: This method is no longer necessary for grid files created in Surfer. To eliminate negative values while creating a grid file with the Grid | Data command, set the Minimum value to the Data min or a Custom value (such as 0) in the Grid Z Limits section of the Grid Data dialog.

Some gridding methods (i.e. Kriging, Radial Basis Function, Minimum Curvature, and Modified Shepard's Method) extrapolate beyond the Z range of the data, which can create inappropriate negative values for parameters like concentration, thickness, and magnitude. The Grids | Calculate | Math command can set negative values equal to zero with the formula max(A,0).

To set negative values equal to zero:

  1. Click the Grid | Math command.

  2. In the Grid Math dialog, click the Add Grids button. Select the grid file containing the unwanted negative values and click Open. This grid file appears in Input Grid column.

  3. Select an output grid file name in the Output Grid File section by clicking on the image\open2.png button.

  4. In the Enter a function of the form f(A,B,...) where A, B, ... are the variables in the list above. box, enter max(a,0). This tells the program to return whichever is greater, the value in the grid or zero.

  5. Click OK and the new grid without negative values is created.

See Also

Grid Convert

Grid Extract

Grid Transform

Generate an Isopach Map