next up previous contents index
Next: Data formats Up: Getting started Previous: Getting started   Contents   Index


Invoking gstat

Gstat is started either by typing

gstat command_file

where command_file is the name of a file with gstat commands, or by typing

gstat -i

In the latter case, the interactive variogram modelling user interface is started. This interface can be used to specify data, calculate and plot sample variograms, fit variogram models and create variogram plot files. Within the interface, help is obtained by pressing `H' or `?', and the program stops after pressing `q' or `x'. At the end of a variogram modelling session the program settings concerning data and (fitted) variogram models can be written to a gstat command file by pressing `c'. Such a command file will look like:

#
# gstat command file
#
data(zinc): 'zinc.eas', x=1, y=2, v=3;
variogram(zinc): 0.0716914 Nug(0) + 0.563708 Sph(917.803);

The first three lines that start with a # are comment lines, the following lines are gstat commands. The first command specifies where data were read (the variable zinc was read from the file zinc.eas, having measured values on column 3, x-coordinates on column 1 and y-coordinates on column 2), the second command defines a variogram model for the variable zinc (the sum of a nugget and a spherical model). Suppose that these commands are held in a file called zinc.gst, then starting gstat with the command

gstat zinc.gst

will start the variogram modelling user interface after reading data and variogram model, and work can be continued at the point where it was saved before.

At a later stage, the data and variogram definitions in the command file can be used for kriging. This is accomplished by adding commands to the command file that specify where the kriging predictions should be made, and where the results should be written to. Consider the command file zinc_pr.gst:

#
# gstat command file
#
data(zinc): 'zinc.eas', x=1, y=2, v=3;
variogram(zinc): 0.0717 Nug(0) + 0.564 Sph(917.8);
mask:       'mask.map';
predictions(zinc): 'zinc_pr.map';
variances(zinc):  'zinc_var.map';

It says that prediction locations are the grid cell centres of the (non-missing valued) cells in the grid map mask.map, that ordinary kriging predictions should be written to the grid map zinc_pr.map, and ordinary kriging prediction variances to zinc_var.map, after starting gstat as:

gstat zinc_pr.gst


next up previous contents index
Next: Data formats Up: Getting started Previous: Getting started   Contents   Index
Edzer Pebesma
1999-08-31