Chapter 10: Grid  


The Grid module interpolates parameter values at locations were there are no physical data. This is done using various interpolation algorithms (inverse-distance, kriging, trend-surface analysis) based on irregularly spaced data. Sometimes it is of interest to estimate what is occurring between data locations. For other applications, for convenience, or for clarity, irregularly spaced data must be interpolated onto a regular grid to be useful. For example contour, surface, and block require that the data being viewed be gridded with a rectangular pattern. These programs then allow the user to visually view the interpolated estimate of the field data. Grid is used to interpolate values at locations of convenient based on field data.

Within grid there are several gridding algorithms; inverse-distance, simple and ordinary kriging method, and trend-surface analysis. Inverse-distance is a relatively simple method which estimates the value of a location based on the distance and value of surrounding points. Kriging does much the same thing as inverse-distance, except kriging also considers spatial statistics describing how the field data varies directionally. Kriging is often referred to a the best unbiased estimator to estimate a value for a given location. Trend-surface analysis is basically a least-squares regression technique which assumes a data value is a function of a "regional" trend and minor "local" variations. The calculated trend-surface attempts to model the "regional" component.

The grid application is composed of two sections (Figure 10.1); the main menu-bar, and the log/status area. The menu-bar is used to select all grid commands and the log/status area contains relevant data about the status of the program or the state of on-going calculations.

(10-1)Figure 10.1


Menu Items
Examples
Command Line Arguments
File Formats
Mathematics
Bibliography

The Main Menu:

The main menu controls nearly all the program operations; files can be opened and saved, calculations can be made, and help can be requested. For grid there are six items on the main menu: File, Method, Grid, Log, View, and Help (Figure 10.1). File controls file handling (opening, saving, viewing, and naming files), and allows the user to quit the application. Method specifies what gridding algorithm will be used. Grid defines whether the solution will be 2D or 3D, search parameters, grid spacing and extents, and the data columns in the data file representing the X, Y, (Z), and value data. Log allows the user to save and view anything which has been written by the program or the user in the status text window. View allows the user to plot the grid results using contour, surface, or block (3D grid). Help gives the user a selection of pop-up help topics. Each menu item is fully described below with all the available options.

File:

The File sub-menu options control file and print handling, and exiting the program. The options include Open, View, Save, Save as, Save Preferences, Quit, and Quit Without Saving.

Open:

Selecting File:Open generates a pop-up dialog. This dialog functions exactly as the dialog in Figure 5.2 (Plotgraph - Chapter 5) and allows the user to select an existing data file. As for plotgraph files, the default data extension is "*.dat".

View:

File:View:Data pops up a simple screen editor with the last opened data file. File:View:Results pops up the screen editor with the calculated grid results.

Save Preferences:

When using programs with many user options, it is not possible for the program to always pick reasonable default values for each parameter or input variable. For this reason preference files were created (See Appendix C). These allow the user to define a unique set of "defaults" applicable to the particular project. When File:Save Preferences is selected, surface determines how all the input variables are currently defined and writes them to the file "grid.prf." The next time grid is run these "default" values will be used.

WARNING: if "grid.prf" already exists, you will be warned that it is about to be over- written. If you do not want the old version destroyed you must move it to a new file (e.g. the UNIX command mv grid.prf grid.old.prf would be sufficient). When you press OK the old version will be over-written! The renaming cannot be done currently from within the application. To rename the file you will have to execute the UNIX mv command from a UNIX prompt in another window. If " grid.prf" does not exist in the current directory, it is created. This is an ASCII file and can be edited by the user. See Appendix C for details.

Quit:

File:Quit terminates the program, but if a grid has been calculated and not yet saved, the user will first be queried to supply a file to save the changes in.

Quit Without Saving:

File:Quit Without Saving terminates the program regardless of any changes for calculations made while using grid.

[TOP] [SYNTAX]


Method:

The Method menu-bar options allows the user to select a gridding algorithm. The active method will be highlighted in red on the pull-down menu. The active method is selected by choosing from the pull-down menu. The theory for each method is described in the Grid Mathematics section later in the chapter, and the use of each methods follows below.

NOTE: Several options (Simple 2D Kriging (GSLIB), Cokriging (GSLIB), and Indicator Kriging (GSLIB)) are "grayed out." These methods currently are not installed and will not be discussed further.

Inverse-Distance:

Method:Inverse-Distance creates the pop-up dialog show in Figure 10.2. This dialog is used to control the inverse-distance gridding algorithm.

(10-2)Figure 10.2

The parameters defining the search and weighting parameters are the search radius, tolerance, power, nearest points, search type, and the grid file name. The search radius specifies the maximum a data point can be from the point being gridded and still have an influence on its estimated value; the default value is the maximum diagonal distance across the data set (i.e. all points may influence any grid location). The tolerance is used to handle a problem with the inverse-distance algorithm. If the point being gridded is at the same location as a data point, the distance between the two locations is zero; if this is not specially treated, a division by zero error occurs. The tolerance is used to avoid this problem (See Mathematics Section for further details). Power is a weighting function for the distance between the gridded location and the surrounding data points. If power equals 1.0, the inverse-distance algorithm regresses to a normal linear interpolation. Power set equal to 2.0 is a commonly used weight (See Mathematics Section for details). The nearest points refer to the maximum number of "nearby" points that will be used to estimate a grid location, 10 is a commonly used number. Depending on the data set more or fewer points may be called for.

NOTE: In large data sets, you should not use all of the points in the data set as nearest neighbors. Though it seems reasonable to maximize the use of all the available data, doing so tends to pull the estimate of the grid location toward the mean of the data set despite local trends.

Currently, the software only supports a normal search; not quadrant or octant searches. In some data sets it is possible to get artificial benching on slopes, and peaks and valleys or pits tend to become flat; these different search methods can reduce these problems (See Mathematics Section).

