1

I am trying to write an ArcPy script that uses Kriging to interpolate various nutrients in the soil (i.e. nitrogen) using ArcGIS Pro 2.4.0. These nutrients were collected by sampling the soil, so it will be a very high-resolution output raster.

The Kriging tool will run when using ArcGIS Pro. Here are the parameters:

enter image description here

(Every field below this tool is blank).

However, when running an ArcPy code, get the following error messages:

Traceback (most recent call last):
  File "<pyshell#24>", line 1, in <module>
    outKriging = Kriging(inFeatures, field, kModelOrdinary, cellSize, kRadius, "outVarRaster")
  File "C:\Program Files (x86)\ArcGIS\Desktop10.7\ArcPy\arcpy\sa\Functions.py", line 2804, in Kriging
    out_variance_prediction_raster)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.7\ArcPy\arcpy\sa\Utils.py", line 53, in swapper
    result = wrapper(*args, **kwargs)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.7\ArcPy\arcpy\sa\Functions.py", line 2796, in Wrapper
    out_variance_prediction_raster)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.7\ArcPy\arcpy\geoprocessing\_base.py", line 510, in <lambda>
    return lambda *args: val(*gp_fixargs(args, True))
ExecuteError: ERROR 000622: Failed to execute (Kriging). Parameters are not valid.

ERROR 000628: Cannot set input into parameter semiVariogram_props.

I'm new to Kriging, so what can I do to get the tool to run?

Here's my code:

#Import modules
import arcpy
from arcpy import env
from arcpy.sa import *

#Set workspace
env.workspace = "C:\\Users\\asdf\\Documents"
env.overwriteOutput = True

#Set simple parameters
inFeatures = "ne10soilpnts"
field = "NO3"
outRaster = "krig"
cellSize = 0.000026
lagSize = 0.000026

#Set complex variables
kModelOrdinary = KrigingModelOrdinary("ORDINARY", lagSize)

kRadius = RadiusFixed(12)

#Error occurs after running this line
outKriging = Kriging(inFeatures, field, kModelOrdinary, cellSize, kRadius, outRaster)
3

Taking a look at the Kriging tool's documentation I see that "ORDINARY" is not an option for the semi-variogram type in the KrigingModelOrdinary class.

  • 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.

Looking at your screenshot I'd guess you'll want to change that for "SPHERICAL".

| improve this answer | |
  • Thank you, I am away from my computer at the moment but will fix this, and will accept the answer when I’m able to run the code. – ihb Nov 27 '19 at 23:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.