Python kriging code errors

110
4
Jump to solution
11-14-2022 10:31 AM
Labels (1)
Gabrieleti
New Contributor II

Hello,

I have created a model in ArcGIS pro and then I tried to convert it into a python script, but the code of Kriging function (even autogenerated) gives me this error:

Kriging() got an unexpected keyword argument 'semiVariogram_props'

The autogenerated code:

Kriging = Kriging_Extr2

Output_variance_of_prediction_raster = ""

with arcpy.EnvManager(extent=Rectangle):

Kriging_Extr2 = arcpy.sa.Kriging(in_point_features=point_values, z_field="RASTERVALU", semiVariogram_props="Spherical 7.200000 # # #", cell_size="0.25", search_radius="VARIABLE 12", out_variance_prediction_raster=Output_variance_of_prediction_raster)

Kriging_Extr2.save(Kriging)

I have looked into kriging python syntax online, but it also does not work. But maybe I am making some errors myself.

How could I solve this problem?

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
SteveLynch
Esri Regular Contributor

There appears to be a problem with the variable name semiVariogram_props.

Remove them, viz.,

Kriging_Extr2 = arcpy.sa.Kriging(point_values, "RASTERVALU", "Spherical 7.200000 # # #", "0.25", "VARIABLE 12", Output_variance_of_prediction_raster)

View solution in original post

4 Replies
DanPatterson
MVP Esteemed Contributor

Are you using the spatial analyst kriging? because it is a parameter?

Kriging (Spatial Analyst)—ArcGIS Pro | Documentation


... sort of retired...
0 Kudos
Gabrieleti
New Contributor II

Yes I am. And when I run model in ArcGIS Pro everything works, it’s just that I am having problems with the python code. 

0 Kudos
SteveLynch
Esri Regular Contributor

There appears to be a problem with the variable name semiVariogram_props.

Remove them, viz.,

Kriging_Extr2 = arcpy.sa.Kriging(point_values, "RASTERVALU", "Spherical 7.200000 # # #", "0.25", "VARIABLE 12", Output_variance_of_prediction_raster)

Gabrieleti
New Contributor II

It worked. Thank You very much!

0 Kudos