The grid file is the file where the calculated results will be saved. The file will be formatted for contour (Chapter 11), surface (Chapter 12), and block (Chapter 13) using a GRID CENTERED GRID format (Figure 10.3, see Setting up a "Standard" Input Grid File section (Chapter 11)). The filename can be typed directly in the text field or, the Select button next to the text entry field maybe used. It generates a pop-up dialog similar to that in Figure 5.2. The default search extension for 2D solutions, though is *.srf. The filename may also be selected using the File:Save as menu options (This option, however will also save the file; not just rename the destination). After the grid is calculated, the results can be saved to the grid file by pressing the Save button or by selecting the File:Save menu-bar option.

(10-3)Figure 10.3

To calculate the inverse-distance grid, press 1) the Calculate button at the bottom of this pop-up dialog, or 2) press the Calculate button at the bottom of either the bottom of the 2D or 3D pop-up dialogs, or 3) select either the Method:Calculate or the Grid:Calculate menu-bar options. When the calculation is started, the pop-up dialog shown in Figure 10.4 will be displayed. This dialog will be displayed as long as the computer is calculating the grid. When the computation is complete it will be removed. If you want to abort the calculation, press the "Stop" button. As soon as the current column calculation is complete (This may take several second on large grids or large data sets), the calculation will be stopped. Note; if the calculation is aborted, no usable information is retained. While the grid is being calculated, the current column being calculated will be displayed in the log/status window, and "Grid Complete" will be printed when the calculation is done.

(10-4)Figure 10.4

WARNING: When the grid is calculated, it is not automatically saved. If you want to save the calculation, press the Save button on this dialog or select the File:Save menu-bar option. This grid calculation will be lost the next time any grid using any method is calculated!

Ordinary Kriging (GSLIB):

Method:Ordinary Kriging creates the pop-up dialog shown in Figure 10.5. This portion of the code actually is based the program ktb3dm from the GSLIB geostatistics package from Stanford University (Deutsch and Journel, 1992), but many alterations have been made. This package allows the user to use simple or ordinary, point or block kriging for 2D and 3D data sets. Depending on how the options are set, regional drift can also be considered.

(10-5)Figure 10.5

NOTE: Unlike other modules in grid, the output file format is NODE CENTERED GRID (Figure 10.3), not GRID CENTERED GRID. These formats are discussed in the Setting up a "Standard" Input Grid File section of Chapter 11 (contour).

WARNING: This module should not be used by those unfamiliar with kriging and semivariogram analysis.

For the kriging algorithm there are many variable take must be set by the user, there are some that can ignored for some data sets, and there are some where the default values are acceptable (there may be better values) in most cases. These parameters are described below. For a complete description of these variable it is suggested that the reader refer to Deutsch and Journel (1992).

The first item to decide on is whether Simple or Ordinary Kriging will be used. If Simple kriging is used, you must enter the data sets mean value (This can be determined in histo). The data set mean is assumed, but if a different value is desired, press the Simple Mean button. The pop-up dialog shown in Figure 10.6 can be used set a new value. Note, it is important to check and set these values correctly if "zonal kriging" is used (discussed below), because the mean for the data set may not be relevant for each zone.

(10-6)Figure 10.6

The output file names and the Debug Level can also be specified. Be careful not to save results over previously existing files. A 0 Debug Level gives very little information. A 3 Debug Level can give many megabytes of debugging information.

To set the remaining information, there are several buttons for creating input dialogs for defining search, semivariogram, drift, and zonal parameters.

Finally, to calculate the grid, press the Calculate button at the bottom of Figure 10.4 or select the Method:Calculate menu option.

WARNING: After the grid is calculated, the results are not saved to file until the Save buttons are pressed. Using the File:Quit menu option will warn you that you have unsaved work. Using the File:Quit menu option will not; it will quit, not saving the results!

Model Semivariograms:

To define the spatial correlation of data, the Model Semivariogram(s) must be defined. Pressing the Model Semivariogram button will create the dialog shown in Figure 10.7. This dialog allows the user to specify the Range, C(Sill), Nugget, Semivariogram Model Type, Anisotropy's, and Model Orientations for up to four nested structures. The Semivariogram Angles and Anisotropies are calculated as described in Figure 10.8. The Range, C, Nugget, and Models can be determined using vario (Chapter 8) and variofit (Chapter 9).

(10-7)Figure 10.7

(10-8)Figure 10.8

If "zonal kriging" is used, complete semivariogram model definitions must be defined for each zone.

It is also possible to define different semivariogram models for each axis, though the sills in each direction must be identical in all directions at the maximum range. This allows up to three semivariogram models to be defined for each zone (Principle (X), Y-Axis, and Z-Axis). This takes more work to model, but in some cases, modeling the data, it appears that different directions fit different models (e.g. horizontal is a two- nested spherical, but vertical is exponential). This option can be selected by turning the Semivariogram Anisotropies Off. The normal and default position is On.

Search parameters:

The Search Parameters pop-up dialog (Figure 10.9) is used to define data regarding the search parameters for locating the data points nearest to the grid point/block being located (The "nearest neighbors"). The Search Radius defines the maximum distance away from the grid location being estimated, that data points will be chosen from. If a search ellipsoid is used for this search (When the semivariogram models suggest the data is anisotropic), the Search Angles (1,2,3) and the Anisotropies must be defined. To determine what these values should be, refer to Figure 10.8. If there is no anisotropy to the data, the search and anisotropy values may be ignored. If the data is fairly regularly distributed, the Normal Search is appropriate. If the data are clustered, or data values are along lines (wells, contour lines, geophysical survey lines) it is often better to use an Octant Search. If an Octant Search is used you must also select the Maximum number of points per Octant to be used (This is the number of points that will be used from each octant if they are available). Associated with this is the Minimum and Maximum Nearest Points used. If fewer then the Minimum number of points are available, the grid location will not be estimated. The Minimum and Maximum Trimming Limits are used to filter out data points where no appropriate value is available. Only data points with values between the Trimming Limits will be used. Block Discretization in the X, Y, and Z directions are used to differentiate between point and block kriging. If all the values are 1, point kriging is used, otherwise block kriging is used.

