The GLOBEC Kriging Software Package - EasyKrig

Copyright (c) 1998, property of Dezhang Chu and Woods Hole Oceanographic Institution. All Rights Reserved.

The kriging software, EasyKrig, described in this document was developed by Dezhang Chu with funding from the National Science Foundation through the U.S. GLOBEC Georges Bank Project's Program Service and Data Management Office. It was inspired by a kriging toolbox in MATLAB developed by Yves Gratton and Caroline Lafleur (INRS-Océanologie, Rimouski, Qc, Canada) and Jeff Runge (Institut Maurice-Lamontagne). The original version of trans.m was written by D. Marcotte and is used with permission. Also, we are using, with permission, the variogram model code from 'variogr2.m' written by Yves Gratton and Caroline Lafleur.

This software may be reproduced for noncommercial purposes only and is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.

Contact Dr. Chu at dchu@whoi.edu with enhancements or suggestions for changes.

Table of Contents.

1. Introduction

2. Data Processing Stages.
3. Example.
4. References.

1. Introduction

1.1 General Information.

1.1.1 Operating systems.

This kriging software was originally developed under MATLAB 5.2 on a PC platform, but it is intended to be computer platform and/or operating system independent. The program has been tested on various machines. The following table shows the tested machines/OS:

Computer OS
PC-compatible Windows 95/NT, Windows 98*
SUN Solaris 2.6
SGI IRIX64 Release 6.4
Macintosh OS 8.1

* Windows 98 needs to get the patch from Mathworks to fix some problems related to graphics; see instructions from Mathworks web site:

http://www.mathworks.com/support/solutions/v5/20744.shtml

1.1.2 Brief description

The program uses a graphical user interface (GUI) and it requires MATLAB 5.2 or higher with or without optimization toolbox (see section 2.2). The package consists of five components, or processing stages: (1) data preparation, (2) variogram computation, (3) kriging, (4) visualization, and (5) saving results. It allows the user to process isotropic or anisotropic data, select a model from a list of variogram models, and provide a choice of kriging methods (which is also a common feature of the other existing software packages). One of the major advantages of this M-FILE package is that it minimizes the users' requirements to "guess" the initial parameters and automatically generate the required default parameters. In addition, because of convenient GUI interfaces, the modifications from the initial settings can be easily performed.

Another feature of this package is that it has a built-in on-line help library that allows the user to understand the use of parameters and operation buttons by just a simple click.

Although the EasyKrig lacks some features such as 3D- and Co-kriging, it certainly provides a convenient tool for geostatistical applications and the hope is that it will also assist scientists from other fields.

1.2 Getting Started.

1.2.1 Down-load the program.

You can

1.2.2 Quick start.

Start MATLAB and go to the designated kriging software directory. Just type 'startkrig' in the MATLAB command window, a window will pop up which contains five command buttons corresponding to five data processing stages. Now you are ready to move on.

Note: do not add the designated kriging directory to your current MATLAB path and run the program from another directory even if you add all of the paths of sub-directories to your path.

2. Data Processing Stages

There are five buttons associated with five data processing stages (tasks) on the main window (navigator). By clicking on any one of the buttons, a window corresponding to the selected task will pop up. However, if you haven't loaded any data, the variogram and kriging buttons will not work. Within each task window there are small buttons marked with a question mark, '?', that are online help buttons. By clicking on any of these buttons, a small window will pop up and provide information about the use of the parameter or the operation button. On any window, clicking on the 'Navigator' button will activate the navigator window.

2.1 Data preparation.

A click on the 'Data Preparation' button on the navigator window leads to the data preparation window. Click on the 'Load' button to load the raw data file. The required data format can be found by clicking on the small square "help" button marked with a question mark. One can set the other parameters before loading the file. After the file is loaded, the user can change the other settings such as data filter, and simply click on 'Apply' after the parameters have been set. The difference between 'Load' and 'Apply' is that the later will not re-load the data file.

2.2 Semi-variogram.

A click on the 'Semi-Variogram' button on the navigator window leads to the variogram window. One first needs to click on the 'Compute' button to generate a data-based semi-variogram (or correlogram) and then to seek a model-based semi-variogram (or correlogram) to fit the data-based variogram. The relation between the semi-variogram , gamma(h), and the correlogram C(h) is:

C(h) = 1 - gamma (h)

where h is the lag distance. To select a semi-variogram model, click on the appropriate model listed on the lower left corner. The explanations of the parameters associated with the model can be found by activating the on-line help button next to the model list box.

A click on the 'Apply' button will cause the program to compute the variogram/correlogram based on the current parameter settings. The settings can be changed by dragging a slider bar (or clicking on the arrows on both ends) or by entering the number directly into the text box. If using the slider, the theoretical curve will change automatically, while if entering the number into the text box, the user needs to click on the 'Apply' button to re-compute the curve.

If the optimization toolbox (recommended, buy not required) is installed, the user can use the Least-Square fit function to fit the data by clicking on 'LSQ fit' button. If the optimization toolbox isn't installed, the program will automatically disable the Least-Square fit function.

Note that since the LSQ fit has a certain range for each parameter, different initial settings (parameters) may produce different results.

2.3 Kriging.

A click on the 'Kriging' button in the navigator window leads to the kriging window. The parameters of the variogram (or correlogram) needed in the kriging operation are automatically passed from the variogram window to the kriging window, but they can be changed from within the kriging window. Click on the 'Refresh' button to obtain the most recent semi-variogram parameters; click on the 'Krig' button to start the kriging. There are two passes of kriging, the first one is used to compute the grid values for the "krig-contour-map" and the second one is used to estimate the uncertainty of the kriging using pseudo data as described below.

2.4 Visualization.

Click on the 'Display' button on the navigator window to go to the visualization window. There are three figures in this window: the kriging-contour-map, the kriging-error-map, and the comparison of the original observed data with the kriged values (pseudo data). The first two maps are commonly used in the kriging literature, while the last one is a unique approach of this program. The pseudo data used in comparison with the true data are obtained by kriging with the gridded 'data' shown in the kriging-countour-map and the same semi-variogram (correlogram) model to provide values for the same spatial positions as the true data. The agreement between the pseudo data and the true data provides a guide to validate the kriging results.

Click on the 'Show Plots' button to display the current kriging results and on 'Load' to load previously saved results (.mat file).

2.5 Saving results.

The program will allow you to load and save files using a window-based file browser. A click on the 'Save To File' button in the navigator window leads to the save file window. Use the file browser to save the output as a .mat file with a user-defined filename and at the user selected location.

3. Example

There are some sample data files included in the package. All files are in ASCII format which is required by the program. In the following example, the designated krig directory is assumed to be 'easy_krig'.

4. References.

Some references used in the development of this software package are:

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

Journel, A.G. & C.J. Huijbregts, 1992. Mining Geostatistics. Academic Press, New York, 600 p.

Kitanidi, P.K. 1997. Introduction to Geostatistics. Applications in hydrogeology. Cambridge University Press. 249 p.

Marcotte, D. 1991. Cokrigeage with MATLAB. Computers & Geosciences. 17(9): 1265-1280.