Available with Spatial Analyst license.

Available with 3D Analyst license.

## Usage

Kriging is a processor-intensive process. The speed of execution is dependent on the number of points in the input dataset and the size of the search window.

Low values within the optional output variance of prediction raster indicate a high degree of confidence in the predicted value. High values may indicate a need for more data points.

The Universal kriging types assume that there is a structural component present and that the local trend varies from one location to another.

The Semivariogram properties allow control of the semivariogram used for kriging. A default value for Lag size is initially set to the default output cell size. For Major range, Partial sill, and Nugget, a default value will be calculated internally if nothing is specified.

The optional output variance of prediction raster contains the kriging variance at each output raster cell. Assuming the kriging errors are normally distributed, there is a 95.5 percent probability that the actual z-value at the cell is the predicted raster value, plus or minus two times the square root of the value in the variance raster.

The Output cell size can be defined by a numeric value or obtained from an existing raster dataset. If the cell size hasn’t been explicitly specified as the parameter value, it is derived from the Cell Size environment if it has been specified. If the parameter cell size or the environment cell size have not been specified, but the Snap Raster environment has been set, the cell size of the snap raster is used. If nothing is specified, the cell size is calculated from the shorter of the width or height of the extent divided by 250, where the extent is in the Output Coordinate System specified in the environment.

If the cell size is specified using a numeric value, the tool will use it directly for the output raster.

If the cell size is specified using a raster dataset, the parameter will show the path of the raster dataset instead of the cell size value. The cell size of that raster dataset will be used directly in the analysis, provided the spatial reference of the dataset is the same as the output spatial reference. If the spatial reference of the dataset is different than the output spatial reference, it will be projected based on the selected Cell Size Projection Method.

Some input datasets may have several points with the same x,y coordinates. If the values of the points at the common location are the same, they are considered duplicates and have no effect on the output. If the values are different, they are considered coincident points.

The various interpolation tools may handle this data condition differently. For example, in some cases, the first coincident point encountered is used for the calculation; in other cases, the last point encountered is used. This may cause some locations in the output raster to have different values than what you might expect. The solution is to prepare your data by removing these coincident points. The Collect Events tool in the Spatial Statistics toolbox is useful for identifying any coincident points in your data.

See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.

## Syntax

Kriging(in_point_features, z_field, semiVariogram_props, {cell_size}, {search_radius}, {out_variance_prediction_raster})

Parameter | Explanation | Data Type |

in_point_features | The input point features containing the z-values to be interpolated into a surface raster. | Feature Layer |

z_field | The field that holds a height or magnitude value for each point. This can be a numeric field or the Shape field if the input point features contain z-values. | Field |

semiVariogram_props kriging_model | The KrigingModel class defines which kriging model is to be used. There are two types of kriging classes. The KrigingModelOrdinary method has five types of semivariograms available. The KrigingModelUniversal method has two types of semivariograms available. - KrigingModelOrdinary ({semivariogramType}, {lagSize}, {majorRange}, {partialSill}, {nugget})
- semivariogramType—The semivariogram model to be used. The available models include the following:
- SPHERICAL—Spherical semivariogram model. This is the default.
- CIRCULAR—Circular semivariogram model.
- EXPONENTIAL—Exponential semivariogram model.
- GAUSSIAN—Gaussian (or normal distribution) semivariogram model.
- LINEAR—Linear semivariogram model with a sill.
- semivariogramType—The semivariogram model to be used. The available models include the following:
- KrigingModelUniversal ({semivariogramType}, {lagSize}, {majorRange}, {partialSill}, {nugget})
- semivariogramType—The semivariogram model to be used. The available models include the following:
- LINEARDRIFT—Universal Kriging with linear drift.
- QUADRATICDRIFT—Universal Kriging with quadratic drift.
- semivariogramType—The semivariogram model to be used. The available models include the following:
- After the {semivariogramType}, the other parameters are common between Ordinary and Universal kriging.
- lagSize—The default is the output raster cell size.
- majorRange—Represents a distance beyond which there is little or no correlation.
- partialSill—The difference between the nugget and the sill.
- nugget—Represents the error and variation at spatial scales too fine to detect. The nugget effect is seen as a discontinuity at the origin.
| KrigingModel |