(10-9)Figure 10.9

If "zonal kriging" is used, the Search Radius, Search Angles (1,2,3) and the Anisotropies must be defined for each zone.

Drift Parameters:

The Search Parameters pop-up dialog (Figure 10.10) is used to define data regarding drift. Some data sets show an obvious trend, or a trend becomes apparent in the semivariogram analysis. If the trend can be accurately estimated, it should be removed, the residuals kriged, and finally the trend added back in. Where a trend is present, this should give better results. The program can krige with No Drift, it can internally Estimate Trend (Drift), or it can Read Drift From a File. If the program is to estimate the drift internally, the user must specify the nature of the drift in the X, Y, and Z axes. This is done by pressing the Set Drift Orders button. This creates the dialog shown in Figure 10.11. For each axis, the drift can be Linear, Quadratic, or Cross- Quadratic. The drift can also be read from a file, if the user prefers to use another algorithm.

(10-10)Figure 10.10

(10-11)Figure 10.11

Zonation Parameters:

The Zonation Parameters pop-up dialog (Figure 10.12) is used to setup the model zonation. Under most circumstances, a single zone will be used, but sometimes more are needed. The maximum number of zones allowed is ten. The reason one would consider using multiple zones, is when there are two or more areas within the region which should be described by more then model semivariogram. In other words, the assumption of stationarity is not valid. An example of how this is used is shown in Figures 10.13a and 13b. For the site, the upper zone has a short range of less then 60 m. The lower region has a range of over 300 m. When both zones are modeled together, the average range is about 150 m and the results are shown in Figure 13a. When the zones are treated separately, results closer to actual site conditions are attained and shown in Figure 13b. (Note the long continuous zone in the lower portion of the grid that is not present in Figure 13a).

(10-12)Figure 10.12

(10-13)Figure 10.13a and (10-13)Figure 10.13b

The Model Semivariograms button creates the same pop-up dialog as shown in Figure 10.7 and described above. The Select Zone Definition Files pop-up dialog is shown in Figure 10.14. This file is used to select and view the mask files for each zone (The file format is discussed in the Setting up the Input File section below).

(10-14)Figure 10.14

NOTE: There must be a zone mask for each zone, every cell in the grid must be belong to one and only one zone, and the zone mask files must have exactly the same number of layers, rows, and columns as the grid being calculated.

The Relationship Between Zones button creates the dialog shown in Figure 10.15. This dialog allows the user to specify how data points in one zone will be used, will be used when they are in the search neighborhood of a point being kriged in another zone. A Sharp transition means that only points from the specified zone will be ignored (Figure 10.16a). A Gradational transition means that points will be shared across the specified zones (Figure 10.16b). Note, at the transition from one zone to another, the transition can still be abrupt. This can happen in neighboring cells because the model semivariograms are different and the search neighborhood, and there fore point used in the estimation, can be substantially different. This problem will tend to disappear with increasing model ranges and sample data densities. The Fuzzy transition is not yet supported. Note that this relationship matrix can be loaded or saved using the dialog in Figure 10.12 (The file format is discussed in the Setting up the Input File section below).

(10-15)Figure 10.15

(10-16)Figure 10.16a and (10-16)Figure 10.16b

Trend-Surface Analysis:

Method:Trend-Surface Analysis creates the pop-up dialog shown in Figure 10.17. This dialog is used to control the trend-surface gridding algorithm.

(10-17)Figure 10.17

For the trend-surface algorithm there is only one parameter, the surface order. The remaining variables, ANOVA File, Grid File, and Residual File, simply define where the results will be saved. Valid entries for Order are one to five; higher order surfaces are not supported; the solution matrix size becomes prohibitive.

NOTE: There must be at least:

2D: ((order + 1) * (order + 2)) / 2
3D: ((order + 1) * (order + 2) * (order + 3) / 6

data points in the data set. This is the number of unknowns in the solution equation.

Filenames for the ANOVA, Grid, or Residual files may be entered in the appropriate text field, or by pressing the appropriate Select button a pop-up dialog (similar to Figure 5.2) will be created allowing the output file to be selected. The default data file extensions are:

ANOVA: *.anova
Grid: *.srf (2D) or *.bck (3D)
Residual: *.res.dat

To save the data after a calculation is made, press each of the appropriate Save buttons.

WARNING: None of the data is automatically saved. If you want to save information you must do so manually before the next calculation is made using any grid method!

The ANOVA file will store statistical information about the trend-surface (the same data printed to the log-status window). The Grid file will store the gridded "regional" trend- surface. The Residual file will store six columns of data; the X, Y, Z, location and observed value for each data point, the residual (actual - estimate), and the trend - surface estimate at each data location.

To calculate the trend-surface grid, press 1) the Calculate button at the bottom of this pop-up dialog, or 2) press the Calculate button at the bottom of either the bottom of the 2D or 3D pop-up dialogs, or 3) select either the Method:Calculate or the Grid:Calculate menu-bar options. When the calculation is started, the pop-up dialog shown in Figure 10.4 will be displayed. This dialog will be displayed as long as the computer is calculating the grid (This is a fairly fast calculation). When the computation is complete "Trend-Surface Grid Complete" will be printed in the log-status window.

WARNING: When the grid is calculated, it is not automatically saved. If you want to save the calculation, press the Save button on this dialog or select the File:Save menu-bar option. This grid calculation will be lost the next time any grid using any method is calculated!

When the trend-surface is calculated the trend-surface parameters and several statistical parameters are printed to the log-status window. The statistical variables are calculated are used to evaluate the "goodness of fit" of the calculated surface to the field data. These variables are summarize here, but further details may be found in the Mathematics section of this chapter, or in Davis (1986). The statistical analysis is referred to as the Analysis of Variance (ANOVA). The terms of interest are:

