Select to view content in your preferred language

arcpy arcpy.sa.Kriging infinite run when cell_size set

1101
4
Jump to solution
08-26-2023 04:25 AM
Labels (1)
TadeášDěd
Occasional Contributor

Hi, 

I have an issue with running arcpy.sa.Kriging when defining cell_size. In ArcGIS Pro it is all running smoothly. When I run this code in a notebook or anywhere else it runs infinitely.

When cell_size is not set, everything is running fine. What is the issue? 

# List of columns to interpolate
columns_to_interpolate = ["R","R_1", "R_2", "R_3", "R_4", "R_5", "R_6", "R_7", "R_8", "R_9", "R_10", "R_11", "R_12"]
cell_size = 0.1
# Loop through each column and perform kriging interpolation
for column in columns_to_interpolate:
    in_field = column
    out_raster_name = f"R_factor_MR_SK_{column}"
   
    # Perform kriging interpolation
 
    print(f"Interpolating column {column}...")
    KM = arcpy.sa.KrigingModelOrdinary("CIRCULAR")
    kriging_output = arcpy.sa.Kriging("R_factor", in_field, KM, cell_size) # unfortunately, custom cell size is not working at the moment
    kriging_output.save(out_raster_name)
    print(f"Interpolation completed for column {column}.")
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

What is the extent that you are trying to interpolate in?

How many rows and columns in a raster will a cell size of 0.1 units generate?

Perhaps the cell size is to small for the extent


... sort of retired...

View solution in original post

0 Kudos
4 Replies
DanPatterson
MVP Esteemed Contributor

What is the extent that you are trying to interpolate in?

How many rows and columns in a raster will a cell size of 0.1 units generate?

Perhaps the cell size is to small for the extent


... sort of retired...
0 Kudos
TadeášDěd
Occasional Contributor

Hi Dan, 

after a second look, it seems that I was setting extremely low cell_size. In ArcGIS Pro, there was 0,0107... cell size as default, so I have set 0,1 in my arcpy code just to try. 
And now default cell_size is 1200 in ArcGIS Pro.... 

Is there a way for me to set units for cell size in the code? Just to make sure everything goes as expected. 

Thank you very much!

Best from 

Tadeas

0 Kudos
DanPatterson
MVP Esteemed Contributor

It would be best if you are working with projected data and not data in decimal degrees, however,

What are the coordinates in?

Are those values assigned to points?

Too many unknowns to make good suggestions., but cell size can be specified in code, it is an arcpy.env setting.

Some suggested readings

Cell size and resampling in analysis—ArcGIS Pro | Documentation

Cell Size (Environment setting)—ArcGIS Pro | Documentation

Cell Size Projection Method (Environment setting)—ArcGIS Pro | Documentation

How the Cell Size Projection Method environment setting works—ArcGIS Pro | Documentation

 


... sort of retired...
TadeášDěd
Occasional Contributor

HI Dan, 

 

thank you very much for your help. I think this has been sorted. Thank you very much for the help and links, everything is clear now!


Best from 

Tadeas

0 Kudos