# Data Filters

You can filter the data before gridding in the worksheet using the Data | Data | Spatial Filter command. Or, you can filter data directly in the Grid Data dialog based on a predefined filter or based on a user-defined equation. The Filter dialog provides methods for filtering data. Filtering is also available on the Data New Variogram page in the dialog. You can filter data by using one of the predefined data filtering methods (To Keep list), or you can generate a filtering method with the Data Exclusion Filter. When filtering data, the Data Exclusion Filter is applied first, then the Duplicate Data methods are applied next.

## Filter Dialog

To open the Filterdialog, click theGrids | New Grid | Grid Datacommand. Select a data file and click Open in the Open Data dialog. In theGrid Datadialog, click the Filter Data button to open the Filter dialog.

 Filter data before gridding in the Filter dialog.

### Duplicate Data

The Duplicate Data section contains methods for defining and handling duplicate data points. Duplicate data are two or more data points having nearly identical X and Y coordinates. The Z values may vary for these X and Y coordinates. Duplicate data present a problem for a number of gridding methods, including Kriging, Natural Neighbor, Radial BasisFunction, and Triangulation with Linear Interpolation. Filtering the data reduces the duplicate points to allow a better gridding fit.

#### To Keep

Duplicates are determined by moving from the lowest X value to the highest X value. A datum only belongs to one set of duplicates. The To Keep options specify which duplicate data points to keep and which to delete in each set of duplicate points. A report containing the retained and deleted points can be generated.

 All Do not delete any duplicates. This option is not available for Kriging, Nearest Neighbor, Natural Neighbor, Radial Basis Function, and Triangulation with Linear Interpolation. None Eliminate all of the duplicates. First Keep the first point, as defined by the order in the data file, from each set of duplicates. Last Keep the last point, as defined by the order in the data file, from each set of duplicates. Minimum X Keep the point with the minimum X coordinate. Maximum X Keep the point with the maximum X coordinate. Median X Keep the point with the median X coordinate. Minimum Y Keep the point with the minimum Y coordinate. Maximum Y Keep the point with the maximum Y coordinate. Median Y Keep the point with the median Y coordinate. Minimum Z Keep the point with the minimum Z value. Maximum Z Keep the point with the maximum Z value. Median Z Keep the point with the median Z value. Sum Create an artificial data point at the centroid of the duplicate points with a Z value equal to the sum of the duplicate set's Z values. Average Create an artificial data point at the centroid of the duplicate points with a Z value equal to the average of the duplicate set's Z values. Midrange Create an artificial data point at the centroid of the duplicate points with a Z value equal to the midrange of the duplicate observations' Z values halfway between the minimum Z and the maximum Z. Random Keep a single randomly selected representative point.

#### X and Y Tolerance

In addition to the To Keep options there are X Tolerance and Y Tolerance options. The Tolerance values specify how close two points are located before Surfer considers the points duplicates. For example, two points, A and B are duplicates if:

Using this definition, it is possible for points A and B to be "duplicates," for points B and C to be "duplicates," but for points A and C to not be "duplicates."

### Data Exclusion Filter

The Data Exclusion Filter allows a Boolean expression to specify how to exclude data. The Data Exclusion Filter can be used with any column in the worksheet that contains numbers. Columns in the worksheet that contain text or columns that are empty will not be excluded by the Data Exclusion Filter.

To use one of the X, Y, or Z columns, use X, Y, or Z in the Data Exclusion Filter . To use another column from the worksheet, use _A, _B, _C, etc. The underscore is required when specifying a worksheet column.

For example:

 X=-999 or Y=-999 or Z=-999 Excludes any data with a -999 value in either the X, Y, or Z columns. X<10 or X>20 or Y<10 or Y>20 Excludes all data except for points in the range 10 to 20 for both the X and Y directions. Z < 0.0 Excludes any triplet with Z value less than 0.0. _A > 10 Excludes any row in the worksheet that contains a value greater than 10 in column A. Z < 0 AND _D = -999 Excludes any triplet with Z value less than 0.0 and whose row in the worksheet contains a value in column D equal to -999.

Boolean expressions, used by Grids | New Grid | Function, Grids | Calculate | Math, Grid | Data, and Grid | Variogram, include:

• logical operators (and, or, xor, not)
• comparison operators (=, <>, <, >, <=, >=)
• the IF function - for example IF(condition,

The words AND, OR, XOR, NOT, and IF are reserved keywords and may not be used as variable names.

To use a stored function, click the next to the current function. This will display the ten most recent functions used. The functions are stored in the registry, so the equations are stored between Surfer sessions. You can also start typing the function in the function box. If the function is in the ten function history, the entire function will auto-complete.

For example, consider the case of ignoring data outside of a grid. The original grid X Maximum is 50, but the grid X Maximum is reset to 40. To limit the search to data with X values less than 40, use the Data Exclusion Filter by entering X > 40 into the Data Exclusion Filter text box. This tells Surfer to exclude all data with X values greater than 40.

Consider a second case where data contains a numerical identifier in column D. When the value in this column is equal to -999, the data point is considered inaccurate and should not be used when gridding. To grid only those data where column D is not equal to -999, exclude column D with the Data Exclusion Filter by entering _D = -999 into the Data Exclusion Filter text box. This excludes all rows of data where column D contains the value -999.