The two main variables of concern are the R2 and the F-statistic. The R2 term when multiplied by 100% defines the amount of data variation explain by the regression trend-surface (Davis, 1986).

NOTE: If the number of data observation points equals the number of coefficients in the trend-surface equation, the surface will pass through all of the points and R2 will equal 1.0 (100%); i.e. all the variation will be explained.

The Fstatistic is used to evaluate whether all of the coefficients as a group are significantly different then zero, and the surface is considered meaningful. All of these terms and their use are defined and explained in the Mathematics section. Suffice it to say here though that the best trend-surface will maximize R2 and minimize the F-statistic.

Calculate:

Once the gridding method/algorithm has been selected, and the grid dimensions (see below) have been specified, selecting Method:Calculate will start the grid calculation. The status of the calculation will be shown in the log/status window (Figure 10.1).

NOTE: When the calculation is complete, the results are not automatically saved. To save the results, select File:Save or File:Save as.

[TOP] [SYNTAX]


Grid:

The Grid sub-menu options control the setup and calculation of the 2D or 3D grid. The sub-menu options include 2D-Grid, 3D-Grid, and Calculate.

2D-Grid:

The Grid:2D-Grid menu option defines the gridding parameters needed for estimating two-dimensional data, typically data in the X-Y, X-Z, or Y-Z plane. When selected the pop-up dialog shown in Figure 10.18 is displayed. This dialog defines , the column location of the data within the data file, and the extents and the density of the calculated grid.

(10-18)Figure 10.18

NOTE: If this option is used, the saved grid file will be saved as if the data came from the X-Y plane, even if they really came from the X-Z or Y-Z plane.

By default, the program assumes the X data is in column 1, the Y data in column 2, and the Z (elevation) data is in column 3. If your data file is prepared differently, or you have multiple Z data columns you will have to redefine the column definitions.

The Grid Dimensions area is where the density and the extent of the grid is specified. The number of Rows and Columns desired is of user preference. As a rule of thumb though a denser grid (more rows and columns) will generate a smoother, but not necessarily a more accurate surface. The X and Y Minimum and Maximum values are by default set the extents of the X and Y data. Depending on the area of interest within the gridded data, or simply shifting these values to whole numbers (e.g. 0.19 is close to 0.0) so the coordinate labels on contour maps are not to busy, the grid extents are user definable.

3D-Grid:

The Grid:3D-Grid menu option is essentially the same as the 2D-Grid menu option described above, but is used to define the grid for three-dimensional data. In addition to the fields shown in the 2D dialog (Figure 10.18), the 3D dialog (Figure 10.19) has entries for the Z Column, the number of Layers in the grid, and the Z Minimum and Z Maximum extents of the model grid.

(10-19)Figure 10.19

NOTE: 3D GRIDDING IT NOT CURRENTLY SUPPORTED FOR TREND SURFACE ANALYSIS!

Calculate:

Based on which gridding option has been selected, 2D or 3D (high-lighted in red on Grid pull-down menu), selecting the Grid:Calculate option calculates the requested grid. As the grid is being generated, the status on the solution is displayed in the log window shown in Figure 10.1. When the calculation is done, the message "Grid Complete" will be displayed in the log/status window.

NOTE: Grid:Calculate only calculates the grid. Nothing is saved to the hard disk. If Grid:Quit Without Saving is used to terminate the program after the calculation the calculated grid is lost. The user must specifically save the file or quit using the Grid:Quit menu option. The simple quit option checks to see if a grid has been calculated and not saved. If it has not been saved, the user will be queried for a file name.

[TOP] [SYNTAX]


Log:

The Log menu option is supplied to allow the user to save, view, or print all text which has been written to the log/status window by the program or added by the user (The log window is also a simple text editor). The options include View Log, Save, Save as, Clear, and Print. View Log, Save, and Save as are similar in operation to the menu options under File described above.

[TOP] [SYNTAX]


View:

View allows the user to display the calculated grid as a Contour Map, Surface Map, or a Block Map. When these menu items are selected, the program saves the calculated grid. If no file has been saved before, the user is prompted for as to whether the data should be saved to a file (Figure 10.20). If the "Save & Plot" button is pressed, the grid will be saved to the last selected plot file. If no file has been selected previously, the program will request a file name (A similar dialog to Figure 5.2 appears)). Once the file has been saved, grid passes the data file to the program contour (Chapter 11), surface (Chapter 12), or block (Chapter 13) respectively. Once the visualization package is open, it is separate and no longer dependent on grid. To terminate the program you must quit it separately. If the "Cancel" button is pressed instead, the calculated grid is not saved and the visualization package is not called.

(10-20)Figure 10.20

NOTE: It is good practice to close block, contour, or surface when you are done, because the next time you view a file using grid's View menu item it will start a new instance of the program (i.e. you can have multiple versions of block, contour, or surface running simultaneously); each program uses additional computer memory, and if you are not careful you can tax the limits of the computers RAM memory.

[TOP] [SYNTAX]


Help:

Help works exactly as explained in Chapter 4 (plotgraph, Figure 5.15) Help section.

[TOP]


Example of Using Grid:

Using grid is a straight forward step-wise process. After starting the application, load the desired data file containing the XY(Z)-Value data, pick whether a 2D or a 3D solution is desired, define the solution parameters and grid dimensions, define the source data columns, calculate the grid, and if desired plot the resultant grid.

Inverse-Distance Example:

To grid the data shown in Figure 10.21, and create the contour map shown in Figure 10.22 follow the steps below:

(10-21)Figure 10.21

(10-22)Figure 10.22

Type grid at the UNIX prompt.

From the menu bar select File:Open, and select the file "conc3.dat." This opens the data file. By viewing the data file (File:View:Data), it can be seen that this a 2D data set even though X, Y, Z, and Value data are supplied. The Y data column (column 2) contains only zeros. To grid this data, the 2D gridding option will be used where column 1 (X data referring to horizontal distance), column 3 (Z data referring to elevation above some datum), and column 4 (Value data representing contaminant concentrations in ppm) are used. Use File:Quit in the editor to destroy the editor window.