cell_size (Optional) | The cell size of the output raster that will be created. This parameter can be defined by a numeric value or obtained from an existing raster dataset. If the cell size hasn't been explicitly specified as the parameter value, the environment cell size value will be used if specified; otherwise, additional rules will be used to calculate it from the other inputs. See the usage for more detail. | Analysis Cell Size |

search_radius (Optional) |
The Radius class defines which of the input points will be used to interpolate the value for each cell in the output raster. There are two types of radius classes: RadiusVariable and RadiusFixed. A Variable search radius is used to find a specified number of input sample points for the interpolation. The Fixed type uses a specified fixed distance within which all input points will be used for the interpolation. The Variable type is the default. - RadiusVariable ({numberofPoints}, {maxDistance})
- {numberofPoints}—An integer value specifying the number of nearest input sample points to be used to perform interpolation. The default is 12 points.
- {maxDistance}—Specifies the distance, in map units, by which to limit the search for the nearest input sample points. The default value is the length of the extent's diagonal.
- RadiusFixed ({distance}, {minNumberofPoints})
- {distance}—Specifies the distance as a radius within which input sample points will be used to perform the interpolation.
The value of the radius is expressed in map units. The default radius is five times the cell size of the output raster. - {minNumberofPoints}—An integer defining the minimum number of points to be used for interpolation. The default value is 0.
If the required number of points is not found within the specified distance, the search distance will be increased until the specified minimum number of points is found. When the search radius needs to be increased it is done so until the {minNumberofPoints} fall within that radius, or the extent of the radius crosses the lower (southern) and/or upper (northern) extent of the output raster. NoData is assigned to all locations that do not satisfy the above condition.
- {distance}—Specifies the distance as a radius within which input sample points will be used to perform the interpolation.
| Radius |

out_variance_prediction_raster (Optional) | Optional output raster where each cell contains the predicted variance values for that location. | Raster Dataset |

#### Return Value

Name | Explanation | Data Type |

out_surface_raster | The output interpolated surface raster. It is always a floating-point raster. | Raster |

## Code sample

This example inputs a point shapefile and interpolates the output surface as a Grid raster.

```
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outKrig = Kriging("ozone_pts.shp", "OZONE", KrigingModelOrdinary("CIRCULAR", 2000, 2.6, 542, 0), 2000, RadiusFixed(20000, 1))
outKrig.save("c:/sapyexamples/output/krigout")
```

This example inputs a point shapefile and interpolates the output surface as a Grid raster.

```
# Name: Kriging_Ex_02.py
# Description: Interpolates a surface from points using kriging.
# Requirements: Spatial Analyst Extension
# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *
# Set environment settings
env.workspace = "C:/sapyexamples/data"
# Set local variables
inFeatures = "ca_ozone_pts.shp"
field = "OZONE"
cellSize = 2000
outVarRaster = "C:/sapyexamples/output/outvariance"
lagSize = 2000
majorRange = 2.6
partialSill = 542
nugget = 0
# Set complex variables
kModelOrdinary = KrigingModelOrdinary("CIRCULAR", lagSize,
majorRange, partialSill, nugget)
kRadius = RadiusFixed(20000, 1)
# Execute Kriging
outKriging = Kriging(inFeatures, field, kModelOrdinary, cellSize,
kRadius, outVarRaster)
# Save the output
outKriging.save("C:/sapyexamples/output/krigoutput02")
```

## Environments

## Licensing information

- Basic: Requires Spatial Analyst or 3D Analyst
- Standard: Requires Spatial Analyst or 3D Analyst
- Advanced: Requires Spatial Analyst or 3D Analyst