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:
-
Click the Grid | Math command.
-
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.
-
Select an output grid file name in the Output Grid File section by clicking on the button.
-
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.
-
Click OK and the new grid without negative values is created.