To set up the gridding calculation, select from the menu-bar, Method:Inverse- Distance. This accomplishes two tasks; 1) it tells the program to use the Inverse- Distance solver when the grid is calculated, and 2) it creates the pop-up dialog shown in Figure 10.2 allowing parameters about the gridding method to be defined. For this example the default Solution Parameters and the Search Type are reasonable.

Next, select the Grid:2D Grid menu-bar option. The pop-up dialog shown in Figure 10.18 will be created. The Y Column, however needs to be redefined. Since this data set is a cross-section (X-Z plane) we need to map the Z data to the Y-axis on the grid (the grid always grids using the X and Y axes). In this case the Y Column should specify the Z data column in the file; enter 3 in the Y Column field. The Value Column now specifies data column 3; this needs to be changed to column 4. When you hit <RETURN> in each field, or hit the Apply dialog button, the Minimum and Maximum File Data values should appear as:


	X Column:	0.00	to	350.0
	Y Column:	12.5	to	139.0
	Value Column:	-0.0175	to	100.0

The Grid Dimensions are reasonable, but if you wanted the grid cells to be approximately square, you could change the number of Columns (X) to 50 (grid cell 7.14' x 5.23'). Exit the dialog by pressing the Done dialog button.

To calculate the grid, select Grid:Calculate from the menu-bar, or press either Calculate button on the Inverse-Distance dialog or the 2D Grid dialog. This starts the calculation process. In the text area of the main window the status of the solution is displayed. As each column is calculated it is printed. When the calculation is completed, the message "Grid Complete" is displayed. Note that the program has only calculated the grid; no results have been saved to a file! To save the results, use the File:Save or File:Save as menu-bar options, or the Save button in the Inverse-Distance dialog.

To view the results, select form the menu-bar View:Contour Map or View:Surface Map. If the results have been saved, contour (Chapter 11) or surface (Chapter 12) is called and the gridded results of the data set are mapped. If the results haven't been saved you will be requested to save the results. If no file has been previously saved, you will be queried for a file name, otherwise the results will be saved to the file used last (i.e. the previous results will be overwritten).

Trend-Surface Analysis Example:

For the trend-surface analysis example, run grid, load the data file water.dat, and specify the value column as column 4. The easiest way to do this is to type at the UNIX prompt:

grid -vc 4 water.dat

The default 2D grid parameters will be reasonable. Next, open the Method:Trend- Surface Analysis pop-up dialog. The dialog should come up with a first-order trend (a plane) specified. Press the Calculate button. In the log-status window the regression equation and the ANOVA results will be printed. The trend-surface equation for any X- Y point is:

estimate = 2.903 + 0.2464x + 1.312y

The squared Multiple Correlation Coefficient (R2), in this example suggest that the trend-surface explains 30.06% of the data set variation. The Fstatistic of 93.83 with 3/655 Degrees of Freedom , using an F-Test with a 1% (a = 0.01) Level of Significance, implies that the NULL hypothesis (H0, the terms of the regression are not significantly different then zero) is not true (93.83 > 3.78, Table 10.1c), therefore this regression has value in describing the nature of the surface. Next, save the regression surface (press the Grid File Save button). Once the file is saved, to make a contour map of the first order trend, select the menu-bar option View:Contour Map. This will call the program contour (Chapter 11) and show the "regional" trend-surface (Figure 10.23a).

(10-23)Figure 10.23a

(10-1c)Table 10.1c

To examine the "local" variations between the observed data and the "regional" trend surface, save the Residual File. Next select File:Open, and open the file you just saved (default name is junk.res.dat). The data residuals are stored in column 5, so bring up the 2D Grid dialog (Grid:2D Grid) and change the Value Column from 4 to 5. This data needs to be gridded using conventional gridding algorithm. For this example use inverse-distance. Select the Method:Inverse-Distance menu-bar option. The default values are reasonable in the new dialog. Press Calculate button in the Inverse-Distance dialog. Once it is done calculating, press the Save button for the inverse-distance Grid File. Selecting the View:Contour Map will start another version of contour with the residuals mapped (Figure 10.23b).

(10-23)Figure 10.23b

This process can be repeated for each trend-surface order, two through five. The resultant trend-surface and residual maps are shown in Figures 24a & 24b, Figures 25a & 25b, Figures 26a & 26b, and Figures 27a & 27b. The results are summarized below.

(10-24)Figure 10.24a and (10-24)Figure 10.24b

(10-25)Figure 10.25a and (10-25)Figure 10.25b

(10-26)Figure 10.26a and (10-26)Figure 10.26b

(10-27)Figure 10.27a and (10-27)Figure 10.27b

2nd order:

estimate=4.351 + -0.5674x - 0.4921y + 0.3338x2 - 0.3123 xy + 0.5464 y2
Total F-Test = 88.740944 D.F. = ( 6 / 652 )

Regression explains 44.95% of variation (R2 = 0.4495)

3rd order:

estimate=-2.000 - 0.8560x + 7.961y + 2.535x2 - 4.1104xy - 1.5339y2 - 0.3626x3 + 0.2649x2y + 0.4921xy2 + 0.1465y3

Total F-Test = 148.3 D.F. = ( 10 / 648 )
Regression explains 69.59% of variation (R2 = 0.6959)

4th order:

estimate=-4.350 + 3.077x + 8.853y + 2.739x2 + -8.675xy - 1.202 y2 - 1.018x3 + 2.095x2y + 0.4670xy2 + 0.3205y3 + 0.08823x4 - 0.1118x3y - 0.2049x2y2 + 0.1472xy3 - 0.06392y4

Total F-Test = 136.4 D.F. = ( 15 / 643 )
Regression explains 76.09% of variation (R2 = 0.7609)

5th order:

estimate=-11.09 + 20.90x + 12.61y - 17.86x2 - 3.346xy - 4.780y2 + 8.423x3 + 1.001x2y - 3.193xy2 + 1.835y3 - 1.762x4 + -0.3104x3y + 0.9373x2y2 + 0.5003xy3 - 0.2397y4 + 0.1320x5 + 0.01749x4y - 0.000378x3y2 - 0.1814x2y3 + 0.05065xy4 - 0.007175y5

Total F-Test = 153.2 D.F. = ( 21 / 637 )
Regression explains 83.47% of variation (R2 = 0.8347)

For each of these regressions, the Fstatistic with a 1% (a = 0.01) Level of Significance, implies that the NULL hypothesis is not true, therefore this regression has value in describing the nature of the surface.

[TOP]


Running From the Command Line:

In many cases it is more convenient to run the application completely from the command line, or at least pass some parameter values in from the command line. The options listed below allow the user to accomplish almost anything that is possible from within the X-windows application from the command line. This feature can be useful when the user does not have a X-windows/Motif terminal available, or when many graphs need to be processed quickly, and the operation can be completed in batch mode without user interaction.

Syntax:

grid [-anovae " "] [-anovaf " "] [-cl #] [-dft #] [-dfte " "] [-dftf " "] [-dfti #] [-dfto #] [-do {#}] [-este " "] [-estf " "] [-gd #] [-help] [-kdbge " "] [-kdbgf " "] [-kdbgl #] [-kst #] [-kt #] [-lgf " "] [-ly #] [-m1 {#}] [-m2 {#}] [-m3 {#}] [-m4 {#}] [-mode " "] [-modf {" "}] [-ng {#.#}] [-nm {#}] [-np #] [-npmax #] [-npmin #] [-nz #] [-octmax #] [-out " "] [-pr #.#] [-prf " "] [-r1 {#.#}] [-r2 {#.#}] [-r3 {#.#}] [-r4 {#.#}] [-rese " "] [-resf " "] [-run] [-rw #] [-s1 {#.#}] [-s2 {#.#}] [-s3 {#.#}] [-s4 {#.#}] [-sang1 {#.#}] [-sang2 {#.#}] [-sang3 {#.#}] [-sn #] [-so #] [-sr #.#] [-st #] [-syaniso {#.#}] [-szaniso {#.#}] [-tl #.#] [-tmmax #.#] [-tmmin #.#] [-va11 {#.#}] [-va12 {#.#}] [-va13 {#.#}] [-va14 {#.#}] [-va21 {#.#}] [-va22 {#.#}] [-va23 {#.#}] [-va24 {#.#}] [-va31 {#.#}] [-va32 {#.#}] [-va33 {#.#}] [-va34 {#.#}] [-vc #] [-xbdes #] [-xc #] [-xmax #.#] [-xmin #.#] [-ya1 {#.#}] [-ya2 {#.#}] [-ya3 {#.#}] [-ya4 {#.#}] [-ybdes #] [-yc #] [-ymax #.#] [-ymin#.#] [-za1 {#.#}] [-za2 {#.#}] [-za3 {#.#}] [-za4 {#.#}] [-zbdes #] [-zc #] [-ze " "] [-zf {" "}] [-zmax #.#] [-zmin #.#] [-zre " "] [-zrf {" "}] [filename]

Meaning of flag symbols:

# = integer
#.# = float
" " = character string.
{} = variable is an array. Values must be seperated by a ',' and no spaces are allowed. Do not use the "{ }" symbols on the command line.

NOTES:

1). All parameters in [] brackets are optional.
2). Quotes must be used around character strings.
3). Filename, if given, must be listed last.
4). If no default is given, the feature is not currently supported on command line.

If no entry is required for flag, flag command executed.

Flag Definitions:

-anovae = ANOVA file search extension default = "*.anova"
-anovaf = ANOVA file name default = "junk.anova"
-cl = number of grid columns (Y) default = 25
-dft = drift option default = 0
0
1
2
=
=
=
no drift
estimate trend
read drift file
-dfte = drift search extension default = "*.dft"
-dftf = drift file default = "junk.dft"
-dfti = drift input column default = 5
-dfto = drift output column default = 4
-do {} = drift output column default = 0
0
1
=
=
False
True
-dfte = estimation search extension default = "*.est"
-dftf = estimation file default = "junk.est"
-gd = grid dimension default = 0
0
1
=
=
2D
3D
-help = give this help menu
-kdbge = kriging debug search extension default = "*.dbg"
-kdbgf = kriging debug file default = "junk.dbg"
-kdbgl = kriging debug level default = 0
-kst = kriging search method default = 0
0
1
=
=
normal
octant
-kt = kriging method default = 1
0
1
=
=
simple
ordinary
-lgf = log file name defalut = "log.dat"
-ly = number of grid layers (Z) default = 1
-m1 {} = Model types nest #1 default = 3
0
1
2
3
4
5
6
7
=
=
=
=
=
=
=
=
No Model (Not available for nest #1)
Linear
Linear With Sill
Spherical
Exponential
Logarithmic
Power (NOT INSTALLED)
Gaussian
-m2 {} = model types nest #2 (See -ml) default = 0
-m3 {} = model types nest #3 (See -ml) default = 0
-m4 {} = model types nest #4 (See -ml) default = 0
-mode = semivariogram model search extension default = "*.mod"
-modf {} = semivariogram model file default = " "
-ng {} = nugget default = 0.0
-nm = number of semivariogram models default = 1
-np = number of nearest search neighbors default = 10
-npmax = maximum number of points default = 16
-npmin = minimum number of points default = 4
-nz = number of zones default = 1
-octmax = maximum points per octant default = 4
-out = output *.out filename defalut = " "
-pr = inverse distance power default = 2.0
-prf = preference file name defalut = "grid.prf"
-r1 {} = range for nest #1 default = 0.0
-r2 {} = range for nest #2 default = 0.0
-r3 {} = range for nest #3 default = 0.0
-r4 {} = range for nest #4 default = 0.0
-s1 {} = C for nest #1 default = 0.0
-s2 {} = C for nest #2 default = 0.0
-s3 {} = C for nest #3 default = 0.0
-s4 {} = C for nest #4 default = 0.0
-rese = residual file search extension default = "*.res.dat"
-resf = residual file name default = "junk.res.dat"
-run = run and calcualte grid without X-interface
-rw = number of grid rows (X) default = 25
-sang1 {} = neighbor search angle 1 default = 0.0
-sang2 {} = neighbor search angle 2 default = 0.0
-sang3 {} = neighbor search angle 3 default = 0.0
-sn = kriging method default = 0
0
1
2
=
=
=
normal
quadrant
octant
-so = trend-surface order number default = 1
-sr = searc h radius default = max. diagonal
-st = solution type default = 0
0
2
5
=
=
=
inverse-distance
simple/ordinary kriging
trend-surface analysis
-syaniso {} = neighbor anisotropy 1 default = 1.0
-szaniso {} = neighbor anisotropy 2 default = 1.0
-tl = tolerence default = 1/10 grid spacing
-tmmax = maximum trimming limit default = 1.0e30
-tmmin = minimum trimming limit default = -1.0e30
-va11 {} = angle 1 for nest #1 default = 0.0
-va12 {} = angle 1 for nest #2 default = 0.0
-va13 {} = angle 1 for nest #3 default = 0.0
-va14 {} = angle 1 for nest #4 default = 0.0
-va21 {} = angle 2 for nest #1 default = 0.0
-va22 {} = angle 2 for nest #2 default = 0.0
-va23 {} = angle 2 for nest #3 default = 0.0
-va24 {} = angle 2 for nest #4 default = 0.0
-va31 {} = angle 3 for nest #1 default = 0.0
-va32 {} = angle 3 for nest #2 default = 0.0
-va33 {} = angle 3 for nest #3 default = 0.0
-va34 {} = angle 3 for nest #4 default = 0.0
-vc = value data column default = 4
-xbdes = x block descretization default = 1
-xc = x data column default = 1
-xmax = maximum gridded X value default = maximun data X
-xmin = minimum gridded X value default = minimun data X
-ya1 {} = anisotropy 1 for nest #1 default = 1.0
-ya2 {} = anisotropy 1 for nest #2 default = 1.0
-ya3 {} = anisotropy 1 for nest #3 default = 1.0
-ya4 {} = anisotropy 1 for nest #4 default = 1.0
-ybdes = y block descretization default = 1
-yc = y data column default = 2
-ymax = maximum gridded Y value default = maximun data Y
-ymin = minimum gridded Y value default = minimun data Y
-za1 {} = anisotropy 2 for nest #1 default = 1.0
-za2 {} = anisotropy 2 for nest #2 default = 1.0
-za3 {} = anisotropy 2 for nest #3 default = 1.0
-za4 {} = anisotropy 2 for nest #4 default = 1.0
-ybdes = z block descretization default = 1
-zc = z data column default = 3
-zc = zone search extension default = "*.zon"
-zf = zone file default = " "
-zmax = maximum gridded Z value default = maximun data Z
-zmin = minimum gridded Z value default = minimun data Z
-zrc = zone relationship search extension default = "*.zrl"
-zrf = zone relationship file default = " "
An example command might be (typed on one line):

grid -cl 50 -rw 50 -xc 1 -yc 2 -vc 4 -sn 0 -xmin 0.0 - ymin 0.0 water.dat

[TOP]


Setting up the Input Data File:

Grid reads several different data file formats for different tasks, spatial field data, zone delineation, and inter-zone relationships. The raw data can be read from the Basic Column and GEO-EAS/GSLIB formats described in Chapter 5 (plotgraph). The only requirement here is that there are at least three columns of data (X, Y, Value); the order is unimportant. The files describing which grid cells are in which zone use the NODE CENTERED GRID format described in Chapter 11 (contour). If the grid cell is within the zone, this is indicated with a "1", otherwise a "0" is used. The file describing the inter- zone relationships has the following format:

[Number of Zones]
for (i=1;i<=# of Zones - 1)
for (j=1;j<=# of Zones - 1)
[Inter-Relationship] (0 = Sharp, 1 = Gradational, 2 = Fuzzy)
end for
for (i=1;i<=# of Zones - 1)
for (j=1;j<=# of Zones - 1)
[Fuzzy Boundary Thickness]
end for

For an example, see data file grad.zrl.

[TOP]


Output Files:

The output file formats depend on whether a 2D or a 3D grid were generated. 2D files are formatted as specified for the programs contour and surface (Chapters 11 & 12). 3D files are formatted for the program block (Chapter 13). See the relevant chapters for a description of the data file formats.

[TOP]


Grid Mathematics:

Inverse-Distance Mathematics:

Inverse-distance techniques are often used to estimate the value of a parameter at locations where no specific data exists. This is done on a regular grid overlaying sparse, randomly located data (This can be done in either 1, 2, or 3 dimensions). The technique estimates values at a point by weighting the influence of nearby data the most, and more distant data the least. This can be described mathematically by (Burrough, 1986):
(10-1) (10-1)

where gi is the estimated value at the grid location, di is the distance between the grid location and the sample data, and p is the power to which the distance is raised. The basis of this technique is that nearby data are most similar to the actual field conditions at the grid location. Depending on the site conditions the distance may be weighted in different ways. If p = 1, this is a simple linear interpolation between points. Many people have found that p = 2 produces better results. In this case, close points are heavily weighted, and more distant point are lightly weighted (points are weighted by 1 / d2). At other sites, p has been set to other powers and yielded reasonable results.

Inverse-distance is a simple and effective way to estimate parameter values at grid locations of unknown value. Beside the directness and simplicity, however, inverse-distance techniques have a number of shortcomings. Some of these are:

Kriging Mathematics:

Trend-Surface Analysis Mathematics:

Trend-surface analysis is different then kriging and inverse-distance estimation techniques which try to estimate "local" features; trend-surface analysis is a mathematical method used to separate "regional" from "local" fluctuations (Davis, 1973). What is defined as "local" and "regional" is also often subjective and a function of scale, and the regional trend may vary with scale. The use of trend analysis allows a observed data point to be divided into these two components. A trend can be defined by three components (Davis, 1973):

  1. It is based of geographic coordinates; i.e. the distribution of material properties can be considered to be a function of location.
  2. The trend is a linear function. That is, it has the form:

    (10-a)

    where V is the data value at the described location, the b's are coefficients, and X and Y are combinations of geographic location.

  3. The optimum trend, or linear function, must minimize the squared deviations from the trend.

An example is shown in Figure 10.28. For a set of data, a line or surface may be fit exactly through each point, but a trend (a mathematical equation) can be defined which approximates the data well "regionally" with only minor "local" variations.

(10-28)Figure 10.28

Trend-surface analysis is basically a linear regression technique, but it is applied to two- and three-dimensions instead of just fitting a line. A first order linear trend surface equation has the form:

(10-2) (10-2)

That is, an observation, with a value V, can be described as a linear function of a constant value (b0) related to the data set mean, and east-west (b1), and north-south (b2) components (Davis, 1973). To solve for these three unknowns, three normal equations are available (Davis, 1973):

(10-3) (10-3)

(10-4) (10-4)

(10-5) (10-5)

where n is the number of data points. Solving these equations simultaneously will yield a "best-fit", defined by least-squares regression, for a two-dimensional, first-order (a plane) trend surface. This can be rewritten in matrix format:

(10-6) (10-6)

This approach can also be applied to higher order surfaces and three-dimensions. In three-dimensions, the equivalent equation would be:

(10-7) (10-7)

(10-8) (10-8)

For second-order, two-dimensional surfaces, the general equation is:

(10-9) (10-9)

Third-order, two-dimensional surfaces:

(10-10) (10-10)

Forth-order, two-dimensional surfaces:

(10-11) (10-11)

Fifth-order, two-dimensional surfaces:

(10-12) (10-12)

For second-order, three-dimensional surfaces, the general equation is:

(10-13) (10-13)

Third-order, three-dimensional surfaces:

(10-14) (10-14)

Forth-order, three-dimensional surfaces:

(10-15) (10-15)

Fifth-order, three-dimensional surfaces:

(10-16) (10-16)

Analysis of Variance (ANOVA) Mathematics for Trend-Surface Regressions:

A trend-surface of a given order can be fit to any set of data, but that does not mean that it is a meaningful or worthwhile model. Each of the terms in the trend- surface polynomial equation has an associated error, and the trend-surface itself is only used to estimate the "regional" trend. The "local" fluctuations can be considered to be errors in the trend-surface regression estimate. To evaluate the "worthiness" of the trend-surface several terms must be calculated:

where:

(10-18) (10-18)
(10-19) (10-19))
(10-20) (10-20))
(10-21) (10-21))
(10-22) (10-22))
(10-23) (10-23))
(10-24) (10-24)
(10-25) (10-25)
(10-26) (10-26)

where n equals the number of data observations, and m equals the number of coefficients in the trend-surface equation. R, R2 and the Fstatistic are terms used to evaluate the "goodness of fit." R is referred to as the coefficient of multiple correlation and R2 x 100% effects the percent of the data variation explained by the regional trend- surface (Davis, 1986). The Fstatistic is used with the F-test to determine if the group of trend-surface coefficients are significantly different than zero; i.e. the regression effect is not significantly different from the random effect of the data. In formal statistical terms, the F-test for significance of fit tests the hypothesis (H0) and alternative (H1):

(10-27) (10-27)

The hypothesis tested, is that the partial regression coefficients equal zero, i.e. there is no regression. If the computed F value exceeds the table value of F (Tables 10.1a, 10.1b, and 10.1c), the NULL hypothesis is rejected and the alternative is accepted, i.e. all the coefficients in the regression are significant and the regression is worthwhile.

(10-1a)Table 10.1a, (10-1b)Table 10.1b, and (10-1c)Table 10.1c

In addition to the problems of getting a "good" fit for the trend surface, there are a number of pit-falls to the technique (Davis, 1986):

1). There must be adequate data control. The number of observations should be much greater then the number of coefficients.
2). The spacing of the observation points is important. It can affect the size and resolution of features seen. Clustering can cause problems or bias. The distribution can affect the shape of the surface.
3). There are problems near boundaries. The surface can "blow-up" in the corners. For this reason it is important to have a buffer around the area of concern. It amounts to a problem of interpolating between data to one of extrapolating beyond data observations.

[TOP]


Bibliography (grid):

Burrough, P.A., 1986, Principles of Geographical Information Systems for Land Resource Assessment, Monographs on Soil and Resources Survey No. 12, Oxford Science Publications - Clarendon Press, Oxford.

Davis, John C., 1986 (Second Edition), Statistics and Data Analysis in Geology, John Wiley & Sons, New York, pp 405-425.

Deutsch, C.V., and A.G. Journel, 1992, GSLIB: Geostatistical Software Library and User's Guide, Oxford University Press, New York.

Kirk, K.G., 1991, Residual Analysis for Evaluating the Robustness of Inverse Distance, Kriging, and Minimum Tension Gridding Algorithms, GeoTech/GeoChautauqua 91' Conference Proceedings, Lakewood, Colorado, pg. 15 (presentation).

Wingle, W.L., 1992, Examining Common Problems Associated with Various Contouring Methods, Particularly Inverse-Distance Methods, Using Shaded Relief Surfaces, Geotech '92 Conference Proceedings, 1992, Lakewood, Colorado.

[TOP]


Table of Contents
Previous Chapter
Beginning of this Chapter
Next Chapter